Skip to content

fix(evm-ee): persist created bytecodes during chunk replay#1848

Closed
irnb wants to merge 1 commit into
mainfrom
fix/ee-chunk-same-chunk-bytecode-witness
Closed

fix(evm-ee): persist created bytecodes during chunk replay#1848
irnb wants to merge 1 commit into
mainfrom
fix/ee-chunk-same-chunk-bytecode-witness

Conversation

@irnb
Copy link
Copy Markdown
Contributor

@irnb irnb commented May 22, 2026

Root Cause

AccessedStateGenerator records bytecodes that are read from state during block execution. Contract creation is different: the runtime bytecode is produced as a write in execution_output.state.contracts.

EE chunk replay merged the account/storage trie changes after each block, so a newly-created contract account and its code_hash became visible to later blocks in the same chunk. However, replay discarded the created bytecode itself.

The fix carries created bytecodes through EvmWriteBatch and inserts them into EvmPartialState after the block is replayed.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

Is this PR addressing any specification, design doc or external reference document?

  • Yes
  • No

If yes, please add relevant links:

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added (where necessary) tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.
  • I have disclosed my use of AI in the body of this PR.

Related Issues

@github-actions
Copy link
Copy Markdown
Contributor

Commit: 6eee20c

SP1 Execution Results

program cycles gas
EVM EE Chunk 568,054 778,887
EVM EE Account 421,125 526,509
Checkpoint 2,241,397 2,582,981

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.77%. Comparing base (d1d88bd) to head (135a3bb).

Files with missing lines Patch % Lines
crates/evm-ee/src/types/write_batch.rs 64.00% 9 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1848      +/-   ##
==========================================
+ Coverage   79.76%   79.77%   +0.01%     
==========================================
  Files         674      674              
  Lines       74805    74838      +33     
==========================================
+ Hits        59665    59699      +34     
+ Misses      15140    15139       -1     
Flag Coverage Δ
functional 60.18% <54.54%> (-0.01%) ⬇️
unit 65.67% <72.72%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crates/evm-ee/src/execution.rs 83.91% <100.00%> (+0.57%) ⬆️
crates/evm-ee/src/types/write_batch.rs 82.35% <64.00%> (-10.68%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@irnb irnb marked this pull request as draft May 22, 2026 11:36
@irnb irnb closed this May 22, 2026
@storopoli storopoli deleted the fix/ee-chunk-same-chunk-bytecode-witness branch May 22, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant