Skip to content

Fix fee-vault reward old/new balance on withdrawal tx#6

Merged
sduchesneau merged 2 commits into
firehose/2.xfrom
firehose/fix-vault-posttx-balance
Jul 2, 2026
Merged

Fix fee-vault reward old/new balance on withdrawal tx#6
sduchesneau merged 2 commits into
firehose/2.xfrom
firehose/fix-vault-posttx-balance

Conversation

@sduchesneau

Copy link
Copy Markdown

Problem

OpPostTxExtras reads each fee vault's old_balance from db.basic() — the pre-tx committed state (the DB isn't updated until commit_transaction). On a FeeVault-withdrawal tx the vault is drained mid-execution, so old/new are overstated by the withdrawn amount and the REASON_REWARD_TRANSACTION_FEE change diverges from geth.

Observed on base-mainnet block 52115535, tx c7febd6385acb3434ed7dc8cc974c73391214a5869547ab755e9e7e7a7e6edcf:

vault reth (pre-fix) geth
0x…19 old 74500df8c2f300 → new 74501e02b785a0 old 0 → new 1009f492a0
0x…1a old 0684e77c7b3956 → new 0684e79b702aa3 old 0 → new 1ef4f14d

Only the base differs (delta = the reward is identical); the committed state is correct, so this is a trace-reporting bug, not a consensus one.

Fix

Resolve old_balance from the inspector's post-tx journal snapshot via the new post_tx_balance_erased (same source the coinbase reward uses) instead of db.basic. It reflects the intra-tx drain, and falls back to the pre-tx DB balance when the vault is untouched during execution (every non-withdrawal tx — behaviour unchanged).

Depends on

streamingfast/reth#16 (adds post_tx_balance_erased). This branch does not build against the current v2.3.0-fh pin — merge the reth PR, cut a new -fh tag, then bump the streamingfast/reth pin in rust/Cargo.toml (all lines currently tag = "v2.3.0-fh"). Verified compiling + tracing correct against the reth branch via a local path override.

🤖 Generated with Claude Code

sduchesneau and others added 2 commits July 1, 2026 20:55
OpPostTxExtras read the vault old_balance from db.basic (pre-tx committed
state). On a FeeVault-withdrawal tx the vault is drained mid-execution, so
old and new were overstated by the withdrawn amount and diverged from geth's
REASON_REWARD_TRANSACTION_FEE change.

Resolve old_balance from the inspector's post-tx journal snapshot
(post_tx_balance_erased) instead — the same source the coinbase reward uses —
which reflects the intra-tx drain and falls back to the pre-tx DB balance when
the vault is untouched during execution.

Requires the reth-firehose pin bump that adds post_tx_balance_erased.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pulls in reth-firehose post_tx_balance_erased (streamingfast/reth#16),
required by the fee-vault reward fix in the previous commit. Also brings the
native-precompile state-change capture from v2.3.0-fh-1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sduchesneau sduchesneau merged commit e564005 into firehose/2.x Jul 2, 2026
4 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.

1 participant