fix(gateway): retry on addMilestone write-throw (estimateGas read-lag under burst) - #163
Open
LamaSu wants to merge 1 commit into
Open
fix(gateway): retry on addMilestone write-throw (estimateGas read-lag under burst)#163LamaSu wants to merge 1 commit into
LamaSu wants to merge 1 commit into
Conversation
… under burst) Residual after #161: under burst concurrency, ~1/N creates still returned fast_track_failed. Logs showed the escrow created, then NO milestone-confirmed, dropped, reverted, or retry line — the signature of the addMilestone writeContract THROWING before the receipt wait. The existing try only wrapped waitForTransactionReceipt, so a write-throw propagated straight to fast_track_failed with no retry. Cause: eth_estimateGas for addMilestone runs against the just-created escrow and hits a load-balanced public-RPC replica that hasn't synced the createEscrowV2 yet -> "execution reverted". Same read-lag class as the getMilestoneCount bug #161 fixed, on a different call. Fix: move the addMilestone writeContract inside the existing try, so a write-throw is treated like a dropped receipt — abandon the escrow and mint a fresh one. The retry re-reads the nonce (no leak) and the createEscrowV2 round-trip gives the RPC time to sync. A mined-but-reverted tx still throws immediately. Context: #161 (trust-receipt) is verified live — single create works (0xcdC811, milestoneCount=1 on-chain) and 2/3 concurrent succeed. This targets the residual 1/3 (the write-throw path); to be verified post-deploy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Residual after #161 (the 1/3 concurrency failure)
#161 (trust-receipt) fixed the stale
getMilestoneCountread and is verified live: single create works (escrow0xcdC811…,milestoneCount=1on-chain), concurrency went 0/3 → 2/3. But 1/3 still returnedfast_track_failed.Root cause (from logs, not inferred)
The failed create's logs show: escrow created, then nothing — no milestone-confirmed, no dropped, no reverted, no retry. That pattern is only produced by the
addMilestonewriteContract throwing before the receipt wait. The existing try wrapped onlywaitForTransactionReceipt, so a write-throw skipped the retry → straight tofast_track_failed.Most likely:
eth_estimateGasfor addMilestone runs against the just-created escrow and hits a load-balanced public-RPC replica that hasn't synced thecreateEscrowV2yet → "execution reverted". Same read-lag class as thegetMilestoneCountbug #161 fixed, on a different call.Fix
Move the
addMilestonewriteContract inside the existing try, so a write-throw is treated like a dropped receipt — abandon the escrow, mint a fresh one. Safe because:createEscrowV2round-trip on the next attempt gives the RPC time to sync;Verification
tsc: 0 new errors in paid-job-flow.ts (the line-21 import error is pre-existing unbuilt-workspace noise).signer-locktest: 3/3.fast_track_failed.🤖 Generated with Claude Code