feat(dvm): verify_proof PoC with executing-block roothash bind (fixes #93) - #94
Open
liqdmetal wants to merge 2 commits into
Open
feat(dvm): verify_proof PoC with executing-block roothash bind (fixes #93)#94liqdmetal wants to merge 2 commits into
liqdmetal wants to merge 2 commits into
Conversation
liqdmetal
force-pushed
the
feature/verify-proof-poc
branch
from
August 23, 2026 03:26
b857f36 to
84eccbb
Compare
This was referenced Aug 23, 2026
…noise) verify_proof(tx_hex, scid_index, ctx_hex) -> 0/1: native hook into DERO's Proof.Verify, ~2M gas, >=10.0.0, panic-safe (recover->0). ctx_hex carries per-member [ring point || CLn || CRn] (tx Serialize strips ring + drops CLn/CRn). PoC: roothash binding + gas metering still open.
liqdmetal
force-pushed
the
feature/verify-proof-poc
branch
from
August 25, 2026 01:32
1f0acb2 to
e808dd5
Compare
Reject a statement whose Roothash is not the executing BLID when Chain_inputs is set. Adds TestVerifyProofRoothashBind + BenchmarkVerifyProof. Still a PoC: gas remains a policy number (~85ms/op ring-16 on 5900X).
Author
|
Folded local maturity: verify_proof now rejects a statement whose Roothash != executing BLID when Chain_inputs is set. TestVerifyProofRoothashBind + BenchmarkVerifyProof (~85ms/op ring-16). Still a PoC — gas is a policy number. |
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
PoC implementation of the P1-1
verify_proofintrinsic — ZK proof verification inside the DVM, as a native hook into the audited GoProof.Verify(NOT VM-interpreted group arithmetic). Follows the design in issue #92.The intrinsic
tx_hex— a fully-serialized transaction (carries the statement's C/D/pointers/roothash + the proof)ctx_hex— the expanded statement material DERO's serialization deliberately omits (ring/CLn/CRn are "expanded from graviton store"): per ring member[ring key (33B) | CLn (33B) | CRn (33B)]concatenated, 99·N bytesProof.Verifynodes run on every tx (transaction_verify.go:482)Known limitation — chain-binding gap (wargame finding, pinned by test)
The intrinsic verifies a bulletproof against a fully caller-supplied context: the tx (with its Roothash/Fees/BurnValue), the payload index, and the expanded ring. It performs zero chain-state lookups:
Roothashto equal the chain's actual merkle root at the referenced snapshot (transaction_verify.go:424) and expands the ring/balances from the balance tree (transaction_verify.go:429+). The intrinsic has no chain handle, so it can do neither.verify_proofproves only that a bulletproof exists that is internally consistent with the caller-supplied statement. A fabricated-but-self-consistent proof — random roothash that has never been a chain root, decoy ring members with made-up encrypted balances — verifies as 1.TestVerifyProofChainBindingGap(dvm/wargame_verify_proof_test.go): a never-mined tx with fabricated state verifies as 1; a genuinely tampered proof still returns 0 (crypto binding intact; it is the chain binding that is missing).Fix direction (required before this is production-grade): the intrinsic must be a daemon-side hook that resolves
tx.BLID's snapshot, checks the merkle root against the actual chain state, and expands the ring from the balance tree — i.e. exactly the binding the on-chain verifier applies. As specified here it is a tautology machine, and a contract gating a payout onverify_proof()==1could be triggered by a fabricated tx. This PoC establishes the VM plumbing, serialization format, and gas shape; the chain-binding hook is the follow-up.Why this serialization format
DERO's tx serialization strips the expanded statement (ring, CLn, CRn) to truncated pointers + C/D — the verifier needs the real points, which nodes normally reconstruct from the graviton balance tree. The context blob is the contract's way of supplying exactly what it expects. These are public values; nothing secret enters SCDATA. (Note: this caller-supplied expansion is precisely why the chain-binding hook above is mandatory — without it the "context" is attacker-chosen.)
Safety
>= 10.0.0(new DVM major), gas 2,000,000 (benchmarked shape — the Rust reference implementation in derohe-rs can calibrate this).Tests (
dvm/verify_proof_test.go+dvm/wargame_verify_proof_test.go)TestVerifyProofbuilds a valid NORMAL tx (aggregate bulletproof, ring 16) and asserts:TestVerifyProofChainBindingGappins the known limitation above (fabricated-state tx accepted, tampered rejected, crypto self-consistency shown).Honest scope
Relationship
Branch:
feature/verify-proof-pocin the forkliqdmetal/derohe-improvements-by-liqdmetal. Carries the build fixes: re-vendored modules (vendor/modules.txtpresent) and theKickReaderremoval.