From 8d7a9793b692574f9deada577c31033b01d1f5db Mon Sep 17 00:00:00 2001 From: Jim Larson Date: Mon, 17 Oct 2022 11:18:02 -0700 Subject: [PATCH] fix: dragonberry fixes ported from Agoric-ag0 --- baseapp/msg_service_router.go | 19 +- contrib/images/simd-env/Dockerfile | 2 + go.mod | 7 +- go.sum | 11 +- ics23/.gitignore | 1 + ics23/go/Makefile | 20 + ics23/go/compress.go | 157 + ics23/go/go.mod | 9 + ics23/go/go.sum | 14 + ics23/go/ics23.go | 175 + ics23/go/ops.go | 250 ++ ics23/go/proof.go | 452 +++ ics23/go/proofs.pb.go | 4548 +++++++++++++++++++++++++ proto/cosmos/staking/v1beta1/tx.proto | 9 +- x/staking/types/tx.pb.go | 172 +- 15 files changed, 5779 insertions(+), 67 deletions(-) create mode 100644 ics23/.gitignore create mode 100644 ics23/go/Makefile create mode 100644 ics23/go/compress.go create mode 100644 ics23/go/go.mod create mode 100644 ics23/go/go.sum create mode 100644 ics23/go/ics23.go create mode 100644 ics23/go/ops.go create mode 100644 ics23/go/proof.go create mode 100644 ics23/go/proofs.pb.go diff --git a/baseapp/msg_service_router.go b/baseapp/msg_service_router.go index 1b7f8f89bf73..a8c997cf683b 100644 --- a/baseapp/msg_service_router.go +++ b/baseapp/msg_service_router.go @@ -46,9 +46,9 @@ func (msr *MsgServiceRouter) HandlerByTypeURL(typeURL string) MsgServiceHandler // service description, handler is an object which implements that gRPC service. // // This function PANICs: -// - if it is called before the service `Msg`s have been registered using -// RegisterInterfaces, -// - or if a service is being registered twice. +// - if it is called before the service `Msg`s have been registered using +// RegisterInterfaces, +// - or if a service is being registered twice. func (msr *MsgServiceRouter) RegisterService(sd *grpc.ServiceDesc, handler interface{}) { // Adds a top-level query handler based on the gRPC service name. for _, method := range sd.Methods { @@ -112,6 +112,15 @@ func (msr *MsgServiceRouter) RegisterService(sd *grpc.ServiceDesc, handler inter goCtx = context.WithValue(goCtx, sdk.SdkContextKey, ctx) return handler(goCtx, req) } + if err := req.ValidateBasic(); err != nil { + if mm, ok := req.(getter1); ok { + if !mm.GetAmount().Amount.IsZero() { + return nil, err + } + } else { + return nil, err + } + } // Call the method handler from the service description with the handler object. // We don't do any decoding here because the decoding was already done. res, err := methodHandler(handler, sdk.WrapSDKContext(ctx), noopDecoder, interceptor) @@ -138,3 +147,7 @@ func noopDecoder(_ interface{}) error { return nil } func noopInterceptor(_ context.Context, _ interface{}, _ *grpc.UnaryServerInfo, _ grpc.UnaryHandler) (interface{}, error) { return nil, nil } + +type getter1 interface { + GetAmount() sdk.Coin +} diff --git a/contrib/images/simd-env/Dockerfile b/contrib/images/simd-env/Dockerfile index 7c5fcf7644b4..f00d0e582238 100644 --- a/contrib/images/simd-env/Dockerfile +++ b/contrib/images/simd-env/Dockerfile @@ -2,6 +2,8 @@ FROM golang:1.17-alpine AS build RUN apk add build-base git linux-headers WORKDIR /work COPY go.mod go.sum /work/ +RUN mkdir -p /work/ics23/go +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 a5a3d70b2a51..cd80a521218e 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.10.1 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 github.com/tendermint/btcd v0.1.1 github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/go-amino v0.16.0 @@ -115,13 +115,16 @@ require ( golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/ini.v1 v1.66.2 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect ) replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + // vendor ics23 + github.com/confio/ics23/go => ./ics23/go + // 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 diff --git a/go.sum b/go.sum index 6e2688565eda..7a160452c760 100644 --- a/go.sum +++ b/go.sum @@ -188,8 +188,6 @@ 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.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= -github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/continuity v0.2.1 h1:/EeEo2EtN3umhbbgCveyjifoMYg0pS+nMMEemaYw634= github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= @@ -876,16 +874,18 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/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 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= 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= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= 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= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1480,8 +1480,9 @@ 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= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ics23/.gitignore b/ics23/.gitignore new file mode 100644 index 000000000000..22d0d82f8095 --- /dev/null +++ b/ics23/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/ics23/go/Makefile b/ics23/go/Makefile new file mode 100644 index 000000000000..aebfcb20d751 --- /dev/null +++ b/ics23/go/Makefile @@ -0,0 +1,20 @@ +.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 new file mode 100644 index 000000000000..ebe3275e3897 --- /dev/null +++ b/ics23/go/compress.go @@ -0,0 +1,157 @@ +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 new file mode 100644 index 000000000000..adde1916b313 --- /dev/null +++ b/ics23/go/go.mod @@ -0,0 +1,9 @@ +module github.com/confio/ics23/go + +go 1.14 + +require ( + github.com/gogo/protobuf v1.3.1 + github.com/pkg/errors v0.8.1 + golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 +) diff --git a/ics23/go/go.sum b/ics23/go/go.sum new file mode 100644 index 000000000000..8f7d866cb334 --- /dev/null +++ b/ics23/go/go.sum @@ -0,0 +1,14 @@ +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= +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= diff --git a/ics23/go/ics23.go b/ics23/go/ics23.go new file mode 100644 index 000000000000..9a79dc3fc302 --- /dev/null +++ b/ics23/go/ics23.go @@ -0,0 +1,175 @@ +/* +* +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 new file mode 100644 index 000000000000..6666dac5c00c --- /dev/null +++ b/ics23/go/ops.go @@ -0,0 +1,250 @@ +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 new file mode 100644 index 000000000000..cec590590fe7 --- /dev/null +++ b/ics23/go/proof.go @@ -0,0 +1,452 @@ +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 new file mode 100644 index 000000000000..7ebd4a61f43a --- /dev/null +++ b/ics23/go/proofs.pb.go @@ -0,0 +1,4548 @@ +// 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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x81, 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") +) diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/proto/cosmos/staking/v1beta1/tx.proto index 7b05d89eea22..d074fe010e30 100644 --- a/proto/cosmos/staking/v1beta1/tx.proto +++ b/proto/cosmos/staking/v1beta1/tx.proto @@ -81,8 +81,7 @@ message MsgEditValidatorResponse {} // MsgDelegate defines a SDK message for performing a delegation of coins // from a delegator to a validator. message MsgDelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; @@ -95,8 +94,7 @@ message MsgDelegateResponse {} // MsgBeginRedelegate defines a SDK message for performing a redelegation // of coins from a delegator and source validator to a destination validator. message MsgBeginRedelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; @@ -112,8 +110,7 @@ message MsgBeginRedelegateResponse { // MsgUndelegate defines a SDK message for performing an undelegation from a // delegate and a validator. message MsgUndelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go index c3a1bf706599..59e3b4ba6650 100644 --- a/x/staking/types/tx.pb.go +++ b/x/staking/types/tx.pb.go @@ -240,6 +240,27 @@ func (m *MsgDelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo +func (m *MsgDelegate) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *MsgDelegate) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *MsgDelegate) GetAmount() types1.Coin { + if m != nil { + return m.Amount + } + return types1.Coin{} +} + // MsgDelegateResponse defines the Msg/Delegate response type. type MsgDelegateResponse struct { } @@ -319,6 +340,34 @@ func (m *MsgBeginRedelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBeginRedelegate proto.InternalMessageInfo +func (m *MsgBeginRedelegate) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *MsgBeginRedelegate) GetValidatorSrcAddress() string { + if m != nil { + return m.ValidatorSrcAddress + } + return "" +} + +func (m *MsgBeginRedelegate) GetValidatorDstAddress() string { + if m != nil { + return m.ValidatorDstAddress + } + return "" +} + +func (m *MsgBeginRedelegate) GetAmount() types1.Coin { + if m != nil { + return m.Amount + } + return types1.Coin{} +} + // MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. type MsgBeginRedelegateResponse struct { CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` @@ -405,6 +454,27 @@ func (m *MsgUndelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUndelegate proto.InternalMessageInfo +func (m *MsgUndelegate) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *MsgUndelegate) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *MsgUndelegate) GetAmount() types1.Coin { + if m != nil { + return m.Amount + } + return types1.Coin{} +} + // MsgUndelegateResponse defines the Msg/Undelegate response type. type MsgUndelegateResponse struct { CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` @@ -466,61 +536,61 @@ func init() { func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } var fileDescriptor_0926ef28816b35ab = []byte{ - // 860 bytes of a gzipped FileDescriptorProto + // 861 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4d, 0x6b, 0xe3, 0x46, 0x18, 0xb6, 0x6c, 0xc7, 0x4d, 0x27, 0xe4, 0x4b, 0xf9, 0xc0, 0x11, 0xc1, 0x0a, 0x4a, 0x3f, 0x42, 0xdb, 0xc8, 0x4d, 0x4a, 0x29, 0xe4, 0x52, 0xe2, 0xb8, 0xa1, 0x21, 0x35, 0x14, 0x25, 0xed, 0xa1, 0x14, 0x8c, 0x3e, 0xc6, 0xaa, 0xb0, 0xa4, 0x51, 0x34, 0xe3, 0x10, 0x43, 0x7f, 0x40, 0x8f, 0x81, - 0xde, 0xf6, 0x94, 0x1f, 0xb1, 0x3f, 0x22, 0x2c, 0xec, 0x92, 0xe3, 0xb2, 0x07, 0xef, 0x92, 0xc0, - 0x92, 0xb3, 0x7f, 0xc1, 0xa2, 0xd1, 0x48, 0x96, 0xe5, 0x0f, 0x4c, 0x58, 0x5f, 0xf6, 0x64, 0x33, - 0xf3, 0xcc, 0xf3, 0xce, 0xfb, 0xbc, 0xcf, 0xbc, 0xaf, 0x80, 0xa8, 0x23, 0xec, 0x20, 0x5c, 0xc6, - 0x44, 0x6d, 0x5a, 0xae, 0x59, 0xbe, 0xdc, 0xd3, 0x20, 0x51, 0xf7, 0xca, 0xe4, 0x4a, 0xf6, 0x7c, - 0x44, 0x10, 0xbf, 0x1e, 0x02, 0x64, 0x06, 0x90, 0x19, 0x40, 0xd8, 0x30, 0x11, 0x32, 0x6d, 0x58, - 0xa6, 0x28, 0xad, 0xd5, 0x28, 0x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 0x6e, 0xc1, + 0xe2, 0x27, 0x94, 0x66, 0x2b, 0xaa, 0x52, 0x60, 0xb2, 0x44, 0x89, 0xac, 0xa8, 0xce, 0x21, 0xfa, + 0x68, 0xfe, 0x9f, 0x3b, 0x31, 0xf3, 0xee, 0x4e, 0xcc, 0x48, 0xdb, 0x40, 0x18, 0xb6, 0x93, 0x02, + 0xb1, 0x87, 0x5c, 0x0c, 0xa5, 0x7f, 0x73, 0x60, 0xa5, 0x86, 0xcd, 0x9f, 0x0c, 0x8b, 0xcc, 0xc8, + 0x6b, 0x3f, 0x8e, 0xd2, 0x34, 0x4b, 0x35, 0xe5, 0x7b, 0x1d, 0x71, 0x29, 0xd4, 0x74, 0x82, 0x92, + 0x0e, 0x58, 0xee, 0x7b, 0xad, 0xee, 0xab, 0x04, 0x32, 0x67, 0x55, 0xa7, 0x74, 0x55, 0x15, 0xea, + 0xbd, 0x8e, 0xb8, 0x19, 0x06, 0x4a, 0x51, 0x49, 0xca, 0x92, 0x3e, 0xe0, 0x6f, 0xfe, 0x66, 0xb4, + 0x99, 0x43, 0x43, 0xfd, 0x3c, 0x43, 0x23, 0x27, 0x6a, 0x26, 0x80, 0x62, 0xba, 0x28, 0x71, 0xc5, + 0xba, 0x1c, 0x58, 0xa8, 0x61, 0x93, 0x9d, 0x83, 0xa3, 0xed, 0xcf, 0x7d, 0x38, 0xfb, 0x67, 0x9f, + 0x65, 0xff, 0x1f, 0x40, 0x41, 0x75, 0x50, 0xcb, 0x25, 0xb4, 0x56, 0x53, 0xf8, 0x96, 0xc1, 0x8f, + 0xf2, 0x54, 0x80, 0x0d, 0xb0, 0x96, 0xc8, 0x31, 0xce, 0xfd, 0x21, 0x4b, 0x7b, 0x63, 0x05, 0x9a, + 0x96, 0xab, 0x40, 0x63, 0x06, 0x12, 0x5c, 0x82, 0x8d, 0x7e, 0x7e, 0xd8, 0xd7, 0x53, 0x32, 0xec, + 0xf4, 0x3a, 0xe2, 0x76, 0x5a, 0x86, 0x04, 0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1e, 0xbb, 0x25, 0xee, + 0x4d, 0xb7, 0xc4, 0xdd, 0x3e, 0x95, 0x32, 0x8f, 0x4f, 0xa5, 0xcc, 0xcb, 0xa7, 0x52, 0xe6, 0x8f, + 0x6f, 0x26, 0x8e, 0xae, 0x9b, 0xf8, 0xcb, 0x94, 0x0e, 0x31, 0xad, 0x40, 0x2d, 0xf9, 0xdd, 0xfb, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xdc, 0x0e, 0x15, 0x7e, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.