Skip to content

feat(benchmark): create new benchmark_test test type #1896

@LouisTsai-Csie

Description

@LouisTsai-Csie

Background

Following discussions around general benchmark refactoring and the transaction gas limit cap issue, the ZkEVM team, Nethermind team (for gas benchmarking purpose),along with other teams, agreed that using the blockchain_test format is sufficient. This aligns with zkEVM’s goal of proving entire blocks rather than individual transactions (as in state_test).

However, most existing test cases are currently in the state_test format, which requires conversion using the reth deserialization tools. Additionally, EIP-7825 has been introduced in Fusaka, which enforces a maximum transaction gas limit of 2^24. This requires us to rewrite a lot of benchmark tests. Since the test must be split into multiple parts and use the blockchain_test format when the transaction gas exceeds the cap.

Proposed Solution

Introduce a new test type: benchmark_test, designed specifically for benchmark test cases. This format would support:

  • Act as a wrapper and only generates the blockchain_test format as output
  • High compatibility with both blockchain_test and state_test formats
  • Support EIP-7825 for transaction limit cap

Usage Scenarios

  • For existing blockchain_test cases: If the blocks field is present, benchmark_test will execute using the blockchain_test format:
blockchain_test(
    genesis_environment=Environment(),
    pre=pre,
    post=post_state,
    blocks=[Block(txs=txs)],
    exclude_full_post_state_in_output=True,
)

->

benchmark_test(
    genesis_environment=Environment(),
    pre=pre,
    post=post_state,
    blocks=[Block(txs=txs)],
    exclude_full_post_state_in_output=True,
)
  • For existing state_test input: If only a single transaction is provided, benchmark_test will convert it into a blockchain_test:
state_test(
    env=Environment(),
    pre=pre,
    post={},
    tx=tx,
)

->

benchmark_test(
    env=Environment(),
    pre=pre,
    post={},
    tx=tx,
)

In both scenarios, benchmark_test will:

  • Verify the gas limit specified in the transaction.
  • If EIP-7825 is active, compare the transaction gas limit against the 2**24 cap:
  • If the limit exceeds the cap, split the test into multiple parts accordingly.
  • If EIP-7825 is not active, proceed with the original gas limit.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions