← Back to Pull requests

fix(e2e): make EVM transaction sending reliable under concurrent load #1550

Open
gjermundgaraba opened this pull request with 717 lines diff across 8 files
View on GitHub
gjermundgaraba gjermundgaraba commented on Oct 12, 2026 16:38 UTC
Author

Summary

First of the load-test stack: #1550 → #1551 → #1552 → #1553. It's useful on its own: these are harness bugs on main that only show up with many concurrent senders, which the load test (#1553) produces and the e2e suite doesn't.

With many concurrent senders, harness transactions hung on requests the node never answered, were refused with "Nonce too low", reverted during gas estimation, or failed to connect. This makes sending reliable under that load:

  • Requests the node doesn't answer are retried until the transaction's time budget runs out. A request with no answer within a quarter of the budget is abandoned and repeated. Transport failures, a null where a value must exist, HTTP 5xx and 429, and JSON-RPC -32603 (which Besu returns under load) are retried too. Errors the node does answer with, such as reverts, still fail at once. Submission and inclusion get one budget each, and Retry is exported so other readers share these rules.

  • A resend after an unanswered submission treats a refusal as success only if the node holds the transaction.

  • Each account keeps a nonce floor, one past the highest nonce it saw included, and never signs below it. Besu once answered a pending-nonce read with the nonce of a transaction it had just included, and the next send was refused with "Nonce too low".

  • Gas is estimated against pending first, falling back to latest on any node error. Estimating only at latest reverts IFT transfers: the rate limiter's bucket can be stamped with a block time newer than latest, and OpenZeppelin's RateLimiter then underflows.

  • Connections: every Dial shares one HTTP transport that reuses connections and caps them at 128 per node, so extra callers queue instead of piling onto the container runtime's port forwarding. (The CLI's pool in #1547 only keeps idle connections, up to 256, without a cap.) Besu accepts up to 1024 active RPC connections instead of 80.

  • Timing.TransactionWait is the one mapping from a Chain's timing to a transaction budget.
  • Test plan

  • go test ./internal/harness/chain/... ./internal/harness/environment/ in e2e/, including new send tests against a fake node (stalled requests, refused resends, the nonce floor, estimate fallback)

  • golangci-lint run ./... in e2e/

  • Full e2e suite (E2E_MODE=complete) passed on #1551 and #1553, which include this change
  • 🤖 Generated with Claude Code

    Diff: 717 lines (+652 / -65) across 8 files Reviewer: dhfang Review duration: 6809m
    All Vouch review confidence checks passed
    Residual risk 0.08 = Change Risk (0.53) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 717 lines diff across 8 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.81 · 3 substantive comment(s)
    0.81
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.393
    Real PR Conversation Timeline
    5 items
    github-actions[bot] github-actions[bot] commented on Oct 12, 2026 16:40 UTC
    Bot

    <!-- dependency-review:govulncheck -->

    Vulnerable dependencies

    11 advisories across 1 library need attention, 2 accepted.

    :rotating_light: Needs attention

    Go standard library

    In use: go1.26.6, go0.58.0 — reached from cli, e2e, gen/go/solidity-abi

    | Advisory | CVE | Fixed in | Summary |
    |---|---|---|---|
    | GO-2026-6599 | CVE-2026-94448 | go1.26.9 | Reset context tracking on consecutive template expressions in html/template |
    | GO-2026-6600 | CVE-2026-97030 | go1.26.9 | Recognize yield as regexp preceder keyword in html/template |
    | GO-2026-6603 | CVE-2026-78659 | go1.26.9 | HTTP/2 server memory exhaustion due to Trailer headers in net/http |
    | GO-2026-6605 | CVE-2026-56866 | go1.26.9 | HTTP/1 client connection desynchronization after CONNECT rejection in net/http |
    | GO-2026-6607 | CVE-2026-97031 | go1.26.9 | Reject malformed ECH outer extension references in crypto/tls |
    | GO-2026-6608 | CVE-2026-94440 | go1.26.9 | Memory limit bypass when parsing MIME headers in net/textproto, mime/multipart |
    | GO-2026-6610 | CVE-2026-78660 | go1.26.9 | HTTP/2 transport accepts malformed framing-related headers in net/http |
    | GO-2026-6611 | CVE-2026-78669 | go1.26.9 | Excessive CPU consumption from repeated initial window changes in net/http |
    | GO-2026-6612 | CVE-2026-78663 | go1.26.9 | Double flow control refund on HTTP/2 server streams in net/http |
    | GO-2026-6613 | CVE-2026-94439 | go1.26.9 | HTTP/1 server connection desynchronization after 2xx CONNECT response in net/http |
    | GO-2026-6617 | CVE-2026-97032 | go1.26.9 | HTTP/2 server crash due to HPACK encoder race in net/http |

    Run make vulncheck for the call paths. Either upgrade the library, or add the
    advisory to .govulncheck-ignore with a reason if no fix exists yet.

    Accepted

    Listed in .govulncheck-ignore with a reason.

    github.com/pion/dtls/v2

    In use: v2.2.12 — reached from cli, e2e

    | Advisory | CVE | Fixed in | Summary |
    |---|---|---|---|
    | GO-2026-4479 | CVE-2026-26014 | no fix yet | Usage of random nonce generation with AES GCM ciphers risks leaking the authentication key in github.com/pion/dtls |

    golang.org/x/crypto

    In use: v0.56.0 — reached from cli, e2e

    | Advisory | CVE | Fixed in | Summary |
    |---|---|---|---|
    | GO-2026-5932 | — | no fix yet | The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues |

    <sub>From make vulncheck-json on this run: logs.</sub>

    greptile-apps[bot] greptile-apps[bot] commented on Oct 12, 2026 20:28 UTC
    Bot

    <!-- greptile_summary -->

    <h2><a href="https://app.greptile.com/api/retrigger?id=79385260"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2>

    [Medium impact] Refactors EVM transaction sending for concurrent load handling\.

    The PR appears safe to merge, with a non-blocking gap in tests for concurrent transaction sends.

    <h2>Findings</h2>

    1. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Concurrent sends lack test coverage <a href="https://github.com/cosmos/ibc/pull/1550#discussion_r4252051279">▶</a>

    <h3>Summary</h3>

    This PR makes harness transaction sends more resilient under concurrent load.

  • EVM transactions retry temporary RPC failures and get a fresh wait for inclusion.

  • Each account keeps its sends in order and spends included nonces.

  • EVM clients reuse a bounded pool of node connections.
  • <details><summary><h3>Diagram</h3></summary>

    %%{init: {'theme': 'neutral'}}%%
    flowchart TD
      A[BroadcastTx] --> B[Acquire account gate]
      B --> C[Read nonce and build transaction]
      C --> D[Retry submission within budget]
      D --> E{Refused after unanswered attempt?}
      E -->|Yes| F[Look up transaction hash]
      F -->|Known| G[Release account gate]
      F -->|Missing| H[Return error]
      E -->|No, submitted| G
      G --> I[Poll receipt with separate budget]
      I --> J[Raise account nonce floor]
      J --> K{Receipt succeeded?}
      K -->|Yes| L[Return receipt]
      K -->|No| H
    

    </details>

    <!-- greptile_confidence_score:4 -->

    <sub>Reviews (1) · Last reviewed commit: "fix(harness): send EVM transactions safe..." · Reviewed by Greptile</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Oct 12, 2026 20:28 UTC
    Code Review
    e2e/internal/harness/chain/evm/client_test.go:1
    @@ -19,16 +19,27 @@ func TestRequireEOARejectsZeroBeforeRPC(t *testing.T) {
     }
     
     func TestTransactionSerializationObservesContext(t *testing.T) {
    -	client := &EVMClient{txGate: make(chan struct{}, 1)}
    -	client.txGate <- struct{}{}
    +	client := &EVMClient{accounts: map[common.Address]*accountState{}}
    +	sender := common.HexToAddress("0x01")
    +	gate := client.account(sender).gate
    +	gate <- struct{}{}
     	ctx, cancel := context.WithTimeout(t.Context(), 10*time.Millisecond)
     	defer cancel()
     
    -	err := client.acquireTx(ctx)
    +	err := acquireTx(ctx, client.account(sender).gate)
     
     	require.ErrorIs(t, err, context.DeadlineExceeded)
     }
     
    +func TestTransactionSerializationIsPerSender(t *testing.T) {
    +	client := &EVMClient{accounts: map[common.Address]*accountState{}}
    +	client.account(common.HexToAddress("0x01")).gate <- struct{}{}
    +	ctx, cancel := context.WithTimeout(t.Context(), time.Second)
    +	defer cancel()
    +
    +	require.NoError(t, acquireTx(ctx, client.account(common.HexToAddress("0x02")).gate))

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Concurrent sends lack test coverage

    TestTransactionSerializationIsPerSender checks the gates directly, while the new BroadcastTx tests send transactions one at a time. These tests can pass if unrelated accounts block each other or overlapping same-account sends use the wrong nonce.

    Add fake-node tests that stall one account's submission while another completes, and overlap sends from one account while checking the submitted nonces. This is a non-blocking test gap.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    dhfang dhfang approved these changes on Oct 15, 2026 01:19 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    gjermundgaraba gjermundgaraba
    Labels
    risk: low confidence: 84.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.6% (MEDIUM) · Higher = larger blast radius
    52.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 84.7% · Lower = rushed or shallow review
    84.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 8.1% · Safe to merge
    8.1%
    Repository