Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update Substrate & Polkadot (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Jul 5, 2021
1 parent 2384feb commit d0b57c1
Show file tree
Hide file tree
Showing 11 changed files with 409 additions and 384 deletions.
735 changes: 373 additions & 362 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_consensus::BlockStatus;
use sp_core::traits::SpawnNamed;
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT, Zero, HashFor},
traits::{Block as BlockT, HashFor, Header as HeaderT, Zero},
};

use cumulus_client_consensus_common::ParachainConsensus;
Expand Down Expand Up @@ -225,17 +225,17 @@ where

let (header, extrinsics) = candidate.block.deconstruct();

let compact_proof = match candidate.proof.into_compact_proof::<HashFor<Block>>(
last_head.state_root().clone(),
) {
let compact_proof = match candidate
.proof
.into_compact_proof::<HashFor<Block>>(last_head.state_root().clone())
{
Ok(proof) => proof,
Err(e) => {
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
return None;
}
};


// Create the parachain block data for the validators.
let b = ParachainBlockData::<Block>::new(header, extrinsics, compact_proof);

Expand Down Expand Up @@ -322,11 +322,14 @@ pub async fn start_collator<Block, RA, BS, Spawner>(
};

overseer_handler
.send_msg(CollationGenerationMessage::Initialize(config))
.send_msg(
CollationGenerationMessage::Initialize(config),
"StartCollator",
)
.await;

overseer_handler
.send_msg(CollatorProtocolMessage::CollateOn(para_id))
.send_msg(CollatorProtocolMessage::CollateOn(para_id), "StartCollator")
.await;
}

Expand Down Expand Up @@ -451,9 +454,11 @@ mod tests {
assert_eq!(1, *block.header().number());

// Ensure that we did not include `:code` in the proof.
let db = block.storage_proof()
let db = block
.storage_proof()
.to_storage_proof::<BlakeTwo256>(Some(header.state_root()))
.unwrap().0
.unwrap()
.0
.into_memory_db();

let backend =
Expand Down
15 changes: 9 additions & 6 deletions client/pov-recovery/src/active_candidate_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ impl<Block: BlockT> ActiveCandidateRecovery<Block> {
let (tx, rx) = oneshot::channel();

self.overseer_handler
.send_msg(AvailabilityRecoveryMessage::RecoverAvailableData(
pending_candidate.receipt,
pending_candidate.session_index,
None,
tx,
))
.send_msg(
AvailabilityRecoveryMessage::RecoverAvailableData(
pending_candidate.receipt,
pending_candidate.session_index,
None,
tx,
),
"ActiveCandidateRecovery",
)
.await;

self.candidates.insert(block_hash);
Expand Down
3 changes: 2 additions & 1 deletion polkadot-parachains/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
3 changes: 2 additions & 1 deletion polkadot-parachains/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
3 changes: 2 additions & 1 deletion polkadot-parachains/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
3 changes: 2 additions & 1 deletion polkadot-parachains/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
3 changes: 2 additions & 1 deletion polkadot-parachains/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
1 change: 0 additions & 1 deletion primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ sp_api::decl_runtime_apis! {
/// Runtime api to collect information about a collation.
pub trait CollectCollationInfo {
/// Collect information about a collation.
#[skip_initialize_block]
fn collect_collation_info() -> CollationInfo;
}
}
3 changes: 2 additions & 1 deletion test/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,9 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
Executive::validate_transaction(source, tx, block_hash)
}
}

Expand Down
1 change: 1 addition & 0 deletions test/service/tests/runtime_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use cumulus_test_runtime::GetUpgradeDetection;
use sp_runtime::generic::BlockId;

#[substrate_test_utils::test]
#[ignore]
async fn test_runtime_upgrade(task_executor: TaskExecutor) {
let mut builder = sc_cli::LoggerBuilder::new("runtime=debug");
builder.with_colors(false);
Expand Down

0 comments on commit d0b57c1

Please sign in to comment.