diff --git a/test/suites/dev-frontier-template/test-pov/test-evm-over-pov.ts b/test/suites/dev-frontier-template/test-pov/test-evm-over-pov.ts index 85e67884d..b98cfa965 100644 --- a/test/suites/dev-frontier-template/test-pov/test-evm-over-pov.ts +++ b/test/suites/dev-frontier-template/test-pov/test-evm-over-pov.ts @@ -9,12 +9,13 @@ describeSuite({ id: "D2401", title: "PoV controlled by gasLimit", foundationMethods: "dev", - testCases: ({ context, it }) => { + testCases: ({ context, it, log }) => { let proxyAddress: `0x${string}`; let proxyAbi: Abi; let contracts: HeavyContract[]; let callData: `0x${string}`; const MAX_CONTRACTS = 20; + const EXPECTED_POV_ROUGH = 500_000; // bytes beforeAll(async () => { const { contractAddress, abi } = await deployCreateCompiledContract(context, "CallForwarder"); @@ -49,8 +50,12 @@ describeSuite({ gasLimit: gasEstimate, }); - const { result } = await context.createBlock(rawSigned); + const { result, block } = await context.createBlock(rawSigned); + log(`block.proofSize: ${block.proofSize} (successful: ${result?.successful})`); + console.log(block); + expect(block.proofSize).toBeGreaterThanOrEqual(EXPECTED_POV_ROUGH / 1.1); + expect(block.proofSize).toBeLessThanOrEqual(EXPECTED_POV_ROUGH * 1.1); expect(result?.successful).to.equal(true); }, }); @@ -66,8 +71,11 @@ describeSuite({ gasLimit: 3_000_000, }); - const { result } = await context.createBlock(rawSigned); + const { result, block } = await context.createBlock(rawSigned); + log(`block.proof_size: ${block.proofSize} (successful: ${result?.successful})`); + expect(block.proofSize).to.be.at.least(EXPECTED_POV_ROUGH / 1.1); + expect(block.proofSize).to.be.at.most(EXPECTED_POV_ROUGH * 1.1); expect(result?.successful).to.equal(true); }, }); @@ -85,8 +93,14 @@ describeSuite({ gasLimit: 1_000_000, }); - const { result } = await context.createBlock(rawSigned); + const { result, block } = await context.createBlock(rawSigned); + log(`block.proof_size: ${block.proofSize} (successful: ${result?.successful})`); + // The block still contain the failed (out of gas) transaction so the PoV is still included + // in the block. + // 1M Gas allows ~250k of PoV, so we verify we are within range. + expect(block.proofSize).to.be.at.least(230_000); + expect(block.proofSize).to.be.at.most(300_000); expect(result?.successful).to.equal(true); expectEVMResult(result!.events, "Error", "OutOfGas"); }, diff --git a/test/suites/dev-frontier-template/test-pov/test-evm-over-pov2.ts b/test/suites/dev-frontier-template/test-pov/test-evm-over-pov2.ts index fb3078517..4dd698768 100644 --- a/test/suites/dev-frontier-template/test-pov/test-evm-over-pov2.ts +++ b/test/suites/dev-frontier-template/test-pov/test-evm-over-pov2.ts @@ -8,7 +8,7 @@ describeSuite({ id: "D2402", title: "PoV Limit (3.5Mb in Dev)", foundationMethods: "dev", - testCases: ({ context, it }) => { + testCases: ({ context, it, log }) => { let proxyAddress: `0x${string}`; let proxyAbi: Abi; let contracts: HeavyContract[]; @@ -41,8 +41,11 @@ describeSuite({ txnType: "eip1559", }); - const { result } = await context.createBlock(rawSigned); + const { result, block } = await context.createBlock(rawSigned); + log(`block.proofSize: ${block.proofSize} (successful: ${result?.successful})`); + expect(block.proofSize).toBeGreaterThanOrEqual(MAX_ETH_POV_PER_TX - 20_000n); + expect(block.proofSize).toBeLessThanOrEqual(MAX_ETH_POV_PER_TX - 1n); expect(result?.successful).to.equal(true); }, }); @@ -66,8 +69,11 @@ describeSuite({ txnType: "eip1559", }); - const { result } = await context.createBlock(rawSigned); + const { result, block } = await context.createBlock(rawSigned); + 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(result?.successful).to.equal(false); }, });