refactor: remove owner field from UpdateBalanceArgs#169
Open
refactor: remove owner field from UpdateBalanceArgs#169
UpdateBalanceArgs#169Conversation
The `update_balance` endpoint now always uses the caller's principal as the owner, preventing callers from registering automated deposit monitoring on behalf of arbitrary principals. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace `default_update_balance_args()` fixture helper and explicit
`UpdateBalanceArgs { subaccount: None }` literals with
`UpdateBalanceArgs::default()`. Also updates the Candid interface to
remove the now-deleted `owner` field and its stale doc comment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The loop in `should_fail_for_anonymous_owner` covers endpoints that accept an explicit `owner` field. Since `update_balance` no longer has an `owner` field, calling it with `DEFAULT_CALLER` (case 1 of the loop) would succeed, not reject. Move the `update_balance` assertion below the loop where it is tested only with an anonymous caller, matching how `withdraw` is already handled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
UpdateBalanceArgs
The accounts list included an entry with a different owner (Principal::from_slice(&[1])). With the old API this registered that principal's account. Now that update_balance always uses the caller, that call is a duplicate of the DEFAULT_CALLER/no-subaccount entry and emits no event, so the expected-count assertion failed (3 events vs 4). Remove the entry; the test now only covers subaccount variants for the caller. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nce test Since update_balance always uses the caller as owner, the test no longer needs a list of Account structs. Iterate over subaccounts directly and derive the expected accounts by pairing them with DEFAULT_CALLER. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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
owner: Option<Principal>field fromUpdateBalanceArgs, soupdate_balancealways uses the caller's principal as the owner🤖 Generated with Claude Code