From 9f23566f62c39de2d9dd590311c09530db2b0b14 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 16 Jan 2023 16:16:34 +0100 Subject: [PATCH] chore: prepare v0.45.12 release (#14623) --- CHANGELOG.md | 4 +- RELEASE_NOTES.md | 12 +- contrib/images/simd-env/Dockerfile | 1 - go.mod | 31 +- go.sum | 92 +- ics23/.gitignore | 1 - ics23/go/Makefile | 20 - ics23/go/compress.go | 157 - ics23/go/go.mod | 10 - ics23/go/go.sum | 28 - ics23/go/ics23.go | 175 -- ics23/go/ops.go | 250 -- ics23/go/proof.go | 452 --- ics23/go/proofs.pb.go | 4548 ---------------------------- 14 files changed, 83 insertions(+), 5698 deletions(-) delete mode 100644 ics23/.gitignore delete mode 100644 ics23/go/Makefile delete mode 100644 ics23/go/compress.go delete mode 100644 ics23/go/go.mod delete mode 100644 ics23/go/go.sum delete mode 100644 ics23/go/ics23.go delete mode 100644 ics23/go/ops.go delete mode 100644 ics23/go/proof.go delete mode 100644 ics23/go/proofs.pb.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d1d3f3f18b85..1ae21386af0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,11 +37,13 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## v0.45.12 - 2023-01-16 + ### Improvements * [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general. * (store) [#11646](https://github.com/cosmos/cosmos-sdk/pull/11646) Add store name in tracekv-emitted store traces -* (deps) Bump Tendermint version to [v0.34.24](https://github.com/tendermint/tendermint/releases/tag/v0.34.24). +* (deps) Bump Tendermint version to [v0.34.24](https://github.com/tendermint/tendermint/releases/tag/v0.34.24) and use Informal Systems fork. ### API Breaking Changes diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index a2151c45818c..ca073b726dbe 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,14 +1,16 @@ -# Cosmos SDK v0.45.11 Release Notes +# Cosmos SDK v0.45.12 Release Notes -This release introduces a number of bug fixes and improvements. +This release introduces a number of bug fixes and improvements. Notably with an update to State Streaming APIs. Please see the [CHANGELOG](https://github.com/cosmos/cosmos-sdk/blob/release/v0.45.x/CHANGELOG.md) for an exhaustive list of changes. -**Full Commit History**: https://github.com/cosmos/cosmos-sdk/compare/v0.45.10...v0.45.11 +**Full Commit History**: https://github.com/cosmos/cosmos-sdk/compare/v0.45.11...v0.45.12 -**NOTE**: The changes mentioned in `v0.45.9` are **still** required: +**NOTE:** The changes mentioned in `v0.45.9` are **no longer required**. The following replace directive can be removed from the chains. ```go -# Chains must add the following to their go.mod for the application: +# Can be deleted from go.mod replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 ``` + +Instead, `github.com/confio/ics23/go` must be **bumped to `v0.9.0`**. diff --git a/contrib/images/simd-env/Dockerfile b/contrib/images/simd-env/Dockerfile index 8adbc8dd8ef2..b83c3b831bac 100644 --- a/contrib/images/simd-env/Dockerfile +++ b/contrib/images/simd-env/Dockerfile @@ -2,7 +2,6 @@ FROM golang:1.18-alpine AS build RUN apk add build-base git linux-headers WORKDIR /work COPY go.mod go.sum /work/ -COPY ./ics23/go/go.mod /work/ics23/go/go.mod RUN go mod download COPY ./ /work diff --git a/go.mod b/go.mod index be949a09400b..32d3fd1b9ec8 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bgentry/speakeasy v0.1.0 github.com/btcsuite/btcd v0.22.1 github.com/coinbase/rosetta-sdk-go v0.7.0 - github.com/confio/ics23/go v0.7.0 + github.com/confio/ics23/go v0.9.0 github.com/cosmos/btcutil v1.0.4 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.19.4 @@ -45,7 +45,7 @@ require ( github.com/tendermint/tendermint v0.34.24 github.com/tendermint/tm-db v0.6.6 github.com/tidwall/btree v1.5.0 - golang.org/x/crypto v0.1.0 + golang.org/x/crypto v0.2.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a google.golang.org/grpc v1.50.1 @@ -55,6 +55,7 @@ require ( require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/DataDog/zstd v1.4.5 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect @@ -63,14 +64,14 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect - github.com/danieljoos/wincred v1.0.2 // indirect + github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.2 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.0 // indirect - github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect + github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect @@ -91,7 +92,6 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/klauspost/compress v1.15.11 // indirect github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -117,9 +117,9 @@ require ( github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/net v0.1.0 // indirect - golang.org/x/sys v0.1.0 // indirect - golang.org/x/term v0.1.0 // indirect + golang.org/x/net v0.2.0 // indirect + golang.org/x/sys v0.2.0 // indirect + golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -127,17 +127,24 @@ require ( ) replace ( - github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + // Use cosmos keyring + github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - // vendor ics23 - github.com/confio/ics23/go => ./ics23/go + // dgrijalva/jwt-go is deprecated and doesn't receive security updates. + // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 + github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 - github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1 + + // Use regen gogoproto fork + // This for is replaced by cosmos/gogoproto in future versions github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/jhump/protoreflect => github.com/jhump/protoreflect v1.9.0 + // use informal system fork of tendermint + github.com/tendermint/tendermint => github.com/informalsystems/tendermint v0.34.24 // latest grpc doesn't work with with our modified proto compiler, so we need to enforce // the following version across all dependencies. diff --git a/go.sum b/go.sum index ae75c3f3204a..c573f9bd5b20 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= @@ -146,6 +148,8 @@ 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/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= +github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= +github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -160,8 +164,8 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= +github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= +github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -172,8 +176,9 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= +github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -187,7 +192,6 @@ github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDm github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -200,8 +204,8 @@ github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbT github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= +github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= +github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -235,8 +239,8 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= -github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -256,12 +260,12 @@ github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNV github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -271,11 +275,14 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM= +github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -428,6 +435,8 @@ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7P github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/informalsystems/tendermint v0.34.24 h1:2beNEg5tp+U5oj/Md+0xDBsMHGbdue31T3OrstS6xS0= +github.com/informalsystems/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -455,8 +464,6 @@ github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= @@ -470,13 +477,16 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -548,6 +558,7 @@ github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -596,6 +607,7 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= @@ -605,6 +617,7 @@ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCr github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -666,7 +679,9 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= @@ -726,7 +741,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -751,8 +765,6 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RM github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.24 h1:879MKKJWYYPJEMMKME+DWUTY4V9f/FBpnZDI82ky+4k= -github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ= @@ -767,11 +779,11 @@ github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+l github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= @@ -825,9 +837,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE= +golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -916,8 +929,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -958,7 +971,6 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1007,17 +1019,19 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1182,13 +1196,16 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk= google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -1208,7 +1225,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/ics23/.gitignore b/ics23/.gitignore deleted file mode 100644 index 22d0d82f8095..000000000000 --- a/ics23/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor diff --git a/ics23/go/Makefile b/ics23/go/Makefile deleted file mode 100644 index aebfcb20d751..000000000000 --- a/ics23/go/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -.PHONY: protoc test - -# make sure we turn on go modules -export GO111MODULE := on - -# PROTOC_FLAGS := -I=.. -I=./vendor -I=$(GOPATH)/src -PROTOC_FLAGS := -I=.. -I=$(GOPATH)/src - -test: - go test . - -protoc: -# @go mod vendor - protoc --gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. $(PROTOC_FLAGS) ../proofs.proto - -install-proto-dep: - @echo "Installing protoc-gen-gocosmos..." - @go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos - - diff --git a/ics23/go/compress.go b/ics23/go/compress.go deleted file mode 100644 index ebe3275e3897..000000000000 --- a/ics23/go/compress.go +++ /dev/null @@ -1,157 +0,0 @@ -package ics23 - -// IsCompressed returns true if the proof was compressed -func IsCompressed(proof *CommitmentProof) bool { - return proof.GetCompressed() != nil -} - -// Compress will return a CompressedBatchProof if the input is BatchProof -// Otherwise it will return the input. -// This is safe to call multiple times (idempotent) -func Compress(proof *CommitmentProof) *CommitmentProof { - batch := proof.GetBatch() - if batch == nil { - return proof - } - return &CommitmentProof{ - Proof: &CommitmentProof_Compressed{ - Compressed: compress(batch), - }, - } -} - -// Decompress will return a BatchProof if the input is CompressedBatchProof -// Otherwise it will return the input. -// This is safe to call multiple times (idempotent) -func Decompress(proof *CommitmentProof) *CommitmentProof { - comp := proof.GetCompressed() - if comp != nil { - return &CommitmentProof{ - Proof: &CommitmentProof_Batch{ - Batch: decompress(comp), - }, - } - } - return proof -} - -func compress(batch *BatchProof) *CompressedBatchProof { - var centries []*CompressedBatchEntry - var lookup []*InnerOp - registry := make(map[string]int32) - - for _, entry := range batch.Entries { - centry := compressEntry(entry, &lookup, registry) - centries = append(centries, centry) - } - - return &CompressedBatchProof{ - Entries: centries, - LookupInners: lookup, - } -} - -func compressEntry(entry *BatchEntry, lookup *[]*InnerOp, registry map[string]int32) *CompressedBatchEntry { - if exist := entry.GetExist(); exist != nil { - return &CompressedBatchEntry{ - Proof: &CompressedBatchEntry_Exist{ - Exist: compressExist(exist, lookup, registry), - }, - } - } - - non := entry.GetNonexist() - return &CompressedBatchEntry{ - Proof: &CompressedBatchEntry_Nonexist{ - Nonexist: &CompressedNonExistenceProof{ - Key: non.Key, - Left: compressExist(non.Left, lookup, registry), - Right: compressExist(non.Right, lookup, registry), - }, - }, - } -} - -func compressExist(exist *ExistenceProof, lookup *[]*InnerOp, registry map[string]int32) *CompressedExistenceProof { - if exist == nil { - return nil - } - res := &CompressedExistenceProof{ - Key: exist.Key, - Value: exist.Value, - Leaf: exist.Leaf, - Path: make([]int32, len(exist.Path)), - } - for i, step := range exist.Path { - res.Path[i] = compressStep(step, lookup, registry) - } - return res -} - -func compressStep(step *InnerOp, lookup *[]*InnerOp, registry map[string]int32) int32 { - bz, err := step.Marshal() - if err != nil { - panic(err) - } - sig := string(bz) - - // load from cache if there - if num, ok := registry[sig]; ok { - return num - } - - // create new step if not there - num := int32(len(*lookup)) - *lookup = append(*lookup, step) - registry[sig] = num - return num -} - -func decompress(comp *CompressedBatchProof) *BatchProof { - lookup := comp.LookupInners - - var entries []*BatchEntry - - for _, centry := range comp.Entries { - entry := decompressEntry(centry, lookup) - entries = append(entries, entry) - } - - return &BatchProof{ - Entries: entries, - } -} - -// TendermintSpec constrains the format from proofs-tendermint (crypto/merkle SimpleProof) -var TendermintSpec = &ProofSpec{ - LeafSpec: &LeafOp{ - Prefix: []byte{0}, - PrehashKey: HashOp_NO_HASH, - Hash: HashOp_SHA256, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - InnerSpec: &InnerSpec{ - ChildOrder: []int32{0, 1}, - MinPrefixLength: 1, - MaxPrefixLength: 1, - ChildSize: 32, // (no length byte) - Hash: HashOp_SHA256, - }, -} - -func decompressExist(exist *CompressedExistenceProof, lookup []*InnerOp) *ExistenceProof { - if exist == nil { - return nil - } - res := &ExistenceProof{ - Key: exist.Key, - Value: exist.Value, - Leaf: exist.Leaf, - Path: make([]*InnerOp, len(exist.Path)), - } - for i, step := range exist.Path { - res.Path[i] = lookup[step] - } - return res -} diff --git a/ics23/go/go.mod b/ics23/go/go.mod deleted file mode 100644 index 4588c6961d28..000000000000 --- a/ics23/go/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/confio/ics23/go - -go 1.14 - -require ( - github.com/gogo/protobuf v1.3.1 - github.com/pkg/errors v0.8.1 - github.com/stretchr/testify v1.8.0 // indirect - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 -) diff --git a/ics23/go/go.sum b/ics23/go/go.sum deleted file mode 100644 index 9f866e054cf4..000000000000 --- a/ics23/go/go.sum +++ /dev/null @@ -1,28 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/ics23/go/ics23.go b/ics23/go/ics23.go deleted file mode 100644 index 9a79dc3fc302..000000000000 --- a/ics23/go/ics23.go +++ /dev/null @@ -1,175 +0,0 @@ -/* -* -This implements the client side functions as specified in -https://github.com/cosmos/ics/tree/master/spec/ics-023-vector-commitments - -In particular: - - // Assumes ExistenceProof - type verifyMembership = (root: CommitmentRoot, proof: CommitmentProof, key: Key, value: Value) => boolean - - // Assumes NonExistenceProof - type verifyNonMembership = (root: CommitmentRoot, proof: CommitmentProof, key: Key) => boolean - - // Assumes BatchProof - required ExistenceProofs may be a subset of all items proven - type batchVerifyMembership = (root: CommitmentRoot, proof: CommitmentProof, items: Map) => boolean - - // Assumes BatchProof - required NonExistenceProofs may be a subset of all items proven - type batchVerifyNonMembership = (root: CommitmentRoot, proof: CommitmentProof, keys: Set) => boolean - -We make an adjustment to accept a Spec to ensure the provided proof is in the format of the expected merkle store. -This can avoid an range of attacks on fake preimages, as we need to be careful on how to map key, value -> leaf -and determine neighbors -*/ -package ics23 - -import ( - "bytes" - "fmt" -) - -// CommitmentRoot is a byte slice that represents the merkle root of a tree that can be used to validate proofs -type CommitmentRoot []byte - -// VerifyMembership returns true iff -// proof is (contains) an ExistenceProof for the given key and value AND -// calculating the root for the ExistenceProof matches the provided CommitmentRoot -func VerifyMembership(spec *ProofSpec, root CommitmentRoot, proof *CommitmentProof, key []byte, value []byte) bool { - // decompress it before running code (no-op if not compressed) - proof = Decompress(proof) - ep := getExistProofForKey(proof, key) - if ep == nil { - return false - } - err := ep.Verify(spec, root, key, value) - return err == nil -} - -// VerifyNonMembership returns true iff -// proof is (contains) a NonExistenceProof -// both left and right sub-proofs are valid existence proofs (see above) or nil -// left and right proofs are neighbors (or left/right most if one is nil) -// provided key is between the keys of the two proofs -func VerifyNonMembership(spec *ProofSpec, root CommitmentRoot, proof *CommitmentProof, key []byte) bool { - // decompress it before running code (no-op if not compressed) - proof = Decompress(proof) - np := getNonExistProofForKey(proof, key) - if np == nil { - return false - } - err := np.Verify(spec, root, key) - return err == nil -} - -// BatchVerifyMembership will ensure all items are also proven by the CommitmentProof (which should be a BatchProof, -// unless there is one item, when a ExistenceProof may work) -func BatchVerifyMembership(spec *ProofSpec, root CommitmentRoot, proof *CommitmentProof, items map[string][]byte) bool { - // decompress it before running code (no-op if not compressed) - once for batch - proof = Decompress(proof) - for k, v := range items { - valid := VerifyMembership(spec, root, proof, []byte(k), v) - if !valid { - return false - } - } - return true -} - -// BatchVerifyNonMembership will ensure all items are also proven to not be in the Commitment by the CommitmentProof -// (which should be a BatchProof, unless there is one item, when a NonExistenceProof may work) -func BatchVerifyNonMembership(spec *ProofSpec, root CommitmentRoot, proof *CommitmentProof, keys [][]byte) bool { - // decompress it before running code (no-op if not compressed) - once for batch - proof = Decompress(proof) - for _, k := range keys { - valid := VerifyNonMembership(spec, root, proof, k) - if !valid { - return false - } - } - return true -} - -// CombineProofs takes a number of commitment proofs (simple or batch) and -// converts them into a batch and compresses them. -// -// This is designed for proof generation libraries to create efficient batches -func CombineProofs(proofs []*CommitmentProof) (*CommitmentProof, error) { - var entries []*BatchEntry - - for _, proof := range proofs { - if ex := proof.GetExist(); ex != nil { - entry := &BatchEntry{ - Proof: &BatchEntry_Exist{ - Exist: ex, - }, - } - entries = append(entries, entry) - } else if non := proof.GetNonexist(); non != nil { - entry := &BatchEntry{ - Proof: &BatchEntry_Nonexist{ - Nonexist: non, - }, - } - entries = append(entries, entry) - } else if batch := proof.GetBatch(); batch != nil { - entries = append(entries, batch.Entries...) - } else if comp := proof.GetCompressed(); comp != nil { - decomp := Decompress(proof) - entries = append(entries, decomp.GetBatch().Entries...) - } else { - return nil, fmt.Errorf("proof neither exist or nonexist: %#v", proof.GetProof()) - } - } - - batch := &CommitmentProof{ - Proof: &CommitmentProof_Batch{ - Batch: &BatchProof{ - Entries: entries, - }, - }, - } - - return Compress(batch), nil -} - -func getExistProofForKey(proof *CommitmentProof, key []byte) *ExistenceProof { - switch p := proof.Proof.(type) { - case *CommitmentProof_Exist: - ep := p.Exist - if bytes.Equal(ep.Key, key) { - return ep - } - case *CommitmentProof_Batch: - for _, sub := range p.Batch.Entries { - if ep := sub.GetExist(); ep != nil && bytes.Equal(ep.Key, key) { - return ep - } - } - } - return nil -} - -func getNonExistProofForKey(proof *CommitmentProof, key []byte) *NonExistenceProof { - switch p := proof.Proof.(type) { - case *CommitmentProof_Nonexist: - np := p.Nonexist - if isLeft(np.Left, key) && isRight(np.Right, key) { - return np - } - case *CommitmentProof_Batch: - for _, sub := range p.Batch.Entries { - if np := sub.GetNonexist(); np != nil && isLeft(np.Left, key) && isRight(np.Right, key) { - return np - } - } - } - return nil -} - -func isLeft(left *ExistenceProof, key []byte) bool { - return left == nil || bytes.Compare(left.Key, key) < 0 -} - -func isRight(right *ExistenceProof, key []byte) bool { - return right == nil || bytes.Compare(right.Key, key) > 0 -} diff --git a/ics23/go/ops.go b/ics23/go/ops.go deleted file mode 100644 index 6666dac5c00c..000000000000 --- a/ics23/go/ops.go +++ /dev/null @@ -1,250 +0,0 @@ -package ics23 - -import ( - "bytes" - "crypto" - "encoding/binary" - "fmt" - "hash" - - // adds sha256 capability to crypto.SHA256 - _ "crypto/sha256" - // adds sha512 capability to crypto.SHA512 - _ "crypto/sha512" - - // adds ripemd160 capability to crypto.RIPEMD160 - _ "golang.org/x/crypto/ripemd160" - - "github.com/pkg/errors" -) - -// validate the IAVL Ops -func z(op opType, b int) error { - r := bytes.NewReader(op.GetPrefix()) - - values := []int64{} - for i := 0; i < 3; i++ { - varInt, err := binary.ReadVarint(r) - if err != nil { - return err - } - values = append(values, varInt) - - // values must be bounded - if int(varInt) < 0 { - return fmt.Errorf("wrong value in IAVL leaf op") - } - } - if int(values[0]) < b { - return fmt.Errorf("wrong value in IAVL leaf op") - } - - r2 := r.Len() - if b == 0 { - if r2 != 0 { - return fmt.Errorf("invalid op") - } - } else { - if !(r2^(0xff&0x01) == 0 || r2 == (0xde+int('v'))/10) { - return fmt.Errorf("invalid op") - } - if op.GetHash()^1 != 0 { - return fmt.Errorf("invalid op") - } - } - return nil -} - -// Apply will calculate the leaf hash given the key and value being proven -func (op *LeafOp) Apply(key []byte, value []byte) ([]byte, error) { - if len(key) == 0 { - return nil, errors.New("Leaf op needs key") - } - if len(value) == 0 { - return nil, errors.New("Leaf op needs value") - } - pkey, err := prepareLeafData(op.PrehashKey, op.Length, key) - if err != nil { - return nil, errors.Wrap(err, "prehash key") - } - pvalue, err := prepareLeafData(op.PrehashValue, op.Length, value) - if err != nil { - return nil, errors.Wrap(err, "prehash value") - } - data := append(op.Prefix, pkey...) - data = append(data, pvalue...) - return doHash(op.Hash, data) -} - -// Apply will calculate the hash of the next step, given the hash of the previous step -func (op *InnerOp) Apply(child []byte) ([]byte, error) { - if len(child) == 0 { - return nil, errors.Errorf("Inner op needs child value") - } - preimage := append(op.Prefix, child...) - preimage = append(preimage, op.Suffix...) - return doHash(op.Hash, preimage) -} - -// CheckAgainstSpec will verify the LeafOp is in the format defined in spec -func (op *LeafOp) CheckAgainstSpec(spec *ProofSpec) error { - lspec := spec.LeafSpec - - if g(spec) { - fmt.Println("Dragonberry Active") - err := z(op, 0) - if err != nil { - return err - } - } - - if op.Hash != lspec.Hash { - return errors.Errorf("Unexpected HashOp: %d", op.Hash) - } - if op.PrehashKey != lspec.PrehashKey { - return errors.Errorf("Unexpected PrehashKey: %d", op.PrehashKey) - } - if op.PrehashValue != lspec.PrehashValue { - return errors.Errorf("Unexpected PrehashValue: %d", op.PrehashValue) - } - if op.Length != lspec.Length { - return errors.Errorf("Unexpected LengthOp: %d", op.Length) - } - if !bytes.HasPrefix(op.Prefix, lspec.Prefix) { - return errors.Errorf("Leaf Prefix doesn't start with %X", lspec.Prefix) - } - return nil -} - -// CheckAgainstSpec will verify the InnerOp is in the format defined in spec -func (op *InnerOp) CheckAgainstSpec(spec *ProofSpec, b int) error { - if op.Hash != spec.InnerSpec.Hash { - return errors.Errorf("Unexpected HashOp: %d", op.Hash) - } - - if g(spec) { - err := z(op, b) - if err != nil { - return err - } - } - - leafPrefix := spec.LeafSpec.Prefix - if bytes.HasPrefix(op.Prefix, leafPrefix) { - return errors.Errorf("Inner Prefix starts with %X", leafPrefix) - } - if len(op.Prefix) < int(spec.InnerSpec.MinPrefixLength) { - return errors.Errorf("InnerOp prefix too short (%d)", len(op.Prefix)) - } - maxLeftChildBytes := (len(spec.InnerSpec.ChildOrder) - 1) * int(spec.InnerSpec.ChildSize) - if len(op.Prefix) > int(spec.InnerSpec.MaxPrefixLength)+maxLeftChildBytes { - return errors.Errorf("InnerOp prefix too long (%d)", len(op.Prefix)) - } - - // ensures soundness, with suffix having to be of correct length - if len(op.Suffix)%int(spec.InnerSpec.ChildSize) != 0 { - return errors.Errorf("InnerOp suffix malformed") - } - - return nil -} - -// doHash will preform the specified hash on the preimage. -// if hashOp == NONE, it will return an error (use doHashOrNoop if you want different behavior) -func doHash(hashOp HashOp, preimage []byte) ([]byte, error) { - switch hashOp { - case HashOp_SHA256: - return hashBz(crypto.SHA256, preimage) - case HashOp_SHA512: - return hashBz(crypto.SHA512, preimage) - case HashOp_RIPEMD160: - return hashBz(crypto.RIPEMD160, preimage) - case HashOp_BITCOIN: - // ripemd160(sha256(x)) - sha := crypto.SHA256.New() - sha.Write(preimage) - tmp := sha.Sum(nil) - hash := crypto.RIPEMD160.New() - hash.Write(tmp) - return hash.Sum(nil), nil - case HashOp_SHA512_256: - hash := crypto.SHA512_256.New() - hash.Write(preimage) - return hash.Sum(nil), nil - } - return nil, errors.Errorf("Unsupported hashop: %d", hashOp) -} - -type hasher interface { - New() hash.Hash -} - -func hashBz(h hasher, preimage []byte) ([]byte, error) { - hh := h.New() - hh.Write(preimage) - return hh.Sum(nil), nil -} - -func prepareLeafData(hashOp HashOp, lengthOp LengthOp, data []byte) ([]byte, error) { - // TODO: lengthop before or after hash ??? - hdata, err := doHashOrNoop(hashOp, data) - if err != nil { - return nil, err - } - ldata, err := doLengthOp(lengthOp, hdata) - return ldata, err -} - -func g(spec *ProofSpec) bool { - return spec.SpecEquals(IavlSpec) -} - -type opType interface { - GetPrefix() []byte - GetHash() HashOp - Reset() - String() string -} - -// doLengthOp will calculate the proper prefix and return it prepended -// -// doLengthOp(op, data) -> length(data) || data -func doLengthOp(lengthOp LengthOp, data []byte) ([]byte, error) { - switch lengthOp { - case LengthOp_NO_PREFIX: - return data, nil - case LengthOp_VAR_PROTO: - res := append(encodeVarintProto(len(data)), data...) - return res, nil - case LengthOp_REQUIRE_32_BYTES: - if len(data) != 32 { - return nil, errors.Errorf("Data was %d bytes, not 32", len(data)) - } - return data, nil - case LengthOp_REQUIRE_64_BYTES: - if len(data) != 64 { - return nil, errors.Errorf("Data was %d bytes, not 64", len(data)) - } - return data, nil - case LengthOp_FIXED32_LITTLE: - res := make([]byte, 4, 4+len(data)) - binary.LittleEndian.PutUint32(res[:4], uint32(len(data))) - res = append(res, data...) - return res, nil - // TODO - // case LengthOp_VAR_RLP: - // case LengthOp_FIXED32_BIG: - // case LengthOp_FIXED64_BIG: - // case LengthOp_FIXED64_LITTLE: - } - return nil, errors.Errorf("Unsupported lengthop: %d", lengthOp) -} - -// doHashOrNoop will return the preimage untouched if hashOp == NONE, -// otherwise, perform doHash -func doHashOrNoop(hashOp HashOp, preimage []byte) ([]byte, error) { - if hashOp == HashOp_NO_HASH { - return preimage, nil - } - return doHash(hashOp, preimage) -} diff --git a/ics23/go/proof.go b/ics23/go/proof.go deleted file mode 100644 index cec590590fe7..000000000000 --- a/ics23/go/proof.go +++ /dev/null @@ -1,452 +0,0 @@ -package ics23 - -import ( - "bytes" - - "github.com/pkg/errors" -) - -// IavlSpec constrains the format from proofs-iavl (iavl merkle proofs) -var IavlSpec = &ProofSpec{ - LeafSpec: &LeafOp{ - Prefix: []byte{0}, - PrehashKey: HashOp_NO_HASH, - Hash: HashOp_SHA256, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - InnerSpec: &InnerSpec{ - ChildOrder: []int32{0, 1}, - MinPrefixLength: 4, - MaxPrefixLength: 12, - ChildSize: 33, // (with length byte) - EmptyChild: nil, - Hash: HashOp_SHA256, - }, -} - -// SmtSpec constrains the format for SMT proofs (as implemented by github.com/celestiaorg/smt) -var SmtSpec = &ProofSpec{ - LeafSpec: &LeafOp{ - Hash: HashOp_SHA256, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_NO_PREFIX, - Prefix: []byte{0}, - }, - InnerSpec: &InnerSpec{ - ChildOrder: []int32{0, 1}, - ChildSize: 32, - MinPrefixLength: 1, - MaxPrefixLength: 1, - EmptyChild: make([]byte, 32), - Hash: HashOp_SHA256, - }, - MaxDepth: 256, -} - -func encodeVarintProto(l int) []byte { - // avoid multiple allocs for normal case - res := make([]byte, 0, 8) - for l >= 1<<7 { - res = append(res, uint8(l&0x7f|0x80)) - l >>= 7 - } - res = append(res, uint8(l)) - return res -} - -// Calculate determines the root hash that matches a given Commitment proof -// by type switching and calculating root based on proof type -// NOTE: Calculate will return the first calculated root in the proof, -// you must validate that all other embedded ExistenceProofs commit to the same root. -// This can be done with the Verify method -func (p *CommitmentProof) Calculate() (CommitmentRoot, error) { - switch v := p.Proof.(type) { - case *CommitmentProof_Exist: - return v.Exist.Calculate() - case *CommitmentProof_Nonexist: - return v.Nonexist.Calculate() - case *CommitmentProof_Batch: - if len(v.Batch.GetEntries()) == 0 || v.Batch.GetEntries()[0] == nil { - return nil, errors.New("batch proof has empty entry") - } - if e := v.Batch.GetEntries()[0].GetExist(); e != nil { - return e.Calculate() - } - if n := v.Batch.GetEntries()[0].GetNonexist(); n != nil { - return n.Calculate() - } - case *CommitmentProof_Compressed: - proof := Decompress(p) - return proof.Calculate() - default: - return nil, errors.New("unrecognized proof type") - } - return nil, errors.New("unrecognized proof type") -} - -// Verify does all checks to ensure this proof proves this key, value -> root -// and matches the spec. -func (p *ExistenceProof) Verify(spec *ProofSpec, root CommitmentRoot, key []byte, value []byte) error { - if err := p.CheckAgainstSpec(spec); err != nil { - return err - } - - if !bytes.Equal(key, p.Key) { - return errors.Errorf("Provided key doesn't match proof") - } - if !bytes.Equal(value, p.Value) { - return errors.Errorf("Provided value doesn't match proof") - } - - calc, err := p.calculate(spec) - if err != nil { - return errors.Wrap(err, "Error calculating root") - } - if !bytes.Equal(root, calc) { - return errors.Errorf("Calculcated root doesn't match provided root") - } - - return nil -} - -// Calculate determines the root hash that matches the given proof. -// You must validate the result is what you have in a header. -// Returns error if the calculations cannot be performed. -func (p *ExistenceProof) Calculate() (CommitmentRoot, error) { - return p.calculate(nil) -} - -func (p *ExistenceProof) calculate(spec *ProofSpec) (CommitmentRoot, error) { - if p.GetLeaf() == nil { - return nil, errors.New("Existence Proof needs defined LeafOp") - } - - // leaf step takes the key and value as input - res, err := p.Leaf.Apply(p.Key, p.Value) - if err != nil { - return nil, errors.WithMessage(err, "leaf") - } - - // the rest just take the output of the last step (reducing it) - for _, step := range p.Path { - res, err = step.Apply(res) - if err != nil { - return nil, errors.WithMessage(err, "inner") - } - if spec != nil { - if len(res) > int(spec.InnerSpec.ChildSize) && int(spec.InnerSpec.ChildSize) >= 32 { - return nil, errors.WithMessage(err, "inner") - } - } - } - return res, nil -} - -func decompressEntry(entry *CompressedBatchEntry, lookup []*InnerOp) *BatchEntry { - if exist := entry.GetExist(); exist != nil { - return &BatchEntry{ - Proof: &BatchEntry_Exist{ - Exist: decompressExist(exist, lookup), - }, - } - } - - non := entry.GetNonexist() - return &BatchEntry{ - Proof: &BatchEntry_Nonexist{ - Nonexist: &NonExistenceProof{ - Key: non.Key, - Left: decompressExist(non.Left, lookup), - Right: decompressExist(non.Right, lookup), - }, - }, - } -} - -// Calculate determines the root hash that matches the given nonexistence rpoog. -// You must validate the result is what you have in a header. -// Returns error if the calculations cannot be performed. -func (p *NonExistenceProof) Calculate() (CommitmentRoot, error) { - // A Nonexist proof may have left or right proof nil - switch { - case p.Left != nil: - return p.Left.Calculate() - case p.Right != nil: - return p.Right.Calculate() - default: - return nil, errors.New("Nonexistence proof has empty Left and Right proof") - } -} - -// CheckAgainstSpec will verify the leaf and all path steps are in the format defined in spec -func (p *ExistenceProof) CheckAgainstSpec(spec *ProofSpec) error { - if p.GetLeaf() == nil { - return errors.New("Existence Proof needs defined LeafOp") - } - err := p.Leaf.CheckAgainstSpec(spec) - if err != nil { - return errors.WithMessage(err, "leaf") - } - if spec.MinDepth > 0 && len(p.Path) < int(spec.MinDepth) { - return errors.Errorf("InnerOps depth too short: %d", len(p.Path)) - } - if spec.MaxDepth > 0 && len(p.Path) > int(spec.MaxDepth) { - return errors.Errorf("InnerOps depth too long: %d", len(p.Path)) - } - - layerNum := 1 - - for _, inner := range p.Path { - if err := inner.CheckAgainstSpec(spec, layerNum); err != nil { - return errors.WithMessage(err, "inner") - } - layerNum += 1 - } - return nil -} - -// Verify does all checks to ensure the proof has valid non-existence proofs, -// and they ensure the given key is not in the CommitmentState -func (p *NonExistenceProof) Verify(spec *ProofSpec, root CommitmentRoot, key []byte) error { - // ensure the existence proofs are valid - var leftKey, rightKey []byte - if p.Left != nil { - if err := p.Left.Verify(spec, root, p.Left.Key, p.Left.Value); err != nil { - return errors.Wrap(err, "left proof") - } - leftKey = p.Left.Key - } - if p.Right != nil { - if err := p.Right.Verify(spec, root, p.Right.Key, p.Right.Value); err != nil { - return errors.Wrap(err, "right proof") - } - rightKey = p.Right.Key - } - - // If both proofs are missing, this is not a valid proof - if leftKey == nil && rightKey == nil { - return errors.New("both left and right proofs missing") - } - - // Ensure in valid range - if rightKey != nil { - if bytes.Compare(key, rightKey) >= 0 { - return errors.New("key is not left of right proof") - } - } - if leftKey != nil { - if bytes.Compare(key, leftKey) <= 0 { - return errors.New("key is not right of left proof") - } - } - - if leftKey == nil { - if !IsLeftMost(spec.InnerSpec, p.Right.Path) { - return errors.New("left proof missing, right proof must be left-most") - } - } else if rightKey == nil { - if !IsRightMost(spec.InnerSpec, p.Left.Path) { - return errors.New("right proof missing, left proof must be right-most") - } - } else { // in the middle - if !IsLeftNeighbor(spec.InnerSpec, p.Left.Path, p.Right.Path) { - return errors.New("right proof missing, left proof must be right-most") - } - } - return nil -} - -// IsLeftMost returns true if this is the left-most path in the tree, excluding placeholder (empty child) nodes -func IsLeftMost(spec *InnerSpec, path []*InnerOp) bool { - minPrefix, maxPrefix, suffix := getPadding(spec, 0) - - // ensure every step has a prefix and suffix defined to be leftmost, unless it is a placeholder node - for _, step := range path { - if !hasPadding(step, minPrefix, maxPrefix, suffix) && !leftBranchesAreEmpty(spec, step) { - return false - } - } - return true -} - -// IsRightMost returns true if this is the left-most path in the tree, excluding placeholder (empty child) nodes -func IsRightMost(spec *InnerSpec, path []*InnerOp) bool { - last := len(spec.ChildOrder) - 1 - minPrefix, maxPrefix, suffix := getPadding(spec, int32(last)) - - // ensure every step has a prefix and suffix defined to be rightmost, unless it is a placeholder node - for _, step := range path { - if !hasPadding(step, minPrefix, maxPrefix, suffix) && !rightBranchesAreEmpty(spec, step) { - return false - } - } - return true -} - -// IsLeftNeighbor returns true if `right` is the next possible path right of `left` -// -// Find the common suffix from the Left.Path and Right.Path and remove it. We have LPath and RPath now, which must be neighbors. -// Validate that LPath[len-1] is the left neighbor of RPath[len-1] -// For step in LPath[0..len-1], validate step is right-most node -// For step in RPath[0..len-1], validate step is left-most node -func IsLeftNeighbor(spec *InnerSpec, left []*InnerOp, right []*InnerOp) bool { - // count common tail (from end, near root) - left, topleft := left[:len(left)-1], left[len(left)-1] - right, topright := right[:len(right)-1], right[len(right)-1] - for bytes.Equal(topleft.Prefix, topright.Prefix) && bytes.Equal(topleft.Suffix, topright.Suffix) { - left, topleft = left[:len(left)-1], left[len(left)-1] - right, topright = right[:len(right)-1], right[len(right)-1] - } - - // now topleft and topright are the first divergent nodes - // make sure they are left and right of each other - if !isLeftStep(spec, topleft, topright) { - return false - } - - // left and right are remaining children below the split, - // ensure left child is the rightmost path, and visa versa - if !IsRightMost(spec, left) { - return false - } - if !IsLeftMost(spec, right) { - return false - } - return true -} - -// isLeftStep assumes left and right have common parents -// checks if left is exactly one slot to the left of right -func isLeftStep(spec *InnerSpec, left *InnerOp, right *InnerOp) bool { - leftidx, err := orderFromPadding(spec, left) - if err != nil { - panic(err) - } - rightidx, err := orderFromPadding(spec, right) - if err != nil { - panic(err) - } - - // TODO: is it possible there are empty (nil) children??? - return rightidx == leftidx+1 -} - -// checks if an op has the expected padding -func hasPadding(op *InnerOp, minPrefix, maxPrefix, suffix int) bool { - if len(op.Prefix) < minPrefix { - return false - } - if len(op.Prefix) > maxPrefix { - return false - } - return len(op.Suffix) == suffix -} - -// getPadding determines prefix and suffix with the given spec and position in the tree -func getPadding(spec *InnerSpec, branch int32) (minPrefix, maxPrefix, suffix int) { - idx := getPosition(spec.ChildOrder, branch) - - // count how many children are in the prefix - prefix := idx * int(spec.ChildSize) - minPrefix = prefix + int(spec.MinPrefixLength) - maxPrefix = prefix + int(spec.MaxPrefixLength) - - // count how many children are in the suffix - suffix = (len(spec.ChildOrder) - 1 - idx) * int(spec.ChildSize) - return -} - -// leftBranchesAreEmpty returns true if the padding bytes correspond to all empty siblings -// on the left side of a branch, ie. it's a valid placeholder on a leftmost path -func leftBranchesAreEmpty(spec *InnerSpec, op *InnerOp) bool { - idx, err := orderFromPadding(spec, op) - if err != nil { - return false - } - // count branches to left of this - leftBranches := int(idx) - if leftBranches == 0 { - return false - } - // compare prefix with the expected number of empty branches - actualPrefix := len(op.Prefix) - leftBranches*int(spec.ChildSize) - if actualPrefix < 0 { - return false - } - for i := 0; i < leftBranches; i++ { - idx := getPosition(spec.ChildOrder, int32(i)) - from := actualPrefix + idx*int(spec.ChildSize) - if !bytes.Equal(spec.EmptyChild, op.Prefix[from:from+int(spec.ChildSize)]) { - return false - } - } - return true -} - -// rightBranchesAreEmpty returns true if the padding bytes correspond to all empty siblings -// on the right side of a branch, ie. it's a valid placeholder on a rightmost path -func rightBranchesAreEmpty(spec *InnerSpec, op *InnerOp) bool { - idx, err := orderFromPadding(spec, op) - if err != nil { - return false - } - // count branches to right of this one - rightBranches := len(spec.ChildOrder) - 1 - int(idx) - if rightBranches == 0 { - return false - } - // compare suffix with the expected number of empty branches - if len(op.Suffix) != rightBranches*int(spec.ChildSize) { - return false // sanity check - } - for i := 0; i < rightBranches; i++ { - idx := getPosition(spec.ChildOrder, int32(i)) - from := idx * int(spec.ChildSize) - if !bytes.Equal(spec.EmptyChild, op.Suffix[from:from+int(spec.ChildSize)]) { - return false - } - } - return true -} - -// getPosition checks where the branch is in the order and returns -// the index of this branch -func getPosition(order []int32, branch int32) int { - if branch < 0 || int(branch) >= len(order) { - panic(errors.Errorf("Invalid branch: %d", branch)) - } - for i, item := range order { - if branch == item { - return i - } - } - panic(errors.Errorf("Branch %d not found in order %v", branch, order)) -} - -// This will look at the proof and determine which order it is... -// So we can see if it is branch 0, 1, 2 etc... to determine neighbors -func orderFromPadding(spec *InnerSpec, inner *InnerOp) (int32, error) { - maxbranch := int32(len(spec.ChildOrder)) - for branch := int32(0); branch < maxbranch; branch++ { - minp, maxp, suffix := getPadding(spec, branch) - if hasPadding(inner, minp, maxp, suffix) { - return branch, nil - } - } - return 0, errors.New("Cannot find any valid spacing for this node") -} - -// over-declares equality, which we cosnider fine for now. -func (p *ProofSpec) SpecEquals(spec *ProofSpec) bool { - return p.LeafSpec.Hash == spec.LeafSpec.Hash && - p.LeafSpec.PrehashKey == spec.LeafSpec.PrehashKey && - p.LeafSpec.PrehashValue == spec.LeafSpec.PrehashValue && - p.LeafSpec.Length == spec.LeafSpec.Length && - p.InnerSpec.Hash == spec.InnerSpec.Hash && - p.InnerSpec.MinPrefixLength == spec.InnerSpec.MinPrefixLength && - p.InnerSpec.MaxPrefixLength == spec.InnerSpec.MaxPrefixLength && - p.InnerSpec.ChildSize == spec.InnerSpec.ChildSize && - len(p.InnerSpec.ChildOrder) == len(spec.InnerSpec.ChildOrder) -} diff --git a/ics23/go/proofs.pb.go b/ics23/go/proofs.pb.go deleted file mode 100644 index 7ebd4a61f43a..000000000000 --- a/ics23/go/proofs.pb.go +++ /dev/null @@ -1,4548 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: proofs.proto - -package ics23 - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type HashOp int32 - -const ( - // NO_HASH is the default if no data passed. Note this is an illegal argument some places. - HashOp_NO_HASH HashOp = 0 - HashOp_SHA256 HashOp = 1 - HashOp_SHA512 HashOp = 2 - HashOp_KECCAK HashOp = 3 - HashOp_RIPEMD160 HashOp = 4 - HashOp_BITCOIN HashOp = 5 - HashOp_SHA512_256 HashOp = 6 -) - -var HashOp_name = map[int32]string{ - 0: "NO_HASH", - 1: "SHA256", - 2: "SHA512", - 3: "KECCAK", - 4: "RIPEMD160", - 5: "BITCOIN", - 6: "SHA512_256", -} - -var HashOp_value = map[string]int32{ - "NO_HASH": 0, - "SHA256": 1, - "SHA512": 2, - "KECCAK": 3, - "RIPEMD160": 4, - "BITCOIN": 5, - "SHA512_256": 6, -} - -func (x HashOp) String() string { - return proto.EnumName(HashOp_name, int32(x)) -} - -func (HashOp) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{0} -} - -// * -// LengthOp defines how to process the key and value of the LeafOp -// to include length information. After encoding the length with the given -// algorithm, the length will be prepended to the key and value bytes. -// (Each one with it's own encoded length) -type LengthOp int32 - -const ( - // NO_PREFIX don't include any length info - LengthOp_NO_PREFIX LengthOp = 0 - // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length - LengthOp_VAR_PROTO LengthOp = 1 - // VAR_RLP uses rlp int encoding of the length - LengthOp_VAR_RLP LengthOp = 2 - // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer - LengthOp_FIXED32_BIG LengthOp = 3 - // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer - LengthOp_FIXED32_LITTLE LengthOp = 4 - // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer - LengthOp_FIXED64_BIG LengthOp = 5 - // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer - LengthOp_FIXED64_LITTLE LengthOp = 6 - // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) - LengthOp_REQUIRE_32_BYTES LengthOp = 7 - // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) - LengthOp_REQUIRE_64_BYTES LengthOp = 8 -) - -var LengthOp_name = map[int32]string{ - 0: "NO_PREFIX", - 1: "VAR_PROTO", - 2: "VAR_RLP", - 3: "FIXED32_BIG", - 4: "FIXED32_LITTLE", - 5: "FIXED64_BIG", - 6: "FIXED64_LITTLE", - 7: "REQUIRE_32_BYTES", - 8: "REQUIRE_64_BYTES", -} - -var LengthOp_value = map[string]int32{ - "NO_PREFIX": 0, - "VAR_PROTO": 1, - "VAR_RLP": 2, - "FIXED32_BIG": 3, - "FIXED32_LITTLE": 4, - "FIXED64_BIG": 5, - "FIXED64_LITTLE": 6, - "REQUIRE_32_BYTES": 7, - "REQUIRE_64_BYTES": 8, -} - -func (x LengthOp) String() string { - return proto.EnumName(LengthOp_name, int32(x)) -} - -func (LengthOp) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{1} -} - -// * -// ExistenceProof takes a key and a value and a set of steps to perform on it. -// The result of peforming all these steps will provide a "root hash", which can -// be compared to the value in a header. -// -// Since it is computationally infeasible to produce a hash collission for any of the used -// cryptographic hash functions, if someone can provide a series of operations to transform -// a given key and value into a root hash that matches some trusted root, these key and values -// must be in the referenced merkle tree. -// -// The only possible issue is maliablity in LeafOp, such as providing extra prefix data, -// which should be controlled by a spec. Eg. with lengthOp as NONE, -// prefix = FOO, key = BAR, value = CHOICE -// and -// prefix = F, key = OOBAR, value = CHOICE -// would produce the same value. -// -// With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field -// in the ProofSpec is valuable to prevent this mutability. And why all trees should -// length-prefix the data before hashing it. -type ExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` - Path []*InnerOp `protobuf:"bytes,4,rep,name=path,proto3" json:"path,omitempty"` -} - -func (m *ExistenceProof) Reset() { *m = ExistenceProof{} } -func (m *ExistenceProof) String() string { return proto.CompactTextString(m) } -func (*ExistenceProof) ProtoMessage() {} -func (*ExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{0} -} -func (m *ExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExistenceProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExistenceProof.Merge(m, src) -} -func (m *ExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *ExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_ExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_ExistenceProof proto.InternalMessageInfo - -func (m *ExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *ExistenceProof) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *ExistenceProof) GetLeaf() *LeafOp { - if m != nil { - return m.Leaf - } - return nil -} - -func (m *ExistenceProof) GetPath() []*InnerOp { - if m != nil { - return m.Path - } - return nil -} - -// NonExistenceProof takes a proof of two neighbors, one left of the desired key, -// one right of the desired key. If both proofs are valid AND they are neighbors, -// then there is no valid proof for the given key. -type NonExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Left *ExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` - Right *ExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` -} - -func (m *NonExistenceProof) Reset() { *m = NonExistenceProof{} } -func (m *NonExistenceProof) String() string { return proto.CompactTextString(m) } -func (*NonExistenceProof) ProtoMessage() {} -func (*NonExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{1} -} -func (m *NonExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NonExistenceProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NonExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonExistenceProof.Merge(m, src) -} -func (m *NonExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *NonExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_NonExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_NonExistenceProof proto.InternalMessageInfo - -func (m *NonExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *NonExistenceProof) GetLeft() *ExistenceProof { - if m != nil { - return m.Left - } - return nil -} - -func (m *NonExistenceProof) GetRight() *ExistenceProof { - if m != nil { - return m.Right - } - return nil -} - -// CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages -type CommitmentProof struct { - // Types that are valid to be assigned to Proof: - // *CommitmentProof_Exist - // *CommitmentProof_Nonexist - // *CommitmentProof_Batch - // *CommitmentProof_Compressed - Proof isCommitmentProof_Proof `protobuf_oneof:"proof"` -} - -func (m *CommitmentProof) Reset() { *m = CommitmentProof{} } -func (m *CommitmentProof) String() string { return proto.CompactTextString(m) } -func (*CommitmentProof) ProtoMessage() {} -func (*CommitmentProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{2} -} -func (m *CommitmentProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CommitmentProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommitmentProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CommitmentProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitmentProof.Merge(m, src) -} -func (m *CommitmentProof) XXX_Size() int { - return m.Size() -} -func (m *CommitmentProof) XXX_DiscardUnknown() { - xxx_messageInfo_CommitmentProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitmentProof proto.InternalMessageInfo - -type isCommitmentProof_Proof interface { - isCommitmentProof_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type CommitmentProof_Exist struct { - Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type CommitmentProof_Nonexist struct { - Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} -type CommitmentProof_Batch struct { - Batch *BatchProof `protobuf:"bytes,3,opt,name=batch,proto3,oneof" json:"batch,omitempty"` -} -type CommitmentProof_Compressed struct { - Compressed *CompressedBatchProof `protobuf:"bytes,4,opt,name=compressed,proto3,oneof" json:"compressed,omitempty"` -} - -func (*CommitmentProof_Exist) isCommitmentProof_Proof() {} -func (*CommitmentProof_Nonexist) isCommitmentProof_Proof() {} -func (*CommitmentProof_Batch) isCommitmentProof_Proof() {} -func (*CommitmentProof_Compressed) isCommitmentProof_Proof() {} - -func (m *CommitmentProof) GetProof() isCommitmentProof_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *CommitmentProof) GetExist() *ExistenceProof { - if x, ok := m.GetProof().(*CommitmentProof_Exist); ok { - return x.Exist - } - return nil -} - -func (m *CommitmentProof) GetNonexist() *NonExistenceProof { - if x, ok := m.GetProof().(*CommitmentProof_Nonexist); ok { - return x.Nonexist - } - return nil -} - -func (m *CommitmentProof) GetBatch() *BatchProof { - if x, ok := m.GetProof().(*CommitmentProof_Batch); ok { - return x.Batch - } - return nil -} - -func (m *CommitmentProof) GetCompressed() *CompressedBatchProof { - if x, ok := m.GetProof().(*CommitmentProof_Compressed); ok { - return x.Compressed - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CommitmentProof) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CommitmentProof_Exist)(nil), - (*CommitmentProof_Nonexist)(nil), - (*CommitmentProof_Batch)(nil), - (*CommitmentProof_Compressed)(nil), - } -} - -// * -// LeafOp represents the raw key-value data we wish to prove, and -// must be flexible to represent the internal transformation from -// the original key-value pairs into the basis hash, for many existing -// merkle trees. -// -// key and value are passed in. So that the signature of this operation is: -// leafOp(key, value) -> output -// -// To process this, first prehash the keys and values if needed (ANY means no hash in this case): -// hkey = prehashKey(key) -// hvalue = prehashValue(value) -// -// Then combine the bytes, and hash it -// output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) -type LeafOp struct { - Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` - PrehashKey HashOp `protobuf:"varint,2,opt,name=prehash_key,json=prehashKey,proto3,enum=ics23.HashOp" json:"prehash_key,omitempty"` - PrehashValue HashOp `protobuf:"varint,3,opt,name=prehash_value,json=prehashValue,proto3,enum=ics23.HashOp" json:"prehash_value,omitempty"` - Length LengthOp `protobuf:"varint,4,opt,name=length,proto3,enum=ics23.LengthOp" json:"length,omitempty"` - // prefix is a fixed bytes that may optionally be included at the beginning to differentiate - // a leaf node from an inner node. - Prefix []byte `protobuf:"bytes,5,opt,name=prefix,proto3" json:"prefix,omitempty"` -} - -func (m *LeafOp) Reset() { *m = LeafOp{} } -func (m *LeafOp) String() string { return proto.CompactTextString(m) } -func (*LeafOp) ProtoMessage() {} -func (*LeafOp) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{3} -} -func (m *LeafOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeafOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeafOp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LeafOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeafOp.Merge(m, src) -} -func (m *LeafOp) XXX_Size() int { - return m.Size() -} -func (m *LeafOp) XXX_DiscardUnknown() { - xxx_messageInfo_LeafOp.DiscardUnknown(m) -} - -var xxx_messageInfo_LeafOp proto.InternalMessageInfo - -func (m *LeafOp) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetPrehashKey() HashOp { - if m != nil { - return m.PrehashKey - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetPrehashValue() HashOp { - if m != nil { - return m.PrehashValue - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetLength() LengthOp { - if m != nil { - return m.Length - } - return LengthOp_NO_PREFIX -} - -func (m *LeafOp) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -// * -// InnerOp represents a merkle-proof step that is not a leaf. -// It represents concatenating two children and hashing them to provide the next result. -// -// The result of the previous step is passed in, so the signature of this op is: -// innerOp(child) -> output -// -// The result of applying InnerOp should be: -// output = op.hash(op.prefix || child || op.suffix) -// -// where the || operator is concatenation of binary data, -// and child is the result of hashing all the tree below this step. -// -// Any special data, like prepending child with the length, or prepending the entire operation with -// some value to differentiate from leaf nodes, should be included in prefix and suffix. -// If either of prefix or suffix is empty, we just treat it as an empty string -type InnerOp struct { - Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` - Prefix []byte `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` - Suffix []byte `protobuf:"bytes,3,opt,name=suffix,proto3" json:"suffix,omitempty"` -} - -func (m *InnerOp) Reset() { *m = InnerOp{} } -func (m *InnerOp) String() string { return proto.CompactTextString(m) } -func (*InnerOp) ProtoMessage() {} -func (*InnerOp) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{4} -} -func (m *InnerOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InnerOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InnerOp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *InnerOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_InnerOp.Merge(m, src) -} -func (m *InnerOp) XXX_Size() int { - return m.Size() -} -func (m *InnerOp) XXX_DiscardUnknown() { - xxx_messageInfo_InnerOp.DiscardUnknown(m) -} - -var xxx_messageInfo_InnerOp proto.InternalMessageInfo - -func (m *InnerOp) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -func (m *InnerOp) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -func (m *InnerOp) GetSuffix() []byte { - if m != nil { - return m.Suffix - } - return nil -} - -// * -// ProofSpec defines what the expected parameters are for a given proof type. -// This can be stored in the client and used to validate any incoming proofs. -// -// verify(ProofSpec, Proof) -> Proof | Error -// -// As demonstrated in tests, if we don't fix the algorithm used to calculate the -// LeafHash for a given tree, there are many possible key-value pairs that can -// generate a given hash (by interpretting the preimage differently). -// We need this for proper security, requires client knows a priori what -// tree format server uses. But not in code, rather a configuration object. -type ProofSpec struct { - // any field in the ExistenceProof must be the same as in this spec. - // except Prefix, which is just the first bytes of prefix (spec can be longer) - LeafSpec *LeafOp `protobuf:"bytes,1,opt,name=leaf_spec,json=leafSpec,proto3" json:"leaf_spec,omitempty"` - InnerSpec *InnerSpec `protobuf:"bytes,2,opt,name=inner_spec,json=innerSpec,proto3" json:"inner_spec,omitempty"` - // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) - MaxDepth int32 `protobuf:"varint,3,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"` - // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) - MinDepth int32 `protobuf:"varint,4,opt,name=min_depth,json=minDepth,proto3" json:"min_depth,omitempty"` -} - -func (m *ProofSpec) Reset() { *m = ProofSpec{} } -func (m *ProofSpec) String() string { return proto.CompactTextString(m) } -func (*ProofSpec) ProtoMessage() {} -func (*ProofSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{5} -} -func (m *ProofSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProofSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProofSpec.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProofSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProofSpec.Merge(m, src) -} -func (m *ProofSpec) XXX_Size() int { - return m.Size() -} -func (m *ProofSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ProofSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ProofSpec proto.InternalMessageInfo - -func (m *ProofSpec) GetLeafSpec() *LeafOp { - if m != nil { - return m.LeafSpec - } - return nil -} - -func (m *ProofSpec) GetInnerSpec() *InnerSpec { - if m != nil { - return m.InnerSpec - } - return nil -} - -func (m *ProofSpec) GetMaxDepth() int32 { - if m != nil { - return m.MaxDepth - } - return 0 -} - -func (m *ProofSpec) GetMinDepth() int32 { - if m != nil { - return m.MinDepth - } - return 0 -} - -// InnerSpec contains all store-specific structure info to determine if two proofs from a -// given store are neighbors. -// -// This enables: -// -// isLeftMost(spec: InnerSpec, op: InnerOp) -// isRightMost(spec: InnerSpec, op: InnerOp) -// isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) -type InnerSpec struct { - // Child order is the ordering of the children node, must count from 0 - // iavl tree is [0, 1] (left then right) - // merk is [0, 2, 1] (left, right, here) - ChildOrder []int32 `protobuf:"varint,1,rep,packed,name=child_order,json=childOrder,proto3" json:"child_order,omitempty"` - ChildSize int32 `protobuf:"varint,2,opt,name=child_size,json=childSize,proto3" json:"child_size,omitempty"` - MinPrefixLength int32 `protobuf:"varint,3,opt,name=min_prefix_length,json=minPrefixLength,proto3" json:"min_prefix_length,omitempty"` - MaxPrefixLength int32 `protobuf:"varint,4,opt,name=max_prefix_length,json=maxPrefixLength,proto3" json:"max_prefix_length,omitempty"` - // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) - EmptyChild []byte `protobuf:"bytes,5,opt,name=empty_child,json=emptyChild,proto3" json:"empty_child,omitempty"` - // hash is the algorithm that must be used for each InnerOp - Hash HashOp `protobuf:"varint,6,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` -} - -func (m *InnerSpec) Reset() { *m = InnerSpec{} } -func (m *InnerSpec) String() string { return proto.CompactTextString(m) } -func (*InnerSpec) ProtoMessage() {} -func (*InnerSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{6} -} -func (m *InnerSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InnerSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InnerSpec.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *InnerSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_InnerSpec.Merge(m, src) -} -func (m *InnerSpec) XXX_Size() int { - return m.Size() -} -func (m *InnerSpec) XXX_DiscardUnknown() { - xxx_messageInfo_InnerSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_InnerSpec proto.InternalMessageInfo - -func (m *InnerSpec) GetChildOrder() []int32 { - if m != nil { - return m.ChildOrder - } - return nil -} - -func (m *InnerSpec) GetChildSize() int32 { - if m != nil { - return m.ChildSize - } - return 0 -} - -func (m *InnerSpec) GetMinPrefixLength() int32 { - if m != nil { - return m.MinPrefixLength - } - return 0 -} - -func (m *InnerSpec) GetMaxPrefixLength() int32 { - if m != nil { - return m.MaxPrefixLength - } - return 0 -} - -func (m *InnerSpec) GetEmptyChild() []byte { - if m != nil { - return m.EmptyChild - } - return nil -} - -func (m *InnerSpec) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -// BatchProof is a group of multiple proof types than can be compressed -type BatchProof struct { - Entries []*BatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (m *BatchProof) Reset() { *m = BatchProof{} } -func (m *BatchProof) String() string { return proto.CompactTextString(m) } -func (*BatchProof) ProtoMessage() {} -func (*BatchProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{7} -} -func (m *BatchProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BatchProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchProof.Merge(m, src) -} -func (m *BatchProof) XXX_Size() int { - return m.Size() -} -func (m *BatchProof) XXX_DiscardUnknown() { - xxx_messageInfo_BatchProof.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchProof proto.InternalMessageInfo - -func (m *BatchProof) GetEntries() []*BatchEntry { - if m != nil { - return m.Entries - } - return nil -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -type BatchEntry struct { - // Types that are valid to be assigned to Proof: - // *BatchEntry_Exist - // *BatchEntry_Nonexist - Proof isBatchEntry_Proof `protobuf_oneof:"proof"` -} - -func (m *BatchEntry) Reset() { *m = BatchEntry{} } -func (m *BatchEntry) String() string { return proto.CompactTextString(m) } -func (*BatchEntry) ProtoMessage() {} -func (*BatchEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{8} -} -func (m *BatchEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BatchEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchEntry.Merge(m, src) -} -func (m *BatchEntry) XXX_Size() int { - return m.Size() -} -func (m *BatchEntry) XXX_DiscardUnknown() { - xxx_messageInfo_BatchEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchEntry proto.InternalMessageInfo - -type isBatchEntry_Proof interface { - isBatchEntry_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type BatchEntry_Exist struct { - Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type BatchEntry_Nonexist struct { - Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} - -func (*BatchEntry_Exist) isBatchEntry_Proof() {} -func (*BatchEntry_Nonexist) isBatchEntry_Proof() {} - -func (m *BatchEntry) GetProof() isBatchEntry_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *BatchEntry) GetExist() *ExistenceProof { - if x, ok := m.GetProof().(*BatchEntry_Exist); ok { - return x.Exist - } - return nil -} - -func (m *BatchEntry) GetNonexist() *NonExistenceProof { - if x, ok := m.GetProof().(*BatchEntry_Nonexist); ok { - return x.Nonexist - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*BatchEntry) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*BatchEntry_Exist)(nil), - (*BatchEntry_Nonexist)(nil), - } -} - -type CompressedBatchProof struct { - Entries []*CompressedBatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` - LookupInners []*InnerOp `protobuf:"bytes,2,rep,name=lookup_inners,json=lookupInners,proto3" json:"lookup_inners,omitempty"` -} - -func (m *CompressedBatchProof) Reset() { *m = CompressedBatchProof{} } -func (m *CompressedBatchProof) String() string { return proto.CompactTextString(m) } -func (*CompressedBatchProof) ProtoMessage() {} -func (*CompressedBatchProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{9} -} -func (m *CompressedBatchProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedBatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedBatchProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CompressedBatchProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedBatchProof.Merge(m, src) -} -func (m *CompressedBatchProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedBatchProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedBatchProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedBatchProof proto.InternalMessageInfo - -func (m *CompressedBatchProof) GetEntries() []*CompressedBatchEntry { - if m != nil { - return m.Entries - } - return nil -} - -func (m *CompressedBatchProof) GetLookupInners() []*InnerOp { - if m != nil { - return m.LookupInners - } - return nil -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -type CompressedBatchEntry struct { - // Types that are valid to be assigned to Proof: - // *CompressedBatchEntry_Exist - // *CompressedBatchEntry_Nonexist - Proof isCompressedBatchEntry_Proof `protobuf_oneof:"proof"` -} - -func (m *CompressedBatchEntry) Reset() { *m = CompressedBatchEntry{} } -func (m *CompressedBatchEntry) String() string { return proto.CompactTextString(m) } -func (*CompressedBatchEntry) ProtoMessage() {} -func (*CompressedBatchEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{10} -} -func (m *CompressedBatchEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedBatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedBatchEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CompressedBatchEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedBatchEntry.Merge(m, src) -} -func (m *CompressedBatchEntry) XXX_Size() int { - return m.Size() -} -func (m *CompressedBatchEntry) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedBatchEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedBatchEntry proto.InternalMessageInfo - -type isCompressedBatchEntry_Proof interface { - isCompressedBatchEntry_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type CompressedBatchEntry_Exist struct { - Exist *CompressedExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type CompressedBatchEntry_Nonexist struct { - Nonexist *CompressedNonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} - -func (*CompressedBatchEntry_Exist) isCompressedBatchEntry_Proof() {} -func (*CompressedBatchEntry_Nonexist) isCompressedBatchEntry_Proof() {} - -func (m *CompressedBatchEntry) GetProof() isCompressedBatchEntry_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *CompressedBatchEntry) GetExist() *CompressedExistenceProof { - if x, ok := m.GetProof().(*CompressedBatchEntry_Exist); ok { - return x.Exist - } - return nil -} - -func (m *CompressedBatchEntry) GetNonexist() *CompressedNonExistenceProof { - if x, ok := m.GetProof().(*CompressedBatchEntry_Nonexist); ok { - return x.Nonexist - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CompressedBatchEntry) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CompressedBatchEntry_Exist)(nil), - (*CompressedBatchEntry_Nonexist)(nil), - } -} - -type CompressedExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` - // these are indexes into the lookup_inners table in CompressedBatchProof - Path []int32 `protobuf:"varint,4,rep,packed,name=path,proto3" json:"path,omitempty"` -} - -func (m *CompressedExistenceProof) Reset() { *m = CompressedExistenceProof{} } -func (m *CompressedExistenceProof) String() string { return proto.CompactTextString(m) } -func (*CompressedExistenceProof) ProtoMessage() {} -func (*CompressedExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{11} -} -func (m *CompressedExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedExistenceProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CompressedExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedExistenceProof.Merge(m, src) -} -func (m *CompressedExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedExistenceProof proto.InternalMessageInfo - -func (m *CompressedExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *CompressedExistenceProof) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *CompressedExistenceProof) GetLeaf() *LeafOp { - if m != nil { - return m.Leaf - } - return nil -} - -func (m *CompressedExistenceProof) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -type CompressedNonExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Left *CompressedExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` - Right *CompressedExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` -} - -func (m *CompressedNonExistenceProof) Reset() { *m = CompressedNonExistenceProof{} } -func (m *CompressedNonExistenceProof) String() string { return proto.CompactTextString(m) } -func (*CompressedNonExistenceProof) ProtoMessage() {} -func (*CompressedNonExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_855156e15e7b8e99, []int{12} -} -func (m *CompressedNonExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedNonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedNonExistenceProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CompressedNonExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedNonExistenceProof.Merge(m, src) -} -func (m *CompressedNonExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedNonExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedNonExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedNonExistenceProof proto.InternalMessageInfo - -func (m *CompressedNonExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *CompressedNonExistenceProof) GetLeft() *CompressedExistenceProof { - if m != nil { - return m.Left - } - return nil -} - -func (m *CompressedNonExistenceProof) GetRight() *CompressedExistenceProof { - if m != nil { - return m.Right - } - return nil -} - -func init() { - proto.RegisterEnum("ics23.HashOp", HashOp_name, HashOp_value) - proto.RegisterEnum("ics23.LengthOp", LengthOp_name, LengthOp_value) - proto.RegisterType((*ExistenceProof)(nil), "ics23.ExistenceProof") - proto.RegisterType((*NonExistenceProof)(nil), "ics23.NonExistenceProof") - proto.RegisterType((*CommitmentProof)(nil), "ics23.CommitmentProof") - proto.RegisterType((*LeafOp)(nil), "ics23.LeafOp") - proto.RegisterType((*InnerOp)(nil), "ics23.InnerOp") - proto.RegisterType((*ProofSpec)(nil), "ics23.ProofSpec") - proto.RegisterType((*InnerSpec)(nil), "ics23.InnerSpec") - proto.RegisterType((*BatchProof)(nil), "ics23.BatchProof") - proto.RegisterType((*BatchEntry)(nil), "ics23.BatchEntry") - proto.RegisterType((*CompressedBatchProof)(nil), "ics23.CompressedBatchProof") - proto.RegisterType((*CompressedBatchEntry)(nil), "ics23.CompressedBatchEntry") - proto.RegisterType((*CompressedExistenceProof)(nil), "ics23.CompressedExistenceProof") - proto.RegisterType((*CompressedNonExistenceProof)(nil), "ics23.CompressedNonExistenceProof") -} - -func init() { proto.RegisterFile("proofs.proto", fileDescriptor_855156e15e7b8e99) } - -var fileDescriptor_855156e15e7b8e99 = []byte{ - // 940 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4b, 0x6f, 0xe3, 0x54, - 0x14, 0xce, 0x4d, 0x62, 0x27, 0x39, 0x69, 0x53, 0xf7, 0xaa, 0x20, 0x4b, 0x15, 0x69, 0xf1, 0x86, - 0x4e, 0x47, 0x14, 0x26, 0x99, 0x06, 0xb1, 0x40, 0xa2, 0x49, 0x3d, 0xc4, 0x6a, 0x69, 0xc2, 0x4d, - 0x18, 0x0d, 0x12, 0x92, 0xe5, 0x49, 0x6f, 0x26, 0xd6, 0x24, 0xb6, 0x65, 0xbb, 0x28, 0x19, 0x81, - 0x90, 0xf8, 0x05, 0xac, 0x61, 0xc7, 0x96, 0x3f, 0xc2, 0xb2, 0x4b, 0x96, 0xa8, 0x5d, 0xb0, 0xe0, - 0x4f, 0xa0, 0xfb, 0x88, 0x9b, 0x27, 0xed, 0x02, 0xcd, 0xee, 0x9e, 0xef, 0x7c, 0xe7, 0x71, 0xcf, - 0xc3, 0xd7, 0xb0, 0x11, 0x84, 0xbe, 0xdf, 0x8f, 0x8e, 0x82, 0xd0, 0x8f, 0x7d, 0xac, 0xb8, 0xbd, - 0xa8, 0x52, 0x35, 0x7e, 0x84, 0x92, 0x39, 0x76, 0xa3, 0x98, 0x7a, 0x3d, 0xda, 0x66, 0x7a, 0xac, - 0x41, 0xe6, 0x35, 0x9d, 0xe8, 0x68, 0x1f, 0x1d, 0x6c, 0x10, 0x76, 0xc4, 0x3b, 0xa0, 0x7c, 0xe7, - 0x0c, 0xaf, 0xa8, 0x9e, 0xe6, 0x98, 0x10, 0xf0, 0xfb, 0x90, 0x1d, 0x52, 0xa7, 0xaf, 0x67, 0xf6, - 0xd1, 0x41, 0xb1, 0xb2, 0x79, 0xc4, 0xfd, 0x1d, 0x9d, 0x53, 0xa7, 0xdf, 0x0a, 0x08, 0x57, 0x61, - 0x03, 0xb2, 0x81, 0x13, 0x0f, 0xf4, 0xec, 0x7e, 0xe6, 0xa0, 0x58, 0x29, 0x49, 0x8a, 0xe5, 0x79, - 0x34, 0x64, 0x1c, 0xa6, 0x33, 0x7e, 0x80, 0xed, 0x0b, 0xdf, 0xbb, 0x37, 0x87, 0x47, 0x2c, 0x5a, - 0x3f, 0xe6, 0x29, 0x14, 0x2b, 0xef, 0x48, 0x57, 0xf3, 0x66, 0x84, 0x53, 0xf0, 0x63, 0x50, 0x42, - 0xf7, 0xd5, 0x20, 0x96, 0x99, 0xad, 0xe1, 0x0a, 0x8e, 0xf1, 0x0f, 0x82, 0xad, 0x86, 0x3f, 0x1a, - 0xb9, 0xf1, 0x88, 0x7a, 0xb1, 0x88, 0xfe, 0x21, 0x28, 0x94, 0x91, 0x79, 0xfc, 0x75, 0x0e, 0x9a, - 0x29, 0x22, 0x58, 0xb8, 0x06, 0x79, 0xcf, 0xf7, 0x84, 0x85, 0x48, 0x4f, 0x97, 0x16, 0x4b, 0x17, - 0x6b, 0xa6, 0x48, 0xc2, 0xc5, 0x8f, 0x40, 0x79, 0xe9, 0xc4, 0xbd, 0x81, 0xcc, 0x73, 0x5b, 0x1a, - 0xd5, 0x19, 0x96, 0x84, 0xe0, 0x0c, 0xfc, 0x19, 0x40, 0xcf, 0x1f, 0x05, 0x21, 0x8d, 0x22, 0x7a, - 0xa9, 0x67, 0x39, 0x7f, 0x57, 0xf2, 0x1b, 0x89, 0x62, 0xce, 0x72, 0xc6, 0xa0, 0x9e, 0x03, 0x85, - 0xf7, 0xde, 0xb8, 0x46, 0xa0, 0x8a, 0x0e, 0xb1, 0xf6, 0x0d, 0x9c, 0x68, 0xc0, 0xef, 0x58, 0x4a, - 0xda, 0xd7, 0x74, 0xa2, 0x01, 0x6b, 0x0d, 0x53, 0xe1, 0x23, 0x28, 0x06, 0x21, 0x65, 0x47, 0x9b, - 0x75, 0x23, 0xbd, 0x8a, 0x09, 0x92, 0x71, 0x46, 0x27, 0xb8, 0x02, 0x9b, 0x53, 0xbe, 0x98, 0x97, - 0xcc, 0x2a, 0x8b, 0x0d, 0xc9, 0x79, 0xce, 0xa7, 0xe8, 0x03, 0x50, 0x87, 0xd4, 0x7b, 0xc5, 0x87, - 0x84, 0x91, 0xb7, 0x92, 0x39, 0x62, 0x60, 0x2b, 0x20, 0x52, 0x8d, 0xdf, 0x05, 0x35, 0x08, 0x69, - 0xdf, 0x1d, 0xeb, 0x0a, 0x9f, 0x0a, 0x29, 0x19, 0xdf, 0x42, 0x4e, 0x0e, 0xd4, 0x43, 0xae, 0x74, - 0xe7, 0x25, 0x3d, 0xeb, 0x85, 0xe1, 0xd1, 0x55, 0x9f, 0xe1, 0x19, 0x81, 0x0b, 0xc9, 0xf8, 0x0d, - 0x41, 0x81, 0x57, 0xb4, 0x13, 0xd0, 0x1e, 0x3e, 0x84, 0x02, 0x9b, 0x6b, 0x3b, 0x0a, 0x68, 0x4f, - 0x0e, 0xc7, 0xc2, 0xdc, 0xe7, 0x99, 0x9e, 0x73, 0x3f, 0x02, 0x70, 0x59, 0x5e, 0x82, 0x2c, 0xe6, - 0x42, 0x9b, 0xdd, 0x00, 0xc6, 0x22, 0x05, 0x77, 0x7a, 0xc4, 0xbb, 0x50, 0x18, 0x39, 0x63, 0xfb, - 0x92, 0x06, 0xb1, 0x18, 0x09, 0x85, 0xe4, 0x47, 0xce, 0xf8, 0x94, 0xc9, 0x5c, 0xe9, 0x7a, 0x52, - 0x99, 0x95, 0x4a, 0xd7, 0xe3, 0x4a, 0xe3, 0x6f, 0x04, 0x85, 0xc4, 0x25, 0xde, 0x83, 0x62, 0x6f, - 0xe0, 0x0e, 0x2f, 0x6d, 0x3f, 0xbc, 0xa4, 0xa1, 0x8e, 0xf6, 0x33, 0x07, 0x0a, 0x01, 0x0e, 0xb5, - 0x18, 0x82, 0xdf, 0x03, 0x21, 0xd9, 0x91, 0xfb, 0x46, 0xec, 0xb4, 0x42, 0x0a, 0x1c, 0xe9, 0xb8, - 0x6f, 0x28, 0x3e, 0x84, 0x6d, 0x16, 0x4a, 0x14, 0xc6, 0x96, 0xcd, 0x11, 0xf9, 0x6c, 0x8d, 0x5c, - 0xaf, 0xcd, 0x71, 0xd1, 0x1e, 0xce, 0x75, 0xc6, 0x0b, 0xdc, 0xac, 0xe4, 0x3a, 0xe3, 0x39, 0xee, - 0x1e, 0x14, 0xe9, 0x28, 0x88, 0x27, 0x36, 0x0f, 0x25, 0xbb, 0x08, 0x1c, 0x6a, 0x30, 0x24, 0x69, - 0x9f, 0xba, 0xb6, 0x7d, 0xc6, 0xa7, 0x00, 0x77, 0x43, 0x8e, 0x1f, 0x43, 0x8e, 0x7a, 0x71, 0xe8, - 0xd2, 0x88, 0xdf, 0x72, 0x61, 0x85, 0x4c, 0x2f, 0x0e, 0x27, 0x64, 0xca, 0x30, 0xbe, 0x97, 0xa6, - 0x1c, 0x7e, 0x4b, 0x2b, 0x7e, 0xb7, 0x78, 0x3f, 0x21, 0xd8, 0x59, 0xb5, 0xa8, 0xf8, 0x78, 0xf1, - 0x0e, 0x6b, 0xd6, 0x7a, 0xfe, 0x36, 0xb8, 0x0a, 0x9b, 0x43, 0xdf, 0x7f, 0x7d, 0x15, 0xd8, 0x7c, - 0x80, 0x22, 0x3d, 0xbd, 0xf2, 0x13, 0xbb, 0x21, 0x48, 0x5c, 0x8c, 0x8c, 0x5f, 0x96, 0x93, 0x10, - 0xd5, 0xf8, 0x64, 0xbe, 0x1a, 0x7b, 0x4b, 0x29, 0xac, 0xab, 0xcb, 0xe7, 0x4b, 0x75, 0x31, 0x96, - 0x6c, 0x1f, 0x58, 0xa1, 0x09, 0xe8, 0xeb, 0xe2, 0xfd, 0x9f, 0x4f, 0x12, 0x9e, 0x79, 0x92, 0x14, - 0xf9, 0x04, 0xfd, 0x8a, 0x60, 0xf7, 0x3f, 0xf2, 0x5d, 0x11, 0xbe, 0x3a, 0xf7, 0x1a, 0xdd, 0x57, - 0x2f, 0xf9, 0x2e, 0x1d, 0xcf, 0xbf, 0x4b, 0xf7, 0x5a, 0x09, 0xf6, 0x21, 0x05, 0x55, 0xec, 0x00, - 0x2e, 0x42, 0xee, 0xa2, 0x65, 0x37, 0x4f, 0x3a, 0x4d, 0x2d, 0x85, 0x01, 0xd4, 0x4e, 0xf3, 0xa4, - 0x72, 0x5c, 0xd3, 0x90, 0x3c, 0x1f, 0x3f, 0xa9, 0x68, 0x69, 0x76, 0x3e, 0x33, 0x1b, 0x8d, 0x93, - 0x33, 0x2d, 0x83, 0x37, 0xa1, 0x40, 0xac, 0xb6, 0xf9, 0xe5, 0xe9, 0x93, 0xda, 0xc7, 0x5a, 0x96, - 0xd9, 0xd7, 0xad, 0x6e, 0xa3, 0x65, 0x5d, 0x68, 0x0a, 0x2e, 0x01, 0x08, 0x1b, 0x9b, 0xf9, 0x50, - 0x0f, 0x7f, 0x47, 0x90, 0x9f, 0x7e, 0x74, 0x99, 0xe1, 0x45, 0xcb, 0x6e, 0x13, 0xf3, 0x99, 0xf5, - 0x42, 0x4b, 0x31, 0xf1, 0xf9, 0x09, 0xb1, 0xdb, 0xa4, 0xd5, 0x6d, 0x69, 0x88, 0xf9, 0x61, 0x22, - 0x39, 0x6f, 0x6b, 0x69, 0xbc, 0x05, 0xc5, 0x67, 0xd6, 0x0b, 0xf3, 0xb4, 0x5a, 0xb1, 0xeb, 0xd6, - 0x17, 0x5a, 0x06, 0x63, 0x28, 0x4d, 0x81, 0x73, 0xab, 0xdb, 0x3d, 0x37, 0xb5, 0x6c, 0x42, 0xaa, - 0x3d, 0xe5, 0x24, 0x25, 0x21, 0xd5, 0x9e, 0x4e, 0x49, 0x2a, 0xde, 0x01, 0x8d, 0x98, 0x5f, 0x7d, - 0x6d, 0x11, 0xd3, 0x66, 0xce, 0xbe, 0xe9, 0x9a, 0x1d, 0x2d, 0x37, 0x8b, 0x32, 0x6b, 0x8e, 0xe6, - 0xeb, 0xfa, 0x1f, 0x37, 0x65, 0x74, 0x7d, 0x53, 0x46, 0x7f, 0xdd, 0x94, 0xd1, 0xcf, 0xb7, 0xe5, - 0xd4, 0xf5, 0x6d, 0x39, 0xf5, 0xe7, 0x6d, 0x39, 0xf5, 0x52, 0xe5, 0xbf, 0x37, 0xd5, 0x7f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xd4, 0x7d, 0x87, 0x8f, 0xee, 0x08, 0x00, 0x00, -} - -func (m *ExistenceProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Path) > 0 { - for iNdEx := len(m.Path) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Path[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Leaf != nil { - { - size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NonExistenceProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NonExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Right != nil { - { - size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Left != nil { - { - size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CommitmentProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CommitmentProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *CommitmentProof_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Batch) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Batch) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Batch != nil { - { - size, err := m.Batch.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Compressed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Compressed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Compressed != nil { - { - size, err := m.Compressed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *LeafOp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LeafOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeafOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x2a - } - if m.Length != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x20 - } - if m.PrehashValue != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.PrehashValue)) - i-- - dAtA[i] = 0x18 - } - if m.PrehashKey != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.PrehashKey)) - i-- - dAtA[i] = 0x10 - } - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *InnerOp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *InnerOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InnerOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Suffix) > 0 { - i -= len(m.Suffix) - copy(dAtA[i:], m.Suffix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Suffix))) - i-- - dAtA[i] = 0x1a - } - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x12 - } - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ProofSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProofSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProofSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MinDepth != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MinDepth)) - i-- - dAtA[i] = 0x20 - } - if m.MaxDepth != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MaxDepth)) - i-- - dAtA[i] = 0x18 - } - if m.InnerSpec != nil { - { - size, err := m.InnerSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.LeafSpec != nil { - { - size, err := m.LeafSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *InnerSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *InnerSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InnerSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x30 - } - if len(m.EmptyChild) > 0 { - i -= len(m.EmptyChild) - copy(dAtA[i:], m.EmptyChild) - i = encodeVarintProofs(dAtA, i, uint64(len(m.EmptyChild))) - i-- - dAtA[i] = 0x2a - } - if m.MaxPrefixLength != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MaxPrefixLength)) - i-- - dAtA[i] = 0x20 - } - if m.MinPrefixLength != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MinPrefixLength)) - i-- - dAtA[i] = 0x18 - } - if m.ChildSize != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.ChildSize)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChildOrder) > 0 { - dAtA11 := make([]byte, len(m.ChildOrder)*10) - var j10 int - for _, num1 := range m.ChildOrder { - num := uint64(num1) - for num >= 1<<7 { - dAtA11[j10] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j10++ - } - dAtA11[j10] = uint8(num) - j10++ - } - i -= j10 - copy(dAtA[i:], dAtA11[:j10]) - i = encodeVarintProofs(dAtA, i, uint64(j10)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BatchProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *BatchEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *BatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *BatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CompressedBatchProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompressedBatchProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.LookupInners) > 0 { - for iNdEx := len(m.LookupInners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LookupInners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CompressedBatchEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompressedBatchEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *CompressedBatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CompressedBatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CompressedExistenceProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompressedExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Path) > 0 { - dAtA17 := make([]byte, len(m.Path)*10) - var j16 int - for _, num1 := range m.Path { - num := uint64(num1) - for num >= 1<<7 { - dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j16++ - } - dAtA17[j16] = uint8(num) - j16++ - } - i -= j16 - copy(dAtA[i:], dAtA17[:j16]) - i = encodeVarintProofs(dAtA, i, uint64(j16)) - i-- - dAtA[i] = 0x22 - } - if m.Leaf != nil { - { - size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompressedNonExistenceProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompressedNonExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedNonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Right != nil { - { - size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Left != nil { - { - size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProofs(dAtA []byte, offset int, v uint64) int { - offset -= sovProofs(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Leaf != nil { - l = m.Leaf.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if len(m.Path) > 0 { - for _, e := range m.Path { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *NonExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Left != nil { - l = m.Left.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.Right != nil { - l = m.Right.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *CommitmentProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *CommitmentProof_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Batch) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Batch != nil { - l = m.Batch.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Compressed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Compressed != nil { - l = m.Compressed.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *LeafOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - if m.PrehashKey != 0 { - n += 1 + sovProofs(uint64(m.PrehashKey)) - } - if m.PrehashValue != 0 { - n += 1 + sovProofs(uint64(m.PrehashValue)) - } - if m.Length != 0 { - n += 1 + sovProofs(uint64(m.Length)) - } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *InnerOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Suffix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *ProofSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LeafSpec != nil { - l = m.LeafSpec.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.InnerSpec != nil { - l = m.InnerSpec.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.MaxDepth != 0 { - n += 1 + sovProofs(uint64(m.MaxDepth)) - } - if m.MinDepth != 0 { - n += 1 + sovProofs(uint64(m.MinDepth)) - } - return n -} - -func (m *InnerSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ChildOrder) > 0 { - l = 0 - for _, e := range m.ChildOrder { - l += sovProofs(uint64(e)) - } - n += 1 + sovProofs(uint64(l)) + l - } - if m.ChildSize != 0 { - n += 1 + sovProofs(uint64(m.ChildSize)) - } - if m.MinPrefixLength != 0 { - n += 1 + sovProofs(uint64(m.MinPrefixLength)) - } - if m.MaxPrefixLength != 0 { - n += 1 + sovProofs(uint64(m.MaxPrefixLength)) - } - l = len(m.EmptyChild) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - return n -} - -func (m *BatchProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *BatchEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *BatchEntry_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *BatchEntry_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedBatchProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - if len(m.LookupInners) > 0 { - for _, e := range m.LookupInners { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *CompressedBatchEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *CompressedBatchEntry_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedBatchEntry_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Leaf != nil { - l = m.Leaf.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if len(m.Path) > 0 { - l = 0 - for _, e := range m.Path { - l += sovProofs(uint64(e)) - } - n += 1 + sovProofs(uint64(l)) + l - } - return n -} - -func (m *CompressedNonExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Left != nil { - l = m.Left.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.Right != nil { - l = m.Right.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func sovProofs(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProofs(x uint64) (n int) { - return sovProofs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ExistenceProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leaf == nil { - m.Leaf = &LeafOp{} - } - if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = append(m.Path, &InnerOp{}) - if err := m.Path[len(m.Path)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NonExistenceProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NonExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Left == nil { - m.Left = &ExistenceProof{} - } - if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Right == nil { - m.Right = &ExistenceProof{} - } - if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitmentProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CommitmentProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitmentProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &NonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Nonexist{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Batch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &BatchProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Batch{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Compressed", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedBatchProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Compressed{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeafOp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LeafOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeafOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrehashKey", wireType) - } - m.PrehashKey = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrehashKey |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrehashValue", wireType) - } - m.PrehashValue = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrehashValue |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= LengthOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) - if m.Prefix == nil { - m.Prefix = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InnerOp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InnerOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InnerOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) - if m.Prefix == nil { - m.Prefix = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Suffix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Suffix = append(m.Suffix[:0], dAtA[iNdEx:postIndex]...) - if m.Suffix == nil { - m.Suffix = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProofSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProofSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProofSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LeafSpec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LeafSpec == nil { - m.LeafSpec = &LeafOp{} - } - if err := m.LeafSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InnerSpec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.InnerSpec == nil { - m.InnerSpec = &InnerSpec{} - } - if err := m.InnerSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDepth", wireType) - } - m.MaxDepth = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxDepth |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepth", wireType) - } - m.MinDepth = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinDepth |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InnerSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InnerSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InnerSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ChildOrder = append(m.ChildOrder, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ChildOrder) == 0 { - m.ChildOrder = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ChildOrder = append(m.ChildOrder, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ChildOrder", wireType) - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChildSize", wireType) - } - m.ChildSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChildSize |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinPrefixLength", wireType) - } - m.MinPrefixLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinPrefixLength |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxPrefixLength", wireType) - } - m.MaxPrefixLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxPrefixLength |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmptyChild", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EmptyChild = append(m.EmptyChild[:0], dAtA[iNdEx:postIndex]...) - if m.EmptyChild == nil { - m.EmptyChild = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, &BatchEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &BatchEntry_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &NonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &BatchEntry_Nonexist{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedBatchProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompressedBatchProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedBatchProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, &CompressedBatchEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LookupInners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LookupInners = append(m.LookupInners, &InnerOp{}) - if err := m.LookupInners[len(m.LookupInners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedBatchEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompressedBatchEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedBatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CompressedBatchEntry_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedNonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CompressedBatchEntry_Nonexist{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedExistenceProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompressedExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leaf == nil { - m.Leaf = &LeafOp{} - } - if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Path = append(m.Path, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Path) == 0 { - m.Path = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Path = append(m.Path, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedNonExistenceProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompressedNonExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedNonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Left == nil { - m.Left = &CompressedExistenceProof{} - } - if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Right == nil { - m.Right = &CompressedExistenceProof{} - } - if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProofs(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProofs - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProofs - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProofs - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthProofs - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProofs - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProofs - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProofs = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProofs = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProofs = fmt.Errorf("proto: unexpected end of group") -)