Skip to content

Add --max-fee-per-gas - #1

Closed
techdigger wants to merge 5 commits into
mainfrom
pr/legacy-gas-price
Closed

techdigger wants to merge 5 commits into
mainfrom
pr/legacy-gas-price

Conversation

@techdigger

@techdigger techdigger commented Nov 12, 2026 •

Copy link
Copy Markdown

Replaced by #7: the same code as one commit on a clean branch.

safe-cli takes the fees of every transaction from eth_feeHistory: the next
block's base fee plus the median tip. There is no way to change them. On
chains whose fee history forecasts less than they charge (a fixed-fee
chain whose node still projects a falling base fee) every transaction is
refused, and on any chain you cannot pay more to be included sooner or to
replace a pending transaction.

Add two global options, for safe-cli (every command and the attended
mode, anywhere on the command line) and safe-creator:

  --max-fee-per-gas            cap of at least eth_gasPrice
  --max-fee-per-gas=<gwei>     that cap
  --max-priority-fee-per-gas=<gwei>   that tip

SAFE_CLI_MAX_FEE_PER_GAS and SAFE_CLI_MAX_PRIORITY_FEE_PER_GAS set
defaults; the command line overrides them. Transactions stay EIP-1559.
The fees apply to approve_hash, to executing Safe transactions (local key
or hardware wallet) and to deploying a Safe, and show in the confirmation
prompt. safe-cli refuses a cap above 10 times the node's price, a tip
above the cap, and the options on a network without EIP-1559, before
sending anything. Without the options nothing changes.
@techdigger techdigger changed the title Add --legacy-gas-price to send legacy transactions Add --max-fee-per-gas and --max-priority-fee-per-gas Nov 12, 2026
@techdigger techdigger closed this Nov 12, 2026
Replace the fee options with one rule, in one place.

EthereumClient.set_eip1559_fees takes maxFeePerGas from eth_feeHistory:
the next block's forecast base fee plus the tip. A chain that charges
more than its fee history forecasts (a fixed-fee chain whose node still
projects a falling base fee) refuses such a transaction. There the
node's eth_gasPrice is above the forecast, and it becomes the cap. Where
the forecast is at or above eth_gasPrice, nothing changes.

One override of set_eip1559_fees, in a subclass SafeOperator constructs,
covers execution with a local key, approve_hash and execution with a
hardware wallet. No options, and safe-creator is unchanged.
Without the option safe-cli behaves exactly as before.

--max-fee-per-gas GWEI (or SAFE_CLI_MAX_FEE_PER_GAS) sets maxFeePerGas
for every transaction safe-cli sends, instead of the estimate from
eth_feeHistory: for a chain that refuses that estimate (a fixed-fee
chain whose node forecasts less than it charges), or to raise the cap on
a busy chain. Transactions stay EIP-1559 and the tip stays the estimate.

A cap above 10 times the node's gas price is refused before anything is
sent, a guard against typing mistakes.

One override of EthereumClient.set_eip1559_fees, in a subclass
SafeOperator constructs, covers execution with a local key, approve_hash
and execution with a hardware wallet. The option is global: it goes
before the command or the Safe address.
@techdigger techdigger changed the title Add --max-fee-per-gas and --max-priority-fee-per-gas Add --max-fee-per-gas Nov 12, 2026
@techdigger techdigger reopened this Nov 12, 2026
@techdigger techdigger closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant