Skip to content

Conversation

@OlivierBBB
Copy link
Collaborator

@OlivierBBB OlivierBBB commented Oct 22, 2025

Note

Adds parameterized empty-block test scenarios and Besu-backed execution support (with null-transaction handling), plus minor import and test-runner tweaks.

  • Tests:
    • EmptyBlockTests: Refactor to parameterized tests covering multiple E/N block patterns; add @Execution(SAME_THREAD); introduce BlockType and helper builderFromBlockTypeList; allow running against Besu via runWithBesu and validate logs only when not using Besu.
    • BlockhashTest: Add @Execution(SAME_THREAD).
  • Testing infrastructure:
    • MultiBlockExecutionEnvironment: Add runWithBesuNode option; when enabled, translate empty blocks to null transactions and execute via BesuExecutionTools (one tx per block); keep existing replay path otherwise.
    • BesuExecutionTools: Accept and handle null transactions for empty blocks; add preconditions; adjust conflation tracing range for empty vs non-empty blocks; minor cleanup and state checks.
  • Minor:
    • OsakaUserTransaction: Update EIP-7825 gas limit cap import to TraceOsaka.

Written by Cursor Bugbot for commit f5e8fd6. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Null Transaction Handling Bug

When oneTxPerBlock is false, the executeTest method attempts to send all transactions without checking if they are null. This leads to a NullPointerException when calling .encoded() on a null transaction, a check that is present in the oneTxPerBlock true path.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Transaction List Nulls Cause Block Number Errors

The firstBlockNumber calculation is off when oneTxPerBlock is true and the transactions list includes nulls. The current logic subtracts numberOfLeadingEmptyBlocks from an already adjusted firstBlockNumber, which can lead to invalid block numbers (like zero or negative) and an incorrect tracing range.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Block Number Calculation Incorrect for Non-Standard Genesis Blocks

When blockNumbers.isEmpty() is true (all transactions are null), firstBlockNumber is set to 1 and finalBlockNumber is set to transactions.size(). This assumes the starting block number is 1, but blocks may start at a different number. The calculation should use the genesis block configuration or track the actual block numbers created, not hardcode 1.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Null Transaction Handling Mismatch

The else branch, which sends all transactions in a single block, doesn't filter out null transactions from the transactions list. This causes a NullPointerException when txs.next() returns null and encoded() is called, unlike the if branch which correctly handles these null entries.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Test Initialization Order Causes Null References

Instance fields (senderKeyPair, receivingAccount, storingNumber, logging, storing, reading) are initialized with references to chainConfig, but chainConfig is only initialized by the test framework after instance field initialization. This will cause these fields to use a null or uninitialized chainConfig, leading to NullPointerException or incorrect bytecode compilation. These fields should either be initialized lazily in a @beforeeach method or moved into the test methods themselves.

Fix in Cursor Fix in Web

@amkCha
Copy link
Collaborator

amkCha commented Nov 6, 2025

Thanks for fixing the daily ref tests !!

null);
besuExecTools.executeTest();
return;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Early Exit Prevents Tracer Initialization

When runWithBesuNode is true, the run() method returns early without initializing the tracer field, leaving it null. Tests that call getHub() after running with Besu node will encounter a NullPointerException since getHub() returns tracer.getHub() and tracer is null.

Fix in Cursor Fix in Web

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@amkCha amkCha force-pushed the prover-tests-for-empty-blocks branch 2 times, most recently from 7a66335 to 5342cec Compare November 20, 2025 12:00
@amkCha amkCha enabled auto-merge (squash) November 20, 2025 15:48
@amkCha amkCha force-pushed the prover-tests-for-empty-blocks branch from dfadcae to ca5ec51 Compare November 25, 2025 17:57
@amkCha amkCha force-pushed the prover-tests-for-empty-blocks branch from ca5ec51 to b8eca91 Compare November 27, 2025 17:02
@amkCha amkCha force-pushed the prover-tests-for-empty-blocks branch from b8eca91 to 5f09e65 Compare November 27, 2025 17:06
@amkCha amkCha disabled auto-merge November 27, 2025 17:18
@amkCha amkCha enabled auto-merge (squash) November 27, 2025 17:19
.nonce(116)
.address(Address.fromHexStringStrict("0x1122334455667788990011223344556677889900"))
.code(
BytecodeCompiler.newProgram(chainConfig)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Instance fields initialized before chainConfig is set

The instance fields receivingAccount, storingNumber, and logging use BytecodeCompiler.newProgram(chainConfig) during initialization, but chainConfig is a static field initialized in the parent class's @BeforeAll method. In JUnit 5, instance fields are initialized when the test class is instantiated, which occurs before @BeforeAll methods execute. This means chainConfig will be null when these fields are initialized, causing a NullPointerException when the tests run.

Additional Locations (2)

Fix in Cursor Fix in Web

@amkCha amkCha merged commit fc82da8 into arith-dev Nov 27, 2025
14 checks passed
@amkCha amkCha deleted the prover-tests-for-empty-blocks branch November 27, 2025 20:29
jonesho pushed a commit that referenced this pull request Dec 4, 2025
* feat: new tests state manager integration

various configurations of empty / nonempty blocks, in particular

E
EEEE
EEEN
NEEN
NEEE
ENNE
EENENE

where E = empty block, N = nonempty block

* feat: allow MultiBlock tests to run with Besu node

* feat: allow for empty blocks in BesuNodeTests

---------

Co-authored-by: amkCha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants