Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
21 changes: 10 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
1 change: 1 addition & 0 deletions examples/babe/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ features = [
"sp-version",
"sp-io",
"sp-genesis-builder",
"sp-npos-elections",
"frame-executive",
"frame-election-provider-support",
"frame-benchmarking",
Expand Down
15 changes: 12 additions & 3 deletions examples/babe/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use frame_election_provider_support::{
bounds::{ElectionBounds, ElectionBoundsBuilder},
onchain, SequentialPhragmen,
};

use frame_support::{
construct_runtime, derive_impl,
dispatch::DispatchClass,
Expand Down Expand Up @@ -442,7 +443,7 @@ impl_opaque_keys! {
impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ValidatorIdOf = sp_runtime::traits::ConvertInto;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
Expand All @@ -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<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}
Expand Down Expand Up @@ -517,6 +519,7 @@ impl pallet_staking::Config for Runtime {
type OldCurrency = Balances;
type RuntimeHoldReason = RuntimeHoldReason;
type Filter = ();
type MaxValidatorSet = ConstU32<300>;
}

parameter_types! {
Expand Down Expand Up @@ -554,7 +557,9 @@ impl onchain::Config for OnChainSeqPhragmen {
type Solver = SequentialPhragmen<AccountId, Perbill>;
type DataProvider = Staking;
type WeightInfo = ();
type MaxWinners = ConstU32<100>;
type Sort = frame_support::traits::ConstBool<true>;
type MaxBackersPerWinner = ConstU32<64>;
type MaxWinnersPerPage = ConstU32<100>;
type Bounds = Bounds;
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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<T>},
}
);

Expand Down
27 changes: 16 additions & 11 deletions examples/parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
&parachain_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,
&parachain_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();
Expand All @@ -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::<Block, Hash>::register_notification_metrics(
parachain_config.prometheus_config.as_ref().map(|config| &config.registry),
),
})
.await?;

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion examples/parachain/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 7 additions & 6 deletions examples/parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>;
type RelayParentOffset = ConstU32<0>;
}

type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Expand Down Expand Up @@ -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]
);
}
Expand Down Expand Up @@ -766,7 +767,7 @@ impl_runtime_apis! {
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
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;
Expand All @@ -781,17 +782,17 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, 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<u8>) -> Result<(), BenchmarkError> {
ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
fn setup_set_code_requirements(_code: &sp_std::vec::Vec<u8>) -> Result<(), BenchmarkError> {
// ParachainSystem benchmarking not supported in this version
Ok(())
}

fn verify_set_code() {
System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
// ParachainSystem benchmarking not supported in this version
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "simnode-runtime-api"
version = "2503.0.0"
version = "2506.0.0"
authors = ["Polytope Labs <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion simnode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-simnode"
version = "2503.0.0"
version = "2506.0.0"
authors = ["Polytope Labs <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
35 changes: 29 additions & 6 deletions simnode/src/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 2 additions & 0 deletions simnode/src/sproof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![],
})
}
}
Loading