Skip to content
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

Remove data leaf from fuel-merkle BMT proofs #501

Closed
6 tasks done
bvrooman opened this issue Jul 6, 2023 · 1 comment
Closed
6 tasks done

Remove data leaf from fuel-merkle BMT proofs #501

bvrooman opened this issue Jul 6, 2023 · 1 comment
Assignees
Labels
breaking A breaking api change bug Something isn't working documentation Improvements or additions to documentation fuel-merkle Related to the `fuel-merkle` crate.

Comments

@bvrooman
Copy link
Contributor

bvrooman commented Jul 6, 2023

Currently, Merkle proofs generated by the fuel-merkle binary Merkle tree include the hashed leaf data for the leaf being proven in the proof set. This means that the proof set starts with the hashed leaf data and continues with side node data until reaching the root.

The fuel-merkle-sol verify function expects binary Merkle tree proofs to provide a proof set that contains only the side node data, and the unhashed leaf data separately. This represents a discrepancy between the proof format that fuel-merkle generates and the proof format that fuel-merkle-sol expects.

This discrepancy results from having a lack of clear specification on the format in the fuel-specs. To provide a definitive specification, we can defer to RFC 6962 that defines the binary Merkle tree algorithm that we already use for roots. This RFC describes "audit paths" which are analogous to the proof sets we already use. According to this RFC, audit paths do not include the leaf data for the leaf being proven. Therefore, we can adapt our fuel-merkle library to follow this RFC.

Tasks:

@bvrooman bvrooman self-assigned this Jul 6, 2023
@bvrooman bvrooman added bug Something isn't working documentation Improvements or additions to documentation fuel-merkle Related to the `fuel-merkle` crate. labels Jul 6, 2023
@bvrooman bvrooman added the breaking A breaking api change label Jul 6, 2023
@bvrooman bvrooman changed the title Remove data leaf from fuel-merkleBMT proofs Remove data leaf from fuel-merkle BMT proofs Jul 10, 2023
bvrooman pushed a commit to FuelLabs/fuel-specs that referenced this issue Jul 14, 2023
Related issues:
- FuelLabs/fuel-vm#501 (comment)

This PR gives the Fuel specs its own Merkle tree specification, and
removes links to the archived Celestia spec. This gives Fuel ownership
over its own Merkle tree specification and allows us to adapt it to our
design.

Specifically, this PR copies the specification for the binary and sparse
Merkle trees as described in the Celestia spec. Additional comments are
my own, and describe in more detail topics like the BMT proof format.

Lastly, this PR removes the specification for the binary Merkle sum tree
(BMST). The BMST is currently not supported by Fuel and does not fall
under the Fuel specification at this time.
@bvrooman
Copy link
Contributor Author

All subtasks are now complete - closing this issue as complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change bug Something isn't working documentation Improvements or additions to documentation fuel-merkle Related to the `fuel-merkle` crate.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant