feat(economic): a device can publish, and a stranger can verify, which leaves its registered root commits - #764
Merged
Conversation
…h leaves its registered root commits
A device's economic root is published as a write-once register cell at a
named position, so anyone can establish WHICH root it committed. Nothing ever
published which LEAVES that root commits. Both directions of a settlement
need exactly that and neither could get it: the trader's 0x0026 must prove
the owner's two vault reserves, the owner's 0x0027 must prove the trader's
settlement receipt, and `EconomicSmt::siblings` had one production caller,
inside the witness builder, publishing nothing.
This is that object, once, for both directions.
EconomicProofArtifactV1 {
publisher_genesis, publisher_devid,
economic_position, economic_root,
leaves[] { state_ccb, siblings[256] }
}
Three properties are structural rather than conventional:
- ONE SNAPSHOT. Every leaf and every path must derive the one root the
artifact names. The producer builds it from `tree` inside `finish_admission`
— the same post-transition tree the write set advanced and whose root was
just registered — so there is no second read and no window in which the tree
could move between naming the root and taking the paths. The root equality
is stated there rather than assumed, and `EconomicProofArtifact::new`
re-derives every path before the bytes exist, so a mixed-snapshot artifact
cannot be constructed, let alone published.
- NO SELF-ASSERTION. The artifact carries no signature and proves nothing
about its own authority. `verify_against` takes the publisher, position and
root the READER established independently and refuses an artifact naming
anything else, before recomputing. Whatever points at an artifact — an
advertisement, an evidence descriptor — is a locator, never a warrant.
- KEYS ARE DERIVED. The leaf key comes from the decoded state's own class and
the publisher's coordinates, so a publisher cannot present a leaf under a
key it chose.
Every admission now publishes proof of the externally citable leaves its
transition wrote — vault reserves and settlement receipts, the two an
evidence type asks another device to verify. Balance and consumed-source
leaves are excluded deliberately: nothing cites them, and each path costs
8 KiB, so carrying them would grow every admission to prove what no one
reads. The artifact is a post-admit artifact, frozen in the admit
transaction and delivered by the existing quorum republish sweep, so it
cannot reach the fleet before the root it names is registered.
Proven: a stranger holding only the publisher's coordinates, position and
root recomputes every leaf and path and gets that root back, on a real
admitted funded create fetched by content address; leaves and paths from two
snapshots are refused at construction AND at reading; a tampered path, a
repeated leaf, an amount the root does not commit, and reading at a position
or root the reader did not establish are each refused; decode is strict about
shape and does not check inclusion, so shape alone is never evidence. Four
mutation cycles, each reddening only its own named test, restored
checksum-verified.
NOT in this change: no evidence type consumes it yet. The 0x0026 and 0x0027
bundles still carry their own bespoke leaf-and-path fields, and no
advertisement carries a locator. Rewiring them to consume this object is the
0x0026 producer cut, which is where a reader first needs to find one.
Boards: workspace 74 binaries, 3964 passed / 0 failed / 17 ignored (dsm lib 1692/0, dsm_sdk lib 1813/0/7 ignored), exit 0; node 11 binaries, 276/0, exit 0; make lint exit 0; frontend
type-check, lint and jest green; production safety PASS (pinned 1.98.0);
ci_scan PASS.
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
The generic economic-proof transport, first step of the locked chain. A device publishes which leaves its registered root commits; a stranger verifies them against a root it established itself.
Why nothing could be proven before
The register publishes the root at a position. It never published which leaves that root commits.
EconomicSmt::siblingshad exactly one production caller, inside the witness builder, and it published nothing. So the trader's0x0026(prove the owner's two vault reserves) and the owner's0x0027(prove the trader's settlement receipt) both needed material that did not exist. The existing trader settlement receipt does not substitute: it proves against the device tree under a different key derivation.The three structural properties
treeinsidefinish_admission— the same post-transition tree whose root was just registered, so no second read and no window for it to move. The root equality is stated, not assumed, andnewre-derives every path before the bytes exist, so a mixed-snapshot artifact cannot be constructedverify_againsttakes the publisher, position and root the reader established independently and refuses anything else before recomputing. A locator makes an artifact findable, never validWhat gets published
Every admission publishes proof of the externally citable leaves its transition wrote: vault reserves and settlement receipts, the two classes an evidence type asks another device to verify. Balance and consumed-source leaves are excluded on purpose — nothing cites them, and each path costs 8 KiB, so carrying them would grow every admission to prove what no reader wants. That exclusion has its own mutation control.
The artifact is a post-admit artifact: frozen in the admit transaction and delivered by the existing quorum republish sweep, so it cannot reach the fleet before the root it names is registered.
Proof
verify_againstroot equality,check_inclusionrecomputation, the producer self-check innew, the citable-leaf filtermake lintexit 0; frontend type-check 0, lint 0, jest 1101 passed;ci/production_safety_checks.shPASS (pinned 1.98.0, incl. TLA+);scripts/ci_scan.shPASS — all on tree stampe0620f48fde5, identical before and after every runNot in this PR
No evidence type consumes it yet.
ReserveConsumptionEvidenceV1andSettlementPaymentEvidenceV1still carry their own bespoke leaf-and-path fields, and no routing advertisement carries a locator. Rewiring those to consume this object belongs with the0x0026producer, which is where a reader first needs to find one. Stated rather than left to be discovered.