Tackler-style audit triplet: txn-set-checksum + selector-checksum on reports #26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add cryptographic audit metadata to balance reports, modeled on Tackler's triplet: given a report, an auditor can independently verify (a) which version of the books fed it, (b) that the transaction set was complete, and (c) which filter/selector produced it. The combination makes a historical report regenerable byte-for-byte.
This is the property that motivated the whole "are we plain-text enough" question. Without it, a balance from last quarter is a number; with it, it's a number backed by a cryptographic proof you can hand to a collective member.
Prerequisites
Depends on #24 (reversing entries) and #25 (git-backed journal). The checksum only means what we want it to mean if:
Both prerequisites are about ensuring the txn-set-checksum has evidentiary weight, not just computational existence. Without them, the checksum is computable but its meaning collapses back onto whatever non-cryptographic property is actually load-bearing.
The triplet
For each balance report endpoint (start with
GET /api/v1/balance,GET /api/v1/balances/all), include in the response:Computing txn-set-checksum
Tackler's contrib script (
txn-set-checksum.sh) is the reference implementation: sort entries deterministically, serialize each to a canonical form, concatenate, SHA-256. Port to Python and expose asaudit.compute_txn_set_checksum(entries: list[Transaction]) -> str.The contrib script is meant to be independently runnable so an auditor can verify Libra isn't lying about its own inputs. Document the canonicalization rules carefully so a standalone Python script (or even a bash +
bean-querypipeline) can recompute the same checksum from the ledger file. This is the part of the triplet that gives it independent value.Computing selector-checksum
Just SHA-256 of the BQL string (after a deterministic normalization — whitespace collapse, lowercase keywords). Cheap.
Reproducibility
The full property: given
commit_id,selector, andtxn_set_checksumfrom an old report, an auditor can:git checkout <commit_id>against the ledger repobean-query <selector>against the checked-out fileIf all three match, the report is provably the same one the books would produce today against that historical state.
Scope
audit.pymodule withcompute_txn_set_checksum,compute_selector_checksum,current_commit_id.auditblock in responses.libra-verify-audit <commit_id> <selector> <expected_checksum>that mirrors what an external auditor would do — kept as a separate executable script so the verifier itself isn't trusted code.bean-queryscript produce the same number).Out of scope
Dependencies