diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index e961f1aa009..5bcef870c4c 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -47,8 +47,8 @@ use frame_support::{ }, weights::{ constants::{RocksDbWeight, WEIGHT_PER_SECOND}, - DispatchClass, GetDispatchInfo, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, + ConstantMultiplier, DispatchClass, GetDispatchInfo, Weight, WeightToFeeCoefficient, + WeightToFeeCoefficients, WeightToFeePolynomial, }, PalletId, }; @@ -300,28 +300,6 @@ where } } -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - /// Return a vec of coefficients. Here we just use one coefficient and reduce it to a constant - /// modifier in order to closely match Ethereum-based fees. - /// - /// Calculation, per the documentation in `frame_support`: - /// - /// ```ignore - /// coeff_integer * x^(degree) + coeff_frac * x^(degree) - /// ``` - fn polynomial() -> WeightToFeeCoefficients { - smallvec![WeightToFeeCoefficient { - degree: 1, - coeff_frac: Perbill::zero(), - coeff_integer: currency::WEIGHT_FEE, - negative: false, - }] - } -} - pub struct LengthToFee; impl WeightToFeePolynomial for LengthToFee { type Balance = Balance; @@ -337,7 +315,7 @@ impl WeightToFeePolynomial for LengthToFee { WeightToFeeCoefficient { degree: 3, coeff_frac: Perbill::zero(), - coeff_integer: 1, + coeff_integer: 1 * currency::SUPPLY_FACTOR, negative: false, }, ] @@ -347,7 +325,7 @@ impl WeightToFeePolynomial for LengthToFee { impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; - type WeightToFee = WeightToFee; + type WeightToFee = ConstantMultiplier>; type LengthToFee = LengthToFee; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } diff --git a/runtime/moonbase/src/xcm_config.rs b/runtime/moonbase/src/xcm_config.rs index 97335ed850a..8ba1a0986b9 100644 --- a/runtime/moonbase/src/xcm_config.rs +++ b/runtime/moonbase/src/xcm_config.rs @@ -19,8 +19,8 @@ use super::{ AccountId, AssetId, AssetManager, Assets, Balance, Balances, Call, DealWithFees, Event, - LocalAssets, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, Treasury, - WeightToFee, XcmpQueue, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, + LocalAssets, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, Treasury, XcmpQueue, + FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, }; use pallet_evm_precompile_assets_erc20::AccountIdAssetIdConversion; @@ -272,7 +272,13 @@ impl xcm_executor::Config for XcmExecutorConfig { // When we receive a non-reserve asset, we use AssetManager to fetch how many // units per second we should charge type Trader = ( - UsingComponents>, + UsingComponents< + ::WeightToFee, + SelfReserve, + AccountId, + Balances, + DealWithFees, + >, FirstAssetTrader, ); type ResponseHandler = PolkadotXcm; diff --git a/runtime/moonbase/tests/integration_test.rs b/runtime/moonbase/tests/integration_test.rs index 68cf3991fb0..5a1b39dd4d5 100644 --- a/runtime/moonbase/tests/integration_test.rs +++ b/runtime/moonbase/tests/integration_test.rs @@ -1919,23 +1919,6 @@ where fn length_fee_is_sensible() { use sp_runtime::testing::TestXt; - ExtBuilder::default() - .with_balances(vec![ - (AccountId::from(ALICE), (1 * UNIT) + (1 * WEI)), - (AccountId::from(BOB), 0), - ]) - .build() - .execute_with(|| { - // Substrate transfer - assert_ok!(Balances::transfer( - origin_of(AccountId::from(ALICE)), - AccountId::from(BOB), - 1 * UNIT, - )); - // 1 WEI is left in the account - assert_eq!(Balances::free_balance(AccountId::from(ALICE)), 1 * WEI); - }); - // tests that length fee is sensible for a few hypothetical transactions ExtBuilder::default().build().execute_with(|| { let call = frame_system::Call::remark:: { remark: vec![] }; diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index fad2fe773fb..51d74def2a3 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -47,7 +47,8 @@ use frame_support::{ }, weights::{ constants::{RocksDbWeight, WEIGHT_PER_SECOND}, - ConstantMultiplier, DispatchClass, GetDispatchInfo, IdentityFee, Weight, + ConstantMultiplier, DispatchClass, GetDispatchInfo, Weight, WeightToFeeCoefficient, + WeightToFeeCoefficients, WeightToFeePolynomial, }, PalletId, }; @@ -68,6 +69,7 @@ use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustm pub use parachain_staking::{InflationInfo, Range}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +use smallvec::smallvec; use sp_api::impl_runtime_apis; use sp_core::{OpaqueMetadata, H160, H256, U256}; use sp_runtime::{ @@ -122,7 +124,7 @@ pub mod currency { pub const GLMR: Balance = 1_000_000_000_000_000_000; pub const KILOGLMR: Balance = 1_000_000_000_000_000_000_000; - pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROGLMR * SUPPLY_FACTOR; + pub const TRANSACTION_BYTE_FEE: Balance = 1 * GIGAWEI * SUPPLY_FACTOR; pub const STORAGE_BYTE_FEE: Balance = 100 * MICROGLMR * SUPPLY_FACTOR; pub const WEIGHT_FEE: Balance = 100 * KILOWEI * SUPPLY_FACTOR; @@ -294,15 +296,33 @@ where } } -parameter_types! { - pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE; +pub struct LengthToFee; +impl WeightToFeePolynomial for LengthToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + smallvec![ + WeightToFeeCoefficient { + degree: 1, + coeff_frac: Perbill::zero(), + coeff_integer: currency::TRANSACTION_BYTE_FEE, + negative: false, + }, + WeightToFeeCoefficient { + degree: 3, + coeff_frac: Perbill::zero(), + coeff_integer: 1 * currency::SUPPLY_FACTOR, + negative: false, + }, + ] + } } impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; - type WeightToFee = IdentityFee; - type LengthToFee = ConstantMultiplier; + type WeightToFee = ConstantMultiplier>; + type LengthToFee = LengthToFee; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } @@ -1319,7 +1339,7 @@ mod tests { assert_eq!(SUPPLY_FACTOR, 100); // txn fees - assert_eq!(TRANSACTION_BYTE_FEE, Balance::from(1 * MILLIGLMR)); + assert_eq!(TRANSACTION_BYTE_FEE, Balance::from(100 * GIGAWEI)); assert_eq!( get!(pallet_transaction_payment, OperationalFeeMultiplier, u8), 5_u8 diff --git a/runtime/moonbeam/src/xcm_config.rs b/runtime/moonbeam/src/xcm_config.rs index 09323559d10..b698b7df1c9 100644 --- a/runtime/moonbeam/src/xcm_config.rs +++ b/runtime/moonbeam/src/xcm_config.rs @@ -29,7 +29,7 @@ use sp_runtime::traits::Hash as THash; use frame_support::{ parameter_types, traits::{Everything, Nothing, PalletInfoAccess}, - weights::{IdentityFee, Weight}, + weights::Weight, }; use frame_system::EnsureRoot; @@ -261,7 +261,7 @@ impl xcm_executor::Config for XcmExecutorConfig { // units per second we should charge type Trader = ( UsingComponents< - IdentityFee, + ::WeightToFee, SelfReserve, AccountId, Balances, diff --git a/runtime/moonbeam/tests/integration_test.rs b/runtime/moonbeam/tests/integration_test.rs index 6ed9c3d970f..2d708009f3e 100644 --- a/runtime/moonbeam/tests/integration_test.rs +++ b/runtime/moonbeam/tests/integration_test.rs @@ -1055,6 +1055,41 @@ where }); } +#[test] +#[rustfmt::skip] +fn length_fee_is_sensible() { + use sp_runtime::testing::TestXt; + + // tests that length fee is sensible for a few hypothetical transactions + ExtBuilder::default().build().execute_with(|| { + let call = frame_system::Call::remark:: { remark: vec![] }; + let uxt: TestXt<_, ()> = TestXt::new(call, Some((1u64, ()))); + + let calc_fee = |len: u32| -> Balance { + moonbeam_runtime::TransactionPayment::query_fee_details(uxt.clone(), len) + .inclusion_fee + .expect("fee should be calculated") + .len_fee + }; + + // editorconfig-checker-disable + // left: cost of length fee, right: size in bytes + // /------------- proportional component: O(N * 1B) + // | /- exponential component: O(N ** 3) + // | | + assert_eq!( 100_000_000_100, calc_fee(1)); + assert_eq!( 1_000_000_100_000, calc_fee(10)); + assert_eq!( 10_000_100_000_000, calc_fee(100)); + assert_eq!( 100_100_000_000_000, calc_fee(1_000)); + assert_eq!( 1_100_000_000_000_000, calc_fee(10_000)); // inflection point + assert_eq!( 110_000_000_000_000_000, calc_fee(100_000)); + assert_eq!( 100_100_000_000_000_000_000, calc_fee(1_000_000)); // 100 GLMR, ~ 1MB + assert_eq!( 100_001_000_000_000_000_000_000, calc_fee(10_000_000)); + assert_eq!(100_000_010_000_000_000_000_000_000, calc_fee(100_000_000)); + // editorconfig-checker-enable + }); +} + #[test] fn multiplier_can_grow_from_zero() { let minimum_multiplier = moonbeam_runtime::MinimumMultiplier::get(); diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 026e6bc81e4..9e083cec827 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -47,8 +47,8 @@ use frame_support::{ }, weights::{ constants::{RocksDbWeight, WEIGHT_PER_SECOND}, - ConstantMultiplier, DispatchClass, GetDispatchInfo, IdentityFee, Weight, - WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, + ConstantMultiplier, DispatchClass, GetDispatchInfo, Weight, WeightToFeeCoefficient, + WeightToFeeCoefficients, WeightToFeePolynomial, }, PalletId, }; @@ -123,7 +123,7 @@ pub mod currency { pub const MOVR: Balance = 1_000_000_000_000_000_000; pub const KILOMOVR: Balance = 1_000_000_000_000_000_000_000; - pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROMOVR * SUPPLY_FACTOR; + pub const TRANSACTION_BYTE_FEE: Balance = 1 * GIGAWEI * SUPPLY_FACTOR; pub const STORAGE_BYTE_FEE: Balance = 100 * MICROMOVR * SUPPLY_FACTOR; pub const WEIGHT_FEE: Balance = 100 * KILOWEI * SUPPLY_FACTOR; @@ -294,37 +294,33 @@ where } } -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { +pub struct LengthToFee; +impl WeightToFeePolynomial for LengthToFee { type Balance = Balance; - /// Return a vec of coefficients. Here we just use one coefficient and reduce it to a constant - /// modifier in order to closely match Ethereum-based fees. - /// - /// Calculation, per the documentation in `frame_support`: - /// - /// ```ignore - /// coeff_integer * x^(degree) + coeff_frac * x^(degree) - /// ``` fn polynomial() -> WeightToFeeCoefficients { - smallvec![WeightToFeeCoefficient { - degree: 1, - coeff_frac: Perbill::zero(), - coeff_integer: currency::WEIGHT_FEE, - negative: false, - }] + smallvec![ + WeightToFeeCoefficient { + degree: 1, + coeff_frac: Perbill::zero(), + coeff_integer: currency::TRANSACTION_BYTE_FEE, + negative: false, + }, + WeightToFeeCoefficient { + degree: 3, + coeff_frac: Perbill::zero(), + coeff_integer: 1 * currency::SUPPLY_FACTOR, + negative: false, + }, + ] } } -parameter_types! { - pub const TransactionByteFee: Balance = currency::TRANSACTION_BYTE_FEE; -} - impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; - type WeightToFee = IdentityFee; - type LengthToFee = ConstantMultiplier; + type WeightToFee = ConstantMultiplier>; + type LengthToFee = LengthToFee; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } @@ -1348,7 +1344,7 @@ mod tests { assert_eq!(SUPPLY_FACTOR, 1); // txn fees - assert_eq!(TRANSACTION_BYTE_FEE, Balance::from(10 * MICROMOVR)); + assert_eq!(TRANSACTION_BYTE_FEE, Balance::from(1 * GIGAWEI)); assert_eq!( get!(pallet_transaction_payment, OperationalFeeMultiplier, u8), 5_u8 diff --git a/runtime/moonriver/src/xcm_config.rs b/runtime/moonriver/src/xcm_config.rs index b60c0dc4a2d..b973a8b399e 100644 --- a/runtime/moonriver/src/xcm_config.rs +++ b/runtime/moonriver/src/xcm_config.rs @@ -19,8 +19,8 @@ use super::{ AccountId, AssetId, AssetManager, Assets, Balance, Balances, Call, DealWithFees, Event, - LocalAssets, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, Treasury, - WeightToFee, XcmpQueue, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, + LocalAssets, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, Treasury, XcmpQueue, + FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, }; use pallet_evm_precompile_assets_erc20::AccountIdAssetIdConversion; @@ -267,7 +267,13 @@ impl xcm_executor::Config for XcmExecutorConfig { // When we receive a non-reserve asset, we use AssetManager to fetch how many // units per second we should charge type Trader = ( - UsingComponents>, + UsingComponents< + ::WeightToFee, + SelfReserve, + AccountId, + Balances, + DealWithFees, + >, FirstAssetTrader, ); type ResponseHandler = PolkadotXcm; diff --git a/runtime/moonriver/tests/integration_test.rs b/runtime/moonriver/tests/integration_test.rs index b678a04cf91..b1b21c7ffd1 100644 --- a/runtime/moonriver/tests/integration_test.rs +++ b/runtime/moonriver/tests/integration_test.rs @@ -1042,6 +1042,41 @@ where }); } +#[test] +#[rustfmt::skip] +fn length_fee_is_sensible() { + use sp_runtime::testing::TestXt; + + // tests that length fee is sensible for a few hypothetical transactions + ExtBuilder::default().build().execute_with(|| { + let call = frame_system::Call::remark:: { remark: vec![] }; + let uxt: TestXt<_, ()> = TestXt::new(call, Some((1u64, ()))); + + let calc_fee = |len: u32| -> Balance { + moonriver_runtime::TransactionPayment::query_fee_details(uxt.clone(), len) + .inclusion_fee + .expect("fee should be calculated") + .len_fee + }; + + // editorconfig-checker-disable + // left: cost of length fee, right: size in bytes + // /------------- proportional component: O(N * 1B) + // | /- exponential component: O(N ** 3) + // | | + assert_eq!( 1_000_000_001, calc_fee(1)); + assert_eq!( 10_000_001_000, calc_fee(10)); + assert_eq!( 100_001_000_000, calc_fee(100)); + assert_eq!( 1_001_000_000_000, calc_fee(1_000)); + assert_eq!( 11_000_000_000_000, calc_fee(10_000)); // inflection point + assert_eq!( 1_100_000_000_000_000, calc_fee(100_000)); + assert_eq!( 1_001_000_000_000_000_000, calc_fee(1_000_000)); // one MOVR, ~ 1MB + assert_eq!( 1_000_010_000_000_000_000_000, calc_fee(10_000_000)); + assert_eq!(1_000_000_100_000_000_000_000_000, calc_fee(100_000_000)); + // editorconfig-checker-enable + }); +} + #[test] fn multiplier_can_grow_from_zero() { let minimum_multiplier = moonriver_runtime::MinimumMultiplier::get(); diff --git a/tests/tests/test-assets/test-assets-sufficients.ts b/tests/tests/test-assets/test-assets-sufficients.ts index b09ac26db9c..70c89c0bd8b 100644 --- a/tests/tests/test-assets/test-assets-sufficients.ts +++ b/tests/tests/test-assets/test-assets-sufficients.ts @@ -144,6 +144,7 @@ describeDevMoonbeam( }); }, "Legacy", + "moonbase", true ); @@ -267,6 +268,7 @@ describeDevMoonbeam( }); }, "Legacy", + "moonbase", true ); @@ -407,5 +409,6 @@ describeDevMoonbeam( }); }, "Legacy", + "moonbase", true ); diff --git a/tests/tests/test-eth-tx/test-eth-tx-types.ts b/tests/tests/test-eth-tx/test-eth-tx-types.ts index 58b160e24f1..b184b866818 100644 --- a/tests/tests/test-eth-tx/test-eth-tx-types.ts +++ b/tests/tests/test-eth-tx/test-eth-tx-types.ts @@ -30,6 +30,7 @@ describeDevMoonbeam( }); }, "Legacy", + "moonbase", false ); @@ -76,6 +77,7 @@ describeDevMoonbeam( }); }, "EIP2930", + "moonbase", false ); @@ -123,5 +125,6 @@ describeDevMoonbeam( }); }, "EIP1559", + "moonbase", false ); diff --git a/tests/tests/test-fees/test-length-fees.ts b/tests/tests/test-fees/test-length-fees.ts new file mode 100644 index 00000000000..0741facf58a --- /dev/null +++ b/tests/tests/test-fees/test-length-fees.ts @@ -0,0 +1,121 @@ +import "@moonbeam-network/api-augment"; +import { expect } from "chai"; +import { TREASURY_ACCOUNT } from "../../util/constants"; +import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { createTransfer } from "../../util/transactions"; +import { baltathar } from "../../util/accounts"; + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonbase)", + (context) => { + it("should have low balance transfer fees", async () => { + const fee = await testBalanceTransfer(context); + expect(fee).to.equal(14_325_001_520_875n); + }); + }, + "Legacy", + "moonbase" +); + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonbase)", + (context) => { + it("should have expensive runtime-upgrade fees", async () => { + const fee = await testRuntimeUpgrade(context); + expect(fee).to.equal(9_226_795_065_723_667_008n); + }); + }, + "Legacy", + "moonbase" +); + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonriver)", + (context) => { + it("should have low balance transfer fees", async () => { + const fee = await testBalanceTransfer(context); + expect(fee).to.equal(28_535_001_520_875n); + }); + }, + "Legacy", + "moonriver" +); + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonriver)", + (context) => { + it("should have expensive runtime-upgrade fees", async () => { + const fee = await testRuntimeUpgrade(context); + expect(fee).to.equal(9_226_801_365_723_667_008n); + }); + }, + "Legacy", + "moonriver" +); + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonbeam)", + (context) => { + it("should have low balance transfer fees", async () => { + const fee = await testBalanceTransfer(context); + expect(fee).to.equal(2_853_500_152_087_500n); + }); + }, + "Legacy", + "moonbeam" +); + +describeDevMoonbeam( + "Substrate Length Fees - Transaction (Moonbeam)", + (context) => { + it("should have expensive runtime-upgrade fees", async () => { + const fee = await testRuntimeUpgrade(context); + expect(fee).to.equal(922_680_136_572_366_700_800n); + }); + }, + "Legacy", + "moonbeam" +); + +// define our tests here so we can DRY. +// each test submits some txn then measures and returns the fees charged. + +const testBalanceTransfer = async (context) => { + let initialBalance = ( + await context.polkadotApi.query.system.account(baltathar.address) + ).data.free.toBigInt(); + + // send a balance transfer to self and see what our fees end up being + await context.createBlock( + context.polkadotApi.tx.balances.transfer(baltathar.address, 1).signAsync(baltathar) + ); + + let afterBalance = ( + await context.polkadotApi.query.system.account(baltathar.address) + ).data.free.toBigInt(); + + const fee = initialBalance - afterBalance; + return fee; +}; + +const testRuntimeUpgrade = async (context) => { + const initialBalance = ( + await context.polkadotApi.query.system.account(baltathar.address) + ).data.free.toBigInt(); + + // generate a mock runtime upgrade hex string + let size = 4194304; // 2MB bytes represented in hex + let hex = "0x" + "F".repeat(size); + + // send an enactAuthorizedUpgrade. we expect this to fail, but we just want to see that it was + // included in a block (not rejected) and was charged based on its length + await context.polkadotApi.tx.parachainSystem.enactAuthorizedUpgrade(hex).signAndSend(baltathar); + await context.createBlock(); + + let afterBalance = ( + await context.polkadotApi.query.system.account(baltathar.address) + ).data.free.toBigInt(); + + const fee = initialBalance - afterBalance; + return fee; +}; diff --git a/tests/util/dev-node.ts b/tests/util/dev-node.ts index 3620960f491..746671c0a15 100644 --- a/tests/util/dev-node.ts +++ b/tests/util/dev-node.ts @@ -37,6 +37,8 @@ export async function findAvailablePorts() { }; } +export type RuntimeChain = "moonbase" | "moonriver" | "moonbeam"; + // Stores if the node has already started. // It is used when a test file contains multiple describeDevMoonbeam. Those are // executed within the same PID and so would generate a race condition if started @@ -45,7 +47,10 @@ let nodeStarted = false; // This will start a moonbeam dev node, only 1 at a time (check every 100ms). // This will prevent race condition on the findAvailablePorts which uses the PID of the process -export async function startMoonbeamDevNode(withWasm?: boolean): Promise<{ +export async function startMoonbeamDevNode( + withWasm?: boolean, + runtime: RuntimeChain = "moonbase" +): Promise<{ p2pPort: number; rpcPort: number; wsPort: number; @@ -73,8 +78,13 @@ export async function startMoonbeamDevNode(withWasm?: boolean): Promise<{ ETHAPI_CMD != "" ? `${ETHAPI_CMD}` : `--ethapi=txpool`, `--no-telemetry`, `--no-prometheus`, - `--dev`, + `--force-authoring`, + `--rpc-cors=all`, + `--alice`, + `--chain=${runtime}-dev`, `--sealing=manual`, + `--in-peers=0`, + `--out-peers=0`, `-l${MOONBEAM_LOG}`, `--port=${p2pPort}`, `--rpc-port=${rpcPort}`, diff --git a/tests/util/setup-dev-tests.ts b/tests/util/setup-dev-tests.ts index d7ef46177f7..08d454d4bf6 100644 --- a/tests/util/setup-dev-tests.ts +++ b/tests/util/setup-dev-tests.ts @@ -7,7 +7,7 @@ import { RegistryError } from "@polkadot/types/types"; import { EventRecord } from "@polkadot/types/interfaces"; import { ethers } from "ethers"; -import { startMoonbeamDevNode } from "./dev-node"; +import { startMoonbeamDevNode, RuntimeChain } from "./dev-node"; import { provideWeb3Api, provideEthersApi, @@ -81,6 +81,7 @@ export function describeDevMoonbeam( title: string, cb: (context: DevTestContext) => void, ethTransactionType: EthTransactionType = "Legacy", + runtime: RuntimeChain = "moonbase", withWasm?: boolean ) { describe(title, function () { @@ -98,7 +99,7 @@ export function describeDevMoonbeam( before("Starting Moonbeam Test Node", async function () { this.timeout(SPAWNING_TIME); const init = !DEBUG_MODE - ? await startMoonbeamDevNode(withWasm) + ? await startMoonbeamDevNode(withWasm, runtime) : { runningNode: null, p2pPort: 19931, @@ -273,7 +274,7 @@ export function describeDevMoonbeamAllEthTxTypes( withWasm?: boolean ) { let wasm = withWasm !== undefined ? withWasm : false; - describeDevMoonbeam(title + " (Legacy)", cb, "Legacy", wasm); - describeDevMoonbeam(title + " (EIP1559)", cb, "EIP1559", wasm); - describeDevMoonbeam(title + " (EIP2930)", cb, "EIP2930", wasm); + describeDevMoonbeam(title + " (Legacy)", cb, "Legacy", "moonbase", wasm); + describeDevMoonbeam(title + " (EIP1559)", cb, "EIP1559", "moonbase", wasm); + describeDevMoonbeam(title + " (EIP2930)", cb, "EIP2930", "moonbase", wasm); }