chore: one-time migration to convert AcceptedManualDeposit events to AcceptedDeposit#180
Draft
lpahlavi wants to merge 1 commit intolpahlavi/unify-accepted-deposit-eventfrom
Draft
Conversation
d8ad4e5 to
cbb9b76
Compare
7f7d9c7 to
8fb7c48
Compare
AcceptedManualDeposit events to AcceptedDeposit
…AcceptedDeposit
Adds a post_upgrade migration that reads all stored AcceptedManualDeposit
events (CBOR tag #[n(2)], no source field) using a LegacyEvent/LegacyEventType
decoder and rewrites them as AcceptedDeposit { source: Manual } events using
the new Event encoding (same CBOR tag #[n(2)], with mandatory source field).
The migration uses a separate LegacyEventType enum that matches the old on-disk
CBOR format, avoiding any changes to the production EventType. After the
migration runs, all stored events use the new format and the LegacyEvent types
and migration code can be removed.
Two unit tests verify correctness and idempotency of the migration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8fb7c48 to
5fb1ee6
Compare
AcceptedManualDeposit events to AcceptedDepositAcceptedManualDeposit events to AcceptedDeposit
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
One-time migration to run when deploying the
AcceptedDepositsource field (#179).LegacyEvent/LegacyEventTypethat exactly mirrors the old on-disk CBOR format (nosourcefield at index #[n(2)])post_upgradecallsmigrate_event_log(), which reads all stored events viaLegacyEvent, convertsAcceptedManualDeposit → AcceptedDeposit { source: Manual }, and rebuilds the stable log in the new formatDeploy order: this PR must be installed on the canister before #179 is the live version, since #179's
Event::from_byteswill panic on the oldAcceptedManualDepositbytes.Test plan
cargo test -p cksol_minter --lib storagepasses both migration testsget_eventsstill returns all historical depositsLegacyEvent*andmigrate_accepted_manual_deposit_events🤖 Generated with Claude Code