Repository navigation
fix(client): replace a stored pool the chain has no record of in a funding recovery step - #2668
Merged
Merged
Conversation
…nding recovery step `getPool` on an unknown pool id returns a zeroed struct: a zero owner and the status `Open` (enum value 0). The recovery step read that as another owner's pool and tried a `topUp`, which reverts `NotPoolOwner`, so the fetch ended "funding needed" behind an opaque revert. On a full pool the step settled on a pool that does not exist. A shared classifier (`PoolStanding`) now reads a `getPool` answer for both the lane-build reuse check and the recovery step. The recovery step treats an unknown pool as gone and opens a replacement, unless a run of the same command opened the pool or read it on chain as this wallet's (`UnconfirmedEscrows::note_live`). Such a pool reads as unknown only on a lagging RPC, and a replacement would escrow a second deposit. The lane-build reuse check keeps an unknown pool, as before. Closes #2665 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 3 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…Up lock A mined topUp shows its pool live, as an open or an owned read does, so a later lagging read that shows no record keeps the pool. The replacement of an unknown pool takes the run's topUp lock first, refuses while a topUp of the command is unconfirmed, and keeps a pool a sibling's topUp showed live while the step waited: each could otherwise escrow a second deposit beside a pool the chain knows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
PoolFunder::chain_remainingreadsgetPool. A pool id the chain does not know returns a zeroed struct: a zero owner, and the statusOpen, becauseOpenis enum value 0 inPaymentPool.sol. The recovery step read that as another owner's pool:topUp, which revertsNotPoolOwner(the contract checksstatusbeforeowner), notPoolNotOpen. The step skipped the replacement path, so the fetch ended "funding needed" behind an opaque revert.pool_accepts_fundssaw the estimate revert, fell back togetPool, readOpen, and the step settled on a pool that does not exist.Changes:
PoolStanding { Open, NotAccepting, Unknown, Foreign }, reads agetPoolanswer for both the lane-build reuse check (still_open) and the recovery step.Unknownas gone and opens a replacement, as for a closed pool. The exception is a pool that a run of the same command saw live: it opened the pool, or read it on chain as this wallet's.UnconfirmedEscrowsis the command-wide handle that already outlives each pass, and it now records those pools (note_live/saw_live). Such a pool reads as unknown only on a lagging RPC, and replacing it would escrow a second deposit, so the step keeps today's run-view fallback with a specific warning.still_openstill keeps an unknown pool: a lagging RPC can miss a pool opened moments ago.a_tracked_pool_is_reused_only_while_the_chain_shows_it_openis unchanged and still passes. It now also pins which reads mark a pool live.PoolFunder::replacefolds the three replacement call sites into one.ADR 003 § Funding recovery states the rule.
Closes #2665
Reviewer notes
chain_remaining/funds_on_chainandrecoverincrates/client/src/funding.rs,PoolStandingnext tostill_open, andnote_liveincrates/client/src/buyer_pool.rs.NotFound(PoolUnconfirmed), neverUnfunded(ADR 003 § Funding recovery). So this step runs on an unknown pool only when some node still refusesUnfundedorPoolExhausted(e.g. from its cached admission) while the client's chain read shows no record. A stale row that every node answers withNotFoundends the fetch before any recovery step, and this PR does not touch that dead end. It is worth a follow-up issue if it shows up in practice.Verification
funding/adoption_tests.rs:a_stored_pool_the_chain_does_not_know_is_replaced(top-up path)a_full_stored_pool_the_chain_does_not_know_is_replaced(settle path)a_pool_the_command_saw_live_is_not_replaced_on_a_lagging_reada_tracked_pool_is_reused_only_while_the_chain_shows_it_open,a_lost_row_adopts_the_live_pool_and_resumes_from_the_chain_watermarkandan_open_after_an_unrecorded_open_is_refused.GoneGonenote_liveinstill_opennote_liveon adoptionnote_liveon a mined openUnknownread marked livepre-commit runon the change.cargo denyreports only the existing warn-only advisories.CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-featurescargo nextest run -p decdn-client -p decdn-incentive: 1538 passedCARGO_BUILD_WARNINGS=deny cargo doc -p decdn-client --no-deps --document-private-itemsfix, lowercase subjectpub(crate)items changed.decdn-clientsnapshot not regenerated.adr/:make -C adr check-refs.architecture.mdhas no recovery-step summary to update.🤖 Generated with Claude Code