Skip to content

refactor: transactions options - #5720

Open
sbackend123 wants to merge 5 commits into
masterfrom
refactor/tx-fee-options
Open

sbackend123 wants to merge 5 commits into
masterfrom
refactor/tx-fee-options

Conversation

@sbackend123

@sbackend123 sbackend123 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have added or updated fuzz targets for any code handling untrusted input.
  • I have filled out the description and linked the related issues.

Description

Refactoring of transaction fees. The gas price, the gas limit, and Fee-Priority are no longer hidden in the request context. Callers pass them explicitly as transaction.Option. The formulas are the same as on master, but they live in pkg/transaction instead of the Ethereum client wrapper.

Behavior is unchanged except for the following

  • Fee-Priority and Gas-Price can no longer be set together. Previously Fee-Priority silently won and the gas price was dropped. Now HTTP returns 400: Fee-Priority cannot be combined with Gas-Price.
  • A negative tip boost and an unknown Fee-Priority also fail before any network call. Previously the rejection came after an extra RPC.
  • Gas-Limit is now really applied on POST /chequebook/deposit, POST /chequebook/withdraw, and POST /wallet/withdraw/BZZ. On master the header was only validated: garbage returned 400, but the limit was not used and gas was estimated. With no header or 0, gas is still estimated. POST /wallet/withdraw/NativeToken is unchanged: the header value, or 300000 when it is omitted.
  • Block-header and tip-cap RPC counters increased because those calls go through the wrapper. A node with no blockchain now exposes three zero fee-history counters. A Fee-Priority price request on such a node takes the fallback path; the error is still recognized as "chain disabled".

Open API Spec Version Changes (if applicable)

Swarm.yaml 9.0.1 → 9.1.0. SwarmCommon.yaml is unchanged.

The minor bump is for Gas-Limit on POST /chequebook/deposit, POST /chequebook/withdraw, and POST /wallet/withdraw/{coin}: the header is now documented and applied. Omitting it keeps the previous behavior.

Motivation and Context (Optional)

Previously, transaction send options (gas limit, gas price, Fee-Priority) were passed implicitly through the request context, and there was no single place that validated them. As a result, options could fail to reach the final call or be overwritten without the caller noticing.

After Fee-Priority was introduced, the split of this logic between the wrapped backend and the transaction service got worse: callers had to check Fee-Priority themselves and decide how the transaction fee would be calculated.

Related Issue

Screenshots (if appropriate):

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

@sbackend123
sbackend123 marked this pull request as ready for review November 27, 2026 16:41

This branch has not been deployed

No deployments
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