-
Notifications
You must be signed in to change notification settings - Fork 33
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
[IBC] Implement ICS-23 CommitmentProof verification for the SMT #845
Conversation
22b48dd
to
d1a4667
Compare
36a8056
to
8cd1fab
Compare
8cd1fab
to
f482e14
Compare
🚨 I HAVE REWRITTEN HISTORY 🚨 @Olshansk I went through all the comments, and rebased off of main. The PR is now much smaller without all the unecissary files from other PRs. |
) | ||
|
||
var ( | ||
// Custom SMT spec as the store does not hash values |
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.
The hashing and nonhashing makes sense to me in the context of IBC and SMT in independence.
It's not a blocker for this PR, but my question/concern is moreso for the larger context of the blockchain to make sure that I'm personally not missing/misunderstanding something. For the rest of the persistence module, question is: Should we hash the values for the other trees or not?
@dylanlott do you have thoughts/opinion here?
ibc/store/proofs_ics23.go
Outdated
return steps | ||
} | ||
|
||
// getPathBit takes the hash of a key (the path) and a position (depth) and returns whether at |
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.
See the ref - Ref: https://github.com/pokt-network/smt/blob/main/utils.go
Yea, this is definitely non-trivial to implement...
This business logic is VERY closely coupled with our specific SMT implementation. I'd suggest the following:
- exposing
GetPathBit
in the smt and reusing it here - Move the comments you added to the smt
- Add an
isLeftChild
helper and use it here
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.
I have added a techdebt comment here as I have opened smt#14 which will cover this. As I have just release v0.6.0
for the SMT i think that its best to bundle these small changes into releases to save on constantly updating the go.mod
. As the functionality will not change until this issue in in progress I think its alright to leave it until then.
LMK wdyt
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.
Going to push back on this.
I think pokt-network/smt#14 is a 1+ month research and development project, whereas exposing the GetPathBit
function is something we can do before EOD.
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.
fdfd4a5
to
327ed96
Compare
ibc/store/proofs_ics23.go
Outdated
return steps | ||
} | ||
|
||
// getPathBit takes the hash of a key (the path) and a position (depth) and returns whether at |
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.
Going to push back on this.
I think pokt-network/smt#14 is a 1+ month research and development project, whereas exposing the GetPathBit
function is something we can do before EOD.
- `key` is in tree -> `Proof` is invalid -> exclusion QED | ||
|
||
```mermaid | ||
flowchart TD |
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.
Appreciate the new diagram!
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.
ICS23!!!!!
Description
Summary generated by Reviewpad on 29 Jun 23 20:46 UTC
This pull request includes various changes across multiple files.
In the
README.md
file, a new section titled "ICS-23 Vector Commitments" was added under the "Components" section, along with a link to the ICS-23 specification. Additionally, the link to the ICS-24 specification was updated to point to theics24.md
file.In the
go.sum
file, new dependencies were added for the librariesgithub.aaakk.us.kg/cosmos/gogoproto
andgithub.aaakk.us.kg/h5law/ics23/go
, with specific version tags. The existing dependency ongithub.aaakk.us.kg/pokt-network/smt
was also updated to a newer version.The
ics23.md
file provides implementation details of ICS-23 Vector Commitments, including the benefits of using thecosmos/ics23
library and the changes made for Pocket's implementation. It also explains the proof verification process for membership and non-membership proofs, accompanied by flowchart diagrams. The implementation logic can be found in the fileproofs_ics23.go
.A new file
proofs_ics23_test.go
was added to theibc/store
package, containing test functions for generating and verifying commitment proofs using the ICS23 library. The tests cover membership and non-membership proofs for a sparse Merkle tree.The
go.mod
file shows various changes, including the addition of replace directives for modulesgithub.aaakk.us.kg/cosmos/ics23/go
andgithub.aaakk.us.kg/regen-network/gocuke
, updates to module versions, and the addition of a new modulegithub.aaakk.us.kg/cosmos/gogoproto
.The file
proofs_ics23.go
is a new addition to theibc/store
package, containing functions and constants for verifying membership and non-membership in a Sparse Merkle Tree.Lastly, in the file where the
NextCode
constant is defined, it was updated to a new value and a new constant and error function were added.Please review these changes in the pull request.
Issue
Fixes #841
Type of change
Please mark the relevant option(s):
List of changes
cosmos/ics23
Testing
make develop_test
; if any code changes were mademake test_e2e
on k8s LocalNet; if any code changes were madee2e-devnet-test
passes tests on DevNet; if any code was changedRequired Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)