fix(xmr): retry rate-limited FROST sign/partial within the signing round
Summary
This is a reliability fix for failed XMR keysigns. If the local XMR signer sidecar briefly rate-limits POST /v1/monero/sign/partial (HTTP 429), bifrost now retries that call within the same FROST signing round, so the round no longer fails.
Root cause
In a test-simulation BondYield-ChurnOut timeout (job 16972256830), one member's sidecar returned sign/partial -> 429 (0ms). Its scanner/sync returned 200 again two seconds later. Bifrost made a single call, so that member never produced its signature share. The other two members had already sent their shares, so they timed out with timeout waiting for share payloads, round:frost_share.
For XMR, frost_share is a terminal round. The signing claim stays reserved, and the client deliberately refuses a second FROST ceremony for that outbound. So the migrate was never signed. THORChain kept it pending, and the retiring XMR vault could not finish its churn.
Change
sidecar.Client.SignPartialContextretries only HTTP 429. That status is an admission rejection: the signer produced no share.- Up to 5 attempts, with backoff from 250ms doubling to 2s (about 4s in total). That is well inside the keysign timeout the peers wait for this node's share.
- Every attempt replays the exact serialized
msg_id,session_idandall_preprocesses. The retry stays in the same FROST session.
FrostAdapter.FrostSignPartialpasses its stop-channel context, so the backoff wait stops on bifrost shutdown.- Every other status, and transport errors, still fail on the first attempt, as before.
Idempotency
The retry happens before this node has a share to return, and it never leaves the current session:
- It never starts a second ceremony.
- It never changes the reserved signing claim, the signer cache or the spent-output tracking.
- After success, the round goes through combine and payload persistence unchanged.
Non-migrate XMR outbounds use the same signing path, so they get the same fix.
Tests
bifrost/pkg/chainclients/monero/sidecar/client_sign_partial_retry_test.go:
- A 429 followed by success completes, and every attempt sends the same request bytes. This also runs through the
FrostAdapterpath that go-tss calls. - The retry is bounded and returns the final 429 error.
- 400, 409, 500 and 503 are not retried.
- Cancellation stops the backoff wait.
Without the fix, a single 429 fails the partial with the same error seen in CI. The monero, monero/sidecar, signer and go-tss packages pass with -tags=mocknet, and the sidecar tests pass with -race. scripts/lint.sh and golangci-lint 1.63.4 with the trunk config are clean.
Closes #3384