Skip to content

fix(fee): bump priority fee + gas budget to clear gravity-reth promote threshold#48

Merged
keanji-x merged 1 commit into
mainfrom
fix/gravity-fee-and-gas-budget
Apr 27, 2026
Merged

fix(fee): bump priority fee + gas budget to clear gravity-reth promote threshold#48
keanji-x merged 1 commit into
mainfrom
fix/gravity-fee-and-gas-budget

Conversation

@keanji-x

Copy link
Copy Markdown
Collaborator

Summary

Bench's default fee parameters are below gravity-reth's txpool promotion threshold under load: transactions land in the queued bucket and are never promoted to pending, so they stay in the mempool indefinitely and never get mined. Aligning bench's defaults so transactions actually land on a freshly-deployed gravity testnet.

Changes

Knob Before After Reason
BENCH_MAX_PRIORITY_FEE_PER_GAS 1 Gwei 500 Gwei Below ~hundreds of Gwei, gravity-reth doesn't promote queued → pending
BENCH_MAX_FEE_PER_GAS 100 Gwei 5000 Gwei 10× priority headroom, same ratio as before
GAS_COST_PER_TXN_BUDGET (faucet planner) 1e16 wei 5e17 wei Lockstep with BENCH_MAX_FEE_PER_GAS per the existing comment. Without this bump faucet_balance - total_cost underflows U256 and amount_per_recipient becomes astronomical → every faucet tx fails with insufficient funds
scripts/deploy.py legacy gasPrice w3.eth.gas_price (~baseFee + 1 Gwei) DEPLOY_GAS_PRICE_WEI = 800 Gwei (new constant) Same root cause for contract deploys / approves / addLiquidity. 800 Gwei clears the threshold and stays under the 1 ETH RPC txfeecap for the gas limits used here

Symptom this fixes

On a fresh gravity testnet (chainId 127001, baseFee 50 Gwei, 1 ETH txfeecap):

Before:

  • Bench Pool Pending: 0 / Pool Queued: N, growing without bound
  • 0 transfers confirmed
  • txpool_content shows transactions in queued with the right nonces but they sit there forever
  • Manually replacing one with a 500+ Gwei priority fee promotes it and gets it mined → confirms the threshold is in the txpool layer, not consensus

After:

  • ~5k TPS sustained
  • Cascade faucet completes cleanly
  • ERC20 conservation verified: sum(balanceOf) across all 111111 holders == totalSupply() exactly, on both TKN1 and TKN2
  • Bench's reported Success% is now bounded by RPC receipt latency rather than by mempool stuckness

Test plan

  • cargo check passes.
  • End-to-end run against gravity testnet: deploy + faucet (3 tokens × 5 cascade levels) + 10 min erc20 transfer at 5k target TPS.
  • Independent verification of correctness:
    • Token balance conservation: 0 wei diff between totalSupply() and Σ balanceOf over all 111111 holders for both TKN1 and TKN2.
    • On-chain nonce progression: 168k transfers persisted on the leaf accounts, 333k cascade-faucet outflows persisted on intermediates (avg = exactly 30/intermediate = 10 outflows × 3 token types).

Notes for reviewers

These constants make sense to live as configurable values eventually, but a one-off constant bump is the smaller change and matches the existing precedent (#46 "align bench fees with Gravity 50 Gwei min base fee"). Happy to follow up with a config-driven version if preferred.

The lockstep coupling between BENCH_MAX_FEE_PER_GAS and GAS_COST_PER_TXN_BUDGET was already documented in the existing comment but only checked manually; this PR keeps that contract intact.

🤖 Generated with Claude Code

…e threshold

Empirically, gravity-reth's txpool keeps transactions in the `queued`
bucket and never promotes them to `pending` when the priority fee is
below ~hundreds of Gwei, even when the max_fee_per_gas is well above
the base fee. Transactions sit there indefinitely and the bench run
makes no progress (Pool Pending stays 0 while Pool Queued grows).

Aligning bench's defaults so they actually land:

* `BENCH_MAX_PRIORITY_FEE_PER_GAS` 1 → 500 Gwei
  This is the user-visible knob that decides whether txs promote.

* `BENCH_MAX_FEE_PER_GAS` 100 → 5000 Gwei
  Headroom = 10× priority, same ratio as before.

* `GAS_COST_PER_TXN_BUDGET` 1e16 → 5e17 wei (lockstep)
  Per the existing comment "Bumping max_fee_per_gas requires bumping
  this in lockstep". Without this bump, `faucet_balance - total_cost`
  underflows U256 in the cascade-faucet planner and `amount_per_recipient`
  comes out astronomical, causing every faucet tx to fail with
  `insufficient funds`.

* `scripts/deploy.py` legacy gasPrice → 800 Gwei (new constant)
  Same reason: contract deploys / approves / addLiquidity were stuck
  in `queued` because `w3.eth.gas_price` returns ~baseFee + 1 Gwei.
  800 Gwei clears the threshold and stays under the 1 ETH RPC
  `txfeecap` for the gas limits used here.

Reproduced against gravity testnet (`chainId=127001`, baseFee 50 Gwei,
1 ETH txfeecap). Before: 0 confirmed transfers, all txs stuck in
`queued`. After: ~5k TPS sustained, ERC20 conservation verified
(sum of balanceOf across all 111111 holders == totalSupply, exact).
@keanji-x keanji-x force-pushed the fix/gravity-fee-and-gas-budget branch from 7b42f23 to ff6495c Compare April 27, 2026 14:35
@keanji-x keanji-x merged commit 0713edc into main Apr 27, 2026
1 check failed
@keanji-x keanji-x deleted the fix/gravity-fee-and-gas-budget branch April 27, 2026 14:35
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