feat(kaspa): add migration lock file for escrow config safety#453
Merged
feat(kaspa): add migration lock file for escrow config safety#453
Conversation
When a validator enters migration mode, it writes a lock file containing the migration target (new escrow address). When the validator later starts in normal mode, it verifies the configured escrow matches the lock file. This prevents operators from forgetting to update their escrow config after a migration completes. The lock file serves as a reminder that must be resolved (either by updating config or manually deleting the file). Lock file behavior: - Migration mode: writes `kaspa_migration.lock` with new escrow address - Normal mode + lock exists + escrow matches: deletes lock, continues - Normal mode + lock exists + escrow mismatch: panics with clear error - Normal mode + no lock: continues (never migrated or manually cleared) This replaces the previous approach (PR #441) which queried old Kaspa transactions via REST API - those queries are unreliable for old/pruned TXs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Adds a local lock file mechanism to prevent operators from running with stale escrow config after migration.
How It Works
Migration mode startup:
kaspa_migration.lockto the db directoryNormal mode startup:
Example Error
Why This Approach
The previous approach (PR #441, reverted in #452) queried old Kaspa transactions via REST API to verify escrow config. This failed because:
api-tn10.kaspa.orgreturns 500 for all queriesrest.tn.kaspa.rollapp.networkreturns 404 for old/pruned transactionsA local lock file has no external dependencies and is reliable.
Test plan
cargo check -p validatorpasses🤖 Generated with Claude Code