diff --git a/.github/workflows/run_all_benchmarks.yml b/.github/workflows/run_all_benchmarks.yml index 751419375..b2b9dfe48 100644 --- a/.github/workflows/run_all_benchmarks.yml +++ b/.github/workflows/run_all_benchmarks.yml @@ -19,7 +19,7 @@ env: jobs: run-benchmarks: timeout-minutes: 720 - runs-on: runtime-integration-test + runs-on: runtime-large steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v3 @@ -50,7 +50,7 @@ jobs: - name: init run: | sudo apt update - sudo apt install -y pkg-config libssl-dev protobuf-compiler + sudo apt install -y pkg-config libssl-dev protobuf-compiler build-essential clang curl llvm libudev-dev libclang-dev protoc --version curl -s https://sh.rustup.rs -sSf | sh -s -- -y source ${HOME}/.cargo/env @@ -61,7 +61,7 @@ jobs: uses: Swatinem/rust-cache@v2 - name: init nodejs && yarn run: | - curl -s https://deb.nodesource.com/setup_16.x | sudo bash + curl -s https://deb.nodesource.com/setup_18.x | sudo bash sudo apt install nodejs -y node -v sudo npm install --global yarn @@ -75,7 +75,7 @@ jobs: CARGO_TERM_COLOR: always run: | source ${HOME}/.cargo/env - RUSTC_BOOTSTRAP=1 cargo build --profile production --features runtime-benchmarks --verbose --timings + RUSTC_BOOTSTRAP=1 cargo build --profile production --features runtime-benchmarks --timings - name: create-chainspec run: | ${{ github.workspace }}/target/production/manta build-spec --chain $CHAIN_SPEC --disable-default-bootnode --raw > ${{ github.workspace }}/tests/data/fork.json diff --git a/.github/workflows/run_linters.yml b/.github/workflows/run_linters.yml index f31a36fd3..19d814f8c 100644 --- a/.github/workflows/run_linters.yml +++ b/.github/workflows/run_linters.yml @@ -55,7 +55,7 @@ jobs: source ${HOME}/.cargo/env rustup toolchain install nightly-2023-03-13 rustup default nightly-2023-03-13 - cargo install taplo-cli + cargo install taplo-cli --locked - name: cache cargo uses: Swatinem/rust-cache@v2 - name: Check Formatting diff --git a/CHANGELOG.md b/CHANGELOG.md index be31d7af3..93881d34b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # CHANGELOG +## v4.4.0-1 +### Added +- [\#1240](https://github.com/Manta-Network/Manta/pull/1240) :sparkle: org `arc-runner` patch 1 [MACA] +- [\#1241](https://github.com/Manta-Network/Manta/pull/1241) :bug: arc-runner patch 1.1 [MACA] +- [\#1238](https://github.com/Manta-Network/Manta/pull/1238) localdev tests [MA] +- [\#1242](https://github.com/Manta-Network/Manta/pull/1242) :rocket: arc runner migration patch 2.1 [MACA] +- [\#1244](https://github.com/Manta-Network/Manta/pull/1244) more lottery tests [MACA] +- [\#1250](https://github.com/Manta-Network/Manta/pull/1250) :wrench: allow all benchmarks to be triggered on feature branch +- [\#1249](https://github.com/Manta-Network/Manta/pull/1249) Add zombienet examples + +### Fixed +- [\#1234](https://github.com/Manta-Network/Manta/pull/1234) Serialize/deserialize vfr key [MACA] +- [\#1191](https://github.com/Manta-Network/Manta/pull/1191) Fix metadata diff checker workflow [MACA] +- [\#1243](https://github.com/Manta-Network/Manta/pull/1243) Add manta docker image to publish +- [\#1253](https://github.com/Manta-Network/Manta/pull/1253) Fix benchmark [CA] + ## v4.4.0 ### Added - [\#1083](https://github.com/Manta-Network/Manta/pull/1083) tx fees diff support [MACA] diff --git a/pallets/asset-manager/src/benchmarking.rs b/pallets/asset-manager/src/benchmarking.rs index c4f15ab41..37107fe22 100644 --- a/pallets/asset-manager/src/benchmarking.rs +++ b/pallets/asset-manager/src/benchmarking.rs @@ -96,7 +96,7 @@ benchmarks! { let metadata = AssetRegistryMetadata::::testing_default(); Pallet::::register_asset(RawOrigin::Root.into(), location, metadata.clone())?; let some_valid_asset_id = ::AssetId::from(assets_count); - }: _(RawOrigin::Root, some_valid_asset_id, metadata.metadata.clone()) + }: _(RawOrigin::Root, some_valid_asset_id, metadata.clone()) verify { assert_last_event::(crate::Event::AssetMetadataUpdated { asset_id: some_valid_asset_id, metadata }.into()); } diff --git a/pallets/asset-manager/src/lib.rs b/pallets/asset-manager/src/lib.rs index f9ea76f32..4554a726a 100644 --- a/pallets/asset-manager/src/lib.rs +++ b/pallets/asset-manager/src/lib.rs @@ -541,15 +541,14 @@ pub mod pallet { /// /// * `origin`: Caller of this extrinsic, the access control is specified by `ForceOrigin`. /// * `asset_id`: AssetId to be updated. - /// * `metadata`: new `metadata` to be associated with `asset_id`, note `is_frozen` - /// flag in metadata will have no effect and and cannot be changed. + /// * `metadata`: new `metadata` to be associated with `asset_id`. #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::update_asset_metadata())] #[transactional] pub fn update_asset_metadata( origin: OriginFor, asset_id: T::AssetId, - metadata: AssetStorageMetadata, + metadata: AssetRegistryMetadata, ) -> DispatchResult { T::ModifierOrigin::ensure_origin(origin)?; ensure!( @@ -562,25 +561,11 @@ pub mod pallet { ); >::AssetRegistry::update_asset_metadata( &asset_id, - metadata.clone(), + metadata.clone().into(), )?; - let mut registered_metadata = - AssetIdMetadata::::get(asset_id).ok_or(Error::::UpdateNonExistentAsset)?; - let new_metadata = AssetStorageMetadata { - name: metadata.name, - symbol: metadata.symbol, - decimals: metadata.decimals, - // is frozen flag doesn't do anything in metadata - is_frozen: registered_metadata.metadata.is_frozen, - }; - registered_metadata.metadata = new_metadata; - - AssetIdMetadata::::insert(asset_id, ®istered_metadata); - Self::deposit_event(Event::::AssetMetadataUpdated { - asset_id, - metadata: registered_metadata, - }); + AssetIdMetadata::::insert(asset_id, &metadata); + Self::deposit_event(Event::::AssetMetadataUpdated { asset_id, metadata }); Ok(()) } diff --git a/pallets/asset-manager/src/tests.rs b/pallets/asset-manager/src/tests.rs index 5515a528f..11812a2c3 100644 --- a/pallets/asset-manager/src/tests.rs +++ b/pallets/asset-manager/src/tests.rs @@ -82,7 +82,7 @@ fn wrong_modifier_origin_should_not_work() { AssetManager::update_asset_metadata( RuntimeOrigin::signed([3u8; 32].into()), 0, - asset_metadata.metadata + asset_metadata ), BadOrigin ); @@ -174,14 +174,14 @@ fn update_asset() { AssetManager::update_asset_metadata( RuntimeOrigin::root(), native_asset_id, - new_metadata.metadata.clone(), + new_metadata.clone(), ), Error::::CannotUpdateNativeAssetMetadata ); assert_ok!(AssetManager::update_asset_metadata( RuntimeOrigin::root(), asset_id, - new_metadata.metadata.clone(), + new_metadata.clone(), ),); assert_eq!(Assets::name(&asset_id), new_name); assert_eq!(Assets::symbol(&asset_id), new_symbol); @@ -213,7 +213,7 @@ fn update_asset() { AssetManager::update_asset_metadata( RuntimeOrigin::root(), next_asset_id, - new_metadata.metadata.clone() + new_metadata.clone(), ), Error::::UpdateNonExistentAsset ); diff --git a/runtime/calamari/src/diff_tx_fees.rs b/runtime/calamari/src/diff_tx_fees.rs index 4d79e90a9..cc7cc32f0 100644 --- a/runtime/calamari/src/diff_tx_fees.rs +++ b/runtime/calamari/src/diff_tx_fees.rs @@ -1210,7 +1210,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( let call = crate::RuntimeCall::AssetManager(pallet_asset_manager::Call::update_asset_metadata { asset_id: 1, - metadata: AssetRegistryMetadata::testing_default().into(), + metadata: AssetRegistryMetadata::testing_default(), }); let (dispatch_info, call_len) = get_call_details(&call); calamari_runtime_calls.push(( diff --git a/runtime/calamari/src/lib.rs b/runtime/calamari/src/lib.rs index fa281e1f1..bd81c233d 100644 --- a/runtime/calamari/src/lib.rs +++ b/runtime/calamari/src/lib.rs @@ -143,10 +143,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("calamari"), impl_name: create_runtime_str!("calamari"), authoring_version: 2, - spec_version: 4400, + spec_version: 4401, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 15, + transaction_version: 16, state_version: 0, }; @@ -245,10 +245,6 @@ impl Contains for BaseFilter { | pallet_democracy::Call::cancel_proposal {..} | pallet_democracy::Call::clear_public_proposals {..}) | RuntimeCall::Treasury(_) // Treasury calls are filtered while it is accumulating funds. - // Everything except transfer() is filtered out until it is practically needed: - | RuntimeCall::XTokens( - orml_xtokens::Call::transfer_with_fee {..} - | orml_xtokens::Call::transfer_multiasset {..}) // Filter callables from XCM pallets, we use XTokens exclusively | RuntimeCall::XcmpQueue(_) | RuntimeCall::DmpQueue(_) => false, @@ -306,10 +302,7 @@ impl Contains for BaseFilter { | RuntimeCall::MantaPay(_) | RuntimeCall::MantaSbt(_) | RuntimeCall::NameService(_) - | RuntimeCall::XTokens(orml_xtokens::Call::transfer {..} - | orml_xtokens::Call::transfer_multicurrencies {..} - | orml_xtokens::Call::transfer_multiassets {..} - | orml_xtokens::Call::transfer_multiasset_with_fee {..}) + | RuntimeCall::XTokens(_) | RuntimeCall::TransactionPause(_) | RuntimeCall::ZenlinkProtocol(_) | RuntimeCall::Farming(_) diff --git a/runtime/manta/src/diff_tx_fees.rs b/runtime/manta/src/diff_tx_fees.rs index 77e6039f8..4f0891c00 100644 --- a/runtime/manta/src/diff_tx_fees.rs +++ b/runtime/manta/src/diff_tx_fees.rs @@ -1198,7 +1198,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( let call = crate::RuntimeCall::AssetManager(pallet_asset_manager::Call::update_asset_metadata { asset_id: 1, - metadata: AssetRegistryMetadata::testing_default().into(), + metadata: AssetRegistryMetadata::testing_default(), }); let (dispatch_info, call_len) = get_call_details(&call); calamari_runtime_calls.push(( diff --git a/runtime/manta/src/lib.rs b/runtime/manta/src/lib.rs index 80f9d67c0..72ac32bde 100644 --- a/runtime/manta/src/lib.rs +++ b/runtime/manta/src/lib.rs @@ -145,10 +145,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("manta"), impl_name: create_runtime_str!("manta"), authoring_version: 1, - spec_version: 4400, + spec_version: 4401, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 4, + transaction_version: 5, state_version: 1, }; diff --git a/zombienet/examples/README.md b/zombienet/examples/README.md new file mode 100644 index 000000000..c06ed6fb8 --- /dev/null +++ b/zombienet/examples/README.md @@ -0,0 +1,72 @@ +# Manta's zombienet examples + +## Docs and examples +- docs: https://paritytech.github.io/zombienet/ +- examples: + - https://github.com/paritytech/zombienet/tree/main/examples + - https://github.com/paritytech/cumulus/tree/master/zombienet + - https://github.com/paritytech/polkadot/tree/master/zombienet_tests + +## Install zombienet + +According to your platform, download the latest pre-compiled binary from [zombinet](https://github.com/paritytech/zombienet/releases) repository. + +## Start network + +### Start one paracahin network locally by zombienet +1. Go to [small-network](./small-network.toml), make the `command` point to the polkadot binary and manta binary. +2. Start the network. + ```shell + zombienet spawn --provider native small-network.toml + ``` + After a while, the network will be started. + +### Start two parachains +1. Go to [two-parachains](./two-parachains.toml), make the `command` point to the polkadot binary and manta binary. +2. Start the network. + ```shell + zombienet spawn --provider native two-parachains.toml + ``` + After a while, two paracahins(`2084` and `2104`) will be started. + +## Testing + +Zombienet supports testing as well, but you have to write test cases with a special dsl: `zndsl`. +Please take a look at this [doc](https://paritytech.github.io/zombienet/cli/test-dsl-definition-spec.html) to see more details about how to write test cases. + +### Runtime upgrade(not ready) +1. Go to [runtime-upgrade](./runtime-upgrade.toml), make the `command` point to the polkadot binary and manta binary. And go to [runtime upgrade test case](./runtime-upgrade.zndsl), make sure `line 6` point to the correct wasm binary. +2. Run runtime upgrade. + ```shell + zombienet -f --provider native test runtime-upgrade.zndsl + ``` + This test case would take minutes to be finished. + +### Run you own customized test script +1. Go to [custom-script](./custom-script.toml), make the `command` point to the polkadot binary and manta binary. +2. Define and implement a function named `run` in your script. + ```ts + async function run(nodeName, networkInfo, args) { + return 2084; + } + ``` +3. Go to the [custom-script test case](./custom-script.zndsl), make sure `line 8` point to your script, and compare the expected value. + ``` + Dave: js-script ./custom-script.js return is equal to 2084 within 300 seconds + ``` +4. Start the test. + ```shell + zombienet -f --provider native test custom-script.zndsl + ``` + +## Tips: +1. When run the network, please do not use the same node name for relaychain and parachain. +For example: if one relaychain node takes `Alice`, so you cannot use `Alice` for any parachain nodes, but you can use `alice`. +2. Please be careful the node name in your test case, you must understand what you want to test. +For example, if one relaychain node takes `Alice` as node, you can use `alice` for one of paracahin nodes, the `Alice` will test relaychain node, but `alice` is for parachain only. + ``` + alice: parachain 2084 is registered within 225 seconds + Alice: reports block height is at least 5 within 250 seconds + ``` + The first line will check parachain's block production, the second line will check relaychain's. + Because relaychain and parachain use the same node name, the zombienet's test framework won't know who is `Alice`. diff --git a/zombienet/examples/check-block-production.zndsl b/zombienet/examples/check-block-production.zndsl new file mode 100644 index 000000000..fcc90a5d1 --- /dev/null +++ b/zombienet/examples/check-block-production.zndsl @@ -0,0 +1,10 @@ +Description: Block Production Test +Network: ./small-network.toml +Creds: config + +# metrics +Alice: reports node_roles is 4 + +# logs +alice: parachain 2084 is registered within 225 seconds +Alice: reports block height is at least 5 within 250 seconds \ No newline at end of file diff --git a/zombienet/examples/custom-script.js b/zombienet/examples/custom-script.js new file mode 100644 index 000000000..f65e08373 --- /dev/null +++ b/zombienet/examples/custom-script.js @@ -0,0 +1,7 @@ +const assert = require("assert"); + +async function run(nodeName, networkInfo, args) { + return 2084; +} + +module.exports = { run } \ No newline at end of file diff --git a/zombienet/examples/custom-script.toml b/zombienet/examples/custom-script.toml new file mode 100644 index 000000000..46bdc9d99 --- /dev/null +++ b/zombienet/examples/custom-script.toml @@ -0,0 +1,48 @@ +[settings] +timeout = 300 + +[relaychain] +chain = "rococo-local" +default_command = "polkadot-binary" + +[[relaychain.nodes]] +name = "alice" +validator = true +ws_port = 9944 + +[[relaychain.nodes]] +name = "bob" +validator = true +ws_port = 9911 + +[[parachains]] +chain = "calamari-local" +cumulus_based = true +id = 2084 + +[[parachains.collators]] +command = "manta-binary" +name = "Alice" +rcp_port = 9967 +validator = true +ws_port = 9921 + +[[parachains.collators]] +command = "manta-binary" +name = "Bob" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Charlie" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Dave" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Eve" +validator = true diff --git a/zombienet/examples/custom-script.zndsl b/zombienet/examples/custom-script.zndsl new file mode 100644 index 000000000..2eb112d97 --- /dev/null +++ b/zombienet/examples/custom-script.zndsl @@ -0,0 +1,8 @@ +Description: Runtime Upgrade Test +Network: ./custom-script.toml +Creds: config + +alice: parachain 2084 is registered within 225 seconds +Bob: reports block height is at least 5 within 250 seconds +Dave: reports block height is at least 5 within 250 seconds +Dave: js-script ./custom-script.js return is equal to 2084 within 300 seconds \ No newline at end of file diff --git a/zombienet/examples/runtime-upgrade.js b/zombienet/examples/runtime-upgrade.js new file mode 100644 index 000000000..7692d3cef --- /dev/null +++ b/zombienet/examples/runtime-upgrade.js @@ -0,0 +1,24 @@ +const assert = require("assert"); + +async function run(nodeName, networkInfo, args) { + const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName]; + const api = await zombie.connect(wsUri, userDefinedTypes); + + // get blockhash/runtimeVersion at block 1 + const hashAtBlock1 = await api.rpc.chain.getBlockHash(1); + const versionAtBlock1 = await api.rpc.state.getRuntimeVersion(hashAtBlock1.toHuman()); + + // get blockhash/runtimeVersion at current head + const currentHeader = await api.rpc.chain.getHeader(); + const hashAtCurrent = await api.rpc.chain.getBlockHash(currentHeader.number.toHuman()); + const versionAtCurrent = await api.rpc.state.getRuntimeVersion(hashAtCurrent.toHuman()); + + const oldVersionIncremented = parseInt(versionAtBlock1.specVersion.toHuman(),10) + 1; + console.log("current", versionAtCurrent.specVersion.toHuman()); + console.log("oldVersionIncremented", oldVersionIncremented); + + // 2 == 2 + assert.equal( oldVersionIncremented, versionAtCurrent.specVersion.toHuman(), "Running version should be the incremented version"); +} + +module.exports = { run } \ No newline at end of file diff --git a/zombienet/examples/runtime-upgrade.toml b/zombienet/examples/runtime-upgrade.toml new file mode 100644 index 000000000..46bdc9d99 --- /dev/null +++ b/zombienet/examples/runtime-upgrade.toml @@ -0,0 +1,48 @@ +[settings] +timeout = 300 + +[relaychain] +chain = "rococo-local" +default_command = "polkadot-binary" + +[[relaychain.nodes]] +name = "alice" +validator = true +ws_port = 9944 + +[[relaychain.nodes]] +name = "bob" +validator = true +ws_port = 9911 + +[[parachains]] +chain = "calamari-local" +cumulus_based = true +id = 2084 + +[[parachains.collators]] +command = "manta-binary" +name = "Alice" +rcp_port = 9967 +validator = true +ws_port = 9921 + +[[parachains.collators]] +command = "manta-binary" +name = "Bob" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Charlie" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Dave" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Eve" +validator = true diff --git a/zombienet/examples/runtime-upgrade.zndsl b/zombienet/examples/runtime-upgrade.zndsl new file mode 100644 index 000000000..dc1275f41 --- /dev/null +++ b/zombienet/examples/runtime-upgrade.zndsl @@ -0,0 +1,9 @@ +Description: Runtime Upgrade Test +Network: ./runtime-upgrade.toml +Creds: config + +alice: parachain 2084 is registered within 225 seconds +bob: parachain 2084 perform upgrade with ./calamari-runtime-v4400.compact.compressed.wasm within 300 seconds +Bob: reports block height is at least 5 within 250 seconds +Dave: reports block height is at least 5 within 250 seconds +Dave: js-script ./runtime.unpragde.js within 600 seconds \ No newline at end of file diff --git a/zombienet/examples/small-network.toml b/zombienet/examples/small-network.toml new file mode 100644 index 000000000..26769dfb6 --- /dev/null +++ b/zombienet/examples/small-network.toml @@ -0,0 +1,49 @@ +[settings] +timeout = 300 + +[relaychain] +chain = "rococo-local" +default_command = "polkadot-binary" + +[[relaychain.nodes]] +name = "alice" +validator = true +ws_port = 9944 + +[[relaychain.nodes]] +name = "bob" +validator = true +ws_port = 9911 + +[[parachains]] +chain = "calamari-local" +# chain_spec_file = "" +cumulus_based = true +id = 2084 + +[[parachains.collators]] +command = "manta-binary" +name = "Alice" # cannot use alice here, alice has been occupied by one of relaychain node +rcp_port = 9967 +validator = true +ws_port = 9921 + +[[parachains.collators]] +command = "manta-binary" +name = "Bob" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Charlie" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Dave" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Eve" +validator = true diff --git a/zombienet/examples/two-parachains.toml b/zombienet/examples/two-parachains.toml new file mode 100644 index 000000000..9a66cb6a2 --- /dev/null +++ b/zombienet/examples/two-parachains.toml @@ -0,0 +1,76 @@ +[settings] +timeout = 300 + +[relaychain] +chain = "rococo-local" +default_command = "/home/jamie/my-repo/forks/jdeng/Manta/zombienet/polkadot" + +[[relaychain.nodes]] +name = "eve" +validator = true +ws_port = 9944 + +[[relaychain.nodes]] +name = "bob" +validator = true +ws_port = 9911 + +[[parachains]] +chain = "calamari-local" +cumulus_based = true +default_command = "manta-binary" +id = 2084 + +[[parachains.collators]] +args = ["-lparachain=debug,xcm=trace"] +command = "manta-binary" +name = "Alice" # case sensitive, if you use `alice` here, zombienet will generate a key from alice-1 +rcp_port = 9967 +validator = true +ws_port = 9921 + +[[parachains.collators]] +command = "manta-binary" +name = "Bob" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Charlie" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Dave" +validator = true + +[[parachains.collators]] +command = "manta-binary" +name = "Eve" +validator = true + +[[parachains]] +chain = "manta-dev" +cumulus_based = true +default_command = "manta-binary" +id = 2104 + +[[parachains.collators]] +command = "manta-binary" +name = "Alice" # Alice-1 +rcp_port = 9968 +validator = true +ws_port = 9922 +# args = ["-lparachain=debug"] + +[[hrmp_channels]] +max_capacity = 4 +max_message_size = 524288 +recipient = 2084 +sender = 2104 + +[[hrmp_channels]] +max_capacity = 4 +max_message_size = 524288 +recipient = 2104 +sender = 2084