Summary
Implement the current-state migration subcommand that builds protocol current state from deployment ledger forward, converging with live ingestion via the shared current-state CAS cursor.
Scope
- CLI:
./wallet-backend protocol-migrate current-state --protocol-id SEP50 --start-ledger 50000000
- Phase 1 — Validate: Verify protocol exists,
classification_status = 'success'. Set current_state_migration_status = 'in_progress'. Initialize protocol_{ID}_current_state_cursor = start_ledger - 1.
- Phase 2 — Process batches to tip (loop): Same structure as history migration, but: CAS-advances
current_state_cursor instead. Writes only current state (no state changes). Batches must be committed in order (current state is additive — state at ledger N depends on N-1).
- Phase 3 — Complete: Set
current_state_migration_status = 'success'. Clean up.
- Error handling: same pattern as history — set status to
'failed', resume from cursor + 1 on retry.
- Processes ALL ledgers from
--start-ledger to tip (not just retention window).
Dependencies
Reference
docs/feature-design/data-migrations.md (State Production section, line 619+)
Summary
Implement the current-state migration subcommand that builds protocol current state from deployment ledger forward, converging with live ingestion via the shared current-state CAS cursor.
Scope
./wallet-backend protocol-migrate current-state --protocol-id SEP50 --start-ledger 50000000classification_status = 'success'. Setcurrent_state_migration_status = 'in_progress'. Initializeprotocol_{ID}_current_state_cursor = start_ledger - 1.current_state_cursorinstead. Writes only current state (no state changes). Batches must be committed in order (current state is additive — state at ledger N depends on N-1).current_state_migration_status = 'success'. Clean up.'failed', resume from cursor + 1 on retry.--start-ledgerto tip (not just retention window).Dependencies
Reference
docs/feature-design/data-migrations.md(State Production section, line 619+)