fix(firehose): credit selfdestruct refund in post-tx balance resolver - #22
Merged
Merged
Conversation
revm records the beneficiary credit only inside AccountDestroyed on the truly-destroyed path, so the journal walk behind RewardTransactionFee and GasRefund resolved a stale pre-refund balance for the coinbase. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| /// `RewardTransactionFee old=0x4752e5600c77bf43`; pre-fix reth resolved the reward's | ||
| /// `old_balance` back to 0x46e9d5e2f034f0bb, silently dropping the refund. | ||
| #[test] | ||
| fn resolve_post_tx_balance_credits_selfdestruct_beneficiary() { |
There was a problem hiding this comment.
I can see that reth dosent have test_ prefix for tests, thought it was worth noting though, otherwise LGTM
UlysseCorbeil
approved these changes
Aug 7, 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.
On the truly-destroyed SELFDESTRUCT path (EIP-6780: contract created in the same tx, or pre-Cancun) revm credits the beneficiary in place and records the move only inside its
AccountDestroyedjournal entry — noBalanceTransferis pushed.resolve_post_tx_balanceonly handled the destroyed account (→ zero) and ignored thetargetcredit, so a coinbase or sender that received a suicide refund resolved to its stale pre-refund balance and the followingRewardTransactionFee/GasRefundevent reported anold_balancecontradicting theSuicideRefundevent emitted moments earlier.Live regression on Ethereum mainnet block 25690108: 0x8707c2bd… selfdestructed 0x690f7d1c42ce88 into the coinbase 0x4838b106…. geth reports the reward with
old=0x4752e5600c77bf43; reth reportedold=0x46e9d5e2f034f0bb.Two regression tests added: the live-block beneficiary credit, and the self-beneficiary case (
target == address) where the balance is burned rather than credited.🤖 Generated with Claude Code