Skip to content

fix(firehose): credit selfdestruct refund in post-tx balance resolver - #22

Merged
sduchesneau merged 1 commit into
firehose/2.xfrom
fix/selfdestruct-refund-post-tx-balance
Aug 7, 2026
Merged

fix(firehose): credit selfdestruct refund in post-tx balance resolver#22
sduchesneau merged 1 commit into
firehose/2.xfrom
fix/selfdestruct-refund-post-tx-balance

Conversation

@sduchesneau

Copy link
Copy Markdown

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 AccountDestroyed journal entry — no BalanceTransfer is pushed. resolve_post_tx_balance only handled the destroyed account (→ zero) and ignored the target credit, so a coinbase or sender that received a suicide refund resolved to its stale pre-refund balance and the following RewardTransactionFee / GasRefund event reported an old_balance contradicting the SuicideRefund event 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 reported old=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

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() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that reth dosent have test_ prefix for tests, thought it was worth noting though, otherwise LGTM

@sduchesneau
sduchesneau merged commit b069ebb into firehose/2.x Aug 7, 2026
4 checks passed
@sduchesneau
sduchesneau deleted the fix/selfdestruct-refund-post-tx-balance branch August 7, 2026 21:34
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