We’re unable to upgrade our ICRC-1 ledger canister to any version released after 2024-09-13 due to stable memory compatibility issues.
Technical Details
Current Working Version: 2024-09-13 (commit: 5ba1412f) Canister ID: irorr-5aaaa-aaaak-qddsq-cai Network: IC Mainnet
Failed Upgrade Attempts
Attempted to upgrade to the following ledger-suite-icrc releases, all failing with the same error:
2024-10-17
2024-11-28
2025-01-07
2025-01-21
2025-02-27
2025-04-14
2025-05-22
Error Message
Error from Canister irorr-5aaaa-aaaak-qddsq-cai: Canister called `ic0.trap` with message:
'Panicked at 'Cannot upgrade from scratch stable memory, please upgrade to memory manager first.',
rs/ledger_suite/icrc1/ledger/src/main.rs:192:9'
The error suggests that ICRC-1 ledgers deployed before 2024-10-17 use “scratch stable memory” format, while newer versions expect “memory manager” format. This appears to be a breaking change in the stable memory layout.
Questions for the Community
Is there an intermediate upgrade path between 2024-09-13 and 2024-10-17 that handles the memory format migration?
Are there any migration tools or specific upgrade procedures for ledgers stuck on pre-2024-10-17 versions?
What’s the recommended approach for production ICRC-1 ledgers that need to stay on older versions for compatibility?
Will this be addressed in future releases with backward compatibility support?
Thanks for pointing to the migration post @marc0olo! @Vishnu if you are able to upgrade after referring to the instructions in the post, feel free to disregard my follow-up questions.
Just to clarify, you are running the Rust ICRC ledger from the ic repository? Did you build the canister yourself, or download the WASM from a CDN? The error suggests that you are running a pre-2024-09-13 release of the ledger.
Regarding your questions for the community:
Is there an intermediate upgrade path between 2024-09-13 and 2024-10-17 that handles the memory format migration?
No, the only (tested) path is the one documented in the post @marc0olo pointed to.
Are there any migration tools or specific upgrade procedures for ledgers stuck on pre-2024-10-17 versions?
Again, I’d refer to the other post.
What’s the recommended approach for production ICRC-1 ledgers that need to stay on older versions for compatibility?
DFINITY won’t maintain older versions with e.g., bugfixes or backporting of features. The fact that the older ledger versions store their data on the heap rather than in stable structures means that they are limited by the amount of data they can store. The recommended approach is to upgrade to the newer versions, and if you’re encountering issues, we’ll do our best to figure them out and help you upgrade!
Will this be addressed in future releases with backward compatibility support?
I’m not sure I fully understand the question, but backward compatibility in the sense of being to roll back a ledger running a newer WASM version that stores its data in stable structures, to an older version storing its data on the heap, will not be supported. This was considered as part of the migration work, but decided against, with one of the primary reasons being that ledgers using stable structures may end up storing large amounts of data that would no longer fit on the heap (and/or (de)serializing the data to/from stable memory during canister upgrades would run into the instruction limit).
Error from Canister irorr-5aaaa-aaaak-qddsq-cai: Canister called `ic0.trap` with message:
'Panicked at 'Cannot upgrade from scratch stable memory, please upgrade to memory manager first.',
rs/ledger_suite/icrc1/ledger/src/main.rs:192:9'
seems to be from the 2024-11-28 release. The earlier releases do not fail with that error, so if you could let us know what the error is when trying to upgrade to the 2024-10-17 release, that would be helpful!