Repository navigation
chain-write: recover success from stale transmission views in WriteReport - #915
Closed
DylanTinianov wants to merge 10 commits into
Closed
DylanTinianov wants to merge 10 commits into
DylanTinianov wants to merge 10 commits into
Conversation
…port The WriteReport action answers a write request from the forwarder's transmission state, read through each node's own RPC. Two exits could end the action without a reply while the transaction actually landed on chain: - pollTransmissionInfo erroring (stalled view or request timeout) - GetFailedTransmissionHash returning ErrUnexpectedSuccessfulTransmission (state read said failed, logs contain a success), previously logged and returned as an error Both paths skipped the receipt fetch and the gas usage record, so a node whose RPC view lagged the landing tx never reported the fee, and the workflow got an error for a write that succeeded. recoverSuccessFromLogs now answers from the transmission logs in both cases: a successful tx in the logs is ground truth, so its receipt is fetched and metered like the normal success path, on a fresh bounded deadline when the request context is already dead. Unexpected-success errors that cannot be recovered keep their existing error behavior. Tests: poll failure with a landed success recovers and meters; InvalidReceiver state with an unexpected success returns success and meters; poll errors without a success keep the original error. Co-Authored-By: Claude Code <noreply@anthropic.com>
product-security-plaid-production
Bot
requested review from
russell-stern and
silaslenihan
November 16, 2026 18:56
Contributor
|
👋 DylanTinianov, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
product-security-plaid-production
Bot
requested a review
from prashantkumar1982
November 16, 2026 18:56
DylanTinianov
marked this pull request as draft
November 16, 2026 18:59
Autofix: true
unconvert: belowMinimum is already uint64; the conversion is unnecessary and the gosec nolint comment with it. Co-Authored-By: Claude Code <noreply@anthropic.com>
The gomod cache restore repeatedly failed with "tar: Cannot open: File exists" on corrupted entries. Bump cache-version to rotate the cache key and force a fresh save. Co-Authored-By: Claude Code <noreply@anthropic.com>
DylanTinianov
marked this pull request as ready for review
November 17, 2026 17:40
DylanTinianov
marked this pull request as draft
November 17, 2026 19:45
DylanTinianov
marked this pull request as ready for review
November 20, 2026 22:10
The recoverSuccessFromLogs edit left it orphaned above the wrong function, leaving meteringFromReply undocumented. Co-Authored-By: Claude Code <noreply@anthropic.com>
When the write report's transmission poll fails, the gas usage is still metered: the recovery function retries the log scan on a fresh 30s deadline, fetching the receipt and emitting the meter record once the node's RPC catches up. Co-Authored-By: Claude Code <noreply@anthropic.com>
The write-report flow now recovers inline: when the poll fails, the last-chance log scan (30s timeout) fetches the receipt and meters. Previously the scan ran in a background goroutine, which raced with the test and made the failure invisible. Co-Authored-By: Claude Code <noreply@anthropic.com>
When the write report's transmission poll fails, the gas usage is still metered: the recovery function retries the log scan on a fresh 30s deadline, fetching the receipt and emitting the meter record once the node's RPC catches up. Co-Authored-By: Claude Code <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.
What
The
WriteReportaction answers a write request from the forwarder's transmission state, read through each node's own RPC. Two exits could previously end the action without a reply while the transaction actually landed on chain:pollTransmissionInfoerroring (stalled view or request timeout)GetFailedTransmissionHashreturningErrUnexpectedSuccessfulTransmission(the state read said failed, but the logs contain a success) — previously logged and returned as an errorBoth paths skipped the receipt fetch and the gas usage record entirely.
Why
A node whose RPC view lagged the landing transaction never reported the fee for a write that succeeded, and the workflow received an error instead of the successful outcome. Since every node answers independently from its own view, timing skew between nodes produced divergent answers for the same on-chain write.
How it works now
recoverSuccessFromLogsanswers from the transmission logs in both cases: a successful tx in the logs is ground truth, so its receipt is fetched and metered exactly like the normal success path. When the request context is already dead (poll timeout), the check runs on a fresh bounded deadline (finalReceiptCheckTimeout, 10s). Unexpected-success errors that cannot be recovered keep their existing error behavior — the recovery is strictly additive.