fix: handle resubmission replay for canisters without ExpiredTransaction#123
Closed
fix: handle resubmission replay for canisters without ExpiredTransaction#123
ExpiredTransaction#123Conversation
6278d71 to
0ad0215
Compare
99c4f76 to
0b635f9
Compare
0ad0215 to
bfc8681
Compare
0b635f9 to
a7040bf
Compare
bfc8681 to
3a69214
Compare
a7040bf to
7d47203
Compare
3a69214 to
ef2dc10
Compare
ef2dc10 to
0945f05
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an upgrade-time migration intended to backfill missing ExpiredTransaction events for older staging deployments so that the resubmission queue logic remains correct after replaying the event log.
Changes:
- Introduces
migrate_resubmission_queue()to scan the audit log and append syntheticExpiredTransactionevents. - Adds a compatibility fallback in
State::process_transaction_resubmittedfor logs that predateExpiredTransaction. - Hooks the migration into
post_upgrade, and adds a storage helper to record an event with an explicit timestamp.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
minter/src/storage/mod.rs |
Adds record_event_at to append events with an explicit timestamp. |
minter/src/state/mod.rs |
Adds backward-compat logic when replaying old ResubmittedTransaction events. |
minter/src/migrate.rs |
New migration that scans the event log and appends synthetic ExpiredTransaction events. |
minter/src/lifecycle.rs |
Calls the migration during post_upgrade and logs the count. |
minter/src/lib.rs |
Registers the new migrate module. |
minter/cksol_minter.did |
Trailing whitespace/newline adjustment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0945f05 to
cfa0d73
Compare
cfa0d73 to
4748e32
Compare
Canisters deployed before ExpiredTransaction was introduced (#122) have event logs where ResubmittedTransaction events have no preceding ExpiredTransaction. The updated state machine requires the transaction to be in transactions_to_resubmit before it can be resubmitted, so replaying such logs would panic. The fix is a fallback in process_transaction_resubmitted: if the old signature is in submitted_transactions rather than transactions_to_resubmit, process_transaction_expired is called inline first. This makes every replay of old event logs correct. To be removed after the staging migration is complete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4748e32 to
a99910a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ExpiredTransaction
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
Canisters deployed before
ExpiredTransactionwas introduced (#122) have event logs whereResubmittedTransactionevents have no precedingExpiredTransaction. The updated state machine (#122) requires the transaction to be intransactions_to_resubmitbefore it can be resubmitted, so replaying such logs would panic.The fix is a fallback in
process_transaction_resubmitted: if the old signature is insubmitted_transactionsrather thantransactions_to_resubmit(i.e. no precedingExpiredTransactionin the log),process_transaction_expiredis called inline first. This makes every replay of old event logs correct, with no separate migration step or post-replay scan needed.To be removed after the staging migration is complete.
🤖 Generated with Claude Code