fix: move check in AcctDiff::decode and use filtered len in AcctDiff::encode#160
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
AcctDiff::decode and use filtered len in AcctDiff::encode
prestwich
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes two bugs in the
BundleStateIndexjournal codec (src/journal/coder.rs), both affectingAcctDiffround-tripping, and adds thorough boundary-case test coverage for every decode path. Bumps the patch version to0.34.4.Changes
AcctDiff::decodelength check (fb86156): thecheck_len!for the minimum diff size was run after theInfoOutcomehad already been consumed, so it demanded a second outcome's worth of trailing bytes. Any minimum-size diff - notably an empty-storage account near the end of a buffer - was wrongly rejected with anOverrun. The check now runs up front, before decoding the outcome.AcctDiff::encodeslot count (69e3e4e):encodewrotestorage_diff.len()(the full map size) as the slot-count prefix but only serializedis_changed()entries. An unchanged slot made the on-wire count exceed the entries actually written, so decoding read a phantom slot - a clean overrun for a standalone diff, but silent corruption of the trailingnew_contractssection inside aBundleStateIndex.encodenow writes the count of changed slots, matching the write-loop andserialized_size.AcctDiffminimum-size boundary, invalid tags for every tagged type, the unchanged-storage error, EIP-7702 / empty bytecode, empty index, andOption/Headerround-trips. Both bug fixes have dedicated regression tests verified to fail before the fix and pass after.API Breakages
None. No public signatures changed. Both fixes are confined to existing trait-method bodies. The decode fix only widens what is accepted (previously-rejected valid minimum diffs now decode), and the encode fix only changes bytes for directly-constructed diffs that violate the "no unchanged slots" invariant - output for data produced via the normal
From<&BundleAccount>path is byte-identical.🤖 Generated with Claude Code