[IBC] Implement ICS-23 CommitmentProof verification for the SMT#845
[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.
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.
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
GetPathBitin the smt and reusing it here - Move the comments you added to the smt
- Add an
isLeftChildhelper and use it here
There was a problem hiding this comment.
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.
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.
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.
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.
Appreciate the new diagram!
Description
Summary generated by Reviewpad on 29 Jun 23 20:46 UTC
This pull request includes various changes across multiple files.
In the
README.mdfile, 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.mdfile.In the
go.sumfile, new dependencies were added for the librariesgithub.zerozr99.workers.dev/cosmos/gogoprotoandgithub.zerozr99.workers.dev/h5law/ics23/go, with specific version tags. The existing dependency ongithub.zerozr99.workers.dev/pokt-network/smtwas also updated to a newer version.The
ics23.mdfile provides implementation details of ICS-23 Vector Commitments, including the benefits of using thecosmos/ics23library 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.gowas added to theibc/storepackage, 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.modfile shows various changes, including the addition of replace directives for modulesgithub.zerozr99.workers.dev/cosmos/ics23/goandgithub.zerozr99.workers.dev/regen-network/gocuke, updates to module versions, and the addition of a new modulegithub.zerozr99.workers.dev/cosmos/gogoproto.The file
proofs_ics23.gois a new addition to theibc/storepackage, containing functions and constants for verifying membership and non-membership in a Sparse Merkle Tree.Lastly, in the file where the
NextCodeconstant 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/ics23Testing
make develop_test; if any code changes were mademake test_e2eon k8s LocalNet; if any code changes were madee2e-devnet-testpasses tests on DevNet; if any code was changedRequired Checklist
godocformat comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist
shared/docs/*if I updatedshared/*README(s)