Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 2 additions & 7 deletions runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions runtime/moonbase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![])
})
Expand Down Expand Up @@ -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![]);
})
Expand Down Expand Up @@ -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![]);
})
Expand Down Expand Up @@ -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![]);
})
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions runtime/moonbeam/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![])
})
Expand Down Expand Up @@ -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![]);
})
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions runtime/moonriver/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![])
})
Expand Down Expand Up @@ -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![]);
})
Expand Down
10 changes: 5 additions & 5 deletions tests/tests/test-xcm/test-mock-dmp-error-and-appendix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) },
},
},
],
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test-xcm/test-mock-dmp-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/test-xcm/test-mock-hrmp-asset-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -444,7 +444,7 @@ describeDevMoonbeam(
},
fun: { Fungible: transferredBalance },
},
weightLimit: { Limited: new BN(4000000000) },
weightLimit: { Limited: new BN(8000000000) },
},
},
{
Expand Down Expand Up @@ -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);
});
}
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/test-xcm/test-mock-hrmp-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions tests/tests/test-xcm/test-mock-hrmp-transact-ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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 },
},
],
},
Expand All @@ -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) },
},
},
{
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down