diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4dda14..c0dcdfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,14 @@ jobs: - name: Checkout sources uses: actions/checkout@main - - name: Install nightly toolchain + - name: Install stable toolchain uses: dtolnay/rust-toolchain@master with: toolchain: stable + targets: wasm32-unknown-unknown,wasm32v1-none + components: rust-src - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Install protoc run: | sudo apt-get update @@ -35,16 +37,16 @@ jobs: runs-on: arc-runner-set steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@master with: toolchain: stable - - run: | - rustup target add wasm32-unknown-unknown - rustup component add rust-src + targets: wasm32-unknown-unknown,wasm32v1-none + components: rust-src - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Install protoc run: | diff --git a/Cargo.toml b/Cargo.toml index 757e3c6..7a347ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,18 +25,17 @@ scale-info = { version = "2.1.1", default-features = false, features = [ "derive", ] } jsonrpsee = "0.24" -polkadot-sdk = { version = "=2503.0.1", default-features = false } +polkadot-sdk = { version = "2506.0.0", default-features = false } # crates which cannot be used from polkadot-sdk -sp-core = { version = "36.1.0", default-features = false } -sp-runtime-interface = { version = "29.0.1", default-features = false } -cumulus-pallet-parachain-system = { version = "0.20.0", default-features = false } -substrate-wasm-builder = "26.0.0" -sc-service = "0.50.0" -sc-network-sync = "0.48.0" -sc-tracing = "39.0.0" -sp-api-proc-macro = "22.0.0" +sp-core = { version = "37.0.0", default-features = false } +sp-runtime-interface = { version = "30.0.0", default-features = false } +cumulus-pallet-parachain-system = { version = "0.21.0", default-features = false } +substrate-wasm-builder = "27.0.0" +sc-service = "0.52.0" +sc-network-sync = "0.50.0" +sc-tracing = "40.0.0" # local crates -simnode-runtime-api = { path = "./runtime-api", version = "2503.0.0", default-features = false } -sc-simnode = { path = "./simnode", version = "2503.0.0" } +simnode-runtime-api = { path = "./runtime-api", version = "2506.0.0", default-features = false } +sc-simnode = { path = "./simnode", version = "2506.0.0" } diff --git a/examples/babe/runtime/Cargo.toml b/examples/babe/runtime/Cargo.toml index b678d16..259f724 100644 --- a/examples/babe/runtime/Cargo.toml +++ b/examples/babe/runtime/Cargo.toml @@ -39,6 +39,7 @@ features = [ "sp-version", "sp-io", "sp-genesis-builder", + "sp-npos-elections", "frame-executive", "frame-election-provider-support", "frame-benchmarking", diff --git a/examples/babe/runtime/src/lib.rs b/examples/babe/runtime/src/lib.rs index c30379e..bbbc84b 100644 --- a/examples/babe/runtime/src/lib.rs +++ b/examples/babe/runtime/src/lib.rs @@ -30,6 +30,7 @@ use frame_election_provider_support::{ bounds::{ElectionBounds, ElectionBoundsBuilder}, onchain, SequentialPhragmen, }; + use frame_support::{ construct_runtime, derive_impl, dispatch::DispatchClass, @@ -442,7 +443,7 @@ impl_opaque_keys! { impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; - type ValidatorIdOf = pallet_staking::StashOf; + type ValidatorIdOf = sp_runtime::traits::ConvertInto; type ShouldEndSession = Babe; type NextSessionRotation = Babe; type SessionManager = pallet_session::historical::NoteHistoricalRoot; @@ -453,6 +454,7 @@ impl pallet_session::Config for Runtime { } impl pallet_session::historical::Config for Runtime { + type RuntimeEvent = RuntimeEvent; type FullIdentification = pallet_staking::Exposure; type FullIdentificationOf = pallet_staking::ExposureOf; } @@ -517,6 +519,7 @@ impl pallet_staking::Config for Runtime { type OldCurrency = Balances; type RuntimeHoldReason = RuntimeHoldReason; type Filter = (); + type MaxValidatorSet = ConstU32<300>; } parameter_types! { @@ -554,7 +557,9 @@ impl onchain::Config for OnChainSeqPhragmen { type Solver = SequentialPhragmen; type DataProvider = Staking; type WeightInfo = (); - type MaxWinners = ConstU32<100>; + type Sort = frame_support::traits::ConstBool; + type MaxBackersPerWinner = ConstU32<64>; + type MaxWinnersPerPage = ConstU32<100>; type Bounds = Bounds; } @@ -672,6 +677,10 @@ where fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { UncheckedExtrinsic::new_bare(call) } + + fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare(call) + } } impl frame_system::offchain::SigningTypes for Runtime { @@ -715,7 +724,7 @@ construct_runtime!( Grandpa: pallet_grandpa, Sudo: pallet_sudo, Offences: pallet_offences, - Historical: pallet_session_historical::{Pallet}, + Historical: pallet_session_historical::{Pallet, Event}, } ); diff --git a/examples/parachain/node/src/service.rs b/examples/parachain/node/src/service.rs index c30242c..6fdcefe 100644 --- a/examples/parachain/node/src/service.rs +++ b/examples/parachain/node/src/service.rs @@ -29,7 +29,7 @@ use polkadot_primitives::{CollatorPair, ValidationCode}; use sc_client_api::Backend; use sc_consensus::ImportQueue; use sc_executor::{RuntimeVersionOf, WasmExecutor}; -use sc_network::NetworkBlock; +use sc_network::{NetworkBackend, NetworkBlock}; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_simnode::parachain::ParachainSelectChain; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; @@ -156,16 +156,17 @@ async fn start_node_impl( let backend = params.backend.clone(); let mut task_manager = params.task_manager; - let (relay_chain_interface, collator_key) = build_relay_chain_interface( - polkadot_config, - ¶chain_config, - telemetry_worker_handle, - &mut task_manager, - collator_options.clone(), - hwbench.clone(), - ) - .await - .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; + let (relay_chain_interface, collator_key, _relay_chain_network, _paranode_rx) = + build_relay_chain_interface( + polkadot_config, + ¶chain_config, + telemetry_worker_handle, + &mut task_manager, + collator_options.clone(), + hwbench.clone(), + ) + .await + .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let _force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); @@ -191,6 +192,9 @@ async fn start_node_impl( relay_chain_interface: relay_chain_interface.clone(), import_queue: params.import_queue, sybil_resistance_level: CollatorSybilResistance::Resistant, + metrics: sc_network::NetworkWorker::::register_notification_metrics( + parachain_config.prometheus_config.as_ref().map(|config| &config.registry), + ), }) .await?; @@ -305,6 +309,7 @@ async fn start_node_impl( relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle.clone()), sync_service: sync_service.clone(), + prometheus_registry: prometheus_registry.as_ref(), })?; if validator { diff --git a/examples/parachain/runtime/Cargo.toml b/examples/parachain/runtime/Cargo.toml index 3f79aeb..8b366b1 100644 --- a/examples/parachain/runtime/Cargo.toml +++ b/examples/parachain/runtime/Cargo.toml @@ -62,7 +62,6 @@ features = [ "staging-xcm-executor", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", - "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", diff --git a/examples/parachain/runtime/src/lib.rs b/examples/parachain/runtime/src/lib.rs index fea8eb5..281c745 100644 --- a/examples/parachain/runtime/src/lib.rs +++ b/examples/parachain/runtime/src/lib.rs @@ -391,6 +391,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type ConsensusHook = ConsensusHook; type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector; + type RelayParentOffset = ConstU32<0>; } type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< @@ -546,7 +547,7 @@ mod benches { [pallet_message_queue, MessageQueue] [pallet_sudo, Sudo] [pallet_collator_selection, CollatorSelection] - [cumulus_pallet_parachain_system, ParachainSystem] + [cumulus_pallet_xcmp_queue, XcmpQueue] ); } @@ -766,7 +767,7 @@ impl_runtime_apis! { Vec, Vec, ) { - use frame_benchmarking::{Benchmarking, BenchmarkList}; + use frame_benchmarking::BenchmarkList; use frame_support::traits::StorageInfoTrait; use frame_system_benchmarking::Pallet as SystemBench; use cumulus_pallet_session_benchmarking::Pallet as SessionBench; @@ -781,17 +782,17 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{BenchmarkError, Benchmarking, BenchmarkBatch}; + use frame_benchmarking::{BenchmarkError, BenchmarkBatch}; use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { - ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); + fn setup_set_code_requirements(_code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + // ParachainSystem benchmarking not supported in this version Ok(()) } fn verify_set_code() { - System::assert_last_event(cumulus_pallet_parachain_system::Event::::ValidationFunctionStored.into()); + // ParachainSystem benchmarking not supported in this version } } diff --git a/runtime-api/Cargo.toml b/runtime-api/Cargo.toml index a965338..055684e 100644 --- a/runtime-api/Cargo.toml +++ b/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simnode-runtime-api" -version = "2503.0.0" +version = "2506.0.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" diff --git a/simnode/Cargo.toml b/simnode/Cargo.toml index dba70d0..5744bb9 100644 --- a/simnode/Cargo.toml +++ b/simnode/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-simnode" -version = "2503.0.0" +version = "2506.0.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" diff --git a/simnode/src/overrides.rs b/simnode/src/overrides.rs index 84dd4d1..0391683 100644 --- a/simnode/src/overrides.rs +++ b/simnode/src/overrides.rs @@ -19,29 +19,52 @@ use polkadot_sdk::*; use sp_core::{ecdsa, ed25519, sr25519}; -use sp_runtime_interface::runtime_interface; +use sp_runtime_interface::{ + pass_by::{PassFatPointerAndRead, PassPointerAndRead}, + runtime_interface, +}; #[runtime_interface] trait Crypto { - fn ecdsa_verify(_sig: &ecdsa::Signature, _msg: &[u8], _pub_key: &ecdsa::Public) -> bool { + fn ecdsa_verify( + _sig: PassPointerAndRead<&ecdsa::Signature, 65>, + _msg: PassFatPointerAndRead<&[u8]>, + _pub_key: PassPointerAndRead<&ecdsa::Public, 33>, + ) -> bool { true } #[version(2)] - fn ecdsa_verify(_sig: &ecdsa::Signature, _msg: &[u8], _pub_key: &ecdsa::Public) -> bool { + fn ecdsa_verify( + _sig: PassPointerAndRead<&ecdsa::Signature, 65>, + _msg: PassFatPointerAndRead<&[u8]>, + _pub_key: PassPointerAndRead<&ecdsa::Public, 33>, + ) -> bool { true } - fn ed25519_verify(_sig: &ed25519::Signature, _msg: &[u8], _pub_key: &ed25519::Public) -> bool { + fn ed25519_verify( + _sig: PassPointerAndRead<&ed25519::Signature, 64>, + _msg: PassFatPointerAndRead<&[u8]>, + _pub_key: PassPointerAndRead<&ed25519::Public, 32>, + ) -> bool { true } - fn sr25519_verify(_sig: &sr25519::Signature, _msg: &[u8], _pub_key: &sr25519::Public) -> bool { + fn sr25519_verify( + _sig: PassPointerAndRead<&sr25519::Signature, 64>, + _msg: PassFatPointerAndRead<&[u8]>, + _pub_key: PassPointerAndRead<&sr25519::Public, 32>, + ) -> bool { true } #[version(2)] - fn sr25519_verify(_sig: &sr25519::Signature, _msg: &[u8], _pub_key: &sr25519::Public) -> bool { + fn sr25519_verify( + _sig: PassPointerAndRead<&sr25519::Signature, 64>, + _msg: PassFatPointerAndRead<&[u8]>, + _pub_key: PassPointerAndRead<&sr25519::Public, 32>, + ) -> bool { true } } diff --git a/simnode/src/sproof.rs b/simnode/src/sproof.rs index 80aef8e..27987d6 100644 --- a/simnode/src/sproof.rs +++ b/simnode/src/sproof.rs @@ -114,6 +114,8 @@ where relay_chain_state: proof, downward_messages: Default::default(), horizontal_messages: Default::default(), + collator_peer_id: None, + relay_parent_descendants: vec![], }) } }