Repository navigation
feat(minter): snapshot the watchlist before every upgrade - #285
Draft
gregorydemay wants to merge 7 commits into
Draft
gregorydemay wants to merge 7 commits into
gregorydemay wants to merge 7 commits into
Conversation
gregorydemay
added this pull request to stack #288
October 14, 2026 08:50
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 09:04
2878ffd to
8494587
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Snapshot events currently prevent binary rollback and can make event-query pages exceed response limits.
2 open findings
What changed in this PR
Persists the automatic-deposit watchlist across canister upgrades through event-log snapshots.
Changes:
- Adds watchlist snapshot serialization and replay.
- Records snapshots during
pre_upgrade. - Adds unit, Candid, and PocketIC coverage.
| File | Description |
|---|---|
minter/src/test_fixtures/mod.rs |
Generates snapshot events for property tests. |
minter/src/state/watchlist/tests.rs |
Tests snapshot reconstruction. |
minter/src/state/watchlist/mod.rs |
Implements snapshot and restoration. |
minter/src/state/tests.rs |
Tests snapshot replay ordering. |
minter/src/state/mod.rs |
Restores snapshots into state. |
minter/src/state/event/candid/mod.rs |
Converts snapshot Candid types. |
minter/src/state/event.rs |
Defines the persisted snapshot event. |
minter/src/state/audit.rs |
Applies snapshot events during replay. |
minter/src/main.rs |
Registers the pre_upgrade hook. |
minter/src/lifecycle/tests.rs |
Tests snapshot recording. |
minter/src/lifecycle.rs |
Records snapshots before upgrades. |
minter/cksol_minter.did |
Exposes snapshot debug-event types. |
libs/types-internal/src/event.rs |
Adds public event representations. |
integration_tests/tests/tests.rs |
Tests restoration across an upgrade. |
integration_tests/src/fixtures.rs |
Adds watchlist test constants. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+233
to
+234
| #[n(15)] | ||
| WatchedDepositAddresses(#[n(0)] WatchlistSnapshot), |
Comment on lines
+248
to
+249
| #[n(2)] | ||
| pub entries: Vec<WatchedDepositAddress>, |
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 09:18
8494587 to
8888936
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 09:20
8888936 to
4e94eae
Compare
Comment on lines
+49
to
+51
| #[ic_cdk::pre_upgrade] | ||
| fn pre_upgrade() { | ||
| cksol_minter::lifecycle::pre_upgrade(IcCanisterRuntime::new()); |
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 09:35
4e94eae to
5dde44b
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 09:56
5dde44b to
2aa32af
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 14, 2026 11:19
2aa32af to
b97a96b
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 15, 2026 09:04
ec2b60b to
c3b8c88
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 15, 2026 09:54
c3b8c88 to
1313d8e
Compare
gregorydemay
force-pushed
the
DEFI-2780-10-watchlist-snapshot
branch
from
October 15, 2026 11:28
1313d8e to
7cac93c
Compare
Comment on lines
+129
to
+133
| entries: snapshot | ||
| .entries | ||
| .into_iter() | ||
| .map(CandidWatchedDepositAddress::from) | ||
| .collect(), |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…napshot Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…estoring a snapshot Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…shot tests Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.

The watchlist of the automatic deposit flow of #272 lives on the heap and registrations are not recorded as events, so a new
pre_upgradehook records a snapshot of it on every upgrade, empty included, and replay restores the latest one. Covered by unit tests and a PocketIC test of a registration surviving an upgrade.🤖 Generated with Claude Code