Skip to content

feat(remittance_split): add snapshot export integrity verification (#251)#404

Merged
Baskarayelu merged 3 commits intoRemitwise-Org:mainfrom
Miracle656:feature/remit-split-snapshot-integrity
Mar 28, 2026
Merged

feat(remittance_split): add snapshot export integrity verification (#251)#404
Baskarayelu merged 3 commits intoRemitwise-Org:mainfrom
Miracle656:feature/remit-split-snapshot-integrity

Conversation

@Miracle656
Copy link
Copy Markdown
Contributor

FNV-1a Checksum-Based Tamper Detection for Split Config Snapshots

Implements FNV-1a checksum-based tamper detection for split config snapshots and adds version gating, ownership binding, timestamp sanity checks, and replay protection via nonce to prevent malicious or corrupted payloads from being restored.


Changes

Snapshot Format

  • Added exported_at field to ExportSnapshot struct (snapshot format v2)
  • Replaced trivial checksum with FNV-1a 64-bit hash over all config fields
  • Added SNAPSHOT_VERSION / MIN_SNAPSHOT_VERSION constants for version gating

import_snapshot — 8 Ordered Integrity Checks

Rewrote import_snapshot with the following ordered checks:

# Check Error Variant
1 Version boundary UnsupportedVersion
2 FNV-1a checksum ChecksumMismatch
3 Initialized flag SnapshotNotInitialized
4 Per-field percentage range ≤ 100 InvalidPercentageRange
5 Sum == 100 InvalidPercentages
6 Timestamp sanity — no future timestamps FutureTimestamp
7 Caller is current owner Unauthorized
8 Snapshot owner matches caller OwnerMismatch

New Additions

  • Added verify_snapshot read-only pre-flight function
  • Added new error variants: OwnerMismatch, SnapshotNotInitialized, FutureTimestamp, InvalidPercentageRange
  • Added SnapshotExported / SnapshotImported to SplitEvent enum

Renames & Fixes

  • Renamed PercentagesDoNotSumTo100InvalidPercentages throughout
  • Added 30+ snapshot integrity tests
  • Fixed 3 pre-existing test failures

Docs & Workspace

  • Updated remittance_split/README.md with full snapshot API docs
  • Resolved workspace ed25519-dalek conflict by excluding sdk-v20 crates

Closes #251

@Miracle656 Miracle656 force-pushed the feature/remit-split-snapshot-integrity branch from 131a57f to b092aa5 Compare March 26, 2026 09:26
…emitwise-Org#251)

Implements FNV-1a checksum-based tamper detection for split config snapshots
and adds version gating, ownership binding, timestamp sanity checks, and
replay protection via nonce to prevent malicious or corrupted payloads from
being restored.

Changes:
- Add `exported_at` field to `ExportSnapshot` struct (snapshot format v2)
- Replace trivial checksum with FNV-1a 64-bit hash over all config fields
- Add SNAPSHOT_VERSION / MIN_SNAPSHOT_VERSION constants for version gating
- Rewrite `import_snapshot` with 8 ordered integrity checks:
    1. Version boundary (UnsupportedVersion)
    2. FNV-1a checksum (ChecksumMismatch)
    3. Initialized flag (SnapshotNotInitialized)
    4. Per-field percentage range <= 100 (InvalidPercentageRange)
    5. Sum == 100 (InvalidPercentages)
    6. Timestamp sanity - no future timestamps (FutureTimestamp)
    7. Caller is current owner (Unauthorized)
    8. Snapshot owner matches caller (OwnerMismatch)
- Add `verify_snapshot` read-only pre-flight function
- Add new error variants: OwnerMismatch, SnapshotNotInitialized,
  FutureTimestamp, InvalidPercentageRange
- Add SnapshotExported / SnapshotImported to SplitEvent enum
- Rename PercentagesDoNotSumTo100 to InvalidPercentages throughout
- Add 30+ snapshot integrity tests; fix 3 pre-existing test failures
- Update remittance_split/README.md with full snapshot API docs
- Resolve workspace ed25519-dalek conflict by excluding sdk-v20 crates
@Miracle656 Miracle656 force-pushed the feature/remit-split-snapshot-integrity branch from b092aa5 to c390f0f Compare March 26, 2026 11:25
Miracle656 and others added 2 commits March 26, 2026 12:53
…artial move, and gas baseline

- orchestrator: add Copy derive to ExecutionState enum (E0277)
- orchestrator: implement missing validate_remittance_flow_addresses helper (E0599)
- savings_goals: fix partial move bug in upgrade_admin matcher (E0382)
- benchmarks: update gas baseline to match current remittance_split implementation
@Baskarayelu Baskarayelu merged commit 92ad278 into Remitwise-Org:main Mar 28, 2026
2 of 3 checks passed
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.

Add snapshot export integrity verification for split config

2 participants