diff --git a/networks/README.md b/networks/README.md index e65544fc..6ef0901d 100644 --- a/networks/README.md +++ b/networks/README.md @@ -13,5 +13,5 @@ cargo install --git https://github.com/r0gue-io/pop-cli You can spawn a local network as follows: ```shell -pop up parachain -f ./networks/paseo.toml +pop up parachain -f ./networks/testnet.toml ``` \ No newline at end of file diff --git a/networks/paseo.toml b/networks/devnet.toml similarity index 100% rename from networks/paseo.toml rename to networks/devnet.toml diff --git a/networks/testnet.toml b/networks/testnet.toml new file mode 100644 index 00000000..15ac9b03 --- /dev/null +++ b/networks/testnet.toml @@ -0,0 +1,40 @@ +# pop up parachain -f ./tests/networks/pop.toml + +[relaychain] +chain = "paseo-local" + +[relaychain.runtime_genesis_patch.balances] +balances = [ + # Pop sovereign account + ["5Ec4AhPKXY9B4ayGshkz2wFMh7N8gP7XKfAvtt1cigpG9FkJ", 60000000000000000], +] + +[[relaychain.nodes]] +name = "alice" +rpc_port = 8833 +validator = true + +[[relaychain.nodes]] +name = "bob" +validator = true + +[[parachains]] +id = 4001 +chain = "testnet" +default_command = "./target/release/pop-node" + +[parachains.genesis_overrides.balances] +balances = [ + # Dev accounts + ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", 10000000000000000], + ["5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty", 10000000000000000], + ["5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y", 10000000000000000], + ["5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy", 10000000000000000], + ["5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw", 10000000000000000], + ["5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL", 10000000000000000], +] + +[[parachains.collators]] +name = "pop" +rpc_port = 9944 +args = ["-lruntime::contracts=debug", "-lpopapi::extension=debug"] \ No newline at end of file diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index d5fa32f4..ca6c9542 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -150,7 +150,7 @@ pub fn testnet_config(relay: Relay) -> TestnetChainSpec { #[allow(deprecated)] TestnetChainSpec::builder( - pop_runtime_devnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), + pop_runtime_testnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), extensions, ) .with_name("Pop Network Testnet") diff --git a/node/src/command.rs b/node/src/command.rs index 8ba956e1..b1fcd614 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -64,8 +64,10 @@ impl RuntimeResolver for PathBuf { fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { - "dev" | "dev-paseo" => Box::new(chain_spec::development_config(Relay::PaseoLocal)), - "test" | "pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)), + "dev" | "devnet" | "dev-paseo" => { + Box::new(chain_spec::development_config(Relay::PaseoLocal)) + }, + "test" | "testnet" | "pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)), "" | "local" => Box::new(chain_spec::development_config(Relay::PaseoLocal)), path => { let path: PathBuf = path.into(); diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index e62d55da..e9b7a3ed 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -6,6 +6,7 @@ use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}; // Cumulus types re-export // These types are shared between the devnet and testnet runtimes pub use parachains_common::{AccountId, AuraId, Balance, Block, BlockNumber, Hash, Signature}; +pub use polkadot_primitives::MAX_POV_SIZE; /// Nonce for an account pub type Nonce = u32; @@ -40,10 +41,8 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 2 seconds of compute with a 6-second average block. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::MAX_POV_SIZE as u64, -); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = + Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), MAX_POV_SIZE as u64); // Unit = the base number of indivisible units for balances pub const UNIT: Balance = 10_000_000_000; // 10 decimals diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index a659e98d..295398f9 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -54,9 +54,8 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; pub use pop_runtime_common::{ deposit, AuraId, Balance, BlockNumber, Hash, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, - BLOCK_PROCESSING_VELOCITY, DAYS, EXISTENTIAL_DEPOSIT, HOURS, MAXIMUM_BLOCK_WEIGHT, MICROUNIT, - MILLISECS_PER_BLOCK, MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, - RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT, + BLOCK_PROCESSING_VELOCITY, EXISTENTIAL_DEPOSIT, MICROUNIT, MILLIUNIT, NORMAL_DISPATCH_RATIO, + RELAY_CHAIN_SLOT_DURATION_MILLIS, UNIT, }; pub use sp_runtime::{MultiAddress, Perbill, Permill}; @@ -296,6 +295,9 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; + #[cfg(feature = "experimental")] + type MinimumPeriod = ConstU64<0>; + #[cfg(not(feature = "experimental"))] type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = (); } @@ -353,6 +355,18 @@ parameter_types! { pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; } +// Async backing +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + pop_runtime_common::MAX_POV_SIZE as u64, +); +const MILLISECS_PER_BLOCK: u64 = 6_000; +const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; +const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +const HOURS: BlockNumber = MINUTES * 60; +const DAYS: BlockNumber = HOURS * 24; + type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, @@ -440,7 +454,7 @@ impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; - type AllowMultipleBlocksPerSlot = ConstBool; + type AllowMultipleBlocksPerSlot = ConstBool; #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 7c03e429..e1b23843 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -444,8 +444,11 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; + // Note: SlotDuration potentially enabled here due to devnet runtime and Rust's feature + // unification, requiring the setting of a backwards compatible value. + // See https://github.com/paritytech/polkadot-sdk/blob/09df373db9cd5dfed82c5cdb0736d417d54249e6/substrate/frame/aura/src/lib.rs#L262 #[cfg(feature = "experimental")] - type SlotDuration = ConstU64; + type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } parameter_types! {