You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First PR of the stack implementing the balance-sweep deposit flow designed in #207. It adds the deposit_sol update endpoint and the deposit_status query with their Candid types, both returning a constant Queued status with a sweepable amount of zero, so that the interface can be reviewed and the following PRs each replace one stage of the constant with real behaviour: balance check, sweep, finalization, mint, and finally removal of process_deposit.
No cycles are charged, no RPC call is made and no state is changed. The anonymous principal is rejected as for the existing endpoints. Covered by unit tests and a PocketIC integration test.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified.
Review effort: Lite Findings: None
What changed in this PR
Adds skeleton deposit_sol and deposit_status endpoints for the balance-sweep deposit flow, returning a constant queued status without state changes or external calls.
Changes:
Added Candid and Rust deposit types and endpoints.
Wired the sweep module into the minter.
Added unit, integration, and anonymous-caller tests.
Introduce the Candid interface and shared types of the manual sweep flow:
`deposit_sol` queues the deposit address of an account for a sweep and
`deposit_status` reports the latest deposit of an account. Both endpoints
resolve the owner to the caller by default, reject the anonymous principal,
and for now return a constant `Queued` status with nothing to sweep.
Reading the balance, sweeping, and minting follow in later changes.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…wner
Exercise `deposit_sol` and `deposit_status` with an anonymous caller that
names a non-anonymous owner, and with a non-anonymous caller paying for
another owner, so that the owner argument is proven to be wired through.
Drop the unit test that only enshrined the placeholder status.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nd deposit_status
`deposit_sol` now returns the identifier of the queued deposit and
`deposit_status` takes that identifier, like `withdraw` and
`withdrawal_status` exchange the burn index. The `Queued` status no longer
echoes the account, and `deposit_status` no longer resolves an owner, so it
accepts any caller and returns null for an unknown identifier.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…indices
Follow the crate's convention for boundary identifiers instead of a
newtype with a hand-written Candid implementation, and fix the stale
documentation of `DepositSolArgs`, which no longer serves `deposit_status`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every successful call returns the same DepositSolId (0). The public contract defines this as a sequence number that identifies each sweep for its entire lifetime, so a second request cannot be distinguished from the first and historical statuses will collide once state is implemented. Allocate a persisted monotonically increasing id instead of reusing the placeholder.
This issue also appears on line 13 of the same file.
The reason will be displayed to describe this comment to others. Learn more.
🤖 Done in 32ec08f: the sweep module's deposit_sol now asserts the resolved account is non-anonymous via a shared assert_non_anonymous_account helper (main.rs keeps the same trap and message for the other endpoints). Covered by a should_panic unit test on the sweep function and the anonymous-caller integration loop.
The reason will be displayed to describe this comment to others. Learn more.
🤖 Done in 32ec08f: one table-driven test should_queue_deposit_for_non_anonymous_owner over (user 1 for self, with and without explicit owner), (user 2 for user 1) and (anonymous for user 1), all asserting the same Ok(id) and Queued status.
…he deposit_sol tests
The sweep module now rejects an anonymous owner itself, through a check
shared with the other endpoints, so `deposit_sol` only resolves the owner
in the canister entry point. The integration tests cover, in one table,
a user depositing for themselves, another user paying for them, and the
anonymous principal paying for them; the unit tests check the queued
status hand in hand with the outcome of `deposit_sol`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The endpoints reuse ID 0 and report queued status for unknown IDs, preventing reliable deposit identification.
Review effort: Lite Findings: None
Previously missed (1)
In code that hasn't changed since last review
deposit_status returns queued for unknown deposit IDs
minter/src/deposit/sweep/mod.rs:19
deposit_status ignores its argument and returns a queued status for every value, so deposit_status(123) reports a real deposit even though the Candid contract says unknown IDs return null. This makes mistyped or stale IDs indistinguishable from queued deposits; at minimum, the skeleton should only recognize its placeholder ID, and the real implementation must look up the requested ID.
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
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.
First PR of the stack implementing the balance-sweep deposit flow designed in #207. It adds the
deposit_solupdate endpoint and thedeposit_statusquery with their Candid types, both returning a constantQueuedstatus with a sweepable amount of zero, so that the interface can be reviewed and the following PRs each replace one stage of the constant with real behaviour: balance check, sweep, finalization, mint, and finally removal ofprocess_deposit.No cycles are charged, no RPC call is made and no state is changed. The anonymous principal is rejected as for the existing endpoints. Covered by unit tests and a PocketIC integration test.
🤖 Generated with Claude Code