From 7ba80f760fc8a4a5ca307b3b54a0b8f6bdaf5c64 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 18 Apr 2024 18:01:59 +0100 Subject: [PATCH 1/7] multiply Erc20TransferGasLimit constant by 4 in moonbase --- runtime/moonbase/src/lib.rs | 1 + runtime/moonbase/src/xcm_config.rs | 2 +- runtime/moonbeam/src/lib.rs | 1 + runtime/moonriver/src/lib.rs | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 82bc4122c1..9e2c467ad3 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -426,6 +426,7 @@ parameter_types! { /// ceil( /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS /// ) + /// We should re-check `xcm_config::Erc20XcmBridgeTransferGasLimit` when changing this value pub const GasLimitPovSizeRatio: u64 = 16; /// The amount of gas per storage (in bytes): BLOCK_GAS_LIMIT / BLOCK_STORAGE_LIMIT /// (60_000_000 / 160 kb) diff --git a/runtime/moonbase/src/xcm_config.rs b/runtime/moonbase/src/xcm_config.rs index bd05759a21..17c2ccc65c 100644 --- a/runtime/moonbase/src/xcm_config.rs +++ b/runtime/moonbase/src/xcm_config.rs @@ -691,7 +691,7 @@ parameter_types! { // To be able to support almost all erc20 implementations, // we provide a sufficiently hight gas limit. - pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000; + pub Erc20XcmBridgeTransferGasLimit: u64 = 800_000; } impl pallet_erc20_xcm_bridge::Config for Runtime { diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index 04baa84fc3..0cef23f7b2 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -410,6 +410,7 @@ parameter_types! { /// ceil( /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS /// ) + /// We should re-check `xcm_config::Erc20XcmBridgeTransferGasLimit` when changing this value pub const GasLimitPovSizeRatio: u64 = 4; /// The amount of gas per storage (in bytes): BLOCK_GAS_LIMIT / BLOCK_STORAGE_LIMIT /// The current definition of BLOCK_STORAGE_LIMIT is 40 KB, resulting in a value of 366. diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 5efbf504eb..baebdf84cf 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -411,6 +411,7 @@ parameter_types! { /// ceil( /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS /// ) + /// We should re-check `xcm_config::Erc20XcmBridgeTransferGasLimit` when changing this value pub const GasLimitPovSizeRatio: u64 = 4; /// The amount of gas per storage (in bytes): BLOCK_GAS_LIMIT / BLOCK_STORAGE_LIMIT /// The current definition of BLOCK_STORAGE_LIMIT is 40 KB, resulting in a value of 366. From 648c1183cc1043ff6a55c067a005d017d709033e Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 18 Apr 2024 21:10:53 +0100 Subject: [PATCH 2/7] fix test-xcm-erc20-v3-filter and test-xcm-erc20-fees-and-trap tests --- .../dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts | 2 +- .../suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts index 1057caa492..0e87e1e611 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts @@ -175,7 +175,7 @@ describeSuite({ }) ).equals(amountTransferred); - const feeAssetAmount = 1_000_000_000_000_000n; + const feeAssetAmount = 1_100_000_000_000_000n; // Create xcm message to send ERC20 tokens to Charleth const config: XcmFragmentConfig = { diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts index 676b466338..1e7875f263 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts @@ -83,7 +83,7 @@ describeSuite({ X1: { PalletInstance: Number(balancesPalletIndex) }, }, }, - fungible: 1_000_000_000_000_000n, + fungible: 1_700_000_000_000_000n, }, { multilocation: { From 57da05f0f0c682492a2b036b0cfc79f3d80f5a85 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 18 Apr 2024 21:15:34 +0100 Subject: [PATCH 3/7] fix test test-xcm-erc20-transfer --- .../dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts index 015c192642..01eacd6993 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts @@ -61,9 +61,9 @@ describeSuite({ // Destination as multilocation destination, // weight - 500_000n, + 900_000n, ], - gas: 500_000n, + gas: 900_000n, rawTxOnly: true, }); From 63442b36d818dc45496442907e83fca835b5234e Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 18 Apr 2024 21:17:48 +0100 Subject: [PATCH 4/7] fix test test-xcm-erc20-v3 --- test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts index f35905ce6c..2628603c20 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts @@ -83,7 +83,7 @@ describeSuite({ X1: { PalletInstance: Number(balancesPalletIndex) }, }, }, - fungible: 1_000_000_000_000_000n, + fungible: 1_100_000_000_000_000n, }, { multilocation: { From 8aba91e23a5bf83aec2490f2d2cf25eb5ef0050d Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 18 Apr 2024 13:39:55 -0700 Subject: [PATCH 5/7] fix test-xcm-erc20-excess-gas.ts --- test/contracts/src/ERC20ExcessGas.sol | 2 +- .../dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/contracts/src/ERC20ExcessGas.sol b/test/contracts/src/ERC20ExcessGas.sol index f8cd5aa74a..73a5d0e8bb 100644 --- a/test/contracts/src/ERC20ExcessGas.sol +++ b/test/contracts/src/ERC20ExcessGas.sol @@ -18,7 +18,7 @@ contract ERC20ExcessGas is ERC20WithInitialSupply { uint256 amount ) public override returns (bool) { // Consume gas to over Erc20XcmBridgeTransferGasLimit - for (uint i = 0; i < 500; i++) { + for (uint i = 0; i < 2000; i++) { _gasHog += i; } diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts index 3c95fc41c3..b407173e87 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts @@ -63,7 +63,7 @@ describeSuite({ // weight 4_000_000n, ], - gas: 300_000n, + gas: 900_000n, rawTxOnly: true, }); @@ -239,8 +239,8 @@ describeSuite({ { GeneralKey: { data: [ - 103, 97, 115, 95, 108, 105, 109, 105, 116, 58, 224, 147, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 103, 97, 115, 95, 108, 105, 109, 105, 116, 58, 160, 187, 13, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], length: 32, }, From de8c1723116d21a4cfb449e8da7061a5590578c7 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 18 Apr 2024 13:41:47 -0700 Subject: [PATCH 6/7] fix comment in test --- .../dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts index b407173e87..4d5eb2f09c 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts @@ -235,7 +235,7 @@ describeSuite({ }, }, // Override default gas limit with optional GeneralKey. - // b'gas_limit:' + 300000(little endian) + zeros padding + // b'gas_limit:' + 900000(little endian) + zeros padding { GeneralKey: { data: [ From 0fc3437dabc7a2dd2f8af84752ffa2e7828e3b66 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 18 Apr 2024 14:02:16 -0700 Subject: [PATCH 7/7] fix tracing test --- test/suites/tracing-tests/test-trace-erc20-xcm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/tracing-tests/test-trace-erc20-xcm.ts b/test/suites/tracing-tests/test-trace-erc20-xcm.ts index 777baca63e..2125434ec4 100644 --- a/test/suites/tracing-tests/test-trace-erc20-xcm.ts +++ b/test/suites/tracing-tests/test-trace-erc20-xcm.ts @@ -74,7 +74,7 @@ describeSuite({ X1: { PalletInstance: Number(balancesPalletIndex) }, }, }, - fungible: 1_000_000_000_000_000n, + fungible: 1_700_000_000_000_000n, }, { multilocation: {