From a8ca4d35988f115f483fca5d473b8f7db7f94048 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:03:54 +0100 Subject: [PATCH] feat: Enable storage weight reclaiming (#2931) * feat: Enable storage weight reclaiming * fix test --- Cargo.lock | 3 +++ Cargo.toml | 5 ++--- node/service/src/lib.rs | 3 ++- runtime/moonbase/Cargo.toml | 4 +++- runtime/moonbase/src/lib.rs | 1 + runtime/moonbeam/Cargo.toml | 2 ++ runtime/moonbeam/src/lib.rs | 1 + runtime/moonriver/Cargo.toml | 2 ++ runtime/moonriver/src/lib.rs | 1 + .../suites/dev/moonbase/test-fees/test-fee-multiplier-xcm.ts | 2 +- 10 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3dc826784d..4aabc8bb45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6289,6 +6289,7 @@ dependencies = [ "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", + "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "cumulus-test-relay-sproof-builder", @@ -6803,6 +6804,7 @@ dependencies = [ "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", + "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "cumulus-test-relay-sproof-builder", @@ -7214,6 +7216,7 @@ dependencies = [ "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", + "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "cumulus-test-relay-sproof-builder", diff --git a/Cargo.toml b/Cargo.toml index a4666d5a32..bf3d477a9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -290,6 +290,7 @@ cumulus-primitives-parachain-inherent = { git = "https://github.com/moonbeam-fou cumulus-primitives-timestamp = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } cumulus-primitives-utility = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } cumulus-test-relay-sproof-builder = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } +cumulus-primitives-storage-weight-reclaim = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } parachain-info = { package = "staging-parachain-info", git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } parachains-common = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-v1.11.0", default-features = false } @@ -375,9 +376,7 @@ slices = "0.2.0" smallvec = "1.8.0" strum = { version = "0.24", default-features = false, features = ["derive"] } strum_macros = "0.24" -p256 = { version = "0.13.2", default-features = false, features = [ - "ecdsa", -] } +p256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] } # Other (client) diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 5c15b886fc..bb2a6f0fb8 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -461,10 +461,11 @@ where let executor = wasm_builder.build(); let (client, backend, keystore_container, task_manager) = - sc_service::new_full_parts::( + sc_service::new_full_parts_record_import::( config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, + true, )?; if let Some(block_number) = Customizations::first_block_number_compatible_with_ed25519_zebra() { diff --git a/runtime/moonbase/Cargo.toml b/runtime/moonbase/Cargo.toml index b12ede2a83..53c53d9a89 100644 --- a/runtime/moonbase/Cargo.toml +++ b/runtime/moonbase/Cargo.toml @@ -163,6 +163,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-timestamp = { workspace = true } cumulus-primitives-utility = { workspace = true } +cumulus-primitives-storage-weight-reclaim = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } @@ -212,6 +213,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", + "cumulus-primitives-storage-weight-reclaim/std", "evm-tracing-events/std", "fp-evm/std", "fp-rpc/std", @@ -262,7 +264,7 @@ std = [ "pallet-evm-precompile-xcm-utils/std", "pallet-evm-precompile-xtokens/std", "pallet-evm-precompileset-assets-erc20/std", - "pallet-evm-precompile-storage-cleaner/std", + "pallet-evm-precompile-storage-cleaner/std", "pallet-evm-precompile-p256verify/std", "pallet-evm/std", "pallet-identity/std", diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 0c62a31834..0415b76968 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -1475,6 +1475,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/runtime/moonbeam/Cargo.toml b/runtime/moonbeam/Cargo.toml index 77aedbefcb..de25099feb 100644 --- a/runtime/moonbeam/Cargo.toml +++ b/runtime/moonbeam/Cargo.toml @@ -158,6 +158,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-timestamp = { workspace = true } cumulus-primitives-utility = { workspace = true } +cumulus-primitives-storage-weight-reclaim = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } @@ -205,6 +206,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", + "cumulus-primitives-storage-weight-reclaim/std", "evm-tracing-events/std", "fp-evm/std", "fp-rpc/std", diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index d24e588e86..2d3d7b40c7 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -1524,6 +1524,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/runtime/moonriver/Cargo.toml b/runtime/moonriver/Cargo.toml index 6f7fd19d11..8a8d5d1631 100644 --- a/runtime/moonriver/Cargo.toml +++ b/runtime/moonriver/Cargo.toml @@ -159,6 +159,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-timestamp = { workspace = true } cumulus-primitives-utility = { workspace = true } +cumulus-primitives-storage-weight-reclaim = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } @@ -206,6 +207,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", + "cumulus-primitives-storage-weight-reclaim/std", "evm-tracing-events/std", "fp-evm/std", "fp-rpc/std", diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 07831d70a7..744c8070fb 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -1525,6 +1525,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/test/suites/dev/moonbase/test-fees/test-fee-multiplier-xcm.ts b/test/suites/dev/moonbase/test-fees/test-fee-multiplier-xcm.ts index 9cf586ae4f..a15cefb7c1 100644 --- a/test/suites/dev/moonbase/test-fees/test-fee-multiplier-xcm.ts +++ b/test/suites/dev/moonbase/test-fees/test-fee-multiplier-xcm.ts @@ -14,7 +14,7 @@ import { // export const TARGET_FILL_AMOUNT = // ((MAX_BLOCK_WEIGHT * 0.75 * 0.25 - EXTRINSIC_BASE_WEIGHT) / MAX_BLOCK_WEIGHT) * 1_000_000_000; // In 0.9.43 rootTesting::fillBlock() now uses more weight so we need to account for that -const TARGET_FILL_AMOUNT = 262_212_900; +const TARGET_FILL_AMOUNT = 262_349_350; // Note on the values from 'transactionPayment.nextFeeMultiplier': this storage item is actually a // FixedU128, which is basically a u128 with an implicit denominator of 10^18. However, this