From 0c25210b445d444ccab5656236d0be62e32df33f Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 14 Nov 2023 13:18:42 +0100 Subject: [PATCH] Fix parachain config & Add zombienet config (#216) --- Cargo.toml | 1 + node/Cargo.toml | 12 ++++---- parachain-runtime/src/lib.rs | 55 +++++++++++++++++------------------- runtime/Cargo.toml | 2 +- zombienet.toml | 33 ++++++++++++++++++++++ 5 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 zombienet.toml diff --git a/Cargo.toml b/Cargo.toml index 23bc0ac..8224e08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace.package] authors = ["anonymous"] edition = "2021" +version = "0.34.0" license = "Unlicense" homepage = "https://github.com/paritytech/substrate-contracts-node" repository = "https://github.com/paritytech/substrate-contracts-node" diff --git a/node/Cargo.toml b/node/Cargo.toml index 0d0c17a..70b2258 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "contracts-node" -version = "0.33.0" -authors = ["Parity Technologies "] +version.workspace = true +authors.workspace = true description = "Substrate node configured for smart contracts via `pallet-contracts`." -edition = "2021" -license = "Unlicense" +edition.workspace = true +license.workspace = true build = "build.rs" -homepage = "https://github.com/paritytech/substrate-contracts-node" -repository = "https://github.com/paritytech/substrate-contracts-node" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/parachain-runtime/src/lib.rs b/parachain-runtime/src/lib.rs index c615fdd..6029e63 100644 --- a/parachain-runtime/src/lib.rs +++ b/parachain-runtime/src/lib.rs @@ -345,8 +345,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<50>; + type MaxFreezes = ConstU32<50>; } parameter_types! { @@ -491,37 +491,33 @@ impl pallet_utility::Config for Runtime { construct_runtime!( pub enum Runtime { - // System support stuff. - System: frame_system = 0, - ParachainSystem: cumulus_pallet_parachain_system = 1, - Timestamp: pallet_timestamp = 2, - ParachainInfo: parachain_info = 3, - - // Monetary stuff. - Balances: pallet_balances = 10, - TransactionPayment: pallet_transaction_payment = 11, + // Order should match with Runtime defined in runtime/src/lib.rs + System: frame_system, + RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip, + Utility: pallet_utility, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + Authorship: pallet_authorship, + TransactionPayment: pallet_transaction_payment, + Sudo: pallet_sudo, + Contracts: pallet_contracts, + Assets: pallet_assets, - // Governance - Sudo: pallet_sudo = 15, + // Parachain support stuff. + ParachainSystem: cumulus_pallet_parachain_system, + ParachainInfo: parachain_info, // Collator support. The order of these 4 are important and shall not change. - Authorship: pallet_authorship = 20, - CollatorSelection: pallet_collator_selection = 21, - Session: pallet_session = 22, - Aura: pallet_aura = 23, - AuraExt: cumulus_pallet_aura_ext = 24, + CollatorSelection: pallet_collator_selection, + Session: pallet_session, + Aura: pallet_aura, + AuraExt: cumulus_pallet_aura_ext, // XCM helpers. - XcmpQueue: cumulus_pallet_xcmp_queue = 30, - PolkadotXcm: pallet_xcm = 31, - CumulusXcm: cumulus_pallet_xcm = 32, - DmpQueue: cumulus_pallet_dmp_queue = 33, - - // Others specific to this parachain. - Contracts: pallet_contracts, - Assets: pallet_assets, - RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip, - Utility: pallet_utility, + XcmpQueue: cumulus_pallet_xcmp_queue, + PolkadotXcm: pallet_xcm, + CumulusXcm: cumulus_pallet_xcm, + DmpQueue: cumulus_pallet_dmp_queue, } ); @@ -762,7 +758,8 @@ impl_runtime_apis! { Ok(batches) } } - impl pallet_contracts::ContractsApi + + impl pallet_contracts::ContractsApi for Runtime { fn call( diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 8cf6447..e17ec7e 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contracts-node-runtime" -version = "0.33.0" +version.workspace = true authors.workspace = true edition.workspace = true description = "Runtime configured for smart contracts via `pallet-contracts`." diff --git a/zombienet.toml b/zombienet.toml new file mode 100644 index 0000000..936265d --- /dev/null +++ b/zombienet.toml @@ -0,0 +1,33 @@ +# This sample Zombienet configuration file can be used to spawn a local network with a relaychain +# and a substrate-contracts-node parachain. +# +# Requirements: +# - Install zombienet from https://github.com/paritytech/zombienet/releases. +# - Build `polkadot`, `polkadot-execute-worker` and `polkadot-prepare-worker` from `polkadot-sdk` and make the binaries available in your path. +# - Build or install `substrate-contracts-node` and make the binary available in your path. +# +# Usage: +# zombienet spawn --provider native zombienet.toml + +[relaychain] +chain = "rococo-local" +command = "polkadot" + + [[relaychain.nodes]] + name = "alice" + args = [ "--alice", "-lruntime=debug,parachain=trace" ] + + [[relaychain.nodes]] + name = "bob" + args = [ "--bob", "-lruntime=debug,parachain=trace" ] + +[[parachains]] +id = 100 +addToGenesis = true +chain = "contracts-parachain-local" + + [parachains.collator] + name = "collator01" + rpc_port = 9944 + command = "substrate-contracts-node" + args = [ "-lerror,runtime::contracts=debug,runtime::contracts::strace=trace" ]