-
Notifications
You must be signed in to change notification settings - Fork 84
feat(rpc): add verifyutxochaintipinclusionproof RPC method #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(rpc): add verifyutxochaintipinclusionproof RPC method #819
Conversation
moisesPompilio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the name of this RPC be shorter, like verifyutxoproof?
This is the RPC's name on |
6c51864 to
04fbc6e
Compare
|
thanks for the review! @moisesPompilio done! |
04fbc6e to
f977dbc
Compare
|
thanks for the review! @csgui initially, I chose to remain faithful to the utreexod RPC implementation, but the validation of the proof size is important and it doesn't exist in utreexod, as well as explicit error handling, but all done now. Also added a test for the proof size. furthermore, I realized that
|
04435ee to
882aec3
Compare
8e354d2 to
93274ab
Compare
|
thanks guys! addressed all feedback : added ready for re-review! @moisesPompilio @csgui |
93274ab to
8e2deea
Compare
moisesPompilio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we don't use simple assert statements in the integration tests; we have to use the asserts from FlorestaTestFramework. I marked some asserts and suggested how they should use the FlorestaTestFramework asserts, but check FlorestaTestFramework for which ones you need to use instead of the simple assert calls you added.
73ca04f to
79589d2
Compare
|
hey @moisesPompilio I improved the test as a full integration using the existing frameworks. Utreexod is instantiated via add_node() (no external dependency), coinbase txids are obtained via getblock/getblockhash (no bdkwallet), and shutil.rmtree cleans up data between runs. It runs on CI without manual setup. |
79589d2 to
1a23b57
Compare
|
applied CI lint fix |
1a23b57 to
f573885
Compare
|
thanks! @moisesPompilio sugestions applied |
ff1081d to
0fdd2e0
Compare
|
updated commit descriptions |
8d469cd to
7fc11ea
Compare
|
extracted updated integration test |
Implements utreexo accumulator proof UTXO verification for chain tip, based on the utreexod's reference implementation. This allows clients to cryptographically verify UTXO inclusion without maintaining the full UTXO set. - Parses hex-encoded proofs from utreexod's proveutxochaintipinclusion - Validates proof was generated at current chain tip (rejects stale proofs) - Verifies cryptographic proof against the accumulator state - Makes MAX_INPUTS_PER_BLOCK and MAX_PROOF_HASHES public for DoS bounds - Adds InvalidProof error variant with appropriate HTTP/JSON-RPC codes Returns true for valid proofs, false for well-formed but invalid proofs. Malformed or stale proofs return specific error types.
7fc11ea to
139aaa5
Compare
Adds CLI command to verify utreexo proofs, making the RPC accessible via floresta-cli. Includes comprehensive documentation with usage examples showing both valid and invalid proof scenarios to help users understand expected behavior.
End-to-end test using florestad and utreexod that validates: - Input rejection: invalid hex, oversized proofs, empty input, truncated data - Valid proofs: generates and verifies proofs for all mined coinbase UTXOs - Invalid proofs: tampered data returns false, trailing bytes and wrong block hash return appropriate errors Also adds RPC bindings for both floresta (verifyutxochaintipinclusionproof) and utreexo (proveutxochaintipinclusion) in the test framework.
139aaa5 to
e7f3f40
Compare
|
verbosity added thanks! @jaoleal |




Hey guys, I talked to Davidson and we agreed I'd implement this RPC.
This PR implements the
verifyutxochaintipinclusionproofRPC method to verify utreexo accumulator proofs for chain tip UTXOs. It's based on the utreexod's reference implementation and allows clients to cryptographically verify UTXO inclusion without maintaining the full UTXO set.proveutxochaintipinclusionRPCPollard::from_roots()pollard.verify()to cryptographically verify inclusion by reconstructing the merkle path from proven hashes through the provided proof hashes up to the known rootstruefor valid proofs,falsefor invalid proofs and errors for malformed input.Running:
RPC:
./target/release/floresta-cli --network regtest verifyutxochaintipinclusionproof <proof>Test:
uv run tests/test_runner.py -k verifyutxochaintipinclusionproofTested with proofs generated from utreexod
proveutxochaintipinclusionRPC in regtest mode.