-
Notifications
You must be signed in to change notification settings - Fork 329
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
feat: ICRC-ledger: FI-1439: Implement V4 for ICRC ledger - migrate balances to stable structures #2901
Merged
Conversation
This file contains 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
maciejdfinity
changed the title
ICRC stable balances
feat(ICRC-ledger): FI-1439: Implement V4 for ICRC ledger - migrate balances to stable structures
Nov 29, 2024
Co-authored-by: Mathias Björkqvist <[email protected]>
mbjorkqvist
approved these changes
Dec 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for improving the tests and re-enabling the ignored ones!
I see our review is requested, but we don't seem to have anything to review for our team specifically - I'm assuming this was because of an earlier PR version. Let me know if that's not correct! |
mraszyk
reviewed
Dec 20, 2024
mraszyk
approved these changes
Dec 20, 2024
basvandijk
approved these changes
Dec 23, 2024
daniel-wong-dfinity-org
pushed a commit
that referenced
this pull request
Jan 7, 2025
…lances to stable structures (#2901) This version of the ledger migrates the balances stored by the ledger from heap to stable memory stable structures. This allows the ledger to store more data (heap memory is limited to 4GB) and reduces the number of instructions used during the upgrades - there is no need to serialize and deserialize the balances stored in heap memory. Since we are no longer limited by the heap size, the logic for trimming balances and related init/upgrade arguments (`maximum_number_of_accounts`, `accounts_overflow_trim_quantity`) were removed. The migration to stable structures is performed during the upgrade and, if 200B instruction limit is reached, using timer invocations after the upgrade. If timer invocations are used by the migration, the ledger is unavailable for transfers and approvals until migration is finished. The migration status can be checked by checking the value of the `ledger_stable_upgrade_migration_steps` metric and calling the `is_ledger_ready` endpoint. The metric will increase at roughly 1s intervals until the migration is finished. The canister logs will also contain some information about the number of migrated allowances and balances (e.g. "Migration partially done. Scheduling the next part. Number of elements migrated: allowances: 0 expirations: 0 balances: 7657..."). If migration is not progressing and the ledger is not ready, the ledger can still be downgraded to the previous version. After migration is finished and `is_ledger_ready` returns true, it is no longer possible to downgrade the ledger to the previous version . --------- Co-authored-by: Mathias Björkqvist <[email protected]>
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.
This version of the ledger migrates the balances stored by the ledger from heap to stable memory stable structures. This allows the ledger to store more data (heap memory is limited to 4GB) and reduces the number of instructions used during the upgrades - there is no need to serialize and deserialize the balances stored in heap memory. Since we are no longer limited by the heap size, the logic for trimming balances and related init/upgrade arguments (
maximum_number_of_accounts
,accounts_overflow_trim_quantity
) were removed. The migration to stable structures is performed during the upgrade and, if 200B instruction limit is reached, using timer invocations after the upgrade. If timer invocations are used by the migration, the ledger is unavailable for transfers and approvals until migration is finished. The migration status can be checked by checking the value of theledger_stable_upgrade_migration_steps
metric and calling theis_ledger_ready
endpoint. The metric will increase at roughly 1s intervals until the migration is finished. The canister logs will also contain some information about the number of migrated allowances and balances (e.g. "Migration partially done. Scheduling the next part. Number of elements migrated: allowances: 0 expirations: 0 balances: 7657..."). If migration is not progressing and the ledger is not ready, the ledger can still be downgraded to the previous version. After migration is finished andis_ledger_ready
returns true, it is no longer possible to downgrade the ledger to the previous version .