Skip to content

feat(nns): Support disbursing maturity to an AccountIdentifier #5351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

jasonz-dfinity
Copy link
Contributor

@jasonz-dfinity jasonz-dfinity commented May 28, 2025

Why

Currently, DisburseMaturity supports disbursing into any icrc1 account. However, we still have valid use cases beyond icrc1 account, for example for disbursing into a CEX account, which typically does not use icrc1 account but a 32-byte account identifier.

What

  • Add to_account_identifier as a new field in the DisburseMaturity command input
  • Change account_to_disbures_to in the storage type into a oneof destination with the previous account_to_disbures_to as one variant.
  • Implement Destination::try_new to handle the 3 cases - (a) no account or account identifier (use caller), (b) account, and (c) account identifier
  • Implement the conversion from Destination to AccountIdentifier for the finalization (for minting ICPs).
  • Implement the conversion from Destination to Option<Account> and Option<AccountIdentifier> for the fields in "full neuron"
  • Perform a similar validation for neuron management proposals

Backward Compatibility

The main concern of the backward compatibility is that there can already be disbursements prior to this PR, and they do not use the oneof destination but the previous schema with only account_to_disbures_to. The oneof is designed to be compatible with the previous schema, and the test_deserialize_maturity_disbursement_from_old_format test is added to make sure that the decoding actually works, at the Storable level.

@jasonz-dfinity jasonz-dfinity requested a review from a team as a code owner May 28, 2025 23:22
@jasonz-dfinity jasonz-dfinity changed the title feat: Support disbursing maturity to an AccountIdentifier feat(nns): Support disbursing maturity to an AccountIdentifier May 28, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this pull request changes the behavior of any canister owned by
the Governance team in an externally visible way, remember to
update the corresponding unreleased_changelog.md file(s).

To acknowldge this reminder (and unblock the PR), dismiss this
code review by going to the bottom of the pull request page, look
for where it says this bot is requesting changes, click the three
dots on the right, select "Dismiss review", and supply one of the
following reasons:

  1. Done.

  2. No canister behavior changes.

To be more precise, "externally visible behavior change" usually
means that responses differ in some way. However, "externally
visible behavior change" is not limited to that. For example, it
could also means that the canister makes different requests to
other canisters.

@github-actions github-actions bot added the feat label May 28, 2025
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-3849 branch 2 times, most recently from 0a76ec0 to 09b5850 Compare May 29, 2025 16:07
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-3849 branch 3 times, most recently from ecb904e to 4fbdbec Compare May 29, 2025 22:23
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-3849 branch 2 times, most recently from 266b4b8 to 326720c Compare May 30, 2025 18:20
Base automatically changed from jason/NNS1-3788 to master May 30, 2025 18:50
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-3849 branch 2 times, most recently from 420bc4b to 329b618 Compare May 30, 2025 20:28
@oggy-dfin
Copy link
Member

TLA instrumentation changes LGTM, thanks!

Copy link
Contributor

@andrew-lee-work andrew-lee-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jasonz-dfinity jasonz-dfinity enabled auto-merge June 3, 2025 22:33
@jasonz-dfinity jasonz-dfinity added this pull request to the merge queue Jun 4, 2025
Merged via the queue into master with commit 7c9a1ab Jun 4, 2025
35 of 36 checks passed
@jasonz-dfinity jasonz-dfinity deleted the jason/NNS1-3849 branch June 4, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants