Skip to content

fix: use baseFee*2 for feeCap and distribute tx submissions across all clients#207

Merged
pk910 merged 2 commits intoethpandaops:masterfrom
qu0b:fix/tx-submission-fees-and-client-distribution
Mar 16, 2026
Merged

fix: use baseFee*2 for feeCap and distribute tx submissions across all clients#207
pk910 merged 2 commits intoethpandaops:masterfrom
qu0b:fix/tx-submission-fees-and-client-distribution

Conversation

@qu0b
Copy link
Copy Markdown
Member

@qu0b qu0b commented Mar 16, 2026

Summary

  • Fee calculation fix: GetSuggestedFees used eth_gasPrice (baseFee + tipCap) as maxFeePerGas, giving zero headroom for baseFee increases. After a full block (+12.5% baseFee), ALL pending tx become underpriced → empty block → baseFee drops → tx valid → overfull block → repeat. Now uses baseFee * 1.25 + tipCap — just enough to prevent the oscillation (survives 1 full block increase), but low enough that tx start becoming underpriced after 2 consecutive full blocks, preserving EIP-1559's self-regulating baseFee behavior when throughput exceeds the 50% gas target.

  • Client distribution fix: Redundant submissions (SubmitCount=3) always targeted clients at index 1 and 2 due to ClientsStartOffset defaulting to 0 and never being set. Clients 1 & 2 received 100% of tx while others got ~12.5%. Now derives offset from tx.Hash() for uniform distribution across all clients. Same fix applied to rebroadcastTransaction.

Test plan

  • Verify build: go build ./..., go vet ./... — both pass
  • Verify existing tests: go test ./... — all pass
  • Deploy to devnet and confirm blocks show consistent ~50% fill instead of alternating 0%/99%
  • Verify with explicit --base-fee flag that user-specified fees still override the new default
  • Confirm baseFee stays stable when throughput ≈ 50%, and self-corrects when throughput > 50%

🤖 Generated with Claude Code

…l clients

Two bugs in submitTransaction caused alternating full/empty blocks:

1. Fee calculation: GetSuggestedFees used eth_gasPrice (baseFee + tipCap)
   as maxFeePerGas, providing zero headroom for baseFee increases. After
   a full block, baseFee rises 12.5% making ALL pending transactions
   underpriced — producing an empty block. BaseFee then drops, tx become
   valid, next block is overfull, and the cycle repeats.

   Fix: compute feeCap as baseFee*2 + tipCap using the pool's tracked
   baseFee (updated every block). The 2x multiplier survives ~6
   consecutive full blocks of baseFee increases. Actual fee paid is still
   baseFee + tipCap — the higher feeCap just prevents underpricing.

2. Client distribution: redundant submissions (SubmitCount=3) always used
   SelectClientByIndex(i + ClientsStartOffset) where ClientsStartOffset
   was always 0. This sent every transaction's redundant copies to clients
   at index 1 and 2, giving those clients 100% of transactions while
   other clients received only ~12.5%.

   Fix: derive startOffset from tx hash bytes for both submitTransaction
   and rebroadcastTransaction, distributing submissions uniformly.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@pk910 pk910 merged commit 7f15846 into ethpandaops:master Mar 16, 2026
6 checks passed
qu0b added a commit to qu0b/spamoor that referenced this pull request Mar 19, 2026
Restore original fee calculation as default (use provided fees or fetch
from network via eth_gasPrice). Move the dynamic headroom + normal
distribution fee calculation behind --fee-strategy adaptive flag.

This collapses the fee changes from PR ethpandaops#207 and the dynamic headroom
commit into a single opt-in strategy, keeping the client distribution
fix from ethpandaops#207 untouched.

Also fix EIP-1559 violation in adaptive mode where feeCap could be
lower than tipCap due to normal distribution sampling.

Configuration examples:

  # CLI (single scenario)
  spamoor eoatx --fee-strategy adaptive -h http://localhost:8545

  # CLI (yaml multi-scenario)
  spamoor run config.yaml --fee-strategy adaptive

  # Daemon
  spamoor-daemon --fee-strategy adaptive -h http://localhost:8545

  # Kurtosis (spamoor_params)
  spamoor_params:
    extra_args:
      - --fee-strategy=adaptive

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.

2 participants