diff --git a/runtime/moonbase/src/xcm_config.rs b/runtime/moonbase/src/xcm_config.rs index 647741d41f1..75bb5c9d9c9 100644 --- a/runtime/moonbase/src/xcm_config.rs +++ b/runtime/moonbase/src/xcm_config.rs @@ -211,12 +211,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( ); parameter_types! { - /// The amount of weight an XCM operation takes. This is safe overestimate. - /// We should increase this to a value close to what polkadot charges - /// We are charging less to make it work with current reserve_transfer_assets issue - /// TODO: Once fixed in polkadot v0.9.12, we should go back to 1_000_000_000 - /// https://github.com/paritytech/polkadot/pull/4144 - pub UnitWeightCost: Weight = 100_000_000; + pub UnitWeightCost: Weight = 200_000_000; /// Maximum number of instructions in a single XCM fragment. A sanity check against /// weight caculations getting too crazy. pub MaxInstructions: u32 = 100; @@ -444,7 +439,7 @@ where } parameter_types! { - pub const BaseXcmWeight: Weight = 100_000_000; + pub const BaseXcmWeight: Weight = 200_000_000; pub const MaxAssetsForTransfer: usize = 2; // This is how we are going to detect whether the asset is a Reserve asset // This however is the chain part only diff --git a/runtime/moonbase/tests/integration_test.rs b/runtime/moonbase/tests/integration_test.rs index d642b83659b..9de081f6199 100644 --- a/runtime/moonbase/tests/integration_test.rs +++ b/runtime/moonbase/tests/integration_test.rs @@ -1851,7 +1851,7 @@ fn xtokens_precompiles_transfer() { .write(U256::from(4000000)) .build(), ) - .expect_cost(12000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]) }) @@ -1903,7 +1903,7 @@ fn xtokens_precompiles_transfer_multiasset() { .write(U256::from(4000000)) .build(), ) - .expect_cost(12000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]); }) @@ -1945,7 +1945,7 @@ fn xtokens_precompiles_transfer_native() { .write(U256::from(4000000)) .build(), ) - .expect_cost(8000) + .expect_cost(16000) .expect_no_logs() .execute_returns(vec![]); }) @@ -1993,7 +1993,7 @@ fn xtokens_precompile_transfer_local_asset() { .write(U256::from(4000000)) .build(), ) - .expect_cost(8000) + .expect_cost(16000) .expect_no_logs() .execute_returns(vec![]); }) diff --git a/runtime/moonbeam/src/xcm_config.rs b/runtime/moonbeam/src/xcm_config.rs index 5104e424268..c14bbe6c67a 100644 --- a/runtime/moonbeam/src/xcm_config.rs +++ b/runtime/moonbeam/src/xcm_config.rs @@ -419,7 +419,7 @@ where } parameter_types! { - pub const BaseXcmWeight: Weight = 100_000_000; + pub const BaseXcmWeight: Weight = 200_000_000; pub const MaxAssetsForTransfer: usize = 2; // This is how we are going to detect whether the asset is a Reserve asset diff --git a/runtime/moonbeam/tests/integration_test.rs b/runtime/moonbeam/tests/integration_test.rs index 4c2b2236fd2..c8c08fab241 100644 --- a/runtime/moonbeam/tests/integration_test.rs +++ b/runtime/moonbeam/tests/integration_test.rs @@ -2202,7 +2202,7 @@ fn xtokens_precompiles_transfer() { .write(U256::from(4000000)) .build(), ) - .expect_cost(20000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]) }) @@ -2254,7 +2254,7 @@ fn xtokens_precompiles_transfer_multiasset() { .write(U256::from(4000000)) .build(), ) - .expect_cost(20000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]); }) diff --git a/runtime/moonriver/src/xcm_config.rs b/runtime/moonriver/src/xcm_config.rs index e0220df65b8..ffb14498a0e 100644 --- a/runtime/moonriver/src/xcm_config.rs +++ b/runtime/moonriver/src/xcm_config.rs @@ -432,7 +432,7 @@ where } parameter_types! { - pub const BaseXcmWeight: Weight = 100_000_000; + pub const BaseXcmWeight: Weight = 200_000_000; pub const MaxAssetsForTransfer: usize = 2; // This is how we are going to detect whether the asset is a Reserve asset diff --git a/runtime/moonriver/tests/integration_test.rs b/runtime/moonriver/tests/integration_test.rs index f73f9b48904..c00193f1bf1 100644 --- a/runtime/moonriver/tests/integration_test.rs +++ b/runtime/moonriver/tests/integration_test.rs @@ -2186,7 +2186,7 @@ fn xtokens_precompiles_transfer() { .write(U256::from(4000000)) .build(), ) - .expect_cost(20000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]) }) @@ -2238,7 +2238,7 @@ fn xtokens_precompiles_transfer_multiasset() { .write(U256::from(4000000)) .build(), ) - .expect_cost(20000) + .expect_cost(24000) .expect_no_logs() .execute_returns(vec![]); }) diff --git a/tests/tests/test-xcm/test-mock-dmp-error-and-appendix.ts b/tests/tests/test-xcm/test-mock-dmp-error-and-appendix.ts index 2e1cb73dffa..c9ee2e63915 100644 --- a/tests/tests/test-xcm/test-mock-dmp-error-and-appendix.ts +++ b/tests/tests/test-xcm/test-mock-dmp-error-and-appendix.ts @@ -165,7 +165,7 @@ describeDevMoonbeam("Mock XCM - downward transfer with triggered error handler", }, fun: { Fungible: 10n * RELAY_TOKEN }, }, - weightLimit: { Limited: new BN(500000000) }, + weightLimit: { Limited: new BN(1000000000) }, }, }, // Set an error handler that fires if there is any error during the execution @@ -265,7 +265,7 @@ describeDevMoonbeam("Mock XCM - downward transfer with always triggered appendix }, fun: { Fungible: 10n * RELAY_TOKEN }, }, - weightLimit: { Limited: new BN(400000000) }, + weightLimit: { Limited: new BN(800000000) }, }, }, // Set an appendix to be executed after the XCM message is executed. No matter if errors @@ -361,7 +361,7 @@ describeDevMoonbeam("Mock XCM - downward transfer with always triggered appendix }, fun: { Fungible: 10n * RELAY_TOKEN }, }, - weightLimit: { Limited: new BN(500000000) }, + weightLimit: { Limited: new BN(1000000000) }, }, }, // Set an appendix to be executed after the XCM message is executed. No matter if errors @@ -462,7 +462,7 @@ describeDevMoonbeam("Mock XCM - downward transfer claim trapped assets", (contex }, fun: { Fungible: 10n * RELAY_TOKEN }, }, - weightLimit: { Limited: new BN(200000000) }, + weightLimit: { Limited: new BN(400000000) }, }, }, ], @@ -533,7 +533,7 @@ describeDevMoonbeam("Mock XCM - downward transfer claim trapped assets", (contex }, fun: { Fungible: 10n * RELAY_TOKEN }, }, - weightLimit: { Limited: new BN(300000000) }, + weightLimit: { Limited: new BN(600000000) }, }, }, // Deposit assets, this time correctly, on Alith diff --git a/tests/tests/test-xcm/test-mock-dmp-queue.ts b/tests/tests/test-xcm/test-mock-dmp-queue.ts index 4b209e5e41c..eedcece9b8b 100644 --- a/tests/tests/test-xcm/test-mock-dmp-queue.ts +++ b/tests/tests/test-xcm/test-mock-dmp-queue.ts @@ -24,7 +24,7 @@ describeDevMoonbeam("Mock XCMP - test XCMP execution", (context) => { // we want half of numParaMsgs to be executed. That give us how much each message weights const weightPerMessage = (totalDmpWeight * BigInt(2)) / BigInt(numMsgs); - const weightPerXcmInst = 100_000_000n; + const weightPerXcmInst = 200_000_000n; // Now we need to construct the message. This needs to: // - pass barrier (withdraw + clearOrigin*n buyExecution) // - fail in buyExecution, so that the previous instruction weights are counted diff --git a/tests/tests/test-xcm/test-mock-hrmp-asset-transfer.ts b/tests/tests/test-xcm/test-mock-hrmp-asset-transfer.ts index 46b65ebbc4b..b2b0e2e9e67 100644 --- a/tests/tests/test-xcm/test-mock-hrmp-asset-transfer.ts +++ b/tests/tests/test-xcm/test-mock-hrmp-asset-transfer.ts @@ -408,8 +408,8 @@ describeDevMoonbeam( ).index; // We are charging 100_000_000 weight for every XCM instruction // We are executing 4 instructions - // 100_000_000 * 4 * 50000 = 20000000000000 - // We are charging 20 micro DEV for this operation + // 200_000_000 * 4 * 50000 = 40000000000000 + // We are charging 40 micro DEV for this operation // The rest should be going to the deposit account let xcmMessage = { V2: [ @@ -444,7 +444,7 @@ describeDevMoonbeam( }, fun: { Fungible: transferredBalance }, }, - weightLimit: { Limited: new BN(4000000000) }, + weightLimit: { Limited: new BN(8000000000) }, }, }, { @@ -478,7 +478,7 @@ describeDevMoonbeam( let randomBalance = ( (await context.polkadotApi.query.system.account(random.address)) as any ).data.free.toBigInt(); - let expectedRandomBalance = 80000000000000n; + let expectedRandomBalance = 60000000000000n; expect(randomBalance).to.eq(expectedRandomBalance); }); } diff --git a/tests/tests/test-xcm/test-mock-hrmp-queue.ts b/tests/tests/test-xcm/test-mock-hrmp-queue.ts index 7381dde0e80..794fe58c722 100644 --- a/tests/tests/test-xcm/test-mock-hrmp-queue.ts +++ b/tests/tests/test-xcm/test-mock-hrmp-queue.ts @@ -113,7 +113,7 @@ describeDevMoonbeam("Mock XCMP - test XCMP execution", (context) => { // we want half of numParaMsgs to be executed. That give us how much each message weights const weightPerMessage = (totalXcmpWeight * BigInt(2)) / BigInt(numParaMsgs); - const weightPerXcmInst = 100_000_000n; + const weightPerXcmInst = 200_000_000n; // Now we need to construct the message. This needs to: // - pass barrier (withdraw + clearOrigin*n buyExecution) // - fail in buyExecution, so that the previous instruction weights are counted @@ -191,7 +191,7 @@ describeDevMoonbeam("Mock XCMP - test XCMP execution", (context) => { await context.createBlock(); // all the withdraws + clear origins `buyExecution - const weightUsePerMessage = (clearOriginsPerMessage + 2n) * 100_000_000n; + const weightUsePerMessage = (clearOriginsPerMessage + 2n) * weightPerXcmInst; const result = await calculateShufflingAndExecution( context, @@ -253,7 +253,7 @@ describeDevMoonbeam("Mock XCMP - test XCMP execution", (context) => { // we want half of numParaMsgs to be executed. That give us how much each message weights const weightPerMessage = (totalXcmpWeight * BigInt(2)) / BigInt(numParaMsgs); - const weightPerXcmInst = 100_000_000n; + const weightPerXcmInst = 200_000_000n; // Now we need to construct the message. This needs to: // - pass barrier (withdraw + clearOrigin*n buyExecution) // - fail in buyExecution, so that the previous instruction weights are counted @@ -335,7 +335,7 @@ describeDevMoonbeam("Mock XCMP - test XCMP execution", (context) => { await context.createBlock(); // all the withdraws + clear origins `buyExecution - const weightUsePerMessage = (clearOriginsPerMessage + 2n) * 100_000_000n; + const weightUsePerMessage = (clearOriginsPerMessage + 2n) * weightPerXcmInst; // in this case, we have some that will execute on_initialize // some that will fail the execution diff --git a/tests/tests/test-xcm/test-mock-hrmp-transact-ethereum.ts b/tests/tests/test-xcm/test-mock-hrmp-transact-ethereum.ts index fd82ef76f7c..a76ad616f38 100644 --- a/tests/tests/test-xcm/test-mock-hrmp-transact-ethereum.ts +++ b/tests/tests/test-xcm/test-mock-hrmp-transact-ethereum.ts @@ -87,7 +87,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (transfer)" let expectedTransferredAmount = 0n; let expectedTransferredAmountPlusFees = 0n; - const targetXcmWeight = 925_000_000n; + const targetXcmWeight = 1_325_000_000n; const targetXcmFee = targetXcmWeight * 50_000n; for (const xcmTransaction of xcmTransactions) { @@ -352,7 +352,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (asset fee) let random: KeyringPair; let contractDeployed; - const assetsToTransfer = 2_900_000_000n * 2n; + const assetsToTransfer = 3_300_000_000n * 2n; before("should Register an asset and set unit per sec", async function () { const { contract, rawTx } = await createContract(context, "Incrementor"); @@ -386,7 +386,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (asset fee) id: { Concrete: ASSET_MULTILOCATION, }, - fun: { Fungible: assetsToTransfer + 400_000_000n }, + fun: { Fungible: assetsToTransfer + 800_000_000n }, }, ], }, @@ -397,9 +397,9 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (asset fee) id: { Concrete: ASSET_MULTILOCATION, }, - fun: { Fungible: assetsToTransfer + 400_000_000n }, + fun: { Fungible: assetsToTransfer + 800_000_000n }, }, - weightLimit: { Limited: new BN(400_000_000) }, + weightLimit: { Limited: new BN(800_000_000) }, }, }, { @@ -605,7 +605,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (proxy)", ( let feeAmount = 0n; - const targetXcmWeight = 925_000_000n; + const targetXcmWeight = 1_325_000_000n; const targetXcmFee = targetXcmWeight * 50_000n; for (const xcmTransaction of xcmTransactions) { @@ -770,7 +770,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (proxy)", ( let feeAmount = 0n; - const targetXcmWeight = 925_000_000n; + const targetXcmWeight = 1_325_000_000n; const targetXcmFee = targetXcmWeight * 50_000n; for (const xcmTransaction of xcmTransactions) { @@ -950,7 +950,7 @@ describeDevMoonbeam("Mock XCM - receive horizontal transact ETHEREUM (proxy)", ( let expectedTransferredAmount = 0n; let expectedTransferredAmountPlusFees = 0n; - const targetXcmWeight = 925_000_000n; + const targetXcmWeight = 1_325_000_000n; const targetXcmFee = targetXcmWeight * 50_000n; for (const xcmTransaction of xcmTransactions) {