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

Repair must return Merkle branches for each non-nil leaf on error #53

Closed
adlerjohn opened this issue Apr 20, 2021 · 1 comment
Closed
Assignees

Comments

@adlerjohn
Copy link
Member

Ref #44 (comment)

@adlerjohn adlerjohn self-assigned this Apr 20, 2021
@adlerjohn
Copy link
Member Author

adlerjohn commented Apr 30, 2021

Transcluding my comment from Discord:

@liamsi so while looking into #53, I realized different Merkle trees have different prove function signatures:

  1. Regular Merkle tree returns a bunch of stuff: https://github.com/lazyledger/merkletree/blob/6901c4c3c75f7ab8a0f11707cb0eb4e477f9074f/tree.go
  2. NMT returns a proof struct: https://github.com/lazyledger/nmt/blob/ddcc72040149c115f83b2199eafabf3127ae12ac/nmt.go

You accurately pointed out in a TODO that the Prove method would need some looking into https://github.com/lazyledger/rsmt2d/blob/5a692bff96defabeaf8c928510c1894255e97761/tree.go#L22-L23. I see two alternatives:

  1. Make all trees conform to the same Prove method. This might be not possible since they fundamentally return different stuff.
  2. Defer constructing proofs to the caller, which should know exactly which tree is used and can handle the specific return values. Note that as-is, there is sufficient data for the caller to construct Merkle proofs (all repaired shares are returned). Also note that within the repair function there may not be enough data for all Merkle proofs to be constructed; some proofs must come from when a share is downloaded. As such, the caller will need to handle attaching the appropriate proofs regardless. I prefer this approach.

With (2) being the preferred approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant