Skip to content

chore: one-time migration to convert AcceptedManualDeposit events to AcceptedDeposit#180

Draft
lpahlavi wants to merge 1 commit intolpahlavi/unify-accepted-deposit-eventfrom
lpahlavi/migrate-accepted-deposit-events
Draft

chore: one-time migration to convert AcceptedManualDeposit events to AcceptedDeposit#180
lpahlavi wants to merge 1 commit intolpahlavi/unify-accepted-deposit-eventfrom
lpahlavi/migrate-accepted-deposit-events

Conversation

@lpahlavi
Copy link
Copy Markdown
Contributor

@lpahlavi lpahlavi commented Apr 24, 2026

Summary

One-time migration to run when deploying the AcceptedDeposit source field (#179).

  • Defines LegacyEvent / LegacyEventType that exactly mirrors the old on-disk CBOR format (no source field at index #[n(2)])
  • post_upgrade calls migrate_event_log(), which reads all stored events via LegacyEvent, converts AcceptedManualDeposit → AcceptedDeposit { source: Manual }, and rebuilds the stable log in the new format
  • All other event variants pass through unchanged
  • Two unit tests verify correctness and idempotency
  • After the migration is confirmed on the deployed canister, this PR's code (LegacyEvent types + migration call) can be deleted

Deploy order: this PR must be installed on the canister before #179 is the live version, since #179's Event::from_bytes will panic on the old AcceptedManualDeposit bytes.

Test plan

  • cargo test -p cksol_minter --lib storage passes both migration tests
  • Install on testnet, verify get_events still returns all historical deposits
  • After confirming, schedule removal of LegacyEvent* and migrate_accepted_manual_deposit_events

🤖 Generated with Claude Code

@lpahlavi lpahlavi force-pushed the lpahlavi/unify-accepted-deposit-event branch from d8ad4e5 to cbb9b76 Compare April 24, 2026 14:09
@lpahlavi lpahlavi force-pushed the lpahlavi/migrate-accepted-deposit-events branch from 7f7d9c7 to 8fb7c48 Compare April 24, 2026 14:19
@lpahlavi lpahlavi changed the title chore: one-time migration to convert AcceptedManualDeposit events to AcceptedDeposit chore: one-time migration — convert AcceptedManualDeposit events to AcceptedDeposit Apr 24, 2026
@lpahlavi lpahlavi changed the title chore: one-time migration — convert AcceptedManualDeposit events to AcceptedDeposit chore: one-time migration — convert AcceptedManualDeposit events to AcceptedDeposit Apr 24, 2026
…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>
@lpahlavi lpahlavi force-pushed the lpahlavi/migrate-accepted-deposit-events branch from 8fb7c48 to 5fb1ee6 Compare April 24, 2026 14:41
@lpahlavi lpahlavi changed the title chore: one-time migration — convert AcceptedManualDeposit events to AcceptedDeposit chore: one-time migration to convert AcceptedManualDeposit events to AcceptedDeposit Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant