Skip to content

zkvm: allow using entire gas in bytecode attack #1575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025

Conversation

jsign
Copy link
Collaborator

@jsign jsign commented May 7, 2025

This PR proposes a way to fill the bytecode attack, solving two main problems:

  • Creating so many 24KiB contracts with 36M gas limit takes a lot of blocks, which bloats the generated fixture in size and generation time.
  • Even if so many blocks in the fixture aren't a problem, all the ~300MiB of code appears in the postState, which also bloats the fixture. (This PR now uses a new feature introduced in Add optional field to exclude including postState #1578)

Results:

  • I tested in Geth, and it runs exactly as expected.
  • Filling this test on my machine with --block-gas-limit 36M
    • Only two blocks are needed in the fixture.
    • Block 1 only has a single tx creating all contracts.
    • Block 2 has the actual attack.
  • Takes 2 mins to fill the test, which sounds quite fast considering it creates 300MiB of contracts.
  • The fixture json file size is ~35KiB, so very small as wanted.

Fill command: uv run fill --from=Cancun --until=Cancun -m "zkevm and blockchain_test" --block-gas-limit 36000000 -k test_worst_bytecode

@jsign jsign changed the base branch from jsign-zkvm-ecrecover to jsign-optional-poststate May 9, 2025 17:45
@jsign jsign changed the base branch from jsign-optional-poststate to jsign-zkvm-ecrecover May 9, 2025 17:46
@jsign jsign force-pushed the jsign-zkvm-full-bytecode-attack branch 3 times, most recently from eb0aa22 to b4ea57b Compare May 13, 2025 17:20
@jsign jsign changed the base branch from jsign-zkvm-ecrecover to main May 13, 2025 17:20
@jsign jsign marked this pull request as ready for review May 13, 2025 18:20
@jsign jsign requested a review from marioevz May 13, 2025 18:20
@chfast chfast added feature:zkevm scope:tests Scope: Changes EL client test cases in `./tests` labels May 14, 2025
jsign added 2 commits May 14, 2025 15:22
Signed-off-by: Ignacio Hagopian <[email protected]>
Signed-off-by: Ignacio Hagopian <[email protected]>
@jsign jsign force-pushed the jsign-zkvm-full-bytecode-attack branch from dd465e5 to b2f4b2f Compare May 14, 2025 18:22
Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM, hope that the rebase helps with the CI timeout :)

Signed-off-by: Ignacio Hagopian <[email protected]>
@marioevz marioevz merged commit 3be4d6f into main May 14, 2025
21 of 22 checks passed
@marioevz marioevz deleted the jsign-zkvm-full-bytecode-attack branch May 14, 2025 23:33
felix314159 pushed a commit to felix314159/execution-spec-tests that referenced this pull request May 16, 2025
* zkvm: full bytecode attack enabling

Signed-off-by: Ignacio Hagopian <[email protected]>

* set gas limit in ci

Signed-off-by: Ignacio Hagopian <[email protected]>

* add slow mark

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:zkevm scope:tests Scope: Changes EL client test cases in `./tests`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants