Retry scripts on transient gRPC and pruned-state errors - #57
Merged
Conversation
Retry when the connection drops (codes.Unavailable); gRPC reconnects on the next attempt so these errors are transient. Reduce the script result channel buffer from 10000 to 500 to apply backpressure to producers earlier and bound memory usage.
…pruned When execution nodes prune state for a batch's reference block, retrying or splitting at the same height can never succeed. Add ScriptErrorActionRetryAtLatestHeight: the batch is resubmitted whole at the latest scanned height once it advances past the batch's height. If the batch is within PrunedStateFatalHeightGap of the latest scanned height (or nothing has been scanned yet), the error is fatal instead: state that close to the tip should never be pruned. All other resubmissions (retry, split, exclude) are also moved to the latest scanned height when it is higher, so retries never re-execute against potentially pruned state. AddressBatch.WithBlockHeight returns a height-adjusted copy that shares done-tracking with the original. Also skip the empty address in event candidate scanning: it is not a real account (e.g. TokensWithdrawn during the initial FLOW mint has no source) and can never be scanned.
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.
Description
Makes the script runner resilient to failures seen during long-running scans:
codes.UnavailablegRPC errors (connection drops); gRPC reconnects on the next attempt, so these are transient.PrunedStateFatalHeightGapof the latest scanned height (or nothing has been scanned yet), the error stays fatal.AddressBatch.WithBlockHeight, which shares done-tracking with the original batch.Most critical to review:
scanner/script_runner.go(new retry-at-latest-height path and fatal-gap check) andscanner/address_batch.go(WithBlockHeight).For contributor use:
mainbranchFiles changedin the Github PR explorer