From 90869713bc25e1afd66b46afba4725e36a5688b7 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 16 Mar 2020 21:05:54 +0100 Subject: [PATCH 1/3] Update to ics23 branch with proto changes --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e9288c7..c1a17d9 100644 --- a/go.mod +++ b/go.mod @@ -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-20200316202129-754fba6c5fdb // update-proto-spec github.com/tendermint/tendermint v0.33.2 ) diff --git a/go.sum b/go.sum index ef6f19d..53ee151 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,10 @@ 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/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= From 317943c6fa0aa9d7889197232d032ed42feec6ed Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 16 Mar 2020 21:23:09 +0100 Subject: [PATCH 2/3] Update specs, update some tests --- create.go | 3 ++- create_test.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/create.go b/create.go index 046c7e7..03d08d0 100644 --- a/create.go +++ b/create.go @@ -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, }, } diff --git a/create_test.go b/create_test.go index 00efc06..8b8a787 100644 --- a/create_test.go +++ b/create_test.go @@ -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") @@ -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") From 84bab98cd6881328331017b74698e00c03faa9f3 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 23 Mar 2020 20:33:30 +0100 Subject: [PATCH 3/3] Update ics23 to v0.6.0 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c1a17d9..f1ea76b 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/confio/ics23-tendermint go 1.14 require ( - github.com/confio/ics23/go v0.0.0-20200316202129-754fba6c5fdb // update-proto-spec + github.com/confio/ics23/go v0.0.0-20200323120010-7d9a00f0a2fa // update-proto-spec github.com/tendermint/tendermint v0.33.2 ) diff --git a/go.sum b/go.sum index 53ee151..3555d0e 100644 --- a/go.sum +++ b/go.sum @@ -51,6 +51,8 @@ github.com/confio/ics23/go v0.0.0-20200316200307-492bd3c6f3f6 h1:WyZuWel0DTa7seG 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=