fix(relayer): stop a dispatch race from relaying finished packets twice #1545
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.48) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 113 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.47 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.283
No Reviewer Assigned
no_reviewer_assigned
0.120
Real PR Conversation Timeline
1 item
"Review active on #1545"
general
weight: 0.35
gjermundgaraba
Summary
Fixes a race in the relayer's dispatcher between reading the packet list and pushing each packet into its pipeline.
Each tick, the dispatcher reads the dispatchable packets (
dispatcher.go), then pushes each one into its route's pipeline. The pipeline's deduper rejects a push only while the same packet is still in flight. If a packet's transfer leaves the pipeline after the read but before the push, the deduper lets the push through, and the packet goes round the pipeline again from data read before its first run finished. The second run:The fix closes the window. The deduper now keeps a packet claimed after its transfer leaves the pipeline, until
Release, which the dispatcher calls once per tick, before reading. A packet is pushed again only from a read made after its previous run ended, which is the next tick, as before.Evidence
Anvil bursts of 3000 IFT transfers (1500 per direction) from the e2e load test, with the relayer on main (before) and with this change (after):
| | before | after (two runs) |
|---|---|---|
|
Transfer completelog lines | 4019 | 3000, 3000 || "Packet already received on destination chain" lookups | 442 | 0, 0 |
| "Packet commitment gone from source chain" lookups | 191 | 0, 0 |
| Succeeded packets later listed as pending | 28 | 0, 0 |
About a third of the packets were relayed through the pipeline twice.
Test plan
Release.go test ./...andgo test -race ./internal/relay/...incli/golangci-lint run ./...incli/🤖 Generated with Claude Code