Skip to content

Commit

Permalink
more constants
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin committed Nov 28, 2024
1 parent 6205a44 commit f9e850f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describeSuite({

await context.createBlock(createRawTransfer(context, randomAddress, 0n));
expect(await context.viem().getBalance({ address: ALITH_ADDRESS })).toBe(
ALITH_GENESIS_TRANSFERABLE_BALANCE - 21000n * 2_500_000_000n
ALITH_GENESIS_TRANSFERABLE_BALANCE - 21000n * GENESIS_BASE_FEE
);
},
});
Expand Down Expand Up @@ -133,8 +133,8 @@ describeSuite({

expect(await context.viem().getBalance({ blockNumber, address: ALITH_ADDRESS })).to.equal(
balance.data.free.toBigInt() +
balance.data.reserved.toBigInt() -
balance.data.frozen.toBigInt()
balance.data.reserved.toBigInt() -
balance.data.frozen.toBigInt()
);
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@moonbeam-network/api-augment/moonbase";
import { describeSuite, expect } from "@moonwall/cli";
import { ConstantStore } from "../../../../helpers";

describeSuite({
id: "D011601",
Expand All @@ -10,13 +11,15 @@ describeSuite({
id: "T01",
title: "should start with genesis value",
test: async () => {
const { specVersion } = await context.polkadotJs().consts.system.version;
const GENESIS_BASE_FEE = ConstantStore(context).GENESIS_BASE_FEE.get(specVersion.toNumber());
const initialValue = (
await context.polkadotJs().query.transactionPayment.nextFeeMultiplier()
).toBigInt();
expect(initialValue).to.equal(8_000_000_000_000_000_000n);

const gasPrice = await context.viem().getGasPrice();
expect(gasPrice).to.eq(2_500_000_000n); // min gas price
expect(gasPrice).to.eq(GENESIS_BASE_FEE);
},
});
},
Expand Down
18 changes: 9 additions & 9 deletions test/suites/smoke/test-dynamic-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describeSuite({
);
const version = (await paraApi.at(endsAtBlockHash)).consts.system.version;
specVersion = version.specVersion;
let specName = version.specName;
const specName = version.specName;
runtime = specName.toUpperCase() as any;

if (
Expand All @@ -124,15 +124,15 @@ describeSuite({
) {
log(
`Runtime ${specName.toString()} version ` +
`${specVersion.toString()} is less than 2200, skipping test suite.`
`${specVersion.toString()} is less than 2200, skipping test suite.`
);
skipAll = true;
}

if (specVersion.toNumber() < 2300 && specName.toString() == "moonbeam") {
log(
`Runtime ${specName.toString()} version ` +
`${specVersion.toString()} is less than 2300, skipping test suite.`
`${specVersion.toString()} is less than 2300, skipping test suite.`
);
skipAll = true;
}
Expand All @@ -143,9 +143,9 @@ describeSuite({

log(
`Collecting ${hours} hours worth of data ` +
`[from #${blockNumArray[0]} ` +
`to #${blockNumArray[blockNumArray.length - 1]}] ` +
`(${blockNumArray.length} blocks, RT${specVersion.toNumber()})`
`[from #${blockNumArray[0]} ` +
`to #${blockNumArray[blockNumArray.length - 1]}] ` +
`(${blockNumArray.length} blocks, RT${specVersion.toNumber()})`
);

const getBlockData = async (blockNum: number) => {
Expand Down Expand Up @@ -195,7 +195,7 @@ describeSuite({
if (result) {
log(
`Time slice of blocks intersects with upgrade ` +
`from RT ${onChainRt} to RT ${specVersion}, skipping tests.`
`from RT ${onChainRt} to RT ${specVersion}, skipping tests.`
);
skipAll = true;
}
Expand Down Expand Up @@ -293,9 +293,9 @@ describeSuite({
const failures = blockData.filter(({ baseFeePerGasInGwei }) => {
return (
ethers.parseUnits(baseFeePerGasInGwei, "gwei") <
RUNTIME_CONSTANTS[runtime].MIN_BASE_FEE.get(specVersion.toNumber()) ||
RUNTIME_CONSTANTS[runtime].MIN_BASE_FEE.get(specVersion.toNumber()) ||
ethers.parseUnits(baseFeePerGasInGwei, "gwei") >
RUNTIME_CONSTANTS[runtime].MAX_BASE_FEE.get(specVersion.toNumber())
RUNTIME_CONSTANTS[runtime].MAX_BASE_FEE.get(specVersion.toNumber())
);
});

Expand Down

0 comments on commit f9e850f

Please sign in to comment.