Fix fee-vault reward old/new balance on withdrawal tx#6
Merged
Conversation
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>
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.
Problem
OpPostTxExtrasreads each fee vault'sold_balancefromdb.basic()— the pre-tx committed state (the DB isn't updated untilcommit_transaction). On a FeeVault-withdrawal tx the vault is drained mid-execution, soold/neware overstated by the withdrawn amount and theREASON_REWARD_TRANSACTION_FEEchange diverges from geth.Observed on base-mainnet block 52115535, tx
c7febd6385acb3434ed7dc8cc974c73391214a5869547ab755e9e7e7a7e6edcf:74500df8c2f300→ new74501e02b785a00→ new1009f492a00684e77c7b3956→ new0684e79b702aa30→ new1ef4f14dOnly 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_balancefrom the inspector's post-tx journal snapshot via the newpost_tx_balance_erased(same source the coinbase reward uses) instead ofdb.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 currentv2.3.0-fhpin — merge the reth PR, cut a new-fhtag, then bump thestreamingfast/rethpin inrust/Cargo.toml(all lines currentlytag = "v2.3.0-fh"). Verified compiling + tracing correct against the reth branch via a local path override.🤖 Generated with Claude Code