fix(rust-sdk): propagate RPC errors in wait_past_perfect_time - #245
Open
crazywriter1 wants to merge 1 commit into
Open
fix(rust-sdk): propagate RPC errors in wait_past_perfect_time#245crazywriter1 wants to merge 1 commit into
crazywriter1 wants to merge 1 commit into
Conversation
Only retry when the node returns the expected PPT-too-far error; all other RPC failures are now returned to the caller instead of being silently swallowed as success. Adds unit and integration tests for the retry and error paths.
Author
|
Hi @poszu @shresthagrawal friendly ping for a review when you have a moment. This PR fixes
Happy to adjust if you’d prefer a different error-handling structure. Thanks! |
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.
Summary
Fixes a bug in
PodProvider::wait_past_perfect_timewhere unrelated RPC errors were silently treated as success.Previously, the retry loop used a catch-all branch that returned
Ok(())for any error that was not the expected "PPT too far in the future" response. This meant callers could believe waiting succeeded even when the node returned a real failure (for example, protocol validation errors).This PR:
Ok(())only when the RPC call succeeds-32602/"Requested PPT is too far in the future"errorProblem
Any non-retryable RPC failure was converted into success, which can hide real node/network issues from SDK callers.
Fix
Extracted retry logic into
wait_ppt_step()andis_ppt_too_far_error()so the behavior is explicit and testable:Ok(true)→ RPC succeeded, return successOk(false)→ retryable PPT-too-far error, sleep and retryErr(e)→ propagate error to callerTests
Added 8 tests in
rust-sdk/src/provider/mod.rs:success path
retry on PPT-too-far
error when retry budget is exhausted
unrelated RPC errors are propagated
PPT-too-far matcher requires exact code + message
mocked provider integration tests for success, retry, and error propagation
cargo test -p pod-sdk wait_ppt
Test plan
cargo test -p pod-sdk wait_ppt