Skip to content

feat(mev): add eth_sendBundle rate limit option - #224

Merged
thanhpp merged 1 commit into
mainfrom
feat/mev-send-bundle-rate-limit
Sep 5, 2026
Merged

thanhpp merged 1 commit into
mainfrom
feat/mev-send-bundle-rate-limit

Conversation

@thanhpp

@thanhpp thanhpp commented Sep 2, 2026

Copy link
Copy Markdown
Member

What

Add an optional per-client rate limit for eth_sendBundle requests in pkg/mev, and size it for the Ultrasound builder.

Why

Ultrasound caps the eth_sendBundle rate per endpoint at 50 requests per second. A client over the limit should fail the call at once instead of queuing, because a late bundle has no value.

Changes

  • WithSendBundleRateLimit(requestsPerSecond, burst) in pkg/mev/bundle_sender_options.go, backed by golang.org/x/time/rate.Limiter.
  • postBundle in pkg/mev/bundle_sender.go checks the limiter only for ETHSendBundleMethod and returns the new ErrSendBundleRateLimited (pkg/mev/errors.go) when no token is free.
  • UltrasoundSendBundleRPS and UltrasoundSendBundleBurst constants in pkg/mev/constants.go, both 50, one limit per Ultrasound endpoint.
  • go.mod: golang.org/x/time moves from indirect to direct.
  • pkg/mev/bundle_sender_rate_limit_test.go: 5 tests for the burst limit, that only eth_sendBundle is limited, the unlimited default, a non-positive limit, and the Ultrasound constant values.

Test plan

  • go build ./...
  • go test ./pkg/mev/... (new tests pass)
  • golangci-lint run --config=.golangci.yml ./pkg/mev/... (only pre-existing issues, unrelated to this change)
  • go mod tidy (no further change)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ef5HwDcHb2r5EhaYbjhFEc

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ef5HwDcHb2r5EhaYbjhFEc
@thanhpp
thanhpp force-pushed the feat/mev-send-bundle-rate-limit branch from 585be8d to 6f103b0 Compare September 2, 2026 04:31
@thanhpp
thanhpp requested review from hiepnv90 and vaigay September 2, 2026 04:32
@thanhpp
thanhpp merged commit d89be2a into main Sep 5, 2026
3 checks passed
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