fix(txpool): restore cumulative overdraft check for fee delegation txs#87
Closed
colinkim wants to merge 1 commit into
Closed
fix(txpool): restore cumulative overdraft check for fee delegation txs#87colinkim wants to merge 1 commit into
colinkim wants to merge 1 commit into
Conversation
Collaborator
|
To avoid diverging fixes between stableNet and WBFT, I propose closing this PR and continuing with the steps below. During the PR review, we identified several additional issues that need further review and fixes. This is not intended to drop the fix, but to avoid maintaining two diverging implementations while the shared txpool behavior is still being finalized. The proposed plan is as follows:
|
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.
Summary
Fee delegation tx (type 0x16) splits cost between sender (value) and feePayer (gas fee). The upstream cumulative overdraft check(introduced in ethereum/go-ethereum#27429) assumed a single payer via
totalcost, causing false positives for valid fee delegation txs. As a workaround the check was globally disabled, leaving the pool exposed to two DoS vectors:Changes
totalvalue,totalgas,pendingGas(pool-wide shared map); implementaddCost/subCost.pendingGasaggregates gas obligations across all sender lists sharing the same feePayer, enabling cross-sender tracking.pendingGasby reference into each pending list (pending-only).ExistingExpenditurereturns total obligation across three roles: sender (totalvalue), own gas payer (totalgas), fee payer for others (pendingGas).ExistingTxadded for correct replacement accounting.need(). Normal txs: combined balance check. Fee delegation txs: sender/feePayer checked independently.core.ErrInsufficientFundsexpectations.TestFeeDelegationCumulativeGas.Test
go test ./core/txpool/legacypool/ -run TestFeeDelegationCumulativeGas -vgo test ./core/txpool/legacypool/ ./core/txpool/blobpool/go test -race ./core/txpool/legacypool/