Skip to content

fix(hardfork): read actual storage value as original_value in storage patches#322

Merged
ByteYue merged 1 commit intomainfrom
fix/hardfork-storage-patch-original-value
Apr 8, 2026
Merged

fix(hardfork): read actual storage value as original_value in storage patches#322
ByteYue merged 1 commit intomainfrom
fix/hardfork-storage-patch-original-value

Conversation

@ByteYue
Copy link
Copy Markdown
Collaborator

@ByteYue ByteYue commented Apr 8, 2026

Summary

  • Fix hardcoded U256::ZERO as original_value in EvmStorageSlot::new_changed for both storage_patches and batch_storage_patches
  • Read the current slot value from state via DatabaseRef::storage_ref before constructing the storage slot, ensuring correct unwind/revert behavior when patched slots hold non-zero values

Closes Galxe/gravity-audit#1

Test plan

  • cargo check -p reth-evm-ethereum passes
  • Verify unwind correctness on a hardfork block that patches a non-zero storage slot

🤖 Generated with Claude Code

… patches

Previously, `EvmStorageSlot::new_changed` hardcoded `U256::ZERO` as the
original_value for all storage patches. If a patched slot previously held
a non-zero value, unwind/revert would incorrectly restore it to zero
instead of its true prior value. Read the current slot value from state
via `DatabaseRef::storage_ref` before constructing the storage slot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ByteYue ByteYue force-pushed the fix/hardfork-storage-patch-original-value branch from 70d1498 to 3daf876 Compare April 8, 2026 03:24
@AshinGau
Copy link
Copy Markdown
Collaborator

AshinGau commented Apr 8, 2026

LGTM

@ByteYue ByteYue merged commit ceaedd8 into main Apr 8, 2026
31 checks passed
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.

2 participants