Skip to content

rpc/jsonrpc: drop pre-state code already created in-block from witness#21539

Merged
awskii merged 1 commit into
mainfrom
awskii/witness-codes-created-before-read
May 31, 2026
Merged

rpc/jsonrpc: drop pre-state code already created in-block from witness#21539
awskii merged 1 commit into
mainfrom
awskii/witness-codes-created-before-read

Conversation

@awskii

@awskii awskii commented May 31, 2026

Copy link
Copy Markdown
Member

A pre-state contract whose code hash was already produced by an in-block CREATE is redundant in codes — the verifier replays the CREATE and has the bytecode.

Track hashes written via UpdateAccountCode; ReadAccountCode skips a pre-state read whose hash was already created. Writes flush at tx finalization, so a read before the create is still kept.

Corpus (zkevm@v0.4.0): fixes create_same_hash_then_read, keeps keeps_prestate_code_read_even_if_later_created_with_same_hash. codes mm 11→10, no regressions.

Builds on #21518. Refs #20534.

A pre-state contract whose code hash was already produced by an in-block
CREATE earlier in the block does not need to be in the witness: a stateless
verifier replays the CREATE and already holds that bytecode. Track code
hashes written via UpdateAccountCode and skip the pre-state read of a hash
already created.

Order is implicit — writes flush at tx finalization, before later txs read —
so a read preceding the create is still kept (the verifier needs it then).

Fixes witness_codes_create_same_hash_then_read on the EEST zkevm@v0.4.0
corpus while keeping witness_keeps_prestate_code_read_even_if_later_created_with_same_hash;
codes mismatches 11 -> 10, no regressions.

Refs #21307, #20534.
@awskii awskii requested review from lupin012 and yperbasis as code owners May 31, 2026 10:29
@AskAlexSharov AskAlexSharov added this pull request to the merge queue May 31, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 31, 2026
@awskii awskii added this pull request to the merge queue May 31, 2026
@awskii awskii added the RPC label May 31, 2026
Merged via the queue into main with commit 5d993f9 May 31, 2026
90 checks passed
@awskii awskii deleted the awskii/witness-codes-created-before-read branch May 31, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants