From e1644d00c54b0b0af90f48432fde32aeacc9950b Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 13 Oct 2020 12:33:21 +0200 Subject: [PATCH] mempool: length prefix txs when getting them from mempool (#5483) ## Description In protobuf `[]byte` is varint encoded. When adding txs to the block we were not taking this into account. Closes: #XXX --- blockchain/msgs_test.go | 2 +- mempool/clist_mempool.go | 12 +- mempool/clist_mempool_test.go | 16 +- mempool/mempool.go | 3 +- proto/tendermint/types/types.pb.go | 367 ++++++++--------------------- proto/tendermint/types/types.proto | 5 - rpc/client/rpc_test.go | 2 +- state/execution.go | 1 + state/tx_filter_test.go | 6 +- types/block.go | 19 +- types/block_test.go | 2 - types/tx.go | 20 ++ 12 files changed, 142 insertions(+), 313 deletions(-) diff --git a/blockchain/msgs_test.go b/blockchain/msgs_test.go index d0fce25eb..df8efca14 100644 --- a/blockchain/msgs_test.go +++ b/blockchain/msgs_test.go @@ -97,7 +97,7 @@ func TestBlockchainMessageVectors(t *testing.T) { BlockRequest: &bcproto.BlockRequest{Height: math.MaxInt64}}}, "0a0a08ffffffffffffffff7f"}, {"BlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_BlockResponse{ - BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1a93010a90010a5b0a02080b1803220b088092b8c398feffffff012a0212003a20c4da88e876062aa1543400d50d0eaa0dac88096057949cfb7bca7f3a48c04bf96a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855122f0a0b48656c6c6f20576f726c641220c4da88e876062aa1543400d50d0eaa0dac88096057949cfb7bca7f3a48c04bf91a00"}, + BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1a700a6e0a5b0a02080b1803220b088092b8c398feffffff012a0212003a20c4da88e876062aa1543400d50d0eaa0dac88096057949cfb7bca7f3a48c04bf96a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855120d0a0b48656c6c6f20576f726c641a00"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ NoBlockResponse: &bcproto.NoBlockResponse{Height: 1}}}, "12020801"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ diff --git a/mempool/clist_mempool.go b/mempool/clist_mempool.go index 48a25e795..cff2f3b81 100644 --- a/mempool/clist_mempool.go +++ b/mempool/clist_mempool.go @@ -517,21 +517,21 @@ func (mem *CListMempool) ReapMaxBytesMaxGas(maxBytes, maxGas int64) types.Txs { mem.updateMtx.RLock() defer mem.updateMtx.RUnlock() - var ( - totalBytes int64 - totalGas int64 - ) + var totalGas int64 + // TODO: we will get a performance boost if we have a good estimate of avg // size per tx, and set the initial capacity based off of that. // txs := make([]types.Tx, 0, tmmath.MinInt(mem.txs.Len(), max/mem.avgTxSize)) txs := make([]types.Tx, 0, mem.txs.Len()) for e := mem.txs.Front(); e != nil; e = e.Next() { memTx := e.Value.(*mempoolTx) + + dataSize := types.ComputeProtoSizeForTxs(txs, memTx.tx) + // Check total size requirement - if maxBytes > -1 && totalBytes+int64(len(memTx.tx)) > maxBytes { + if maxBytes > -1 && dataSize > maxBytes { return txs } - totalBytes += int64(len(memTx.tx)) // Check total gas requirement. // If maxGas is negative, skip this check. // Since newTotalGas < masGas, which diff --git a/mempool/clist_mempool_test.go b/mempool/clist_mempool_test.go index 92e0af9a0..45f6f5aa8 100644 --- a/mempool/clist_mempool_test.go +++ b/mempool/clist_mempool_test.go @@ -121,11 +121,11 @@ func TestReapMaxBytesMaxGas(t *testing.T) { {20, 0, -1, 0}, {20, 0, 10, 0}, {20, 10, 10, 0}, - {20, 20, 10, 1}, - {20, 100, 5, 5}, - {20, 200, -1, 10}, - {20, 200, 10, 10}, - {20, 200, 15, 10}, + {20, 24, 10, 1}, + {20, 240, 5, 5}, + {20, 240, -1, 10}, + {20, 240, 10, 10}, + {20, 240, 15, 10}, {20, 20000, -1, 20}, {20, 20000, 5, 5}, {20, 20000, 30, 20}, @@ -159,15 +159,15 @@ func TestMempoolFilters(t *testing.T) { }{ {10, nopPreFilter, nopPostFilter, 10}, {10, PreCheckMaxBytes(10), nopPostFilter, 0}, - {10, PreCheckMaxBytes(20), nopPostFilter, 10}, + {10, PreCheckMaxBytes(22), nopPostFilter, 10}, {10, nopPreFilter, PostCheckMaxGas(-1), 10}, {10, nopPreFilter, PostCheckMaxGas(0), 0}, {10, nopPreFilter, PostCheckMaxGas(1), 10}, {10, nopPreFilter, PostCheckMaxGas(3000), 10}, {10, PreCheckMaxBytes(10), PostCheckMaxGas(20), 0}, {10, PreCheckMaxBytes(30), PostCheckMaxGas(20), 10}, - {10, PreCheckMaxBytes(20), PostCheckMaxGas(1), 10}, - {10, PreCheckMaxBytes(20), PostCheckMaxGas(0), 0}, + {10, PreCheckMaxBytes(22), PostCheckMaxGas(1), 10}, + {10, PreCheckMaxBytes(22), PostCheckMaxGas(0), 0}, } for tcIndex, tt := range tests { err := mempool.Update(1, emptyTxArr, abciResponses(len(emptyTxArr), abci.CodeTypeOK), tt.preFilter, tt.postFilter) diff --git a/mempool/mempool.go b/mempool/mempool.go index 3df88a676..cfbe33e78 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -105,7 +105,8 @@ type TxInfo struct { // PreCheckMaxBytes checks that the size of the transaction is smaller or equal to the expected maxBytes. func PreCheckMaxBytes(maxBytes int64) PreCheckFunc { return func(tx types.Tx) error { - txSize := int64(len(tx)) + txSize := types.ComputeProtoSizeForTx(tx) + if txSize > maxBytes { return fmt.Errorf("tx size is too big: %d, max: %d", txSize, maxBytes) diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index c38e60c29..27a936097 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -10,7 +10,6 @@ import ( _ "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - bits "github.com/tendermint/tendermint/proto/tendermint/libs/bits" version "github.com/tendermint/tendermint/proto/tendermint/version" io "io" math "math" @@ -422,8 +421,6 @@ type Data struct { // NOTE: not all txs here are valid. We're just agreeing on the order first. // This means that block.AppHash does not include these txs. Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` - // Volatile - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } func (m *Data) Reset() { *m = Data{} } @@ -466,13 +463,6 @@ func (m *Data) GetTxs() [][]byte { return nil } -func (m *Data) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - // Vote represents a prevote, precommit, or commit vote from validators for // consensus. type Vote struct { @@ -577,12 +567,10 @@ func (m *Vote) GetSignature() []byte { // Commit contains the evidence that a block was committed by a set of validators. type Commit struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - BlockID BlockID `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3" json:"block_id"` - Signatures []CommitSig `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures"` - Hash []byte `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"` - BitArray *bits.BitArray `protobuf:"bytes,6,opt,name=bit_array,json=bitArray,proto3" json:"bit_array,omitempty"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + BlockID BlockID `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Signatures []CommitSig `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures"` } func (m *Commit) Reset() { *m = Commit{} } @@ -646,20 +634,6 @@ func (m *Commit) GetSignatures() []CommitSig { return nil } -func (m *Commit) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *Commit) GetBitArray() *bits.BitArray { - if m != nil { - return m.BitArray - } - return nil -} - // CommitSig is a part of the Vote included in a Commit. type CommitSig struct { BlockIdFlag BlockIDFlag `protobuf:"varint,1,opt,name=block_id_flag,json=blockIdFlag,proto3,enum=tendermint.types.BlockIDFlag" json:"block_id_flag,omitempty"` @@ -1075,93 +1049,90 @@ func init() { func init() { proto.RegisterFile("tendermint/types/types.proto", fileDescriptor_d3a6e55e2345de56) } var fileDescriptor_d3a6e55e2345de56 = []byte{ - // 1364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x36, 0x25, 0xca, 0x92, 0x46, 0x92, 0x2d, 0x13, 0x4e, 0xa2, 0x28, 0xb1, 0x4c, 0xa8, 0x68, - 0xeb, 0xa4, 0x01, 0x95, 0x3a, 0x45, 0x7f, 0x50, 0xf4, 0x20, 0xc9, 0x4e, 0x22, 0xc4, 0x96, 0x55, - 0x4a, 0x49, 0xd1, 0x5e, 0x08, 0x4a, 0xdc, 0x48, 0x6c, 0x28, 0x92, 0xe0, 0xae, 0x5c, 0x3b, 0x4f, - 0x50, 0xf8, 0x94, 0x5e, 0x7a, 0xf3, 0xa9, 0x3d, 0xf4, 0xde, 0x37, 0xe8, 0x29, 0xc7, 0xdc, 0xda, - 0x4b, 0xd3, 0xc2, 0x01, 0x8a, 0x3e, 0x46, 0xb1, 0x3f, 0xa2, 0x48, 0xcb, 0x6e, 0x03, 0x23, 0xe8, - 0x45, 0xe0, 0xce, 0x7c, 0x33, 0x3b, 0xf3, 0xed, 0xc7, 0x1d, 0x0a, 0xae, 0x13, 0xe4, 0x5a, 0x28, - 0x18, 0xdb, 0x2e, 0xa9, 0x91, 0x43, 0x1f, 0x61, 0xfe, 0xab, 0xf9, 0x81, 0x47, 0x3c, 0xa5, 0x38, - 0xf3, 0x6a, 0xcc, 0x5e, 0x5e, 0x1d, 0x7a, 0x43, 0x8f, 0x39, 0x6b, 0xf4, 0x89, 0xe3, 0xca, 0xeb, -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 0x67, 0x99, 0x2a, 0x87, 0xea, 0x5a, 0x18, 0xf4, 0x74, 0x5f, 0x08, - 0xa8, 0x01, 0xd9, 0xf0, 0xca, 0x13, 0x0a, 0x7c, 0x3d, 0x11, 0xcf, 0xc2, 0x94, 0xf7, 0x60, 0x25, - 0xd4, 0x43, 0x48, 0x28, 0x57, 0x61, 0x31, 0x74, 0x08, 0x46, 0x63, 0x52, 0x33, 0xf8, 0xa5, 0x94, - 0x66, 0x7d, 0xcd, 0xa4, 0xd6, 0x62, 0xb7, 0xd3, 0x75, 0xc8, 0x62, 0x7b, 0xe8, 0x9a, 0x64, 0x12, - 0x20, 0xa1, 0xc6, 0x99, 0xa1, 0xfa, 0x5d, 0x02, 0x16, 0xb9, 0xba, 0x23, 0xbc, 0x49, 0x67, 0xf3, - 0x96, 0x38, 0x8f, 0xb7, 0xe4, 0xc5, 0x79, 0xab, 0x03, 0x84, 0xc5, 0xe0, 0x92, 0xac, 0x26, 0x37, - 0x72, 0x9b, 0xd7, 0xe6, 0x13, 0xf1, 0x12, 0xbb, 0xf6, 0x50, 0xbc, 0xbc, 0x91, 0xa0, 0x50, 0x41, - 0xa9, 0xc8, 0x3d, 0xf9, 0x29, 0x64, 0xfb, 0x36, 0x31, 0xcc, 0x20, 0x30, 0x0f, 0x19, 0x85, 0xb9, - 0xcd, 0x4a, 0x34, 0x2b, 0x1d, 0x41, 0x1a, 0x1d, 0x41, 0x5a, 0xc3, 0x26, 0x75, 0x8a, 0xd2, 0x33, - 0x7d, 0xf1, 0x54, 0xfd, 0x5d, 0x82, 0x6c, 0xb8, 0xa1, 0x52, 0x87, 0xc2, 0xb4, 0x51, 0xe3, 0xb1, - 0x63, 0x0e, 0x85, 0x18, 0xd7, 0xce, 0xed, 0xf6, 0xae, 0x63, 0x0e, 0xf5, 0x9c, 0x68, 0x90, 0x2e, - 0xce, 0x3e, 0xd8, 0xc4, 0x39, 0x07, 0x1b, 0x53, 0x52, 0xf2, 0x62, 0x4a, 0x8a, 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be, 0xfd, 0x68, 0xaf, 0xb7, 0x5d, 0x94, - 0x38, 0xba, 0x13, 0xa0, 0x7d, 0x8f, 0x20, 0x86, 0xbe, 0x0d, 0x57, 0xcf, 0x40, 0x87, 0x8d, 0xad, - 0x1c, 0x1d, 0xab, 0x85, 0x4e, 0x80, 0xf8, 0xfb, 0xc3, 0x22, 0x34, 0x28, 0xcd, 0x47, 0xec, 0x75, - 0xf6, 0xba, 0xf5, 0x9d, 0xa2, 0x5a, 0x2e, 0x1e, 0x1d, 0xab, 0xf9, 0xe9, 0x65, 0x48, 0xf1, 0xb3, - 0xce, 0x1a, 0x9f, 0x3f, 0x3f, 0xa9, 0x48, 0x2f, 0x4e, 0x2a, 0xd2, 0x9f, 0x27, 0x15, 0xe9, 0xd9, - 0xab, 0xca, 0xc2, 0x8b, 0x57, 0x95, 0x85, 0xdf, 0x5e, 0x55, 0x16, 0xbe, 0xfa, 0x68, 0x68, 0x93, - 0xd1, 0xa4, 0xaf, 0x0d, 0xbc, 0x71, 0x2d, 0xfa, 0xbf, 0x63, 0xf6, 0xc8, 0xff, 0x21, 0x9d, 0xfe, - 0x4f, 0xd2, 0x5f, 0x64, 0xf6, 0x3b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xf9, 0x01, 0xed, - 0x76, 0x0d, 0x00, 0x00, + // 1314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xda, 0x9b, 0xd8, 0x7e, 0xb6, 0x13, 0x67, 0x95, 0xb6, 0xae, 0xdb, 0x38, 0x2b, 0x23, + 0x20, 0x2d, 0x68, 0x53, 0x52, 0xc4, 0x9f, 0x03, 0x07, 0xdb, 0x49, 0x5b, 0xab, 0x89, 0x63, 0xd6, + 0x6e, 0x11, 0x5c, 0x56, 0x6b, 0xef, 0xd4, 0x5e, 0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x4f, 0xff, 0xd8, 0x50, 0x4c, 0x1e, 0xa1, 0xd5, 0x21, + 0xef, 0xd9, 0x84, 0x5a, 0x5d, 0x46, 0x1b, 0x5b, 0x7e, 0x91, 0x4f, 0x71, 0x75, 0x96, 0x10, 0x49, + 0xac, 0x4c, 0x3d, 0xcb, 0xa2, 0x84, 0xc9, 0xd1, 0x36, 0xa1, 0xc0, 0x27, 0xe9, 0xe1, 0xe1, 0xd0, + 0xa5, 0x16, 0xe7, 0x7d, 0x89, 0xf3, 0xbe, 0xcc, 0xec, 0x75, 0x6e, 0xbe, 0xc7, 0x3a, 0x70, 0x0d, + 0x32, 0x8e, 0x4d, 0x6d, 0x01, 0x49, 0x71, 0x48, 0x9a, 0x19, 0xb8, 0xf3, 0x5d, 0x58, 0x89, 0x54, + 0x47, 0x04, 0x24, 0x2d, 0x66, 0x99, 0x98, 0x39, 0xf0, 0x16, 0xac, 0xf9, 0xe8, 0x88, 0x5a, 0xe7, + 0xd1, 0x19, 0x8e, 0xd6, 0x98, 0xef, 0xe1, 0x74, 0xc4, 0xdb, 0xb0, 0xdc, 0x1b, 0x93, 0x2f, 0xb0, + 0xc0, 0xb1, 0xf9, 0xc8, 0xca, 0x61, 0x57, 0x21, 0x6d, 0x07, 0x81, 0x00, 0x64, 0x39, 0x20, 0x65, + 0x07, 0x01, 0x77, 0xdd, 0x84, 0x55, 0x5e, 0x63, 0x88, 0xc8, 0xc8, 0xa3, 0x72, 0x92, 0x1c, 0xc7, + 0xac, 0x30, 0x87, 0x29, 0xec, 0x1c, 0xfb, 0x16, 0xe4, 0xd1, 0xa1, 0xeb, 0x20, 0xbf, 0x87, 0x04, + 0x2e, 0xcf, 0x71, 0xb9, 0xb1, 0x91, 0x83, 0x6e, 0x40, 0x21, 0x08, 0x71, 0x80, 0x09, 0x0a, 0x2d, + 0xdb, 0x71, 0x42, 0x44, 0x48, 0x71, 0x59, 0xcc, 0x37, 0xb6, 0x57, 0x85, 0xb9, 0x52, 0x04, 0x75,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0f, 0x65, 0x85, 0x55, 0x96, 0x9f, 0x3a, 0x23, 0xb4, 0xf7, 0xe1, 0x4a, 0xbb, 0x71, 0xb7, + 0xb9, 0xbb, 0x63, 0xed, 0xb7, 0xef, 0x5a, 0x9d, 0x2f, 0x5b, 0xbb, 0xb1, 0xea, 0x56, 0x4e, 0x4e, + 0xf5, 0xac, 0x2c, 0x69, 0x1e, 0xba, 0x65, 0xee, 0x3e, 0x3c, 0xe8, 0xec, 0x16, 0x14, 0x81, 0x6e, + 0x85, 0xe8, 0x10, 0x53, 0xc4, 0xd1, 0xb7, 0xe0, 0xea, 0x05, 0xe8, 0xa8, 0xb0, 0xd5, 0x93, 0x53, + 0x3d, 0xdf, 0x0a, 0x91, 0xd8, 0x3f, 0x3c, 0xc2, 0x80, 0xe2, 0x6c, 0xc4, 0x41, 0xeb, 0xa0, 0x5d, + 0xdd, 0x2b, 0xe8, 0xa5, 0xc2, 0xc9, 0xa9, 0x9e, 0x1b, 0x1f, 0x86, 0x0c, 0x3f, 0xa9, 0xac, 0xf6, + 0xf9, 0xb3, 0xb3, 0xb2, 0xf2, 0xfc, 0xac, 0xac, 0xfc, 0x79, 0x56, 0x56, 0x9e, 0xbe, 0x2c, 0x2f, + 0x3c, 0x7f, 0x59, 0x5e, 0xf8, 0xed, 0x65, 0x79, 0xe1, 0xab, 0x8f, 0xfb, 0x2e, 0x1d, 0x8c, 0xba, + 0x46, 0x0f, 0x0f, 0xb7, 0xe2, 0x7f, 0x09, 0x26, 0x9f, 0xe2, 0xaf, 0xc9, 0xf9, 0xbf, 0x0b, 0xdd, + 0x25, 0x6e, 0xbf, 0xfd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x78, 0x43, 0xdf, 0xef, 0x0c, + 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { @@ -1430,13 +1401,6 @@ func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x12 - } if len(m.Txs) > 0 { for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Txs[iNdEx]) @@ -1544,25 +1508,6 @@ func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.BitArray != nil { - { - size, err := m.BitArray.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x2a - } if len(m.Signatures) > 0 { for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { { @@ -1627,12 +1572,12 @@ func (m *CommitSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err10 != nil { - return 0, err10 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err9 != nil { + return 0, err9 } - i -= n10 - i = encodeVarintTypes(dAtA, i, uint64(n10)) + i -= n9 + i = encodeVarintTypes(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x1a if len(m.ValidatorAddress) > 0 { @@ -1677,12 +1622,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err11 != nil { - return 0, err11 + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err10 != nil { + return 0, err10 } - i -= n11 - i = encodeVarintTypes(dAtA, i, uint64(n11)) + i -= n10 + i = encodeVarintTypes(dAtA, i, uint64(n10)) i-- dAtA[i] = 0x32 { @@ -2044,10 +1989,6 @@ func (m *Data) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -2104,14 +2045,6 @@ func (m *Commit) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.BitArray != nil { - l = m.BitArray.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -3181,40 +3114,6 @@ func (m *Data) Unmarshal(dAtA []byte) error { m.Txs = append(m.Txs, make([]byte, postIndex-iNdEx)) copy(m.Txs[len(m.Txs)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -3636,76 +3535,6 @@ func (m *Commit) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BitArray", 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 - } - if m.BitArray == nil { - m.BitArray = &bits.BitArray{} - } - if err := m.BitArray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index d2f1d4126..7f7ea74ca 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -5,7 +5,6 @@ option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "tendermint/libs/bits/types.proto"; import "tendermint/crypto/proof.proto"; import "tendermint/version/types.proto"; import "tendermint/types/validator.proto"; @@ -88,8 +87,6 @@ message Data { // NOTE: not all txs here are valid. We're just agreeing on the order first. // This means that block.AppHash does not include these txs. repeated bytes txs = 1; - // Volatile - bytes hash = 2; } // Vote represents a prevote, precommit, or commit vote from validators for @@ -113,8 +110,6 @@ message Commit { int32 round = 2; BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; - bytes hash = 5; - tendermint.libs.bits.BitArray bit_array = 6; } // CommitSig is a part of the Vote included in a Commit. diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 24a7369ec..ed719bed0 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -290,7 +290,7 @@ func TestAppCalls(t *testing.T) { h = apph - 1 commit2, err := c.Commit(context.Background(), &h) require.NoError(err) - assert.Equal(block.Block.LastCommit, commit2.Commit) + assert.Equal(block.Block.LastCommitHash, commit2.Commit.Hash()) // and we got a proof that works! _pres, err := c.ABCIQueryWithOptions(context.Background(), "/key", k, client.ABCIQueryOptions{Prove: true}) diff --git a/state/execution.go b/state/execution.go index 2cb5857a1..009fdea22 100644 --- a/state/execution.go +++ b/state/execution.go @@ -104,6 +104,7 @@ func (blockExec *BlockExecutor) CreateProposalBlock( // Fetch a limited amount of valid txs maxDataBytes := types.MaxDataBytes(maxBytes, evSize, state.Validators.Size()) + txs := blockExec.mempool.ReapMaxBytesMaxGas(maxDataBytes, maxGas) return state.MakeBlock(height, txs, commit, evidence, proposerAddr) diff --git a/state/tx_filter_test.go b/state/tx_filter_test.go index f5923b84b..aff8247c0 100644 --- a/state/tx_filter_test.go +++ b/state/tx_filter_test.go @@ -25,8 +25,8 @@ func TestTxFilter(t *testing.T) { tx types.Tx isErr bool }{ - {types.Tx(tmrand.Bytes(2154)), false}, - {types.Tx(tmrand.Bytes(2155)), true}, + {types.Tx(tmrand.Bytes(2151)), false}, + {types.Tx(tmrand.Bytes(2152)), true}, {types.Tx(tmrand.Bytes(3000)), true}, } @@ -37,7 +37,7 @@ func TestTxFilter(t *testing.T) { state, err := stateStore.LoadFromDBOrGenesisDoc(genDoc) require.NoError(t, err) - f := sm.TxPreCheck(state) // current max size of a tx 1850 + f := sm.TxPreCheck(state) if tc.isErr { assert.NotNil(t, f(tc.tx), "#%v", i) } else { diff --git a/types/block.go b/types/block.go index 4a6912e91..3590db2a9 100644 --- a/types/block.go +++ b/types/block.go @@ -279,7 +279,6 @@ func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 { } return maxDataBytes - } // MaxDataBytesNoEvidence returns the maximum size of block's data when @@ -925,10 +924,7 @@ func (commit *Commit) ToProto() *tmproto.Commit { c.Height = commit.Height c.Round = commit.Round c.BlockID = commit.BlockID.ToProto() - if commit.hash != nil { - c.Hash = commit.hash - } - c.BitArray = commit.bitArray.ToProto() + return c } @@ -940,8 +936,7 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { } var ( - commit = new(Commit) - bitArray *bits.BitArray + commit = new(Commit) ) bi, err := BlockIDFromProto(&cp.BlockID) @@ -949,8 +944,6 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { return nil, err } - bitArray.FromProto(cp.BitArray) - sigs := make([]CommitSig, len(cp.Signatures)) for i := range cp.Signatures { if err := sigs[i].FromProto(cp.Signatures[i]); err != nil { @@ -962,8 +955,6 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { commit.Height = cp.Height commit.Round = cp.Round commit.BlockID = *bi - commit.hash = cp.Hash - commit.bitArray = bitArray return commit, commit.ValidateBasic() } @@ -1025,10 +1016,6 @@ func (data *Data) ToProto() tmproto.Data { tp.Txs = txBzs } - if data.hash != nil { - tp.Hash = data.hash - } - return *tp } @@ -1050,8 +1037,6 @@ func DataFromProto(dp *tmproto.Data) (Data, error) { data.Txs = Txs{} } - data.hash = dp.Hash - return *data, nil } diff --git a/types/block_test.go b/types/block_test.go index ef622c407..b6d7fb710 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -639,9 +639,7 @@ func TestBlockProtoBuf(t *testing.T) { func TestDataProtoBuf(t *testing.T) { data := &Data{Txs: Txs{Tx([]byte{1}), Tx([]byte{2}), Tx([]byte{3})}} - _ = data.Hash() data2 := &Data{Txs: Txs{}} - _ = data2.Hash() testCases := []struct { msg string data1 *Data diff --git a/types/tx.go b/types/tx.go index 55defb5b2..d4473c1d0 100644 --- a/types/tx.go +++ b/types/tx.go @@ -137,3 +137,23 @@ func TxProofFromProto(pb tmproto.TxProof) (TxProof, error) { return pbtp, nil } + +// ComputeProtoOverheadForTxs wraps the transactions in tmproto.Data{} and calculates the size. +// https://developers.google.com/protocol-buffers/docs/encoding +func ComputeProtoSizeForTxs(txs []Tx, tx Tx) int64 { + tt := make(Txs, len(txs)+1) + + tt = append(tt, txs...) + tt = append(tt, tx) + data := Data{Txs: tt} + pdData := data.ToProto() + return int64(pdData.Size()) +} + +// ComputeProtoSizeForTx wraps the transaction in tmproto.Data{} and calculates the size. +// https://developers.google.com/protocol-buffers/docs/encoding +func ComputeProtoSizeForTx(tx Tx) int64 { + pbdata := tmproto.Data{Txs: [][]byte{tx}} + + return int64(pbdata.Size()) +}