Skip to content

Commit

Permalink
update proof size ranges in PoV tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzamontiel committed Oct 7, 2024
1 parent 6edd820 commit 58a9512
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions test/suites/dev/moonbase/test-pov/test-evm-over-pov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describeSuite({
let contracts: HeavyContract[];
let callData: `0x${string}`;
const MAX_CONTRACTS = 20;
const EXPECTED_POV_ROUGH = 40_000; // bytes
const EXPECTED_POV_ROUGH = 16_000; // bytes

beforeAll(async () => {
const { contractAddress, abi } = await deployCreateCompiledContract(context, "CallForwarder");
Expand Down Expand Up @@ -88,7 +88,7 @@ describeSuite({
to: proxyAddress,
data: callData,
txnType: "eip1559",
gasLimit: 1_000_000,
gasLimit: 100_000,
});

const { result, block } = await context.createBlock(rawSigned);
Expand All @@ -97,8 +97,8 @@ describeSuite({
// The block still contain the failed (out of gas) transaction so the PoV is still included
// in the block.
// 1M Gas allows ~38k of PoV, so we verify we are within range.
expect(block.proofSize).to.be.at.least(30_000);
expect(block.proofSize).to.be.at.most(50_000);
expect(block.proofSize).to.be.at.least(15_000);
expect(block.proofSize).to.be.at.most(25_000);
expect(result?.successful).to.equal(true);
expectEVMResult(result!.events, "Error", "OutOfGas");
},
Expand Down
6 changes: 3 additions & 3 deletions test/suites/dev/moonbase/test-pov/test-evm-over-pov2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ describeSuite({
const { result, block } = await context.createBlock(rawSigned);

log(`block.proofSize: ${block.proofSize} (successful: ${result?.successful})`);
expect(block.proofSize).toBeGreaterThanOrEqual(30_000);
expect(block.proofSize).toBeLessThanOrEqual(50_000n + emptyBlockProofSize);
expect(block.proofSize).toBeGreaterThanOrEqual(15_000);
expect(block.proofSize).toBeLessThanOrEqual(25_000n + emptyBlockProofSize);
expect(result?.successful).to.equal(true);
},
});
Expand Down Expand Up @@ -92,7 +92,7 @@ describeSuite({

log(`block.proofSize: ${block.proofSize} (successful: ${result?.successful})`);
// Empty blocks usually do not exceed 10kb, picking 50kb as a safe limit
expect(block.proofSize).to.be.at.most(50_000);
expect(block.proofSize).to.be.at.most(25_000);
expect(result?.successful).to.equal(false);
},
});
Expand Down
8 changes: 4 additions & 4 deletions test/suites/dev/moonbase/test-pov/test-precompile-over-pov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describeSuite({
testCases: ({ context, log, it }) => {
let contracts: HeavyContract[];
const MAX_CONTRACTS = 50;
const EXPECTED_POV_ROUGH = 55_000; // bytes
const EXPECTED_POV_ROUGH = 24_000; // bytes
let batchAbi: Abi;
let proxyAbi: Abi;
let proxyAddress: `0x${string}`;
Expand Down Expand Up @@ -63,7 +63,7 @@ describeSuite({
const rawSigned = await createEthersTransaction(context, {
to: PRECOMPILE_BATCH_ADDRESS,
data: callData,
gasLimit: 1_000_000,
gasLimit: 100_000,
txnType: "eip1559",
});

Expand All @@ -72,8 +72,8 @@ describeSuite({
// With 1M gas we are allowed to use ~62kb of POV, so verify the range.
// The tx is still included in the block because it contains the failed tx,
// so POV is included in the block as well.
expect(block.proofSize).to.be.at.least(35_000);
expect(block.proofSize).to.be.at.most(70_000);
expect(block.proofSize).to.be.at.least(15_000);
expect(block.proofSize).to.be.at.most(30_000);
expect(result?.successful).to.equal(true);
expectEVMResult(result!.events, "Error", "OutOfGas");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ describeSuite({
});

const { result, block } = await context.createBlock(rawSigned);
expect(block.proofSize).to.be.at.least(Number(30_000));
expect(block.proofSize).to.be.at.most(Number(50_000n + emptyBlockProofSize));
expect(block.proofSize).to.be.at.least(Number(15_000));
expect(block.proofSize).to.be.at.most(Number(30_000n + emptyBlockProofSize));
expect(result?.successful).to.equal(true);
},
});
Expand Down
6 changes: 3 additions & 3 deletions test/suites/dev/moonbase/test-pov/test-xcm-to-evm-pov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describeSuite({
let proxyAddress: `0x${string}`;
const MAX_CONTRACTS = 15;
let contracts: HeavyContract[];
const EXPECTED_POV_ROUGH = 43_000; // bytes
const EXPECTED_POV_ROUGH = 17_000; // bytes
let balancesPalletIndex: number;
let STORAGE_READ_COST: bigint;

Expand Down Expand Up @@ -146,8 +146,8 @@ describeSuite({
// With 500k gas we are allowed to use ~150k of POV, so verify the range.
// The tx is still included in the block because it contains the failed tx,
// so POV is included in the block as well.
expect(block.proofSize).to.be.at.least(30_000);
expect(block.proofSize).to.be.at.most(45_000);
expect(block.proofSize).to.be.at.least(15_000);
expect(block.proofSize).to.be.at.most(22_500);

// Check the evm tx was not executed because of OutOfGas error
const ethEvents = (await context.polkadotJs().query.system.events()).filter(({ event }) =>
Expand Down

0 comments on commit 58a9512

Please sign in to comment.