Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Update proto spec #5

Merged
merged 3 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ var TendermintSpec = &ics23.ProofSpec{
InnerSpec: &ics23.InnerSpec{
ChildOrder: []int32{0, 1},
MinPrefixLength: 1,
MaxPrefixLength: 1,
MaxPrefixLength: 1, // fixed prefix + one child
ChildSize: 32, // (no length byte)
Hash: ics23.HashOp_SHA256,
},
}

Expand Down
16 changes: 16 additions & 0 deletions create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ func TestCreateMembership(t *testing.T) {
if err != nil {
t.Fatalf("Creating Proof: %+v", err)
}
if proof.GetExist() == nil {
t.Fatal("Unexpected proof format")
}

root := helpers.CalcRoot(data)
err = proof.GetExist().Verify(TendermintSpec, root, []byte(key), val)
if err != nil {
t.Fatalf("Verifying Proof: %+v", err)
}

valid := ics23.VerifyMembership(TendermintSpec, root, proof, []byte(key), val)
if !valid {
t.Fatalf("Membership Proof Invalid")
Expand Down Expand Up @@ -63,8 +71,16 @@ func TestCreateNonMembership(t *testing.T) {
if err != nil {
t.Fatalf("Creating Proof: %+v", err)
}
if proof.GetNonexist() == nil {
t.Fatal("Unexpected proof format")
}

root := helpers.CalcRoot(data)
err = proof.GetNonexist().Verify(TendermintSpec, root, []byte(key))
if err != nil {
t.Fatalf("Verifying Proof: %+v", err)
}

valid := ics23.VerifyNonMembership(TendermintSpec, root, proof, []byte(key))
if !valid {
t.Fatalf("Non Membership Proof Invalid")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/confio/ics23-tendermint
go 1.14

require (
github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e // v0.5.0
github.com/confio/ics23/go v0.0.0-20200323120010-7d9a00f0a2fa // update-proto-spec
github.com/tendermint/tendermint v0.33.2
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e h1:yhvB+Wg9rCnUQvdAx65iIrpqRjh3VGFCFdl779IvRjY=
github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e/go.mod h1:rWOCtymU+x3jM2Uib0aszytidui3pfpffvjCfNwATaE=
github.com/confio/ics23/go v0.0.0-20200316200307-492bd3c6f3f6 h1:WyZuWel0DTa7seGeWw0Q1KZ67jHtvUbgLYH1bCWK3uo=
github.com/confio/ics23/go v0.0.0-20200316200307-492bd3c6f3f6/go.mod h1:W1I3XC8d9N8OTu/ct5VJ84ylcOunZwMXsWkd27nvVts=
github.com/confio/ics23/go v0.0.0-20200316202129-754fba6c5fdb h1:o8vRNhuwVbBqBgx2aXnGmss25I5d3pNFpQbjcU1wPL4=
github.com/confio/ics23/go v0.0.0-20200316202129-754fba6c5fdb/go.mod h1:W1I3XC8d9N8OTu/ct5VJ84ylcOunZwMXsWkd27nvVts=
github.com/confio/ics23/go v0.0.0-20200323120010-7d9a00f0a2fa h1:aqH90CygjbiuKqIBoVChyc2PwymJ5K5SrOvpvtNIOuk=
github.com/confio/ics23/go v0.0.0-20200323120010-7d9a00f0a2fa/go.mod h1:W1I3XC8d9N8OTu/ct5VJ84ylcOunZwMXsWkd27nvVts=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down