From 46f6d176016ee533d5ef8b0585ecc1896826fbef Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 10 Jun 2020 16:57:38 +0200 Subject: [PATCH] crypto/merkle: remove simple prefix (#4989) ## Description This PR removes simple prefix from all types in the crypto/merkle directory. The two proto types `Proof` & `ProofOp` have been moved to the `proto/crypto/merkle` directory. proto messge `Proof` was renamed to `ProofOps` and `SimpleProof` message to `Proof`. Closes: #2755 --- CHANGELOG_PENDING.md | 7 + abci/cmd/abci-cli/abci-cli.go | 22 +- abci/types/types.pb.go | 377 +++++------ abci/types/types.proto | 73 ++- consensus/msgs_test.go | 4 +- consensus/wal_test.go | 2 +- crypto/armor/armor_test.go | 2 +- crypto/merkle/merkle.pb.go | 617 ------------------ crypto/merkle/merkle.proto | 28 - crypto/merkle/proof.go | 289 +++++--- crypto/merkle/proof_key_path.go | 2 +- crypto/merkle/proof_op.go | 139 ++++ crypto/merkle/proof_test.go | 43 +- .../{proof_simple_value.go => proof_value.go} | 43 +- crypto/merkle/result.go | 52 -- crypto/merkle/simple_proof.go | 235 ------- crypto/merkle/simple_proof_test.go | 76 --- crypto/merkle/{simple_tree.go => tree.go} | 26 +- .../{simple_tree_test.go => tree_test.go} | 18 +- go.sum | 2 - light/rpc/client.go | 6 +- light/rpc/proof.go | 4 +- proto/crypto/merkle/types.pb.go | 559 ++++++++++++++-- proto/crypto/merkle/types.proto | 18 +- proto/types/types.pb.go | 173 +++-- proto/types/types.proto | 6 +- types/block.go | 4 +- types/block_test.go | 2 +- types/evidence.go | 2 +- types/part_set.go | 10 +- types/part_set_test.go | 4 +- types/results.go | 6 +- types/tx.go | 10 +- types/validator_set.go | 2 +- 34 files changed, 1311 insertions(+), 1552 deletions(-) delete mode 100644 crypto/merkle/merkle.pb.go delete mode 100644 crypto/merkle/merkle.proto create mode 100644 crypto/merkle/proof_op.go rename crypto/merkle/{proof_simple_value.go => proof_value.go} (58%) delete mode 100644 crypto/merkle/result.go delete mode 100644 crypto/merkle/simple_proof.go delete mode 100644 crypto/merkle/simple_proof_test.go rename crypto/merkle/{simple_tree.go => tree.go} (73%) rename crypto/merkle/{simple_tree_test.go => tree_test.go} (86%) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index c1b3faa28..e424bfbc9 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -25,6 +25,12 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - [crypto] \#4940 All keys have become `[]byte` instead of `[]byte`. The byte method no longer returns the marshaled value but just the `[]byte` form of the data. - [crypto] \4988 Removal of key type multisig - The key has been moved to the Cosmos-SDK (https://github.com/cosmos/cosmos-sdk/blob/master/crypto/types/multisig/multisignature.go) + - [crypto] \#4989 Remove `Simple` prefixes from `SimpleProof`, `SimpleValueOp` & `SimpleProofNode`. + - `merkle.Proof` has been renamed to `ProofOps`. + - Protobuf messages `Proof` & `ProofOp` has been moved to `proto/crypto/merkle` + - `SimpleHashFromByteSlices` has been renamed to `HashFromByteSlices` + - `SimpleHashFromByteSlicesIterative` has been renamed to `HashFromByteSlicesIterative` + - `SimpleProofsFromByteSlices` has been renamed to `ProofsFromByteSlices` - [crypto] \#4941 Remove suffixes from all keys. - ed25519: type `PrivKeyEd25519` is now `PrivKey` - ed25519: type `PubKeyEd25519` is now `PubKey` @@ -48,6 +54,7 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - Apps - [abci] [\#4704](https://github.com/tendermint/tendermint/pull/4704) Add ABCI methods `ListSnapshots`, `LoadSnapshotChunk`, `OfferSnapshot`, and `ApplySnapshotChunk` for state sync snapshots. `ABCIVersion` bumped to 0.17.0. + - [abci] \#4989 `Proof` within `ResponseQuery` has been renamed to `ProofOps` - P2P Protocol diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index d5a9aca27..752470977 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -22,7 +22,7 @@ import ( servertest "github.com/tendermint/tendermint/abci/tests/server" "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/abci/version" - "github.com/tendermint/tendermint/crypto/merkle" + "github.com/tendermint/tendermint/proto/crypto/merkle" ) // client is a global variable so it can be reused by the console @@ -98,10 +98,10 @@ type response struct { } type queryResponse struct { - Key []byte - Value []byte - Height int64 - Proof *merkle.Proof + Key []byte + Value []byte + Height int64 + ProofOps *merkle.ProofOps } func Execute() error { @@ -616,10 +616,10 @@ func cmdQuery(cmd *cobra.Command, args []string) error { Info: resQuery.Info, Log: resQuery.Log, Query: &queryResponse{ - Key: resQuery.Key, - Value: resQuery.Value, - Height: resQuery.Height, - Proof: resQuery.Proof, + Key: resQuery.Key, + Value: resQuery.Value, + Height: resQuery.Height, + ProofOps: resQuery.ProofOps, }, }) return nil @@ -719,8 +719,8 @@ func printResponse(cmd *cobra.Command, args []string, rsp response) { fmt.Printf("-> value: %s\n", rsp.Query.Value) fmt.Printf("-> value.hex: %X\n", rsp.Query.Value) } - if rsp.Query.Proof != nil { - fmt.Printf("-> proof: %#v\n", rsp.Query.Proof) + if rsp.Query.ProofOps != nil { + fmt.Printf("-> proof: %#v\n", rsp.Query.ProofOps) } } } diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 37ce711b2..d2427b504 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -10,7 +10,7 @@ import ( proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/timestamp" - merkle "github.com/tendermint/tendermint/crypto/merkle" + merkle "github.com/tendermint/tendermint/proto/crypto/merkle" types "github.com/tendermint/tendermint/proto/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -1758,14 +1758,14 @@ func (m *ResponseInitChain) GetValidators() []ValidatorUpdate { type ResponseQuery struct { Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // bytes data = 2; // use "value" instead. - Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"` - Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` - Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` - Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` - Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"` - Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` - Codespace string `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"` + Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"` + Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` + Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` + Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` + ProofOps *merkle.ProofOps `protobuf:"bytes,8,opt,name=proof_ops,json=proofOps,proto3" json:"proof_ops,omitempty"` + Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` + Codespace string `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"` } func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } @@ -1843,9 +1843,9 @@ func (m *ResponseQuery) GetValue() []byte { return nil } -func (m *ResponseQuery) GetProof() *merkle.Proof { +func (m *ResponseQuery) GetProofOps() *merkle.ProofOps { if m != nil { - return m.Proof + return m.ProofOps } return nil } @@ -3290,175 +3290,176 @@ func init() { func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } var fileDescriptor_9f1eaa49c51fa1ac = []byte{ - // 2688 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0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ba, 0x69, - 0xc8, 0x71, 0xf2, 0x9c, 0xde, 0x35, 0xd0, 0x13, 0xa8, 0x76, 0x6c, 0xcb, 0x23, 0x96, 0x37, 0xf4, - 0x74, 0x11, 0x1e, 0xa4, 0x03, 0x9e, 0x76, 0xb3, 0x76, 0x7c, 0xf6, 0x7d, 0xce, 0xad, 0xad, 0x74, - 0xe2, 0x1d, 0xe8, 0x21, 0xc0, 0x09, 0xee, 0x9b, 0x06, 0xa6, 0xb6, 0xeb, 0xd5, 0xb2, 0x17, 0x33, - 0x33, 0x94, 0x3d, 0xf5, 0x19, 0x8f, 0x1c, 0x03, 0x53, 0xd2, 0xc8, 0xb2, 0x99, 0x6b, 0x11, 0x79, - 0x74, 0x05, 0x56, 0xb0, 0xe3, 0xe8, 0x1e, 0xc5, 0x94, 0xe8, 0xed, 0x11, 0x25, 0x1e, 0x77, 0xd2, - 0xcb, 0x5a, 0x19, 0x3b, 0xce, 0x01, 0xeb, 0x6d, 0xb0, 0x4e, 0xd5, 0x08, 0x76, 0x9b, 0xfb, 0x43, - 0x84, 0x20, 0x6b, 0x60, 0x8a, 0xb9, 0xb5, 0x96, 0x35, 0xde, 0x66, 0x7d, 0x0e, 0xa6, 0x3d, 0x69, - 0x03, 0xde, 0x46, 0x17, 0x20, 0xd7, 0x23, 0x66, 0xb7, 0x47, 0xf9, 0xb2, 0x33, 0x9a, 0xa4, 0xd8, - 0xc6, 0x38, 0xae, 0x7d, 0x42, 0x78, 0x48, 0x29, 0x68, 0x82, 0x50, 0x7f, 0x9f, 0x86, 0xd5, 0x33, - 0x3e, 0x93, 0xe9, 0xed, 0x61, 0xaf, 0xe7, 0x8f, 0xc5, 0xda, 0xe8, 0x2e, 0xd3, 0x8b, 0x0d, 0xe2, - 0xca, 0x50, 0xb8, 0x16, 0xb5, 0x00, 0xdf, 0x33, 0x69, 0x82, 0x16, 0xe7, 0x92, 0x2b, 0x97, 0x32, - 0xe8, 0x08, 0xaa, 0x7d, 0xec, 0x51, 0x5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4, 0x47, 0xd8, 0x53, 0x3b, - 0x50, 0x89, 0x97, 0x72, 0xd8, 0xc9, 0x72, 0xed, 0xa1, 0x65, 0x70, 0x1d, 0x4b, 0x9a, 0x20, 0xd0, - 0x1d, 0x58, 0x3a, 0xb1, 0x85, 0x1f, 0x9a, 0x75, 0x03, 0x9f, 0xda, 0x94, 0x44, 0x0a, 0x42, 0x42, - 0x46, 0x7d, 0x0c, 0x15, 0xee, 0x51, 0xb6, 0x29, 0x75, 0xcd, 0xf6, 0x90, 0x92, 0x68, 0x65, 0x72, - 0x79, 0x42, 0x65, 0x32, 0x40, 0x1a, 0x01, 0x4e, 0xc9, 0x88, 0xb2, 0x18, 0x27, 0xd4, 0x5f, 0x29, - 0xb0, 0xc4, 0x15, 0x32, 0x77, 0xc3, 0xab, 0x3c, 0x12, 0xc3, 0xb2, 0x36, 0xea, 0x00, 0x60, 0x7f, - 0x20, 0x7f, 0xbe, 0x97, 0x67, 0x39, 0xba, 0x60, 0x5a, 0x8d, 0x77, 0xa5, 0xc7, 0x3b, 0x1f, 0x2a, - 0x88, 0x78, 0xbd, 0x88, 0x5a, 0xf5, 0xa5, 0x02, 0x85, 0xc3, 0x53, 0x79, 0x5a, 0xa7, 0x14, 0x7f, - 0xd8, 0xec, 0x77, 0xf9, 0xec, 0x45, 0xb9, 0x44, 0x10, 0xb2, 0x9a, 0x94, 0x09, 0x2a, 0x55, 0xf7, - 0x83, 0x5b, 0x99, 0x5d, 0x2c, 0xa1, 0xf4, 0x8b, 0x78, 0xd2, 0x05, 0xf5, 0x21, 0xcf, 0xcf, 0xc3, - 0xee, 0xbd, 0x89, 0x15, 0xc2, 0x47, 0xb0, 0xec, 0x60, 0x97, 0x7a, 0x7a, 0xac, 0x4e, 0x38, 0x2d, - 0x27, 0xdf, 0xc7, 0x2e, 0x3d, 0x20, 0x34, 0x56, 0x2d, 0x2c, 0x71, 0x79, 0xd1, 0xa5, 0xde, 0x86, - 0x72, 0x8c, 0x87, 0x2d, 0x96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 0xa0, 0x10, 0xe4, 0x70, 0x09, 0xdf, 0xf1, 0xeb, 0x49, 0x4b, 0xb2, 0xe8, 0x33, 0x28, 0xc7, - 0xd3, 0x96, 0x45, 0x5e, 0xe7, 0xeb, 0x0b, 0xd5, 0x5a, 0xd9, 0x58, 0xf1, 0x4c, 0x66, 0x91, 0x37, - 0xfb, 0xfa, 0x42, 0x05, 0x58, 0x74, 0x02, 0xab, 0x67, 0x93, 0x8f, 0x45, 0x1f, 0xf2, 0xeb, 0x0b, - 0x17, 0x66, 0xd1, 0x08, 0xd0, 0x84, 0x04, 0x66, 0xe1, 0xd7, 0xfd, 0xfa, 0xe2, 0xd5, 0xda, 0x46, - 0xf3, 0xcb, 0x57, 0x6b, 0xca, 0x57, 0xaf, 0xd6, 0x94, 0x7f, 0xbc, 0x5a, 0x53, 0x5e, 0xbe, 0x5e, - 0x4b, 0x7d, 0xf5, 0x7a, 0x2d, 0xf5, 0xb7, 0xd7, 0x6b, 0xa9, 0x9f, 0x7e, 0xd8, 0x35, 0x69, 0x6f, - 0xd8, 0xde, 0xe8, 0xd8, 0x83, 0xcd, 0x50, 0x6d, 0xb4, 0x19, 0xfe, 0xc2, 0xaa, 0x9d, 0xe3, 0xc1, - 0xef, 0xe3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x31, 0x8d, 0x36, 0x76, 0x25, 0x00, 0x00, + // 2699 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0x4b, 0x6f, 0x1b, 0xc9, + 0xf1, 0xe7, 0x90, 0x14, 0x1f, 0x45, 0x91, 0xa2, 0xda, 0x5e, 0x2f, 0x97, 0xff, 0x5d, 0xc9, 0x18, + 0xaf, 0x1f, 0xfb, 0xf8, 0x4b, 0xbb, 0x5a, 0x20, 0xb0, 0x63, 0x27, 0x81, 0x28, 0xcb, 0xa1, 0xe2, + 0x87, 0xe4, 0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 0x4e, 0x61, 0xf5, 0x7c, 0xf2, 0xb1, 0xe8, 0xc3, 0x7e, 0x73, 0xe1, 0x42, 0x2d, 0x1a, 0x01, 0x9a, + 0x90, 0xc0, 0x2c, 0xfc, 0xda, 0xdf, 0x5c, 0xbc, 0x7a, 0xdb, 0xda, 0xfd, 0xea, 0xe5, 0x9a, 0xf2, + 0xf5, 0xcb, 0x35, 0xe5, 0x1f, 0x2f, 0xd7, 0x94, 0x17, 0xaf, 0xd6, 0x32, 0x5f, 0xbf, 0x5a, 0xcb, + 0xfc, 0xed, 0xd5, 0x5a, 0xe6, 0x27, 0x1f, 0x74, 0x2d, 0xda, 0x1b, 0x76, 0x36, 0x0c, 0x67, 0xb0, + 0x19, 0xa9, 0x8d, 0x37, 0xa3, 0xbf, 0x5d, 0x75, 0x0a, 0x3c, 0xf8, 0x7d, 0xf2, 0x9f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x33, 0x72, 0x48, 0xac, 0x8b, 0x25, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -5604,9 +5605,9 @@ func (m *ResponseQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.Proof != nil { + if m.ProofOps != nil { { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ProofOps.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -7498,8 +7499,8 @@ func (m *ResponseQuery) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.Proof != nil { - l = m.Proof.Size() + if m.ProofOps != nil { + l = m.ProofOps.Size() n += 1 + l + sovTypes(uint64(l)) } if m.Height != 0 { @@ -11724,7 +11725,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProofOps", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -11751,10 +11752,10 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proof == nil { - m.Proof = &merkle.Proof{} + if m.ProofOps == nil { + m.ProofOps = &merkle.ProofOps{} } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ProofOps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/abci/types/types.proto b/abci/types/types.proto index d8dfa1b2c..2a9d0927d 100644 --- a/abci/types/types.proto +++ b/abci/types/types.proto @@ -4,7 +4,7 @@ option go_package = "github.com/tendermint/tendermint/abci/types"; // For more information on gogo.proto, see: // https://github.com/gogo/protobuf/blob/master/extensions.md -import "crypto/merkle/merkle.proto"; +import "proto/crypto/merkle/types.proto"; import "proto/types/types.proto"; import "proto/types/params.proto"; import "google/protobuf/timestamp.proto"; @@ -56,12 +56,12 @@ message RequestSetOption { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string chain_id = 2; - ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; - bytes app_state_bytes = 5; + google.protobuf.Timestamp time = 1 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; } message RequestQuery { @@ -72,10 +72,10 @@ message RequestQuery { } message RequestBeginBlock { - bytes hash = 1; - tendermint.proto.types.Header header = 2 [(gogoproto.nullable) = false]; - LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; + bytes hash = 1; + tendermint.proto.types.Header header = 2 [(gogoproto.nullable) = false]; + LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; + repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; } enum CheckTxType { @@ -183,19 +183,19 @@ message ResponseInitChain { message ResponseQuery { uint32 code = 1; // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 index = 5; - bytes key = 6; - bytes value = 7; - tendermint.crypto.merkle.Proof proof = 8; - int64 height = 9; - string codespace = 10; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 index = 5; + bytes key = 6; + bytes value = 7; + tendermint.proto.crypto.merkle.ProofOps proof_ops = 8; + int64 height = 9; + string codespace = 10; } message ResponseBeginBlock { repeated Event events = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } message ResponseCheckTx { @@ -206,7 +206,7 @@ message ResponseCheckTx { int64 gas_wanted = 5; int64 gas_used = 6; repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; string codespace = 8; } @@ -218,16 +218,16 @@ message ResponseDeliverTx { int64 gas_wanted = 5; int64 gas_used = 6; repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; string codespace = 8; } message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [(gogoproto.nullable) = false]; - ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + repeated ValidatorUpdate validator_updates = 1 + [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } message ResponseCommit { @@ -276,7 +276,7 @@ message ResponseApplySnapshotChunk { // ConsensusParams contains all consensus-relevant parameters // that can be adjusted by the abci app message ConsensusParams { - BlockParams block = 1; + BlockParams block = 1; tendermint.proto.types.EvidenceParams evidence = 2; tendermint.proto.types.ValidatorParams validator = 3; } @@ -294,19 +294,19 @@ message LastCommitInfo { repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; } - // EventAttribute represents an event to the indexing service. message EventAttribute { - bytes key = 1; + bytes key = 1; bytes value = 2; - bool index = 3; + bool index = 3; } message Event { - string type = 1; + string type = 1; repeated EventAttribute attributes = 2 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty"]; + (gogoproto.jsontag) = "attributes,omitempty" + ]; } // TxResult contains results of executing the transaction. @@ -360,10 +360,11 @@ message Evidence { string type = 1; Validator validator = 2 [(gogoproto.nullable) = false]; int64 height = 3; - google.protobuf.Timestamp time = 4 [ + google.protobuf.Timestamp time = 4 [ (gogoproto.nullable) = false, - (gogoproto.stdtime) = true]; - int64 total_voting_power = 5; + (gogoproto.stdtime) = true + ]; + int64 total_voting_power = 5; } //---------------------------------------- diff --git a/consensus/msgs_test.go b/consensus/msgs_test.go index c652a82a9..b4cfbcd89 100644 --- a/consensus/msgs_test.go +++ b/consensus/msgs_test.go @@ -33,7 +33,7 @@ func TestMsgToProto(t *testing.T) { parts := types.Part{ Index: 1, Bytes: []byte("test"), - Proof: merkle.SimpleProof{ + Proof: merkle.Proof{ Total: 1, Index: 1, LeafHash: tmrand.Bytes(32), @@ -211,7 +211,7 @@ func TestWALMsgProto(t *testing.T) { parts := types.Part{ Index: 1, Bytes: []byte("test"), - Proof: merkle.SimpleProof{ + Proof: merkle.Proof{ Total: 1, Index: 1, LeafHash: tmrand.Bytes(32), diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 044ea2ddf..f2551558f 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -128,7 +128,7 @@ func TestWALWrite(t *testing.T) { Part: &tmtypes.Part{ Index: 1, Bytes: make([]byte, 1), - Proof: merkle.SimpleProof{ + Proof: merkle.Proof{ Total: 1, Index: 1, LeafHash: make([]byte, maxMsgSizeBytes-30), diff --git a/crypto/armor/armor_test.go b/crypto/armor/armor_test.go index 4aa23b211..8ecfaa0e1 100644 --- a/crypto/armor/armor_test.go +++ b/crypto/armor/armor_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestSimpleArmor(t *testing.T) { +func TestArmor(t *testing.T) { blockType := "MINT TEST" data := []byte("somedata") armorStr := EncodeArmor(blockType, nil, data) diff --git a/crypto/merkle/merkle.pb.go b/crypto/merkle/merkle.pb.go deleted file mode 100644 index 071e47b2c..000000000 --- a/crypto/merkle/merkle.pb.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crypto/merkle/merkle.proto - -package merkle - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - 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 - -// ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data -// for example neighbouring node hash -type ProofOp struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *ProofOp) Reset() { *m = ProofOp{} } -func (m *ProofOp) String() string { return proto.CompactTextString(m) } -func (*ProofOp) ProtoMessage() {} -func (*ProofOp) Descriptor() ([]byte, []int) { - return fileDescriptor_9c1c2162d560d38e, []int{0} -} -func (m *ProofOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProofOp.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 *ProofOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProofOp.Merge(m, src) -} -func (m *ProofOp) XXX_Size() int { - return m.Size() -} -func (m *ProofOp) XXX_DiscardUnknown() { - xxx_messageInfo_ProofOp.DiscardUnknown(m) -} - -var xxx_messageInfo_ProofOp proto.InternalMessageInfo - -func (m *ProofOp) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *ProofOp) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *ProofOp) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -// Proof is Merkle proof defined by the list of ProofOps -type Proof struct { - Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"` -} - -func (m *Proof) Reset() { *m = Proof{} } -func (m *Proof) String() string { return proto.CompactTextString(m) } -func (*Proof) ProtoMessage() {} -func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_9c1c2162d560d38e, []int{1} -} -func (m *Proof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proof.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 *Proof) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proof.Merge(m, src) -} -func (m *Proof) XXX_Size() int { - return m.Size() -} -func (m *Proof) XXX_DiscardUnknown() { - xxx_messageInfo_Proof.DiscardUnknown(m) -} - -var xxx_messageInfo_Proof proto.InternalMessageInfo - -func (m *Proof) GetOps() []ProofOp { - if m != nil { - return m.Ops - } - return nil -} - -func init() { - proto.RegisterType((*ProofOp)(nil), "tendermint.crypto.merkle.ProofOp") - proto.RegisterType((*Proof)(nil), "tendermint.crypto.merkle.Proof") -} - -func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_9c1c2162d560d38e) } - -var fileDescriptor_9c1c2162d560d38e = []byte{ - // 234 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0x12, 0x25, 0xa9, 0x79, 0x29, 0xa9, 0x45, 0xb9, 0x99, 0x79, 0x25, 0x7a, 0x10, 0x65, - 0x7a, 0x10, 0x79, 0x29, 0xb5, 0x92, 0x8c, 0xcc, 0xa2, 0x94, 0xf8, 0x82, 0xc4, 0xa2, 0x92, 0x4a, - 0x7d, 0xb0, 0x62, 0xfd, 0xf4, 0xfc, 0xf4, 0x7c, 0x04, 0x0b, 0x62, 0x82, 0x92, 0x33, 0x17, 0x7b, - 0x40, 0x51, 0x7e, 0x7e, 0x9a, 0x7f, 0x81, 0x90, 0x10, 0x17, 0x4b, 0x49, 0x65, 0x41, 0xaa, 0x04, - 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, 0x2d, 0x24, 0xc0, 0xc5, 0x9c, 0x9d, 0x5a, 0x29, 0xc1, - 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x04, 0x62, 0x82, 0x54, 0xa5, 0x24, 0x96, 0x24, 0x4a, 0x30, 0x83, - 0x85, 0xc0, 0x6c, 0x25, 0x27, 0x2e, 0x56, 0xb0, 0x21, 0x42, 0x96, 0x5c, 0xcc, 0xf9, 0x05, 0xc5, - 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x8a, 0x7a, 0xb8, 0x5c, 0xa7, 0x07, 0xb5, 0xd2, 0x89, - 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x90, 0x1e, 0x27, 0x8f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, - 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, - 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x47, 0x98, 0x88, 0xcc, 0x44, 0x09, 0xa1, 0x24, 0x36, 0xb0, 0xcf, 0x8c, 0x01, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x39, 0xc0, 0xa3, 0x13, 0x39, 0x01, 0x00, 0x00, -} - -func (m *ProofOp) 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 *ProofOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Proof) 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 *Proof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ops) > 0 { - for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMerkle(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int { - offset -= sovMerkle(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ProofOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovMerkle(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovMerkle(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovMerkle(uint64(l)) - } - return n -} - -func (m *Proof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ops) > 0 { - for _, e := range m.Ops { - l = e.Size() - n += 1 + l + sovMerkle(uint64(l)) - } - } - return n -} - -func sovMerkle(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMerkle(x uint64) (n int) { - return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ProofOp) 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 ErrIntOverflowMerkle - } - 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: ProofOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProofOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMerkle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMerkle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 ErrIntOverflowMerkle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMerkle - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMerkle - } - 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 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMerkle - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMerkle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMerkle(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMerkle - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMerkle - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Proof) 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 ErrIntOverflowMerkle - } - 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: Proof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMerkle - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMerkle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ops = append(m.Ops, ProofOp{}) - if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMerkle(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMerkle - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMerkle - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMerkle(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, ErrIntOverflowMerkle - } - 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, ErrIntOverflowMerkle - } - 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, ErrIntOverflowMerkle - } - 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, ErrInvalidLengthMerkle - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMerkle - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMerkle - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMerkle = fmt.Errorf("proto: unexpected end of group") -) diff --git a/crypto/merkle/merkle.proto b/crypto/merkle/merkle.proto deleted file mode 100644 index ccf032d57..000000000 --- a/crypto/merkle/merkle.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package tendermint.crypto.merkle; -option go_package = "github.com/tendermint/tendermint/crypto/merkle"; - -// For more information on gogo.proto, see: -// https://github.com/gogo/protobuf/blob/master/extensions.md -import "third_party/proto/gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.sizer_all) = true; - -//---------------------------------------- -// Message types - -// ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data -// for example neighbouring node hash -message ProofOp { - string type = 1; - bytes key = 2; - bytes data = 3; -} - -// Proof is Merkle proof defined by the list of ProofOps -message Proof { - repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; -} diff --git a/crypto/merkle/proof.go b/crypto/merkle/proof.go index 84c9bbc18..ae463e83c 100644 --- a/crypto/merkle/proof.go +++ b/crypto/merkle/proof.go @@ -4,135 +4,232 @@ import ( "bytes" "errors" "fmt" -) - -//---------------------------------------- -// ProofOp gets converted to an instance of ProofOperator: - -// ProofOperator is a layer for calculating intermediate Merkle roots -// when a series of Merkle trees are chained together. -// Run() takes leaf values from a tree and returns the Merkle -// root for the corresponding tree. It takes and returns a list of bytes -// to allow multiple leaves to be part of a single proof, for instance in a range proof. -// ProofOp() encodes the ProofOperator in a generic way so it can later be -// decoded with OpDecoder. -type ProofOperator interface { - Run([][]byte) ([][]byte, error) - GetKey() []byte - ProofOp() ProofOp -} -//---------------------------------------- -// Operations on a list of ProofOperators + "github.com/tendermint/tendermint/crypto/tmhash" + tmmerkle "github.com/tendermint/tendermint/proto/crypto/merkle" +) -// ProofOperators is a slice of ProofOperator(s). -// Each operator will be applied to the input value sequentially -// and the last Merkle root will be verified with already known data -type ProofOperators []ProofOperator +const ( + // MaxAunts is the maximum number of aunts that can be included in a Proof. + // This corresponds to a tree of size 2^100, which should be sufficient for all conceivable purposes. + // This maximum helps prevent Denial-of-Service attacks by limitting the size of the proofs. + MaxAunts = 100 +) -func (poz ProofOperators) VerifyValue(root []byte, keypath string, value []byte) (err error) { - return poz.Verify(root, keypath, [][]byte{value}) +// Proof represents a Merkle proof. +// NOTE: The convention for proofs is to include leaf hashes but to +// exclude the root hash. +// This convention is implemented across IAVL range proofs as well. +// Keep this consistent unless there's a very good reason to change +// everything. This also affects the generalized proof system as +// well. +type Proof struct { + Total int64 `json:"total"` // Total number of items. + Index int64 `json:"index"` // Index of item to prove. + LeafHash []byte `json:"leaf_hash"` // Hash of item value. + Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child. } -func (poz ProofOperators) Verify(root []byte, keypath string, args [][]byte) (err error) { - keys, err := KeyPathToKeys(keypath) - if err != nil { - return +// ProofsFromByteSlices computes inclusion proof for given items. +// proofs[0] is the proof for items[0]. +func ProofsFromByteSlices(items [][]byte) (rootHash []byte, proofs []*Proof) { + trails, rootSPN := trailsFromByteSlices(items) + rootHash = rootSPN.Hash + proofs = make([]*Proof, len(items)) + for i, trail := range trails { + proofs[i] = &Proof{ + Total: int64(len(items)), + Index: int64(i), + LeafHash: trail.Hash, + Aunts: trail.FlattenAunts(), + } } + return +} - for i, op := range poz { - key := op.GetKey() - if len(key) != 0 { - if len(keys) == 0 { - return fmt.Errorf("key path has insufficient # of parts: expected no more keys but got %+v", string(key)) - } - lastKey := keys[len(keys)-1] - if !bytes.Equal(lastKey, key) { - return fmt.Errorf("key mismatch on operation #%d: expected %+v but got %+v", i, string(lastKey), string(key)) - } - keys = keys[:len(keys)-1] - } - args, err = op.Run(args) - if err != nil { - return - } +// Verify that the Proof proves the root hash. +// Check sp.Index/sp.Total manually if needed +func (sp *Proof) Verify(rootHash []byte, leaf []byte) error { + leafHash := leafHash(leaf) + if sp.Total < 0 { + return errors.New("proof total must be positive") } - if !bytes.Equal(root, args[0]) { - return fmt.Errorf("calculated root hash is invalid: expected %+v but got %+v", root, args[0]) + if sp.Index < 0 { + return errors.New("proof index cannot be negative") } - if len(keys) != 0 { - return errors.New("keypath not consumed all") + if !bytes.Equal(sp.LeafHash, leafHash) { + return fmt.Errorf("invalid leaf hash: wanted %X got %X", leafHash, sp.LeafHash) + } + computedHash := sp.ComputeRootHash() + if !bytes.Equal(computedHash, rootHash) { + return fmt.Errorf("invalid root hash: wanted %X got %X", rootHash, computedHash) } return nil } -//---------------------------------------- -// ProofRuntime - main entrypoint +// Compute the root hash given a leaf hash. Does not verify the result. +func (sp *Proof) ComputeRootHash() []byte { + return computeHashFromAunts( + sp.Index, + sp.Total, + sp.LeafHash, + sp.Aunts, + ) +} -type OpDecoder func(ProofOp) (ProofOperator, error) +// String implements the stringer interface for Proof. +// It is a wrapper around StringIndented. +func (sp *Proof) String() string { + return sp.StringIndented("") +} -type ProofRuntime struct { - decoders map[string]OpDecoder +// StringIndented generates a canonical string representation of a Proof. +func (sp *Proof) StringIndented(indent string) string { + return fmt.Sprintf(`Proof{ +%s Aunts: %X +%s}`, + indent, sp.Aunts, + indent) } -func NewProofRuntime() *ProofRuntime { - return &ProofRuntime{ - decoders: make(map[string]OpDecoder), +// ValidateBasic performs basic validation. +// NOTE: it expects the LeafHash and the elements of Aunts to be of size tmhash.Size, +// and it expects at most MaxAunts elements in Aunts. +func (sp *Proof) ValidateBasic() error { + if sp.Total < 0 { + return errors.New("negative Total") + } + if sp.Index < 0 { + return errors.New("negative Index") + } + if len(sp.LeafHash) != tmhash.Size { + return fmt.Errorf("expected LeafHash size to be %d, got %d", tmhash.Size, len(sp.LeafHash)) + } + if len(sp.Aunts) > MaxAunts { + return fmt.Errorf("expected no more than %d aunts, got %d", MaxAunts, len(sp.Aunts)) } + for i, auntHash := range sp.Aunts { + if len(auntHash) != tmhash.Size { + return fmt.Errorf("expected Aunts#%d size to be %d, got %d", i, tmhash.Size, len(auntHash)) + } + } + return nil } -func (prt *ProofRuntime) RegisterOpDecoder(typ string, dec OpDecoder) { - _, ok := prt.decoders[typ] - if ok { - panic("already registered for type " + typ) +func (sp *Proof) ToProto() *tmmerkle.Proof { + if sp == nil { + return nil } - prt.decoders[typ] = dec + pb := new(tmmerkle.Proof) + + pb.Total = sp.Total + pb.Index = sp.Index + pb.LeafHash = sp.LeafHash + pb.Aunts = sp.Aunts + + return pb } -func (prt *ProofRuntime) Decode(pop ProofOp) (ProofOperator, error) { - decoder := prt.decoders[pop.Type] - if decoder == nil { - return nil, fmt.Errorf("unrecognized proof type %v", pop.Type) +func ProofFromProto(pb *tmmerkle.Proof) (*Proof, error) { + if pb == nil { + return nil, errors.New("nil proof") } - return decoder(pop) + sp := new(Proof) + + sp.Total = pb.Total + sp.Index = pb.Index + sp.LeafHash = pb.LeafHash + sp.Aunts = pb.Aunts + + return sp, sp.ValidateBasic() } -func (prt *ProofRuntime) DecodeProof(proof *Proof) (ProofOperators, error) { - poz := make(ProofOperators, 0, len(proof.Ops)) - for _, pop := range proof.Ops { - operator, err := prt.Decode(pop) - if err != nil { - return nil, fmt.Errorf("decoding a proof operator: %w", err) +// Use the leafHash and innerHashes to get the root merkle hash. +// If the length of the innerHashes slice isn't exactly correct, the result is nil. +// Recursive impl. +func computeHashFromAunts(index, total int64, leafHash []byte, innerHashes [][]byte) []byte { + if index >= total || index < 0 || total <= 0 { + return nil + } + switch total { + case 0: + panic("Cannot call computeHashFromAunts() with 0 total") + case 1: + if len(innerHashes) != 0 { + return nil + } + return leafHash + default: + if len(innerHashes) == 0 { + return nil } - poz = append(poz, operator) + numLeft := getSplitPoint(total) + if index < numLeft { + leftHash := computeHashFromAunts(index, numLeft, leafHash, innerHashes[:len(innerHashes)-1]) + if leftHash == nil { + return nil + } + return innerHash(leftHash, innerHashes[len(innerHashes)-1]) + } + rightHash := computeHashFromAunts(index-numLeft, total-numLeft, leafHash, innerHashes[:len(innerHashes)-1]) + if rightHash == nil { + return nil + } + return innerHash(innerHashes[len(innerHashes)-1], rightHash) } - return poz, nil -} - -func (prt *ProofRuntime) VerifyValue(proof *Proof, root []byte, keypath string, value []byte) (err error) { - return prt.Verify(proof, root, keypath, [][]byte{value}) } -// TODO In the long run we'll need a method of classifcation of ops, -// whether existence or absence or perhaps a third? -func (prt *ProofRuntime) VerifyAbsence(proof *Proof, root []byte, keypath string) (err error) { - return prt.Verify(proof, root, keypath, nil) +// ProofNode is a helper structure to construct merkle proof. +// The node and the tree is thrown away afterwards. +// Exactly one of node.Left and node.Right is nil, unless node is the root, in which case both are nil. +// node.Parent.Hash = hash(node.Hash, node.Right.Hash) or +// hash(node.Left.Hash, node.Hash), depending on whether node is a left/right child. +type ProofNode struct { + Hash []byte + Parent *ProofNode + Left *ProofNode // Left sibling (only one of Left,Right is set) + Right *ProofNode // Right sibling (only one of Left,Right is set) } -func (prt *ProofRuntime) Verify(proof *Proof, root []byte, keypath string, args [][]byte) (err error) { - poz, err := prt.DecodeProof(proof) - if err != nil { - return fmt.Errorf("decoding proof: %w", err) +// FlattenAunts will return the inner hashes for the item corresponding to the leaf, +// starting from a leaf ProofNode. +func (spn *ProofNode) FlattenAunts() [][]byte { + // Nonrecursive impl. + innerHashes := [][]byte{} + for spn != nil { + switch { + case spn.Left != nil: + innerHashes = append(innerHashes, spn.Left.Hash) + case spn.Right != nil: + innerHashes = append(innerHashes, spn.Right.Hash) + default: + break + } + spn = spn.Parent } - return poz.Verify(root, keypath, args) + return innerHashes } -// DefaultProofRuntime only knows about Simple value -// proofs. -// To use e.g. IAVL proofs, register op-decoders as -// defined in the IAVL package. -func DefaultProofRuntime() (prt *ProofRuntime) { - prt = NewProofRuntime() - prt.RegisterOpDecoder(ProofOpSimpleValue, SimpleValueOpDecoder) - return +// trails[0].Hash is the leaf hash for items[0]. +// trails[i].Parent.Parent....Parent == root for all i. +func trailsFromByteSlices(items [][]byte) (trails []*ProofNode, root *ProofNode) { + // Recursive impl. + switch len(items) { + case 0: + return nil, nil + case 1: + trail := &ProofNode{leafHash(items[0]), nil, nil, nil} + return []*ProofNode{trail}, trail + default: + k := getSplitPoint(int64(len(items))) + lefts, leftRoot := trailsFromByteSlices(items[:k]) + rights, rightRoot := trailsFromByteSlices(items[k:]) + rootHash := innerHash(leftRoot.Hash, rightRoot.Hash) + root := &ProofNode{rootHash, nil, nil, nil} + leftRoot.Parent = root + leftRoot.Right = rightRoot + rightRoot.Parent = root + rightRoot.Left = leftRoot + return append(lefts, rights...), root + } } diff --git a/crypto/merkle/proof_key_path.go b/crypto/merkle/proof_key_path.go index beafc4f1c..ca8b5f052 100644 --- a/crypto/merkle/proof_key_path.go +++ b/crypto/merkle/proof_key_path.go @@ -17,7 +17,7 @@ import ( /32:) For example, for a Cosmos-SDK application where the first two proof layers - are SimpleValueOps, and the third proof layer is an IAVLValueOp, the keys + are ValueOps, and the third proof layer is an IAVLValueOp, the keys might look like: 0: []byte("App") diff --git a/crypto/merkle/proof_op.go b/crypto/merkle/proof_op.go new file mode 100644 index 000000000..8994a2926 --- /dev/null +++ b/crypto/merkle/proof_op.go @@ -0,0 +1,139 @@ +package merkle + +import ( + "bytes" + "errors" + "fmt" + + tmmerkle "github.com/tendermint/tendermint/proto/crypto/merkle" +) + +//---------------------------------------- +// ProofOp gets converted to an instance of ProofOperator: + +// ProofOperator is a layer for calculating intermediate Merkle roots +// when a series of Merkle trees are chained together. +// Run() takes leaf values from a tree and returns the Merkle +// root for the corresponding tree. It takes and returns a list of bytes +// to allow multiple leaves to be part of a single proof, for instance in a range proof. +// ProofOp() encodes the ProofOperator in a generic way so it can later be +// decoded with OpDecoder. +type ProofOperator interface { + Run([][]byte) ([][]byte, error) + GetKey() []byte + ProofOp() tmmerkle.ProofOp +} + +//---------------------------------------- +// Operations on a list of ProofOperators + +// ProofOperators is a slice of ProofOperator(s). +// Each operator will be applied to the input value sequentially +// and the last Merkle root will be verified with already known data +type ProofOperators []ProofOperator + +func (poz ProofOperators) VerifyValue(root []byte, keypath string, value []byte) (err error) { + return poz.Verify(root, keypath, [][]byte{value}) +} + +func (poz ProofOperators) Verify(root []byte, keypath string, args [][]byte) (err error) { + keys, err := KeyPathToKeys(keypath) + if err != nil { + return + } + + for i, op := range poz { + key := op.GetKey() + if len(key) != 0 { + if len(keys) == 0 { + return fmt.Errorf("key path has insufficient # of parts: expected no more keys but got %+v", string(key)) + } + lastKey := keys[len(keys)-1] + if !bytes.Equal(lastKey, key) { + return fmt.Errorf("key mismatch on operation #%d: expected %+v but got %+v", i, string(lastKey), string(key)) + } + keys = keys[:len(keys)-1] + } + args, err = op.Run(args) + if err != nil { + return + } + } + if !bytes.Equal(root, args[0]) { + return fmt.Errorf("calculated root hash is invalid: expected %+v but got %+v", root, args[0]) + } + if len(keys) != 0 { + return errors.New("keypath not consumed all") + } + return nil +} + +//---------------------------------------- +// ProofRuntime - main entrypoint + +type OpDecoder func(tmmerkle.ProofOp) (ProofOperator, error) + +type ProofRuntime struct { + decoders map[string]OpDecoder +} + +func NewProofRuntime() *ProofRuntime { + return &ProofRuntime{ + decoders: make(map[string]OpDecoder), + } +} + +func (prt *ProofRuntime) RegisterOpDecoder(typ string, dec OpDecoder) { + _, ok := prt.decoders[typ] + if ok { + panic("already registered for type " + typ) + } + prt.decoders[typ] = dec +} + +func (prt *ProofRuntime) Decode(pop tmmerkle.ProofOp) (ProofOperator, error) { + decoder := prt.decoders[pop.Type] + if decoder == nil { + return nil, fmt.Errorf("unrecognized proof type %v", pop.Type) + } + return decoder(pop) +} + +func (prt *ProofRuntime) DecodeProof(proof *tmmerkle.ProofOps) (ProofOperators, error) { + poz := make(ProofOperators, 0, len(proof.Ops)) + for _, pop := range proof.Ops { + operator, err := prt.Decode(pop) + if err != nil { + return nil, fmt.Errorf("decoding a proof operator: %w", err) + } + poz = append(poz, operator) + } + return poz, nil +} + +func (prt *ProofRuntime) VerifyValue(proof *tmmerkle.ProofOps, root []byte, keypath string, value []byte) (err error) { + return prt.Verify(proof, root, keypath, [][]byte{value}) +} + +// TODO In the long run we'll need a method of classifcation of ops, +// whether existence or absence or perhaps a third? +func (prt *ProofRuntime) VerifyAbsence(proof *tmmerkle.ProofOps, root []byte, keypath string) (err error) { + return prt.Verify(proof, root, keypath, nil) +} + +func (prt *ProofRuntime) Verify(proof *tmmerkle.ProofOps, root []byte, keypath string, args [][]byte) (err error) { + poz, err := prt.DecodeProof(proof) + if err != nil { + return fmt.Errorf("decoding proof: %w", err) + } + return poz.Verify(root, keypath, args) +} + +// DefaultProofRuntime only knows about value proofs. +// To use e.g. IAVL proofs, register op-decoders as +// defined in the IAVL package. +func DefaultProofRuntime() (prt *ProofRuntime) { + prt = NewProofRuntime() + prt.RegisterOpDecoder(ProofOpValue, ValueOpDecoder) + return +} diff --git a/crypto/merkle/proof_test.go b/crypto/merkle/proof_test.go index ca9a982e1..398cb3e29 100644 --- a/crypto/merkle/proof_test.go +++ b/crypto/merkle/proof_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/assert" amino "github.com/tendermint/go-amino" + tmmerkle "github.com/tendermint/tendermint/proto/crypto/merkle" ) const ProofOpDomino = "test:domino" @@ -28,21 +29,21 @@ func NewDominoOp(key, input, output string) DominoOp { } //nolint:unused -func DominoOpDecoder(pop ProofOp) (ProofOperator, error) { +func DominoOpDecoder(pop tmmerkle.ProofOp) (ProofOperator, error) { if pop.Type != ProofOpDomino { panic("unexpected proof op type") } var op DominoOp // a bit strange as we'll discard this, but it works. err := amino.UnmarshalBinaryLengthPrefixed(pop.Data, &op) if err != nil { - return nil, fmt.Errorf("decoding ProofOp.Data into SimpleValueOp: %w", err) + return nil, fmt.Errorf("decoding ProofOp.Data into ValueOp: %w", err) } return NewDominoOp(string(pop.Key), op.Input, op.Output), nil } -func (dop DominoOp) ProofOp() ProofOp { +func (dop DominoOp) ProofOp() tmmerkle.ProofOp { bz := amino.MustMarshalBinaryLengthPrefixed(dop) - return ProofOp{ + return tmmerkle.ProofOp{ Type: ProofOpDomino, Key: []byte(dop.key), Data: bz, @@ -140,3 +141,37 @@ func TestProofOperators(t *testing.T) { func bz(s string) []byte { return []byte(s) } + +func TestProofValidateBasic(t *testing.T) { + testCases := []struct { + testName string + malleateProof func(*Proof) + errStr string + }{ + {"Good", func(sp *Proof) {}, ""}, + {"Negative Total", func(sp *Proof) { sp.Total = -1 }, "negative Total"}, + {"Negative Index", func(sp *Proof) { sp.Index = -1 }, "negative Index"}, + {"Invalid LeafHash", func(sp *Proof) { sp.LeafHash = make([]byte, 10) }, + "expected LeafHash size to be 32, got 10"}, + {"Too many Aunts", func(sp *Proof) { sp.Aunts = make([][]byte, MaxAunts+1) }, + "expected no more than 100 aunts, got 101"}, + {"Invalid Aunt", func(sp *Proof) { sp.Aunts[0] = make([]byte, 10) }, + "expected Aunts#0 size to be 32, got 10"}, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testName, func(t *testing.T) { + _, proofs := ProofsFromByteSlices([][]byte{ + []byte("apple"), + []byte("watermelon"), + []byte("kiwi"), + }) + tc.malleateProof(proofs[0]) + err := proofs[0].ValidateBasic() + if tc.errStr != "" { + assert.Contains(t, err.Error(), tc.errStr) + } + }) + } +} diff --git a/crypto/merkle/proof_simple_value.go b/crypto/merkle/proof_value.go similarity index 58% rename from crypto/merkle/proof_simple_value.go rename to crypto/merkle/proof_value.go index d1a0426aa..b9be68ca7 100644 --- a/crypto/merkle/proof_simple_value.go +++ b/crypto/merkle/proof_value.go @@ -5,63 +5,64 @@ import ( "fmt" "github.com/tendermint/tendermint/crypto/tmhash" + tmmerkle "github.com/tendermint/tendermint/proto/crypto/merkle" ) -const ProofOpSimpleValue = "simple:v" +const ProofOpValue = "simple:v" -// SimpleValueOp takes a key and a single value as argument and +// ValueOp takes a key and a single value as argument and // produces the root hash. The corresponding tree structure is // the SimpleMap tree. SimpleMap takes a Hasher, and currently -// Tendermint uses aminoHasher. SimpleValueOp should support +// Tendermint uses aminoHasher. ValueOp should support // the hash function as used in aminoHasher. TODO support // additional hash functions here as options/args to this // operator. // // If the produced root hash matches the expected hash, the // proof is good. -type SimpleValueOp struct { +type ValueOp struct { // Encoded in ProofOp.Key. key []byte // To encode in ProofOp.Data - Proof *SimpleProof `json:"simple_proof"` + Proof *Proof `json:"proof"` } -var _ ProofOperator = SimpleValueOp{} +var _ ProofOperator = ValueOp{} -func NewSimpleValueOp(key []byte, proof *SimpleProof) SimpleValueOp { - return SimpleValueOp{ +func NewValueOp(key []byte, proof *Proof) ValueOp { + return ValueOp{ key: key, Proof: proof, } } -func SimpleValueOpDecoder(pop ProofOp) (ProofOperator, error) { - if pop.Type != ProofOpSimpleValue { - return nil, fmt.Errorf("unexpected ProofOp.Type; got %v, want %v", pop.Type, ProofOpSimpleValue) +func ValueOpDecoder(pop tmmerkle.ProofOp) (ProofOperator, error) { + if pop.Type != ProofOpValue { + return nil, fmt.Errorf("unexpected ProofOp.Type; got %v, want %v", pop.Type, ProofOpValue) } - var op SimpleValueOp // a bit strange as we'll discard this, but it works. + var op ValueOp // a bit strange as we'll discard this, but it works. err := cdc.UnmarshalBinaryLengthPrefixed(pop.Data, &op) if err != nil { - return nil, fmt.Errorf("decoding ProofOp.Data into SimpleValueOp: %w", err) + return nil, fmt.Errorf("decoding ProofOp.Data into ValueOp: %w", err) } - return NewSimpleValueOp(pop.Key, op.Proof), nil + return NewValueOp(pop.Key, op.Proof), nil } -func (op SimpleValueOp) ProofOp() ProofOp { +func (op ValueOp) ProofOp() tmmerkle.ProofOp { bz := cdc.MustMarshalBinaryLengthPrefixed(op) - return ProofOp{ - Type: ProofOpSimpleValue, + return tmmerkle.ProofOp{ + Type: ProofOpValue, Key: op.key, Data: bz, } } -func (op SimpleValueOp) String() string { - return fmt.Sprintf("SimpleValueOp{%v}", op.GetKey()) +func (op ValueOp) String() string { + return fmt.Sprintf("ValueOp{%v}", op.GetKey()) } -func (op SimpleValueOp) Run(args [][]byte) ([][]byte, error) { +func (op ValueOp) Run(args [][]byte) ([][]byte, error) { if len(args) != 1 { return nil, fmt.Errorf("expected 1 arg, got %v", len(args)) } @@ -85,6 +86,6 @@ func (op SimpleValueOp) Run(args [][]byte) ([][]byte, error) { }, nil } -func (op SimpleValueOp) GetKey() []byte { +func (op ValueOp) GetKey() []byte { return op.key } diff --git a/crypto/merkle/result.go b/crypto/merkle/result.go deleted file mode 100644 index a17e38e1f..000000000 --- a/crypto/merkle/result.go +++ /dev/null @@ -1,52 +0,0 @@ -package merkle - -import ( - "bytes" - "encoding/json" - - "github.com/gogo/protobuf/jsonpb" -) - -//--------------------------------------------------------------------------- -// override JSON marshalling so we emit defaults (ie. disable omitempty) - -var ( - jsonpbMarshaller = jsonpb.Marshaler{ - EnumsAsInts: true, - EmitDefaults: true, - } - jsonpbUnmarshaller = jsonpb.Unmarshaler{} -) - -func (r *ProofOp) MarshalJSON() ([]byte, error) { - s, err := jsonpbMarshaller.MarshalToString(r) - return []byte(s), err -} - -func (r *ProofOp) UnmarshalJSON(b []byte) error { - reader := bytes.NewBuffer(b) - return jsonpbUnmarshaller.Unmarshal(reader, r) -} - -func (r *Proof) MarshalJSON() ([]byte, error) { - s, err := jsonpbMarshaller.MarshalToString(r) - return []byte(s), err -} - -func (r *Proof) UnmarshalJSON(b []byte) error { - reader := bytes.NewBuffer(b) - return jsonpbUnmarshaller.Unmarshal(reader, r) -} - -// Some compile time assertions to ensure we don't -// have accidental runtime surprises later on. -// jsonEncodingRoundTripper ensures that asserted -// interfaces implement both MarshalJSON and UnmarshalJSON - -type jsonRoundTripper interface { - json.Marshaler - json.Unmarshaler -} - -var _ jsonRoundTripper = (*ProofOp)(nil) -var _ jsonRoundTripper = (*Proof)(nil) diff --git a/crypto/merkle/simple_proof.go b/crypto/merkle/simple_proof.go deleted file mode 100644 index 7c262e3f6..000000000 --- a/crypto/merkle/simple_proof.go +++ /dev/null @@ -1,235 +0,0 @@ -package merkle - -import ( - "bytes" - "errors" - "fmt" - - "github.com/tendermint/tendermint/crypto/tmhash" - tmmerkle "github.com/tendermint/tendermint/proto/crypto/merkle" -) - -const ( - // MaxAunts is the maximum number of aunts that can be included in a SimpleProof. - // This corresponds to a tree of size 2^100, which should be sufficient for all conceivable purposes. - // This maximum helps prevent Denial-of-Service attacks by limitting the size of the proofs. - MaxAunts = 100 -) - -// SimpleProof represents a simple Merkle proof. -// NOTE: The convention for proofs is to include leaf hashes but to -// exclude the root hash. -// This convention is implemented across IAVL range proofs as well. -// Keep this consistent unless there's a very good reason to change -// everything. This also affects the generalized proof system as -// well. -type SimpleProof struct { - Total int64 `json:"total"` // Total number of items. - Index int64 `json:"index"` // Index of item to prove. - LeafHash []byte `json:"leaf_hash"` // Hash of item value. - Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child. -} - -// SimpleProofsFromByteSlices computes inclusion proof for given items. -// proofs[0] is the proof for items[0]. -func SimpleProofsFromByteSlices(items [][]byte) (rootHash []byte, proofs []*SimpleProof) { - trails, rootSPN := trailsFromByteSlices(items) - rootHash = rootSPN.Hash - proofs = make([]*SimpleProof, len(items)) - for i, trail := range trails { - proofs[i] = &SimpleProof{ - Total: int64(len(items)), - Index: int64(i), - LeafHash: trail.Hash, - Aunts: trail.FlattenAunts(), - } - } - return -} - -// Verify that the SimpleProof proves the root hash. -// Check sp.Index/sp.Total manually if needed -func (sp *SimpleProof) Verify(rootHash []byte, leaf []byte) error { - leafHash := leafHash(leaf) - if sp.Total < 0 { - return errors.New("proof total must be positive") - } - if sp.Index < 0 { - return errors.New("proof index cannot be negative") - } - if !bytes.Equal(sp.LeafHash, leafHash) { - return fmt.Errorf("invalid leaf hash: wanted %X got %X", leafHash, sp.LeafHash) - } - computedHash := sp.ComputeRootHash() - if !bytes.Equal(computedHash, rootHash) { - return fmt.Errorf("invalid root hash: wanted %X got %X", rootHash, computedHash) - } - return nil -} - -// Compute the root hash given a leaf hash. Does not verify the result. -func (sp *SimpleProof) ComputeRootHash() []byte { - return computeHashFromAunts( - sp.Index, - sp.Total, - sp.LeafHash, - sp.Aunts, - ) -} - -// String implements the stringer interface for SimpleProof. -// It is a wrapper around StringIndented. -func (sp *SimpleProof) String() string { - return sp.StringIndented("") -} - -// StringIndented generates a canonical string representation of a SimpleProof. -func (sp *SimpleProof) StringIndented(indent string) string { - return fmt.Sprintf(`SimpleProof{ -%s Aunts: %X -%s}`, - indent, sp.Aunts, - indent) -} - -// ValidateBasic performs basic validation. -// NOTE: it expects the LeafHash and the elements of Aunts to be of size tmhash.Size, -// and it expects at most MaxAunts elements in Aunts. -func (sp *SimpleProof) ValidateBasic() error { - if sp.Total < 0 { - return errors.New("negative Total") - } - if sp.Index < 0 { - return errors.New("negative Index") - } - if len(sp.LeafHash) != tmhash.Size { - return fmt.Errorf("expected LeafHash size to be %d, got %d", tmhash.Size, len(sp.LeafHash)) - } - if len(sp.Aunts) > MaxAunts { - return fmt.Errorf("expected no more than %d aunts, got %d", MaxAunts, len(sp.Aunts)) - } - for i, auntHash := range sp.Aunts { - if len(auntHash) != tmhash.Size { - return fmt.Errorf("expected Aunts#%d size to be %d, got %d", i, tmhash.Size, len(auntHash)) - } - } - return nil -} - -func (sp *SimpleProof) ToProto() *tmmerkle.SimpleProof { - if sp == nil { - return nil - } - pb := new(tmmerkle.SimpleProof) - - pb.Total = sp.Total - pb.Index = sp.Index - pb.LeafHash = sp.LeafHash - pb.Aunts = sp.Aunts - - return pb -} - -func SimpleProofFromProto(pb *tmmerkle.SimpleProof) (*SimpleProof, error) { - if pb == nil { - return nil, errors.New("nil proof") - } - sp := new(SimpleProof) - - sp.Total = pb.Total - sp.Index = pb.Index - sp.LeafHash = pb.LeafHash - sp.Aunts = pb.Aunts - - return sp, sp.ValidateBasic() -} - -// Use the leafHash and innerHashes to get the root merkle hash. -// If the length of the innerHashes slice isn't exactly correct, the result is nil. -// Recursive impl. -func computeHashFromAunts(index, total int64, leafHash []byte, innerHashes [][]byte) []byte { - if index >= total || index < 0 || total <= 0 { - return nil - } - switch total { - case 0: - panic("Cannot call computeHashFromAunts() with 0 total") - case 1: - if len(innerHashes) != 0 { - return nil - } - return leafHash - default: - if len(innerHashes) == 0 { - return nil - } - numLeft := getSplitPoint(total) - if index < numLeft { - leftHash := computeHashFromAunts(index, numLeft, leafHash, innerHashes[:len(innerHashes)-1]) - if leftHash == nil { - return nil - } - return innerHash(leftHash, innerHashes[len(innerHashes)-1]) - } - rightHash := computeHashFromAunts(index-numLeft, total-numLeft, leafHash, innerHashes[:len(innerHashes)-1]) - if rightHash == nil { - return nil - } - return innerHash(innerHashes[len(innerHashes)-1], rightHash) - } -} - -// SimpleProofNode is a helper structure to construct merkle proof. -// The node and the tree is thrown away afterwards. -// Exactly one of node.Left and node.Right is nil, unless node is the root, in which case both are nil. -// node.Parent.Hash = hash(node.Hash, node.Right.Hash) or -// hash(node.Left.Hash, node.Hash), depending on whether node is a left/right child. -type SimpleProofNode struct { - Hash []byte - Parent *SimpleProofNode - Left *SimpleProofNode // Left sibling (only one of Left,Right is set) - Right *SimpleProofNode // Right sibling (only one of Left,Right is set) -} - -// FlattenAunts will return the inner hashes for the item corresponding to the leaf, -// starting from a leaf SimpleProofNode. -func (spn *SimpleProofNode) FlattenAunts() [][]byte { - // Nonrecursive impl. - innerHashes := [][]byte{} - for spn != nil { - switch { - case spn.Left != nil: - innerHashes = append(innerHashes, spn.Left.Hash) - case spn.Right != nil: - innerHashes = append(innerHashes, spn.Right.Hash) - default: - break - } - spn = spn.Parent - } - return innerHashes -} - -// trails[0].Hash is the leaf hash for items[0]. -// trails[i].Parent.Parent....Parent == root for all i. -func trailsFromByteSlices(items [][]byte) (trails []*SimpleProofNode, root *SimpleProofNode) { - // Recursive impl. - switch len(items) { - case 0: - return nil, nil - case 1: - trail := &SimpleProofNode{leafHash(items[0]), nil, nil, nil} - return []*SimpleProofNode{trail}, trail - default: - k := getSplitPoint(int64(len(items))) - lefts, leftRoot := trailsFromByteSlices(items[:k]) - rights, rightRoot := trailsFromByteSlices(items[k:]) - rootHash := innerHash(leftRoot.Hash, rightRoot.Hash) - root := &SimpleProofNode{rootHash, nil, nil, nil} - leftRoot.Parent = root - leftRoot.Right = rightRoot - rightRoot.Parent = root - rightRoot.Left = leftRoot - return append(lefts, rights...), root - } -} diff --git a/crypto/merkle/simple_proof_test.go b/crypto/merkle/simple_proof_test.go deleted file mode 100644 index 2dd8b7eb0..000000000 --- a/crypto/merkle/simple_proof_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package merkle - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - tmrand "github.com/tendermint/tendermint/libs/rand" -) - -func TestSimpleProofValidateBasic(t *testing.T) { - testCases := []struct { - testName string - malleateProof func(*SimpleProof) - errStr string - }{ - {"Good", func(sp *SimpleProof) {}, ""}, - {"Negative Total", func(sp *SimpleProof) { sp.Total = -1 }, "negative Total"}, - {"Negative Index", func(sp *SimpleProof) { sp.Index = -1 }, "negative Index"}, - {"Invalid LeafHash", func(sp *SimpleProof) { sp.LeafHash = make([]byte, 10) }, - "expected LeafHash size to be 32, got 10"}, - {"Too many Aunts", func(sp *SimpleProof) { sp.Aunts = make([][]byte, MaxAunts+1) }, - "expected no more than 100 aunts, got 101"}, - {"Invalid Aunt", func(sp *SimpleProof) { sp.Aunts[0] = make([]byte, 10) }, - "expected Aunts#0 size to be 32, got 10"}, - } - - for _, tc := range testCases { - tc := tc - t.Run(tc.testName, func(t *testing.T) { - _, proofs := SimpleProofsFromByteSlices([][]byte{ - []byte("apple"), - []byte("watermelon"), - []byte("kiwi"), - }) - tc.malleateProof(proofs[0]) - err := proofs[0].ValidateBasic() - if tc.errStr != "" { - assert.Contains(t, err.Error(), tc.errStr) - } - }) - } -} - -func TestSimpleProofProtoBuf(t *testing.T) { - testCases := []struct { - testName string - ps1 *SimpleProof - expPass bool - }{ - {"failure empty", &SimpleProof{}, false}, - {"failure nil", nil, false}, - {"success", - &SimpleProof{ - Total: 1, - Index: 1, - LeafHash: tmrand.Bytes(32), - Aunts: [][]byte{tmrand.Bytes(32), tmrand.Bytes(32), tmrand.Bytes(32)}, - }, true}, - } - - for _, tc := range testCases { - tc := tc - t.Run(tc.testName, func(t *testing.T) { - proto := tc.ps1.ToProto() - p, err := SimpleProofFromProto(proto) - if tc.expPass { - require.NoError(t, err) - require.Equal(t, tc.ps1, p, tc.testName) - } else { - require.Error(t, err, tc.testName) - } - }) - } -} diff --git a/crypto/merkle/simple_tree.go b/crypto/merkle/tree.go similarity index 73% rename from crypto/merkle/simple_tree.go rename to crypto/merkle/tree.go index c9c478406..cbd51ca3a 100644 --- a/crypto/merkle/simple_tree.go +++ b/crypto/merkle/tree.go @@ -4,9 +4,9 @@ import ( "math/bits" ) -// SimpleHashFromByteSlices computes a Merkle tree where the leaves are the byte slice, +// HashFromByteSlices computes a Merkle tree where the leaves are the byte slice, // in the provided order. -func SimpleHashFromByteSlices(items [][]byte) []byte { +func HashFromByteSlices(items [][]byte) []byte { switch len(items) { case 0: return nil @@ -14,27 +14,27 @@ func SimpleHashFromByteSlices(items [][]byte) []byte { return leafHash(items[0]) default: k := getSplitPoint(int64(len(items))) - left := SimpleHashFromByteSlices(items[:k]) - right := SimpleHashFromByteSlices(items[k:]) + left := HashFromByteSlices(items[:k]) + right := HashFromByteSlices(items[k:]) return innerHash(left, right) } } -// SimpleHashFromByteSliceIterative is an iterative alternative to -// SimpleHashFromByteSlice motivated by potential performance improvements. +// HashFromByteSliceIterative is an iterative alternative to +// HashFromByteSlice motivated by potential performance improvements. // (#2611) had suggested that an iterative version of -// SimpleHashFromByteSlice would be faster, presumably because +// HashFromByteSlice would be faster, presumably because // we can envision some overhead accumulating from stack // frames and function calls. Additionally, a recursive algorithm risks // hitting the stack limit and causing a stack overflow should the tree // be too large. // -// Provided here is an iterative alternative, a simple test to assert +// Provided here is an iterative alternative, a test to assert // correctness and a benchmark. On the performance side, there appears to // be no overall difference: // -// BenchmarkSimpleHashAlternatives/recursive-4 20000 77677 ns/op -// BenchmarkSimpleHashAlternatives/iterative-4 20000 76802 ns/op +// BenchmarkHashAlternatives/recursive-4 20000 77677 ns/op +// BenchmarkHashAlternatives/iterative-4 20000 76802 ns/op // // On the surface it might seem that the additional overhead is due to // the different allocation patterns of the implementations. The recursive @@ -47,9 +47,9 @@ func SimpleHashFromByteSlices(items [][]byte) []byte { // // These preliminary results suggest: // -// 1. The performance of the SimpleHashFromByteSlice is pretty good +// 1. The performance of the HashFromByteSlice is pretty good // 2. Go has low overhead for recursive functions -// 3. The performance of the SimpleHashFromByteSlice routine is dominated +// 3. The performance of the HashFromByteSlice routine is dominated // by the actual hashing of data // // Although this work is in no way exhaustive, point #3 suggests that @@ -59,7 +59,7 @@ func SimpleHashFromByteSlices(items [][]byte) []byte { // Finally, considering that the recursive implementation is easier to // read, it might not be worthwhile to switch to a less intuitive // implementation for so little benefit. -func SimpleHashFromByteSlicesIterative(input [][]byte) []byte { +func HashFromByteSlicesIterative(input [][]byte) []byte { items := make([][]byte, len(input)) for i, leaf := range input { diff --git a/crypto/merkle/simple_tree_test.go b/crypto/merkle/tree_test.go similarity index 86% rename from crypto/merkle/simple_tree_test.go rename to crypto/merkle/tree_test.go index 01d6058c3..b8679256c 100644 --- a/crypto/merkle/simple_tree_test.go +++ b/crypto/merkle/tree_test.go @@ -17,7 +17,7 @@ func (tI testItem) Hash() []byte { return []byte(tI) } -func TestSimpleProof(t *testing.T) { +func TestProof(t *testing.T) { total := 100 @@ -26,9 +26,9 @@ func TestSimpleProof(t *testing.T) { items[i] = testItem(tmrand.Bytes(tmhash.Size)) } - rootHash := SimpleHashFromByteSlices(items) + rootHash := HashFromByteSlices(items) - rootHash2, proofs := SimpleProofsFromByteSlices(items) + rootHash2, proofs := ProofsFromByteSlices(items) require.Equal(t, rootHash, rootHash2, "Unmatched root hashes: %X vs %X", rootHash, rootHash2) @@ -70,7 +70,7 @@ func TestSimpleProof(t *testing.T) { } } -func TestSimpleHashAlternatives(t *testing.T) { +func TestHashAlternatives(t *testing.T) { total := 100 @@ -79,12 +79,12 @@ func TestSimpleHashAlternatives(t *testing.T) { items[i] = testItem(tmrand.Bytes(tmhash.Size)) } - rootHash1 := SimpleHashFromByteSlicesIterative(items) - rootHash2 := SimpleHashFromByteSlices(items) + rootHash1 := HashFromByteSlicesIterative(items) + rootHash2 := HashFromByteSlices(items) require.Equal(t, rootHash1, rootHash2, "Unmatched root hashes: %X vs %X", rootHash1, rootHash2) } -func BenchmarkSimpleHashAlternatives(b *testing.B) { +func BenchmarkHashAlternatives(b *testing.B) { total := 100 items := make([][]byte, total) @@ -95,13 +95,13 @@ func BenchmarkSimpleHashAlternatives(b *testing.B) { b.ResetTimer() b.Run("recursive", func(b *testing.B) { for i := 0; i < b.N; i++ { - _ = SimpleHashFromByteSlices(items) + _ = HashFromByteSlices(items) } }) b.Run("iterative", func(b *testing.B) { for i := 0; i < b.N; i++ { - _ = SimpleHashFromByteSlicesIterative(items) + _ = HashFromByteSlicesIterative(items) } }) } diff --git a/go.sum b/go.sum index a64356153..a01c6ab24 100644 --- a/go.sum +++ b/go.sum @@ -438,8 +438,6 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho= -github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= diff --git a/light/rpc/client.go b/light/rpc/client.go index 847f1e468..59d2a3d62 100644 --- a/light/rpc/client.go +++ b/light/rpc/client.go @@ -83,7 +83,7 @@ func (c *Client) ABCIQueryWithOptions(path string, data tmbytes.HexBytes, if resp.IsErr() { return nil, fmt.Errorf("err response code: %v", resp.Code) } - if len(resp.Key) == 0 || resp.Proof == nil { + if len(resp.Key) == 0 || resp.ProofOps == nil { return nil, errors.New("empty tree") } if resp.Height <= 0 { @@ -108,7 +108,7 @@ func (c *Client) ABCIQueryWithOptions(path string, data tmbytes.HexBytes, kp := merkle.KeyPath{} kp = kp.AppendKey([]byte(storeName), merkle.KeyEncodingURL) kp = kp.AppendKey(resp.Key, merkle.KeyEncodingURL) - err = c.prt.VerifyValue(resp.Proof, h.AppHash, kp.String(), resp.Value) + err = c.prt.VerifyValue(resp.ProofOps, h.AppHash, kp.String(), resp.Value) if err != nil { return nil, fmt.Errorf("verify value proof: %w", err) } @@ -117,7 +117,7 @@ func (c *Client) ABCIQueryWithOptions(path string, data tmbytes.HexBytes, // OR validate the ansence proof against the trusted header. // XXX How do we encode the key into a string... - err = c.prt.VerifyAbsence(resp.Proof, h.AppHash, string(resp.Key)) + err = c.prt.VerifyAbsence(resp.ProofOps, h.AppHash, string(resp.Key)) if err != nil { return nil, fmt.Errorf("verify absence proof: %w", err) } diff --git a/light/rpc/proof.go b/light/rpc/proof.go index 51e835f7a..fc349c172 100644 --- a/light/rpc/proof.go +++ b/light/rpc/proof.go @@ -7,8 +7,8 @@ import ( func defaultProofRuntime() *merkle.ProofRuntime { prt := merkle.NewProofRuntime() prt.RegisterOpDecoder( - merkle.ProofOpSimpleValue, - merkle.SimpleValueOpDecoder, + merkle.ProofOpValue, + merkle.ValueOpDecoder, ) return prt } diff --git a/proto/crypto/merkle/types.pb.go b/proto/crypto/merkle/types.pb.go index fdc4493f8..06835cc3b 100644 --- a/proto/crypto/merkle/types.pb.go +++ b/proto/crypto/merkle/types.pb.go @@ -5,6 +5,7 @@ package merkle import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -22,25 +23,25 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type SimpleProof struct { +type Proof struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` LeafHash []byte `protobuf:"bytes,3,opt,name=leaf_hash,json=leafHash,proto3" json:"leaf_hash,omitempty"` Aunts [][]byte `protobuf:"bytes,4,rep,name=aunts,proto3" json:"aunts,omitempty"` } -func (m *SimpleProof) Reset() { *m = SimpleProof{} } -func (m *SimpleProof) String() string { return proto.CompactTextString(m) } -func (*SimpleProof) ProtoMessage() {} -func (*SimpleProof) Descriptor() ([]byte, []int) { +func (m *Proof) Reset() { *m = Proof{} } +func (m *Proof) String() string { return proto.CompactTextString(m) } +func (*Proof) ProtoMessage() {} +func (*Proof) Descriptor() ([]byte, []int) { return fileDescriptor_57e39eefdaf7ae96, []int{0} } -func (m *SimpleProof) XXX_Unmarshal(b []byte) error { +func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SimpleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SimpleProof.Marshal(b, m, deterministic) + return xxx_messageInfo_Proof.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -50,71 +51,186 @@ func (m *SimpleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *SimpleProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleProof.Merge(m, src) +func (m *Proof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proof.Merge(m, src) } -func (m *SimpleProof) XXX_Size() int { +func (m *Proof) XXX_Size() int { return m.Size() } -func (m *SimpleProof) XXX_DiscardUnknown() { - xxx_messageInfo_SimpleProof.DiscardUnknown(m) +func (m *Proof) XXX_DiscardUnknown() { + xxx_messageInfo_Proof.DiscardUnknown(m) } -var xxx_messageInfo_SimpleProof proto.InternalMessageInfo +var xxx_messageInfo_Proof proto.InternalMessageInfo -func (m *SimpleProof) GetTotal() int64 { +func (m *Proof) GetTotal() int64 { if m != nil { return m.Total } return 0 } -func (m *SimpleProof) GetIndex() int64 { +func (m *Proof) GetIndex() int64 { if m != nil { return m.Index } return 0 } -func (m *SimpleProof) GetLeafHash() []byte { +func (m *Proof) GetLeafHash() []byte { if m != nil { return m.LeafHash } return nil } -func (m *SimpleProof) GetAunts() [][]byte { +func (m *Proof) GetAunts() [][]byte { if m != nil { return m.Aunts } return nil } +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +type ProofOp struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *ProofOp) Reset() { *m = ProofOp{} } +func (m *ProofOp) String() string { return proto.CompactTextString(m) } +func (*ProofOp) ProtoMessage() {} +func (*ProofOp) Descriptor() ([]byte, []int) { + return fileDescriptor_57e39eefdaf7ae96, []int{1} +} +func (m *ProofOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProofOp.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 *ProofOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofOp.Merge(m, src) +} +func (m *ProofOp) XXX_Size() int { + return m.Size() +} +func (m *ProofOp) XXX_DiscardUnknown() { + xxx_messageInfo_ProofOp.DiscardUnknown(m) +} + +var xxx_messageInfo_ProofOp proto.InternalMessageInfo + +func (m *ProofOp) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *ProofOp) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *ProofOp) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// Proof is Merkle proof defined by the list of ProofOps +type ProofOps struct { + Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"` +} + +func (m *ProofOps) Reset() { *m = ProofOps{} } +func (m *ProofOps) String() string { return proto.CompactTextString(m) } +func (*ProofOps) ProtoMessage() {} +func (*ProofOps) Descriptor() ([]byte, []int) { + return fileDescriptor_57e39eefdaf7ae96, []int{2} +} +func (m *ProofOps) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProofOps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProofOps.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 *ProofOps) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofOps.Merge(m, src) +} +func (m *ProofOps) XXX_Size() int { + return m.Size() +} +func (m *ProofOps) XXX_DiscardUnknown() { + xxx_messageInfo_ProofOps.DiscardUnknown(m) +} + +var xxx_messageInfo_ProofOps proto.InternalMessageInfo + +func (m *ProofOps) GetOps() []ProofOp { + if m != nil { + return m.Ops + } + return nil +} + func init() { - proto.RegisterType((*SimpleProof)(nil), "tendermint.proto.crypto.merkle.SimpleProof") + proto.RegisterType((*Proof)(nil), "tendermint.proto.crypto.merkle.Proof") + proto.RegisterType((*ProofOp)(nil), "tendermint.proto.crypto.merkle.ProofOp") + proto.RegisterType((*ProofOps)(nil), "tendermint.proto.crypto.merkle.ProofOps") } func init() { proto.RegisterFile("proto/crypto/merkle/types.proto", fileDescriptor_57e39eefdaf7ae96) } var fileDescriptor_57e39eefdaf7ae96 = []byte{ - // 214 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x28, 0xca, 0x2f, - 0xc9, 0xd7, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0xd5, - 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x03, 0xcb, 0x08, 0xc9, 0x95, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, - 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, 0x20, 0x6a, 0xf5, 0x20, 0x6a, 0x95, 0x72, 0xb8, 0xb8, - 0x83, 0x33, 0x73, 0x0b, 0x72, 0x52, 0x03, 0x8a, 0xf2, 0xf3, 0xd3, 0x84, 0x44, 0xb8, 0x58, 0x4b, - 0xf2, 0x4b, 0x12, 0x73, 0x24, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, 0x20, 0x1c, 0x90, 0x68, 0x66, - 0x5e, 0x4a, 0x6a, 0x85, 0x04, 0x13, 0x44, 0x14, 0xcc, 0x11, 0x92, 0xe6, 0xe2, 0xcc, 0x49, 0x4d, - 0x4c, 0x8b, 0xcf, 0x48, 0x2c, 0xce, 0x90, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x09, 0xe2, 0x00, 0x09, - 0x78, 0x24, 0x16, 0x67, 0x80, 0xb4, 0x24, 0x96, 0xe6, 0x95, 0x14, 0x4b, 0xb0, 0x28, 0x30, 0x6b, - 0xf0, 0x04, 0x41, 0x38, 0x4e, 0x7e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, - 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, - 0x65, 0x92, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0x70, 0x32, 0x32, - 0x13, 0x8b, 0x4f, 0x93, 0xd8, 0xc0, 0x82, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x91, 0x57, - 0x16, 0x46, 0x07, 0x01, 0x00, 0x00, -} - -func (m *SimpleProof) Marshal() (dAtA []byte, err error) { + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0x3f, 0x4b, 0x03, 0x31, + 0x1c, 0xbd, 0x78, 0xad, 0xb6, 0xb1, 0x83, 0x04, 0x87, 0x43, 0x21, 0x3d, 0x3a, 0xe8, 0x4d, 0x39, + 0x50, 0x77, 0xa1, 0x2e, 0x82, 0xa0, 0x92, 0xd1, 0xa5, 0xa4, 0xbd, 0xb4, 0x77, 0xb4, 0xbd, 0x84, + 0xe4, 0x57, 0xf0, 0xbe, 0x85, 0x1f, 0xab, 0x63, 0x47, 0x27, 0x91, 0xf6, 0x8b, 0x48, 0x92, 0x42, + 0x1d, 0xc4, 0xed, 0xbd, 0x97, 0xf7, 0x87, 0x24, 0xb8, 0xaf, 0x8d, 0x02, 0x95, 0x4f, 0x4c, 0xa3, + 0x41, 0xe5, 0x4b, 0x69, 0xe6, 0x0b, 0x99, 0x43, 0xa3, 0xa5, 0x65, 0xfe, 0x84, 0x50, 0x90, 0x75, + 0x21, 0xcd, 0xb2, 0xaa, 0x21, 0x28, 0x2c, 0x78, 0x59, 0xf0, 0x5e, 0x5c, 0x41, 0x59, 0x99, 0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00, 0xff, 0xff, 0x3b, 0x62, 0x4b, 0x7e, 0xbb, 0x01, 0x00, 0x00, +} + +func (m *Proof) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -124,12 +240,12 @@ func (m *SimpleProof) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SimpleProof) MarshalTo(dAtA []byte) (int, error) { +func (m *Proof) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SimpleProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -163,6 +279,87 @@ func (m *SimpleProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ProofOp) 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 *ProofOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ProofOps) 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 *ProofOps) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProofOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ops) > 0 { + for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -174,7 +371,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *SimpleProof) Size() (n int) { +func (m *Proof) Size() (n int) { if m == nil { return 0 } @@ -199,13 +396,49 @@ func (m *SimpleProof) Size() (n int) { return n } +func (m *ProofOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ProofOps) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Ops) > 0 { + for _, e := range m.Ops { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *SimpleProof) Unmarshal(dAtA []byte) error { +func (m *Proof) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -228,10 +461,10 @@ func (m *SimpleProof) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SimpleProof: wiretype end group for non-group") + return fmt.Errorf("proto: Proof: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SimpleProof: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -362,6 +595,246 @@ func (m *SimpleProof) Unmarshal(dAtA []byte) error { } return nil } +func (m *ProofOp) 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 ErrIntOverflowTypes + } + 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: ProofOp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProofOp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProofOps) 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 ErrIntOverflowTypes + } + 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: ProofOps: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProofOps: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ops = append(m.Ops, ProofOp{}) + if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/crypto/merkle/types.proto b/proto/crypto/merkle/types.proto index c7dc355a5..905ef80c8 100644 --- a/proto/crypto/merkle/types.proto +++ b/proto/crypto/merkle/types.proto @@ -3,9 +3,25 @@ package tendermint.proto.crypto.merkle; option go_package = "github.com/tendermint/tendermint/proto/crypto/merkle"; -message SimpleProof { +import "third_party/proto/gogoproto/gogo.proto"; + +message Proof { int64 total = 1; int64 index = 2; bytes leaf_hash = 3; repeated bytes aunts = 4; } + +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +// ProofOps is Merkle proof defined by the list of ProofOps +message ProofOps { + repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/types/types.pb.go b/proto/types/types.pb.go index f0b6afd81..68d7d927e 100644 --- a/proto/types/types.pb.go +++ b/proto/types/types.pb.go @@ -140,9 +140,9 @@ func (m *PartSetHeader) GetHash() []byte { } type Part struct { - Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` - Proof merkle.SimpleProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof"` + Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + Proof merkle.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof"` } func (m *Part) Reset() { *m = Part{} } @@ -192,11 +192,11 @@ func (m *Part) GetBytes() []byte { return nil } -func (m *Part) GetProof() merkle.SimpleProof { +func (m *Part) GetProof() merkle.Proof { if m != nil { return m.Proof } - return merkle.SimpleProof{} + return merkle.Proof{} } // BlockID @@ -950,88 +950,87 @@ func init() { func init() { proto.RegisterFile("proto/types/types.proto", fileDescriptor_ff06f8095857fb18) } var fileDescriptor_ff06f8095857fb18 = []byte{ - // 1283 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4d, 0x6f, 0x1a, 0x47, - 0x18, 0x66, 0x61, 0x31, 0xf0, 0x02, 0x36, 0x5e, 0xb9, 0x09, 0xc5, 0x2d, 0x26, 0xb8,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, 0xbd, 0x91, 0xda, 0xa1, 0xb1, 0xe6, - 0xae, 0x96, 0x62, 0xc9, 0xa6, 0xa1, 0x5c, 0x83, 0xa5, 0x01, 0xb6, 0xcc, 0x01, 0x61, 0x82, 0x25, - 0x34, 0x31, 0x52, 0x3e, 0x07, 0x99, 0x9a, 0xa4, 0x28, 0xb3, 0x15, 0x94, 0x54, 0xee, 0x20, 0x35, - 0x74, 0x90, 0xda, 0x0d, 0x1d, 0xd4, 0x48, 0xd3, 0x89, 0x9f, 0xff, 0xbe, 0x21, 0x69, 0x8c, 0xa1, - 0x34, 0x21, 0x6f, 0xa3, 0x80, 0xe8, 0x3d, 0xaa, 0x1e, 0x9d, 0x3e, 0xc9, 0x4a, 0x6c, 0x2c, 0x92, - 0x46, 0xa8, 0x1c, 0x8a, 0x42, 0xb9, 0x3c, 0x64, 0x28, 0x5b, 0x50, 0x60, 0xa5, 0xfa, 0xee, 0x70, - 0x68, 0x11, 0x9d, 0x6d, 0xc2, 0x12, 0xdb, 0x84, 0x65, 0x1a, 0xdf, 0x61, 0xe1, 0x87, 0x74, 0x3b, - 0xd6, 0x21, 0x63, 0x20, 0x82, 0x38, 0x24, 0xc5, 0x20, 0x69, 0x1a, 0x60, 0xc9, 0x8f, 0x61, 0xe5, - 0x18, 0xd9, 0x96, 0x81, 0x88, 0xeb, 0x07, 0x1c, 0x92, 0xe6, 0x55, 0x26, 0x61, 0x06, 0xfc, 0x04, - 0xd6, 0x1c, 0x7c, 0x42, 0xf4, 0x37, 0xd1, 0x19, 0x86, 0x56, 0x68, 0xee, 0xf1, 0x2c, 0xe3, 0x26, - 0x2c, 0xf7, 0xc3, 0x2d, 0xe0, 0x58, 0x60, 0xd8, 0x7c, 0x14, 0x65, 0xb0, 0xf7, 0x21, 0x8d, 0x3c, - 0x8f, 0x03, 0xb2, 0x0c, 0x90, 0x42, 0x9e, 0xc7, 0x52, 0x77, 0x60, 0x95, 0xf5, 0xe8, 0xe3, 0x60, - 0x64, 0x13, 0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b, 0xf3, 0xa3, 0x04, 0xf9, 0x99, 0x53, 0xa2, 0xac, 0xc3, 0xf5, 0x4e, - 0x73, 0xbf, 0xb5, 0xb7, 0xab, 0x1f, 0x76, 0xf6, 0xf5, 0xee, 0xd7, 0xed, 0xbd, 0xa9, 0x2e, 0x6e, - 0x40, 0xae, 0xad, 0xed, 0x3d, 0x3e, 0xea, 0xee, 0xb1, 0x4c, 0x41, 0x2a, 0xad, 0x9c, 0x9e, 0x55, - 0xb2, 0x6d, 0x1f, 0x1f, 0xbb, 0x04, 0x33, 0xfe, 0x4d, 0x58, 0x6e, 0x6b, 0x7b, 0x7c, 0xb1, 0x1c, - 0x14, 0x2f, 0xad, 0x9e, 0x9e, 0x55, 0xf2, 0x6d, 0x1f, 0x73, 0x23, 0x30, 0xd8, 0x26, 0xe4, 0xdb, - 0xda, 0x51, 0xfb, 0xa8, 0x53, 0x3f, 0xe0, 0xa8, 0x44, 0xa9, 0x70, 0x7a, 0x56, 0xc9, 0x85, 0x47, - 0x9c, 0x82, 0x26, 0xeb, 0x6c, 0x3c, 0x78, 0x79, 0x5e, 0x96, 0x5e, 0x9d, 0x97, 0xa5, 0x3f, 0xce, - 0xcb, 0xd2, 0xf3, 0x8b, 0x72, 0xec, 0xd5, 0x45, 0x39, 0xf6, 0xdb, 0x45, 0x39, 0xf6, 0xcd, 0x3d, - 0xd3, 0x22, 0x83, 0x51, 0x4f, 0xed, 0xbb, 0xc3, 0xda, 0x64, 0x57, 0xa7, 0x3f, 0xa7, 0x7e, 0x5a, - 0xf4, 0x96, 0xd8, 0xe0, 0xd3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xd1, 0x12, 0x04, 0x70, - 0x0c, 0x00, 0x00, + // 1274 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1a, 0x47, + 0x14, 0x67, 0x61, 0x31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0x7e, 0x28, 0x46, 0xee, 0xfc, 0x28, 0x41, + 0x76, 0xe1, 0x94, 0x28, 0xdb, 0x70, 0xbd, 0xd7, 0x3a, 0x6c, 0x37, 0x1b, 0xda, 0x71, 0xef, 0x50, + 0xeb, 0x7f, 0xd3, 0x6d, 0xce, 0x75, 0x71, 0x03, 0x32, 0x5d, 0xb5, 0xf9, 0xa8, 0xd3, 0x6f, 0xb2, + 0x4c, 0x4e, 0x2a, 0x6c, 0x9c, 0x9d, 0x97, 0xd2, 0x5d, 0x0f, 0x9f, 0x38, 0x04, 0x33, 0xfe, 0x4d, + 0x58, 0xef, 0xaa, 0x4d, 0xbe, 0x58, 0x0e, 0x8a, 0x16, 0x36, 0xcf, 0xce, 0x4b, 0xd9, 0xae, 0x87, + 0xb9, 0x11, 0x18, 0x6c, 0x17, 0xb2, 0x5d, 0xb5, 0xd3, 0xed, 0xf4, 0x6a, 0x47, 0x1c, 0x15, 0x2b, + 0xe4, 0xce, 0xce, 0x4b, 0x99, 0xe0, 0x88, 0x53, 0xd0, 0x6c, 0x9d, 0xf5, 0xfb, 0x2f, 0x2e, 0x8a, + 0xd2, 0xcb, 0x8b, 0xa2, 0xf4, 0xc7, 0x45, 0x51, 0x7a, 0x76, 0x59, 0x8c, 0xbc, 0xbc, 0x2c, 0x46, + 0x7e, 0xbb, 0x2c, 0x46, 0xbe, 0xbd, 0x6b, 0x98, 0x64, 0x34, 0x19, 0x54, 0x86, 0xce, 0xb8, 0x3a, + 0xdb, 0xd5, 0xf9, 0xcf, 0xb9, 0x1f, 0x15, 0x83, 0x35, 0x36, 0xf8, 0xec, 0xef, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x5f, 0xad, 0x08, 0x71, 0x6a, 0x0c, 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { diff --git a/proto/types/types.proto b/proto/types/types.proto index c35eb6b73..8663ad6f7 100644 --- a/proto/types/types.proto +++ b/proto/types/types.proto @@ -38,9 +38,9 @@ message PartSetHeader { } message Part { - uint32 index = 1; - bytes bytes = 2; - tendermint.proto.crypto.merkle.SimpleProof proof = 3 [(gogoproto.nullable) = false]; + uint32 index = 1; + bytes bytes = 2; + tendermint.proto.crypto.merkle.Proof proof = 3 [(gogoproto.nullable) = false]; } // BlockID diff --git a/types/block.go b/types/block.go index 0aedbe3e2..0c3194ac1 100644 --- a/types/block.go +++ b/types/block.go @@ -449,7 +449,7 @@ func (h *Header) Hash() tmbytes.HexBytes { if h == nil || len(h.ValidatorsHash) == 0 { return nil } - return merkle.SimpleHashFromByteSlices([][]byte{ + return merkle.HashFromByteSlices([][]byte{ cdcEncode(h.Version), cdcEncode(h.ChainID), cdcEncode(h.Height), @@ -867,7 +867,7 @@ func (commit *Commit) Hash() tmbytes.HexBytes { for i, commitSig := range commit.Signatures { bs[i] = cdcEncode(commitSig) } - commit.hash = merkle.SimpleHashFromByteSlices(bs) + commit.hash = merkle.HashFromByteSlices(bs) } return commit.hash } diff --git a/types/block_test.go b/types/block_test.go index 06dce55d9..5bb0cd18e 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -306,7 +306,7 @@ func TestHeaderHash(t *testing.T) { byteSlices = append(byteSlices, cdcEncode(f.Interface())) } assert.Equal(t, - bytes.HexBytes(merkle.SimpleHashFromByteSlices(byteSlices)), tc.header.Hash()) + bytes.HexBytes(merkle.HashFromByteSlices(byteSlices)), tc.header.Hash()) } }) } diff --git a/types/evidence.go b/types/evidence.go index 6c59bf93a..15f00950a 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -520,7 +520,7 @@ func (evl EvidenceList) Hash() []byte { for i := 0; i < len(evl); i++ { evidenceBzs[i] = evl[i].Bytes() } - return merkle.SimpleHashFromByteSlices(evidenceBzs) + return merkle.HashFromByteSlices(evidenceBzs) } func (evl EvidenceList) String() string { diff --git a/types/part_set.go b/types/part_set.go index bb05ce1cd..afa292b16 100644 --- a/types/part_set.go +++ b/types/part_set.go @@ -21,9 +21,9 @@ var ( ) type Part struct { - Index uint32 `json:"index"` - Bytes tmbytes.HexBytes `json:"bytes"` - Proof merkle.SimpleProof `json:"proof"` + Index uint32 `json:"index"` + Bytes tmbytes.HexBytes `json:"bytes"` + Proof merkle.Proof `json:"proof"` } // ValidateBasic performs basic validation. @@ -72,7 +72,7 @@ func PartFromProto(pb *tmproto.Part) (*Part, error) { } part := new(Part) - proof, err := merkle.SimpleProofFromProto(&pb.Proof) + proof, err := merkle.ProofFromProto(&pb.Proof) if err != nil { return nil, err } @@ -166,7 +166,7 @@ func NewPartSetFromData(data []byte, partSize uint32) *PartSet { partsBitArray.SetIndex(int(i), true) } // Compute merkle proofs - root, proofs := merkle.SimpleProofsFromByteSlices(partsBytes) + root, proofs := merkle.ProofsFromByteSlices(partsBytes) for i := uint32(0); i < total; i++ { parts[i].Proof = *proofs[i] } diff --git a/types/part_set_test.go b/types/part_set_test.go index 16ab388a1..b7253da10 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -115,7 +115,7 @@ func TestPartValidateBasic(t *testing.T) { {"Good Part", func(pt *Part) {}, false}, {"Too big part", func(pt *Part) { pt.Bytes = make([]byte, BlockPartSizeBytes+1) }, true}, {"Too big proof", func(pt *Part) { - pt.Proof = merkle.SimpleProof{ + pt.Proof = merkle.Proof{ Total: 1, Index: 1, LeafHash: make([]byte, 1024*1024), @@ -160,7 +160,7 @@ func TestParSetHeaderProtoBuf(t *testing.T) { func TestPartProtoBuf(t *testing.T) { - proof := merkle.SimpleProof{ + proof := merkle.Proof{ Total: 1, Index: 1, LeafHash: tmrand.Bytes(32), diff --git a/types/results.go b/types/results.go index 11ddbcea9..05937d550 100644 --- a/types/results.go +++ b/types/results.go @@ -54,12 +54,12 @@ func (a ABCIResults) Bytes() []byte { func (a ABCIResults) Hash() []byte { // NOTE: we copy the impl of the merkle tree for txs - // we should be consistent and either do it for both or not. - return merkle.SimpleHashFromByteSlices(a.toByteSlices()) + return merkle.HashFromByteSlices(a.toByteSlices()) } // ProveResult returns a merkle proof of one result from the set -func (a ABCIResults) ProveResult(i int) merkle.SimpleProof { - _, proofs := merkle.SimpleProofsFromByteSlices(a.toByteSlices()) +func (a ABCIResults) ProveResult(i int) merkle.Proof { + _, proofs := merkle.ProofsFromByteSlices(a.toByteSlices()) return *proofs[i] } diff --git a/types/tx.go b/types/tx.go index f9dec2c01..402a376b6 100644 --- a/types/tx.go +++ b/types/tx.go @@ -37,7 +37,7 @@ func (txs Txs) Hash() []byte { for i := 0; i < len(txs); i++ { txBzs[i] = txs[i].Hash() } - return merkle.SimpleHashFromByteSlices(txBzs) + return merkle.HashFromByteSlices(txBzs) } // Index returns the index of this transaction in the list, or -1 if not found @@ -69,7 +69,7 @@ func (txs Txs) Proof(i int) TxProof { for i := 0; i < l; i++ { bzs[i] = txs[i].Hash() } - root, proofs := merkle.SimpleProofsFromByteSlices(bzs) + root, proofs := merkle.ProofsFromByteSlices(bzs) return TxProof{ RootHash: root, @@ -80,9 +80,9 @@ func (txs Txs) Proof(i int) TxProof { // TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. type TxProof struct { - RootHash tmbytes.HexBytes `json:"root_hash"` - Data Tx `json:"data"` - Proof merkle.SimpleProof `json:"proof"` + RootHash tmbytes.HexBytes `json:"root_hash"` + Data Tx `json:"data"` + Proof merkle.Proof `json:"proof"` } // Leaf returns the hash(tx), which is the leaf in the merkle tree which this proof refers to. diff --git a/types/validator_set.go b/types/validator_set.go index 1f56faaac..d34f3decc 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -352,7 +352,7 @@ func (vals *ValidatorSet) Hash() []byte { for i, val := range vals.Validators { bzs[i] = val.Bytes() } - return merkle.SimpleHashFromByteSlices(bzs) + return merkle.HashFromByteSlices(bzs) } // Iterate will run the given function over the set.