Skip to content

Commit

Permalink
Update polkadot-sdk to stable2407 (#52)
Browse files Browse the repository at this point in the history
* Update polkadot-sdk to stable2407

* Allow deprecated NativeElseWasmExecutor
  • Loading branch information
tmpolaczyk authored Aug 6, 2024
1 parent 1f48a98 commit c4f6184
Show file tree
Hide file tree
Showing 12 changed files with 2,027 additions and 2,245 deletions.
3,948 changes: 1,862 additions & 2,086 deletions Cargo.lock

Large diffs are not rendered by default.

283 changes: 141 additions & 142 deletions Cargo.toml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/consensus/nimbus-consensus/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
CIDP: CreateInherentDataProviders<Block, ()>,
{
async fn verify(
&mut self,
&self,
mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
// Skip checks that include execution, if being told so or when importing only state.
Expand Down Expand Up @@ -251,12 +251,12 @@ impl<I> NimbusBlockImport<I> {
impl<Block, I> BlockImport<Block> for NimbusBlockImport<I>
where
Block: BlockT,
I: BlockImport<Block> + Send,
I: BlockImport<Block> + Send + Sync,
{
type Error = I::Error;

async fn check_block(
&mut self,
&self,
block: sc_consensus::BlockCheckParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
self.inner.check_block(block).await
Expand Down
2 changes: 1 addition & 1 deletion pallets/async-backing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
version = "0.9.0"

[dependencies]
cumulus-pallet-parachain-system = { workspace = true, features = [ "parameterized-consensus-hook" ] }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-primitives-core = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion pallets/emergency-para-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sp-std = { workspace = true }

# Cumulus
cumulus-primitives-core = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true, features = ["parameterized-consensus-hook"] }
cumulus-pallet-parachain-system = { workspace = true }

# Polkadot
polkadot-parachain-primitives = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions precompiles/balances-erc20/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fn transfer() {
value: 400.into(),
},
)
.expect_cost(176215756) // 1 weight => 1 gas in mock
.expect_cost(173364756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down Expand Up @@ -370,7 +370,7 @@ fn transfer_from() {
value: 400.into(),
},
)
.expect_cost(176215756) // 1 weight => 1 gas in mock
.expect_cost(173364756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down Expand Up @@ -466,7 +466,7 @@ fn transfer_from_self() {
value: 400.into(),
},
)
.expect_cost(176215756) // 1 weight => 1 gas in mock
.expect_cost(173364756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down
1 change: 1 addition & 0 deletions precompiles/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

pub fn root_origin() -> <Runtime as frame_system::Config>::RuntimeOrigin {
Expand Down
1 change: 1 addition & 0 deletions precompiles/xcm-utils/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

pub(crate) struct ExtBuilder {
Expand Down
3 changes: 1 addition & 2 deletions template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<moonkit_template_runtime::RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Helper function to generate a crypto pair from seed
pub fn get_pair_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down
15 changes: 9 additions & 6 deletions template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use futures::FutureExt;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_consensus_manual_seal::{run_instant_seal, InstantSealParams};
#[allow(deprecated)]
use sc_executor::{
HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY,
};
Expand All @@ -57,6 +58,7 @@ impl sc_executor::NativeExecutionDispatch for TemplateRuntimeExecutor {
moonkit_template_runtime::native_version()
}
}
#[allow(deprecated)]
type ParachainExecutor = NativeElseWasmExecutor<TemplateRuntimeExecutor>;

type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
Expand Down Expand Up @@ -404,6 +406,7 @@ fn start_consensus(
}

/// Start a parachain node.
#[allow(deprecated)]
pub async fn start_parachain_node(
parachain_config: Configuration,
polkadot_config: Configuration,
Expand Down Expand Up @@ -497,6 +500,9 @@ where
crate::rpc::create_full(deps).map_err(Into::into)
})
};
let para_id = crate::chain_spec::Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;

sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network,
Expand Down Expand Up @@ -555,18 +561,15 @@ where
let mocked_parachain = MockValidationDataInherentDataProvider {
additional_key_values: None,
current_para_block: 0,
current_para_block_head: None,
relay_offset: 0,
relay_blocks_per_para_block: 0,
para_blocks_per_relay_epoch: 0,
relay_randomness_config: (),
xcm_config: MockXcmConfig::new(
&*client_for_xcm,
block,
Default::default(),
Default::default(),
),
xcm_config: MockXcmConfig::new(&*client_for_xcm, block, Default::default()),
raw_downward_messages: downward_xcm_receiver.drain().collect(),
raw_horizontal_messages: hrmp_xcm_receiver.drain().collect(),
para_id: para_id.into(),
};

Ok((time, mocked_parachain))
Expand Down
2 changes: 1 addition & 1 deletion template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ staging-xcm-builder = { workspace = true }
staging-xcm-executor = { workspace = true }

# Cumulus dependencies
cumulus-pallet-parachain-system = { workspace = true, features = [ "parameterized-consensus-hook" ] }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-primitives-core = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ impl Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// No local origins on this chain are allowed to dispatch XCM sends/executions.
Expand Down Expand Up @@ -612,6 +613,8 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = ();
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
type MaxActiveOutboundChannels = ConstU32<128>;
type MaxPageSize = ConstU32<{ 103 * 1024 }>;
}

parameter_types! {
Expand Down

0 comments on commit c4f6184

Please sign in to comment.