fix: harden autoclaim L1 detection against batch limits and failing RPCs (#1889) - #1890
arnaubennassar wants to merge 8 commits into
Conversation
…h-limit parsing (#1889) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
…1889) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
…k-off (#1889) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
…tries (#1889) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
Both bridge detectors now emit a Debug log line and increment the skipped-already-claimed metric for every bridge skipped because the target already claimed it. L1ToL2 gains PollResult.AlreadyClaimedCount so already-claimed bridges are no longer folded into IgnoredBridgeCount. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
|
Claude finished @arnaubennassar's task in 1m 25s —— View job Review of PR #1890: harden autoclaim L1 detection against batch limits and failing RPCsI read the full diff for the core logic: Overall the design is sound and the isolation, cursor-hold and back-off invariants are well reasoned and documented. I found no 🔴 blockers. 🚀 What's New
🐛 Bug Fixes
📋 Config UpdatesNew optional key in the RPC client config ( BatchBlockHeaderRetrieval = true
BatchRequestMaxSize = 1000 # default 1000; 0 or missing = 1000; negative = validation error
|
…tors (#1889) - etherman: bound the parsed batch limit by math.MaxInt32 before converting to int64 (clears the CodeQL incorrect-integer-conversion alert) - common: make the keyword match for limit errors without a number more specific so rate-limit messages no longer permanently shrink the batch size - common: only normalise numbers of four or more digits in RepeatedErrorLogger so HTTP status codes (429 vs 500) stay distinct - autoclaim: share the back-off failure bookkeeping (metric, 429 wording, Warn) between the L1ToL2 and L2ToLx detectors - docs: recommend alerting on the stalled-destinations gauges and explain the L2ToLx block-window limitation; add small doc comments Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM
|
This PR also appears to fix #1883 (one failing destination withholding the L1→L2 cursor for the whole group) and #1884 (no reactive back-off on 429s): |
| @@ -0,0 +1,140 @@ | |||
| package common | |||
There was a problem hiding this comment.
This feautre is already implemented using common/retry_backoff_config.go
Retries policies could be defined as specific delays of a exponential backoff way. Using RetryPolicyGenericConfig.
I suggest to use the already existing mechanism
🔄 Changes Summary
BatchRequestMaxSize. It parses the provider limit from errors liketoo many batch requests, max is N, otherwise halves, and shrinks only on recognised batch-limit errors. The multidownloaderStartloop now uses exponential back-off (100 ms to 10 s, with jitter) and throttled error logging instead of a 1 ms retry loop.autoclaim_l1_to_l2_stalled_destinations,autoclaim_l2_to_lx_stalled_destinations,autoclaim_detector_destination_errors_total,autoclaim_detector_skipped_already_claimed_total.eth_getLogsomissions confirmed by arbitration now splice the recovered logs instead of retrying the whole range (cap of 8 omitted blocks, then fallback to the previous behaviour). New metrics:sync_logs_omission_confirmed_totalandsync_logs_omission_range_retries_total. Logs are quieter.📋 Config Updates
[L1NetworkConfig.RPC]and[Common.L2RPC]), next toBatchBlockHeaderRetrieval:A missing key or
0means1000; a negative value is a validation error.🔌 API Updates
🔌 Bridge service API
🔌 Proxy API
🔌 Others API
✅ Testing
batch_size_adaptivetests (etherman), back-off tests incommonandmultidownloader, L1ToL2/L2ToLx isolation and back-off tests including cursor invariant checks, sync splice tests, and already-claimed trace tests.TestE2E_BatchLimitedProvider(go test -run TestE2E_BatchLimitedProvider ./multidownloader/).TestAutoClaimL1ToL2FailingDestinationIsolated(added to the CI autoclaim matrix) plus the existing autoclaim e2e tests, all passing locally.make lintandmake test-unitare green on the rebased history.AGGKIT_E2E_ENV=anvil-2chains make test-e2e TEST_RUN='^TestAutoClaimL1ToL2FailingDestinationIsolated$'. Note: e2e metrics output and quoted back-off log lines were not captured (the e2e tests use assertions only); metrics are verified at unit level.🐞 Issues
🔗 Related PRs
📝 Notes
eth_getLogsomitted logs for a few blocks, we fetch the missing blocks' logs and splice them into the result rather than retrying the whole range. This is safe because the arbitration result is authoritative for those blocks and the spliced set is checked for completeness as before. If more than K=8 blocks are omitted, we fall back to the previous whole-range retry.Retry-Afteris not honoured because go-ethereum's RPC error drops response headers.BlockWindowblocks later are not reached until it recovers (accepted design, documented indocs/autoclaim.md).skipped_already_claimedrequest state.Retry-Afterif a header-preserving transport is added.🤖 Generated with Claude Code
https://claude.ai/code/session_017eyBoQ7G2hoShKEzAQvZWM