Repository navigation
Fix stale NodeProxy reconnect state - #31
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
lastblocksentries when NodeProxy removes a primary or fallback WSConn.Tests
mix lintmix format --check-formattedDIODE_MINIMAL_TEST=1 mix test --no-start test/remote_chain/(137 passed)DIODE_MINIMAL_TEST=1 mix test --no-start test/remote_chain/node_proxy_test.exs(39 passed)WALLETSis unset during test compilation.Note
Medium Risk
Touches connection teardown and staleness eviction in
NodeProxy, which affects which RPC providers stay in the pool; change is narrow and well-covered by regression tests.Overview
Fixes reconnect eviction where a new WebSocket for the same URL was treated as stale because
lastblockstimestamps are keyed by URL, not process id.When
remove_connection/2drops a primary or fallbackWSConn, it now collects the affected URLs (includingfallback_urlwhen the fallback dies) andMap.drops those keys fromlastblocks, so a replacement connection does not inherit the old provider’s stale block time.Tests assert fallback
lastblockscleanup on stale fallback eviction, add a regression for “evict stale → reconnect same URL → fresh conn stays in pool,” and factor WSConn stubs throughstub_data_connection/1.Reviewed by Cursor Bugbot for commit b00159a. Configure here.