- Notifications
You must be signed in to change notification settings - Fork 2.1k
Add support for generating and verifying DataLayer Proofs of Inclusions #16845
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
Conversation
| This pull request has conflicts, please resolve those before we can evaluate the pull request. |
| Conflicts have been resolved. A maintainer will review the pull request shortly. |
| This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
| This pull request has conflicts, please resolve those before we can evaluate the pull request. |
| Conflicts have been resolved. A maintainer will review the pull request shortly. |
| This pull request has conflicts, please resolve those before we can evaluate the pull request. |
| Conflicts have been resolved. A maintainer will review the pull request shortly. |
Co-authored-by: Kyle Altendorf <sda@fstab.net>
The base branch was changed.
wjblanke 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.
aok
Add in commands for
get_proofandverify_proof. The proof is a proof of inclusion that a given key, value pair is in the specified datalayer store by chaining the Merkle hashes up to the published on-chain root hashOn verification, the verifier only needs to perform a single lookup of the on-chain root and doesn't need to have synced any of the data, or subscribed to the data store.
To keep the proofs smaller, only the
clvmhash of the key and value are included in the proof and not the actual key or value. Aclvmhash is just a sha256 hash of the data prepended with0x01. Datalayer uses CLVM hashes for ease of verification in CLVM, although for this specific use case, there is no on-chain validation happening.A user can generate a proof for multiple k,v pairs in the same datastore
During verification, the user must pay attention to the
current_rootvalue in the returned JSON. Ifcurrent_rootisTrue, this data chains to the current published root, and so if you synced the data, you can be sure it would be there. However, if this value isFalse, the root has moved from the time the proof was generated. You cannot make any assumptions in this case about whether the data is in fact in the datastore or not since the root has changed, therefore the data might have changed. It is up to the caller to determine how to treat this case; one possible action would be to obtain a new proof.Example proof:
Example verify response: