Skip to content

[svm-acc] feat: off-chain backfill migration tooling#50

Open
bengtlofgren wants to merge 4 commits into
ntt-accountant-backfillfrom
accountant-backfill-tooling
Open

[svm-acc] feat: off-chain backfill migration tooling#50
bengtlofgren wants to merge 4 commits into
ntt-accountant-backfillfrom
accountant-backfill-tooling

Conversation

@bengtlofgren

Copy link
Copy Markdown

Summary

Split out of bengt/global-accountant-svm-scaffold. Base is #49 (NTT backfill program) — this tool's tx_builder.rs imports ntt_global_accountant_backfill::Instruction and reconcile.rs/tx_builder.rs use the NTT PDA layouts/seed prefixes directly, so #49 (and transitively #23) must merge first.

Adds tools/backfill/ — a standalone Rust CLI (ga-backfill, its own isolated Cargo workspace/lockfile) that reads the wormchain snapshot catalogue and drives the on-chain WTT/NTT backfill programs at scale:

  • catalogue.rs / chunker.rs / cursor.rs — snapshot ingestion, tx-size chunking, progress cursor
  • submitter.rs / tx_builder.rs — async submission, instruction building for both backfill programs
  • reconcile.rs / reconcile_balances.rs / stats.rs — post-migration balance reconciliation and reporting

Byte-identical to the scaffold branch's version — no adaptation needed since it's a new standalone crate with no pre-existing local divergence to reconcile.

Test plan

  • cargo test from svm/accountant/tools/backfill/ (standalone workspace)
  • cargo check --locked — copied Cargo.lock from scaffold verbatim, not re-verified with a toolchain in this environment
  • #[ignore]d e2e tests (e2e_against_surfpool.rs, e2e_ntt_against_surfpool.rs) against a local surfpool instance

@bengtlofgren bengtlofgren changed the title feat: off-chain backfill migration tooling [svm-acc] feat: off-chain backfill migration tooling Jul 16, 2026
@bengtlofgren
bengtlofgren force-pushed the ntt-accountant-backfill branch from e6da074 to 3b990a0 Compare July 21, 2026 11:06
Standalone ga-backfill CLI (own Cargo workspace, isolated deps): reads
the wormchain snapshot catalogue and drives the on-chain WTT/NTT
backfill programs at scale (chunking, cursor/progress tracking,
submission, balance reconciliation, stats).
reconcile_balances.rs previously inlined the entire reconciliation
loop in fn main(), making it untestable from tests/ (it compiled as
its own bin crate root, not part of the ga_backfill library). Move
the logic to a new balance_reconcile module (mirroring the
compute/run split already used by stats.rs); the binary becomes a
thin CLI shim over it. Behavior-preserving — same sign rule, same
output format.

Also drops two stale doc-comment references: a `just reconcile-ntt`/
`just reconcile-wtt` pointer (no such recipes exist in this branch's
justfile) and a `.claude/tasks/...` pointer (excluded from this PR).
Covers both transfer sign-rule directions (native lock/wrapped mint,
wrapped burn/native unlock), a mismatch against a wrong committed
balance, unexpected net activity with no committed row, zero-net
activity correctly not flagged, modification add/subtract netting,
credit overflow surfacing as an error, and a sanity check against the
shared sample fixture.
@bengtlofgren
bengtlofgren force-pushed the accountant-backfill-tooling branch from cff2e39 to e115700 Compare July 21, 2026 11:07
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.

1 participant