Browse Source

backport block size fixes (#5492)

* mempool: length prefix txs when getting them from mempool (#5483)

* correctly calculate evidence data size (#5482)

* block: use commit sig size instead of vote size (#5490)

* tx: reduce function to one parameter (#5493)
rc5/v0.34.0
Marko 4 years ago
committed by GitHub
parent
commit
09982ae407
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 320 additions and 454 deletions
  1. +1
    -1
      blockchain/msgs_test.go
  2. +6
    -6
      mempool/clist_mempool.go
  3. +8
    -8
      mempool/clist_mempool_test.go
  4. +2
    -1
      mempool/mempool.go
  5. +77
    -3
      node/node_test.go
  6. +26
    -79
      proto/tendermint/types/evidence.pb.go
  7. +0
    -1
      proto/tendermint/types/evidence.proto
  8. +98
    -269
      proto/tendermint/types/types.pb.go
  9. +0
    -5
      proto/tendermint/types/types.proto
  10. +1
    -1
      rpc/client/rpc_test.go
  11. +1
    -0
      state/execution.go
  12. +3
    -3
      state/tx_filter_test.go
  13. +26
    -33
      types/block.go
  14. +62
    -8
      types/block_test.go
  15. +8
    -0
      types/tx.go
  16. +1
    -3
      types/vote.go
  17. +0
    -33
      types/vote_test.go

+ 1
- 1
blockchain/msgs_test.go View File

@ -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}}}, "1ab5010ab2010a5b0a02080b1803220b088092b8c398feffffff012a0212003a20c4da88e876062aa1543400d50d0eaa0dac88096057949cfb7bca7f3a48c04bf96a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855122f0a0b48656c6c6f20576f726c641220c4da88e876062aa1543400d50d0eaa0dac88096057949cfb7bca7f3a48c04bf91a221220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
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{


+ 6
- 6
mempool/clist_mempool.go View File

@ -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(append(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


+ 8
- 8
mempool/clist_mempool_test.go View File

@ -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)


+ 2
- 1
mempool/mempool.go View File

@ -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.ComputeProtoSizeForTxs([]types.Tx{tx})
if txSize > maxBytes {
return fmt.Errorf("tx size is too big: %d, max: %d",
txSize, maxBytes)


+ 77
- 3
node/node_test.go View File

@ -234,13 +234,14 @@ func TestCreateProposalBlock(t *testing.T) {
state, stateDB, privVals := state(1, height)
stateStore := sm.NewStore(stateDB)
maxBytes := 16384
var partSize uint32 = 256
maxEvidenceBytes := int64(maxBytes / 2)
state.ConsensusParams.Block.MaxBytes = int64(maxBytes)
state.ConsensusParams.Evidence.MaxBytes = maxEvidenceBytes
proposerAddr, _ := state.Validators.GetByIndex(0)
// Make Mempool
memplMetrics := mempl.PrometheusMetrics("node_test")
memplMetrics := mempl.PrometheusMetrics("node_test_1")
mempool := mempl.NewCListMempool(
config.Mempool,
proxyApp.Mempool(),
@ -270,8 +271,8 @@ func TestCreateProposalBlock(t *testing.T) {
// fill the mempool with more txs
// than can fit in a block
txLength := 1000
for i := 0; i < maxBytes/txLength; i++ {
txLength := 100
for i := 0; i <= maxBytes/txLength; i++ {
tx := tmrand.Bytes(txLength)
err := mempool.CheckTx(tx, nil, mempl.TxInfo{})
assert.NoError(t, err)
@ -292,10 +293,83 @@ func TestCreateProposalBlock(t *testing.T) {
proposerAddr,
)
// check that the part set does not exceed the maximum block size
partSet := block.MakePartSet(partSize)
assert.Less(t, partSet.ByteSize(), int64(maxBytes))
partSetFromHeader := types.NewPartSetFromHeader(partSet.Header())
for partSetFromHeader.Count() < partSetFromHeader.Total() {
added, err := partSetFromHeader.AddPart(partSet.GetPart(int(partSetFromHeader.Count())))
require.NoError(t, err)
require.True(t, added)
}
assert.EqualValues(t, partSetFromHeader.ByteSize(), partSet.ByteSize())
err = blockExec.ValidateBlock(state, block)
assert.NoError(t, err)
}
func TestMaxProposalBlockSize(t *testing.T) {
config := cfg.ResetTestRoot("node_create_proposal")
defer os.RemoveAll(config.RootDir)
cc := proxy.NewLocalClientCreator(kvstore.NewApplication())
proxyApp := proxy.NewAppConns(cc)
err := proxyApp.Start()
require.Nil(t, err)
defer proxyApp.Stop() //nolint:errcheck // ignore for tests
logger := log.TestingLogger()
var height int64 = 1
state, stateDB, _ := state(1, height)
stateStore := sm.NewStore(stateDB)
var maxBytes int64 = 16384
var partSize uint32 = 256
state.ConsensusParams.Block.MaxBytes = maxBytes
proposerAddr, _ := state.Validators.GetByIndex(0)
// Make Mempool
memplMetrics := mempl.PrometheusMetrics("node_test_2")
mempool := mempl.NewCListMempool(
config.Mempool,
proxyApp.Mempool(),
state.LastBlockHeight,
mempl.WithMetrics(memplMetrics),
mempl.WithPreCheck(sm.TxPreCheck(state)),
mempl.WithPostCheck(sm.TxPostCheck(state)),
)
mempool.SetLogger(logger)
// fill the mempool with one txs just below the maximum size
txLength := int(types.MaxDataBytesNoEvidence(maxBytes, 1))
tx := tmrand.Bytes(txLength - 4) // to account for the varint
err = mempool.CheckTx(tx, nil, mempl.TxInfo{})
assert.NoError(t, err)
blockExec := sm.NewBlockExecutor(
stateStore,
logger,
proxyApp.Consensus(),
mempool,
sm.EmptyEvidencePool{},
)
commit := types.NewCommit(height-1, 0, types.BlockID{}, nil)
block, _ := blockExec.CreateProposalBlock(
height,
state, commit,
proposerAddr,
)
pb, err := block.ToProto()
require.NoError(t, err)
assert.Less(t, int64(pb.Size()), maxBytes)
// check that the part set does not exceed the maximum block size
partSet := block.MakePartSet(partSize)
assert.EqualValues(t, partSet.ByteSize(), int64(pb.Size()))
}
func TestNodeNewNodeCustomReactors(t *testing.T) {
config := cfg.ResetTestRoot("node_new_node_custom_reactors_test")
defer os.RemoveAll(config.RootDir)


+ 26
- 79
proto/tendermint/types/evidence.pb.go View File

@ -217,7 +217,6 @@ func (*Evidence) XXX_OneofWrappers() []interface{} {
// EvidenceData contains any evidence of malicious wrong-doing by validators
type EvidenceData struct {
Evidence []Evidence `protobuf:"bytes,1,rep,name=evidence,proto3" json:"evidence"`
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
}
func (m *EvidenceData) Reset() { *m = EvidenceData{} }
@ -260,13 +259,6 @@ func (m *EvidenceData) GetEvidence() []Evidence {
return nil
}
func (m *EvidenceData) GetHash() []byte {
if m != nil {
return m.Hash
}
return nil
}
func init() {
proto.RegisterType((*DuplicateVoteEvidence)(nil), "tendermint.types.DuplicateVoteEvidence")
proto.RegisterType((*LightClientAttackEvidence)(nil), "tendermint.types.LightClientAttackEvidence")
@ -277,32 +269,32 @@ func init() {
func init() { proto.RegisterFile("tendermint/types/evidence.proto", fileDescriptor_6825fabc78e0a168) }
var fileDescriptor_6825fabc78e0a168 = []byte{
// 398 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xcd, 0x6a, 0xea, 0x40,
0x14, 0x4e, 0xae, 0x3f, 0xc8, 0xe8, 0x05, 0x6f, 0xb8, 0xb6, 0x2a, 0x12, 0x4b, 0xba, 0xa8, 0x50,
0x9a, 0x80, 0x5d, 0x74, 0xd3, 0x8d, 0xa9, 0x05, 0x0b, 0xdd, 0x34, 0x8b, 0x2e, 0xba, 0x49, 0x27,
0x93, 0x69, 0x32, 0x98, 0xcc, 0x88, 0x4e, 0x84, 0x3e, 0x43, 0x37, 0x7d, 0x2c, 0x97, 0x2e, 0xbb,
0x2a, 0x45, 0xfb, 0x20, 0x25, 0x13, 0x8d, 0x62, 0x94, 0x6e, 0x86, 0xc3, 0x39, 0xdf, 0x9c, 0xef,
0x87, 0x03, 0xda, 0x1c, 0x53, 0x17, 0x8f, 0x43, 0x42, 0xb9, 0xc1, 0x5f, 0x47, 0x78, 0x62, 0xe0,
0x29, 0x71, 0x31, 0x45, 0x58, 0x1f, 0x8d, 0x19, 0x67, 0x4a, 0x75, 0x03, 0xd0, 0x05, 0xa0, 0xf9,
0xdf, 0x63, 0x1e, 0x13, 0x43, 0x23, 0xae, 0x12, 0x5c, 0xb3, 0x95, 0x59, 0x24, 0xde, 0x64, 0xaa,
0x45, 0xa0, 0xd6, 0x8f, 0x46, 0x01, 0x41, 0x90, 0xe3, 0x47, 0xc6, 0xf1, 0xed, 0x8a, 0x44, 0xb9,
0x00, 0xc5, 0x29, 0xe3, 0xd8, 0x86, 0x75, 0xf9, 0x44, 0xee, 0x94, 0xbb, 0x47, 0xfa, 0x2e, 0x9f,
0x1e, 0xe3, 0xad, 0x42, 0x8c, 0xea, 0xa5, 0x70, 0xa7, 0xfe, 0xe7, 0x77, 0xb8, 0xa9, 0xbd, 0xc9,
0xa0, 0x71, 0x4f, 0x3c, 0x9f, 0xdf, 0x04, 0x04, 0x53, 0xde,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1, 0xd0, 0xd8, 0x3e, 0xc8, 0x4d, 0x99, 0x1c, 0xee, 0xee, 0xb1, 0x3a, 0x45, 0xd1, 0xbf,
0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x75, 0x06, 0x32, 0x10, 0x03, 0x00, 0x00,
// 388 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xc1, 0x6a, 0xea, 0x40,
0x14, 0x4d, 0x9e, 0x4f, 0x91, 0xd1, 0x07, 0xbe, 0xf0, 0x7c, 0x55, 0x91, 0x58, 0xd2, 0x45, 0x85,
0xd2, 0x04, 0xec, 0xa2, 0x9b, 0x6e, 0x4c, 0x2d, 0x58, 0x70, 0xd3, 0x2c, 0xba, 0xe8, 0x26, 0x24,
0x93, 0x69, 0x1c, 0x4c, 0x66, 0x44, 0x6f, 0x84, 0x7e, 0x43, 0x37, 0xfd, 0x2c, 0x97, 0x2e, 0xbb,
0x2a, 0x45, 0xfb, 0x21, 0x25, 0x13, 0x8d, 0x62, 0x94, 0x6e, 0x86, 0xe1, 0xdc, 0x73, 0xef, 0xb9,
0xe7, 0x70, 0x51, 0x0b, 0x08, 0xf3, 0xc8, 0x24, 0xa4, 0x0c, 0x0c, 0x78, 0x19, 0x93, 0xa9, 0x41,
0x66, 0xd4, 0x23, 0x0c, 0x13, 0x7d, 0x3c, 0xe1, 0xc0, 0x95, 0xca, 0x96, 0xa0, 0x0b, 0x42, 0xe3,
0x9f, 0xcf, 0x7d, 0x2e, 0x8a, 0x46, 0xfc, 0x4b, 0x78, 0x8d, 0x66, 0x66, 0x90, 0x78, 0x93, 0xaa,
0x16, 0xa1, 0x6a, 0x2f, 0x1a, 0x07, 0x14, 0x3b, 0x40, 0x1e, 0x39, 0x90, 0xbb, 0xb5, 0x88, 0x72,
0x89, 0x0a, 0x33, 0x0e, 0xc4, 0x76, 0x6a, 0xf2, 0xa9, 0xdc,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 0xf9, 0x73, 0xa9, 0xca, 0x6f, 0x2b, 0x55, 0x5a, 0xac, 0x54, 0xe9, 0x7d, 0xa5, 0x4a, 0x4f,
0xd7, 0x3e, 0x85, 0x61, 0xe4, 0xea, 0x98, 0x87, 0xc6, 0xee, 0xf1, 0x6d, 0xbf, 0xc9, 0x91, 0xee,
0x1f, 0xa6, 0x5b, 0x10, 0xf8, 0xd5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x7f, 0xe9, 0x7a,
0xfc, 0x02, 0x00, 0x00,
}
func (m *DuplicateVoteEvidence) Marshal() (dAtA []byte, err error) {
@ -486,13 +478,6 @@ func (m *EvidenceData) 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 = encodeVarintEvidence(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0x12
}
if len(m.Evidence) > 0 {
for iNdEx := len(m.Evidence) - 1; iNdEx >= 0; iNdEx-- {
{
@ -602,10 +587,6 @@ func (m *EvidenceData) Size() (n int) {
n += 1 + l + sovEvidence(uint64(l))
}
}
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovEvidence(uint64(l))
}
return n
}
@ -1034,40 +1015,6 @@ func (m *EvidenceData) Unmarshal(dAtA []byte) error {
return err
}
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 ErrIntOverflowEvidence
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEvidence
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEvidence
}
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 := skipEvidence(dAtA[iNdEx:])


+ 0
- 1
proto/tendermint/types/evidence.proto View File

@ -28,5 +28,4 @@ message Evidence {
// EvidenceData contains any evidence of malicious wrong-doing by validators
message EvidenceData {
repeated Evidence evidence = 1 [(gogoproto.nullable) = false];
bytes hash = 2;
}

+ 98
- 269
proto/tendermint/types/types.pb.go View File

@ -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, 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xc9, 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:])


+ 0
- 5
proto/tendermint/types/types.proto View File

@ -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.


+ 1
- 1
rpc/client/rpc_test.go View File

@ -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})


+ 1
- 0
state/execution.go View File

@ -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)


+ 3
- 3
state/tx_filter_test.go View File

@ -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(2187)), false},
{types.Tx(tmrand.Bytes(2188)), 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 {


+ 26
- 33
types/block.go View File

@ -277,7 +277,7 @@ func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 {
maxDataBytes := maxBytes -
MaxOverheadForBlock -
MaxHeaderBytes -
int64(valsCount)*MaxVoteBytes -
MaxCommitBytes(valsCount) -
evidenceBytes
if maxDataBytes < 0 {
@ -289,7 +289,6 @@ func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 {
}
return maxDataBytes
}
// MaxDataBytesNoEvidence returns the maximum size of block's data when
@ -301,7 +300,7 @@ func MaxDataBytesNoEvidence(maxBytes int64, valsCount int) int64 {
maxDataBytes := maxBytes -
MaxOverheadForBlock -
MaxHeaderBytes -
int64(valsCount)*MaxVoteBytes
MaxCommitBytes(valsCount)
if maxDataBytes < 0 {
panic(fmt.Sprintf(
@ -581,6 +580,14 @@ const (
BlockIDFlagNil
)
const (
// Max size of commit without any commitSigs -> 82 for BlockID, 8 for Height, 4 for Round.
MaxCommitOverheadBytes int64 = 94
// Commit sig size is made up of 32 bytes for the signature, 20 bytes for the address,
// 1 byte for the flag and 14 bytes for the timestamp
MaxCommitSigBytes int64 = 77
)
// CommitSig is a part of the Vote included in a Commit.
type CommitSig struct {
BlockIDFlag BlockIDFlag `json:"block_id_flag"`
@ -599,9 +606,10 @@ func NewCommitSigForBlock(signature []byte, valAddr Address, ts time.Time) Commi
}
}
// ForBlock returns true if CommitSig is for the block.
func (cs CommitSig) ForBlock() bool {
return cs.BlockIDFlag == BlockIDFlagCommit
func MaxCommitBytes(valCount int) int64 {
// From the repeated commit sig field
var protoEncodingOverhead int64 = 2
return MaxCommitOverheadBytes + ((MaxCommitSigBytes + protoEncodingOverhead) * int64(valCount))
}
// NewCommitSigAbsent returns new CommitSig with BlockIDFlagAbsent. Other
@ -612,6 +620,11 @@ func NewCommitSigAbsent() CommitSig {
}
}
// ForBlock returns true if CommitSig is for the block.
func (cs CommitSig) ForBlock() bool {
return cs.BlockIDFlag == BlockIDFlagCommit
}
// Absent returns true if CommitSig is absent.
func (cs CommitSig) Absent() bool {
return cs.BlockIDFlag == BlockIDFlagAbsent
@ -935,10 +948,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
}
@ -950,8 +960,7 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) {
}
var (
commit = new(Commit)
bitArray *bits.BitArray
commit = new(Commit)
)
bi, err := BlockIDFromProto(&cp.BlockID)
@ -959,8 +968,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 {
@ -972,8 +979,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()
}
@ -1035,10 +1040,6 @@ func (data *Data) ToProto() tmproto.Data {
tp.Txs = txBzs
}
if data.hash != nil {
tp.Hash = data.hash
}
return *tp
}
@ -1060,8 +1061,6 @@ func DataFromProto(dp *tmproto.Data) (Data, error) {
data.Txs = Txs{}
}
data.hash = dp.Hash
return *data, nil
}
@ -1087,13 +1086,11 @@ func (data *EvidenceData) Hash() tmbytes.HexBytes {
// ByteSize returns the total byte size of all the evidence
func (data *EvidenceData) ByteSize() int64 {
if data.byteSize == 0 && len(data.Evidence) != 0 {
for _, ev := range data.Evidence {
pb, err := EvidenceToProto(ev)
if err != nil {
panic(err)
}
data.byteSize += int64(pb.Size())
pb, err := data.ToProto()
if err != nil {
panic(err)
}
data.byteSize = int64(pb.Size())
}
return data.byteSize
}
@ -1135,10 +1132,6 @@ func (data *EvidenceData) ToProto() (*tmproto.EvidenceData, error) {
}
evi.Evidence = eviBzs
if data.hash != nil {
evi.Hash = data.hash
}
return evi, nil
}
@ -1155,9 +1148,9 @@ func (data *EvidenceData) FromProto(eviData *tmproto.EvidenceData) error {
return err
}
eviBzs[i] = evi
data.byteSize += int64(eviData.Evidence[i].Size())
}
data.Evidence = eviBzs
data.byteSize = int64(eviData.Size())
return nil
}


+ 62
- 8
types/block_test.go View File

@ -257,6 +257,62 @@ func TestCommitValidateBasic(t *testing.T) {
}
}
func TestMaxCommitSigBytes(t *testing.T) {
// time is varint encoded so need to pick the max.
// year int, month Month, day, hour, min, sec, nsec int, loc *Location
timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC)
cs := &CommitSig{
BlockIDFlag: BlockIDFlagNil,
ValidatorAddress: crypto.AddressHash([]byte("validator_address")),
Timestamp: timestamp,
Signature: tmhash.Sum([]byte("signature")),
}
pb := cs.ToProto()
assert.EqualValues(t, MaxCommitSigBytes, pb.Size())
}
func TestMaxCommitBytes(t *testing.T) {
timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC)
cs := CommitSig{
BlockIDFlag: BlockIDFlagNil,
ValidatorAddress: crypto.AddressHash([]byte("validator_address")),
Timestamp: timestamp,
Signature: tmhash.Sum([]byte("signature")),
}
// check size with a single commit
commit := &Commit{
Height: math.MaxInt64,
Round: math.MaxInt32,
BlockID: BlockID{
Hash: tmhash.Sum([]byte("blockID_hash")),
PartSetHeader: PartSetHeader{
Total: math.MaxInt32,
Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")),
},
},
Signatures: []CommitSig{cs},
}
pb := commit.ToProto()
assert.EqualValues(t, MaxCommitBytes(1), int64(pb.Size()))
// check the upper bound of the commit size
for i := 1; i < MaxVotesCount; i++ {
commit.Signatures = append(commit.Signatures, cs)
}
pb = commit.ToProto()
assert.EqualValues(t, MaxCommitBytes(MaxVotesCount), int64(pb.Size()))
}
func TestHeaderHash(t *testing.T) {
testCases := []struct {
desc string
@ -407,9 +463,9 @@ func TestBlockMaxDataBytes(t *testing.T) {
}{
0: {-10, 1, 0, true, 0},
1: {10, 1, 0, true, 0},
2: {844, 1, 0, true, 0},
3: {846, 1, 0, false, 0},
4: {847, 1, 0, false, 1},
2: {809, 1, 0, true, 0},
3: {810, 1, 0, false, 0},
4: {811, 1, 0, false, 1},
}
for i, tc := range testCases {
@ -436,9 +492,9 @@ func TestBlockMaxDataBytesNoEvidence(t *testing.T) {
}{
0: {-10, 1, true, 0},
1: {10, 1, true, 0},
2: {845, 1, true, 0},
3: {846, 1, false, 0},
4: {847, 1, false, 1},
2: {809, 1, true, 0},
3: {810, 1, false, 0},
4: {811, 1, false, 1},
}
for i, tc := range testCases {
@ -628,9 +684,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


+ 8
- 0
types/tx.go View File

@ -137,3 +137,11 @@ func TxProofFromProto(pb tmproto.TxProof) (TxProof, error) {
return pbtp, nil
}
// ComputeProtoSizeForTxs wraps the transactions in tmproto.Data{} and calculates the size.
// https://developers.google.com/protocol-buffers/docs/encoding
func ComputeProtoSizeForTxs(txs []Tx) int64 {
data := Data{Txs: txs}
pdData := data.ToProto()
return int64(pdData.Size())
}

+ 1
- 3
types/vote.go View File

@ -13,9 +13,7 @@ import (
)
const (
// MaxVoteBytes is a maximum vote size (including amino overhead).
MaxVoteBytes int64 = 209
nilVoteStr string = "nil-Vote"
nilVoteStr string = "nil-Vote"
)
var (


+ 0
- 33
types/vote_test.go View File

@ -1,7 +1,6 @@
package types
import (
"math"
"testing"
"time"
@ -218,38 +217,6 @@ func TestVoteVerify(t *testing.T) {
}
}
func TestMaxVoteBytes(t *testing.T) {
// time is varint encoded so need to pick the max.
// year int, month Month, day, hour, min, sec, nsec int, loc *Location
timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC)
vote := &Vote{
ValidatorAddress: crypto.AddressHash([]byte("validator_address")),
ValidatorIndex: math.MaxInt32,
Height: math.MaxInt64,
Round: math.MaxInt32,
Timestamp: timestamp,
Type: tmproto.PrevoteType,
BlockID: BlockID{
Hash: tmhash.Sum([]byte("blockID_hash")),
PartSetHeader: PartSetHeader{
Total: math.MaxInt32,
Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")),
},
},
}
v := vote.ToProto()
privVal := NewMockPV()
err := privVal.SignVote("test_chain_id", v)
require.NoError(t, err)
bz, err := proto.Marshal(v)
require.NoError(t, err)
assert.EqualValues(t, MaxVoteBytes, len(bz))
}
func TestVoteString(t *testing.T) {
str := examplePrecommit().String()
expected := `Vote{56789:6AF1F4111082 12345/02/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 8B01023386C3 000000000000 @ 2017-12-25T03:00:01.234Z}` //nolint:lll //ignore line length for tests


Loading…
Cancel
Save