feat: transactions with retry#5464
Draft
sbackend123 wants to merge 7 commits into
Draft
Conversation
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.
Checklist
Description
Add automatic gas-fee retry for Ethereum transactions in Bee. Transactions that stay unconfirmed are re-broadcast with the same nonce and an escalated priority fee, using dynamic fees from eth_feeHistory. Retry behaviour is configurable, survives node restarts, and is used for redistribution and postage operations.
What changed
Transaction retry (pkg/transaction)
New SendWithRetry on the transaction service: EIP-1559 txs with fee estimation via eth_feeHistory (initial tip = market / 50th percentile), then +20% tip per retry step (configurable). Replacement transactions reuse the same nonce; maxFeePerGas is derived as 2 × baseFee + tip. Persists RetryState in the state store and resumes in-flight retries after restart. Stops on non-retryable errors (revert, insufficient funds, sign failure, redistribution contract errors, nonce too low, etc.).
Structured logging: Info on each broadcast, Debug on fee suggestion / state updates, Error on critical failures and when all attempts are exhausted.
Configuration (cmd/bee, pkg/node)
CLI flags (defaults: 5 attempts, 1 min delay, 20% increase):
--transaction-retry-max-retries
--transaction-retry-delay
--transaction-retry-gas-increase-percent
--transaction-retry-max-tx-price-wei
Call sites
API
New HTTP header Disable-Retry (parsed in gasConfigMiddleware together with Gas-Price / Gas-Limit).
When Disable-Retry: true, postage falls back to the existing Send + WaitForReceipt path.
Header is included in CORS allow-list.
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
#5114
Screenshots (if appropriate):
AI Disclosure