Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiply Erc20TransferGasLimit constant by 4 for moonbase #2768

Merged
merged 7 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/src/ERC20ExcessGas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describeSuite({
// weight
4_000_000n,
],
gas: 300_000n,
gas: 900_000n,
rawTxOnly: true,
});

Expand Down Expand Up @@ -235,12 +235,12 @@ 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: [
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,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describeSuite({
X1: { PalletInstance: Number(balancesPalletIndex) },
},
},
fungible: 1_000_000_000_000_000n,
fungible: 1_700_000_000_000_000n,
},
{
multilocation: {
Expand Down
2 changes: 1 addition & 1 deletion test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describeSuite({
X1: { PalletInstance: Number(balancesPalletIndex) },
},
},
fungible: 1_000_000_000_000_000n,
fungible: 1_100_000_000_000_000n,
},
{
multilocation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ describeSuite({
// Destination as multilocation
destination,
// weight
500_000n,
900_000n,
],
gas: 500_000n,
gas: 900_000n,
rawTxOnly: true,
});

Expand Down
Loading