fix: try every completion log when completing a partial note - #25121
Draft
vezenovm wants to merge 1 commit into
Draft
fix: try every completion log when completing a partial note#25121vezenovm wants to merge 1 commit into
vezenovm wants to merge 1 commit into
Conversation
step_pending only ever tried completion_logs.get(0), and completion marked the FSM completed whether or not that log discovered anything. The completion log tag is not unique, so a log yielding no note sitting ahead of the genuine completion permanently consumed it and the note was silently lost. Every fetched log is now tried in turn and the first that yields a note completes the reception. If none does the reception still advances on the first log, preserving #24668's property that a poisoned delivery cannot keep it re-running nonce discovery on every sync.
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.
step_pendingonly ever triedcompletion_logs.get(0), and completion marked the FSM completed whether or not that log discovered anything. The completion log tag is not unique, so a log yielding no note sitting ahead of the genuine completion permanently consumed it. The note was silently lost.Every fetched log is now tried in turn, and the first that yields a note completes the reception. If none does, the reception still advances on the first log, preserving #24668's property that a poisoned delivery cannot keep it re-running nonce discovery on every sync.
Red/green
step_discovers_the_note_when_an_earlier_completion_log_yields_nonefails onnext:enqueued_note_count()is 0, expected 1, while the FSM still reachesis_completed.Green after the fix:
partial_notes::fsm15/15,token_contract test::transfer_to_private8/8 (including #24668'sdiscovery_tolerates_a_partial_note_completed_twice).Known gap
A genuine completion mined after a non-discovering log is still lost if a sync lands between the two blocks. Every fetch returns the tag's full history (
LogRetrievalRequest::newleavesfrom_blockunset), so it only bites in that window.Closing it needs the reception to stay pending when nothing discovers, which is only safe once it has a TTL. Delivery is unconstrained, so anyone can otherwise spam bogus partial notes that never leave Pending and cost a full nonce-discovery pass every sync. The sibling offchain-reception FSM already does this (
messages/processing/offchain/reception.nr:242). Tracked in F-828.