From 132f9163b7455daa1d5ed9b6c521be74c0e6dfee Mon Sep 17 00:00:00 2001 From: Daniel T <30197399+danwt@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:00:41 +0000 Subject: [PATCH] feat(block): removes evidence list, intermediate roots from block (#1317) --- block/executor.go | 6 +- da/celestia/celestia_test.go | 5 - da/da_test.go | 5 - proto/types/dymint/dymint.proto | 3 +- rpc/client/client_test.go | 5 - testutil/types.go | 12 +- types/block.go | 6 +- types/pb/dymint/dymint.pb.go | 246 ++++++++------------------------ types/serialization.go | 25 +--- types/serialization_test.go | 5 +- 10 files changed, 72 insertions(+), 246 deletions(-) diff --git a/block/executor.go b/block/executor.go index dfb4d0af3..dad08c73d 100644 --- a/block/executor.go +++ b/block/executor.go @@ -164,10 +164,8 @@ func (e *Executor) CreateBlock( ProposerAddress: e.localAddress, }, Data: types.Data{ - Txs: toDymintTxs(mempoolTxs), - IntermediateStateRoots: types.IntermediateStateRoots{RawRootsList: nil}, - Evidence: types.EvidenceData{Evidence: nil}, - ConsensusMessages: protoutils.FromProtoMsgSliceToAnySlice(e.consensusMsgQueue.Get()...), + Txs: toDymintTxs(mempoolTxs), + ConsensusMessages: protoutils.FromProtoMsgSliceToAnySlice(e.consensusMsgQueue.Get()...), }, LastCommit: *lastCommit, } diff --git a/da/celestia/celestia_test.go b/da/celestia/celestia_test.go index 01b24928b..9d8b1d4ed 100644 --- a/da/celestia/celestia_test.go +++ b/da/celestia/celestia_test.go @@ -324,21 +324,16 @@ func getRandomBlock(height uint64, nTxs int) *types.Block { }, Data: types.Data{ Txs: make(types.Txs, nTxs), - IntermediateStateRoots: types.IntermediateStateRoots{ - RawRootsList: make([][]byte, nTxs), - }, }, } copy(block.Header.AppHash[:], getRandomBytes(32)) for i := 0; i < nTxs; i++ { block.Data.Txs[i] = getRandomTx() - block.Data.IntermediateStateRoots.RawRootsList[i] = getRandomBytes(32) } if nTxs == 0 { block.Data.Txs = nil - block.Data.IntermediateStateRoots.RawRootsList = nil } return block diff --git a/da/da_test.go b/da/da_test.go index e37492f0b..a2d3c947a 100644 --- a/da/da_test.go +++ b/da/da_test.go @@ -214,22 +214,17 @@ func getRandomBlock(height uint64, nTxs int) *types.Block { }, Data: types.Data{ Txs: make(types.Txs, nTxs), - IntermediateStateRoots: types.IntermediateStateRoots{ - RawRootsList: make([][]byte, nTxs), - }, }, } copy(block.Header.AppHash[:], getRandomBytes(32)) for i := 0; i < nTxs; i++ { block.Data.Txs[i] = getRandomTx() - block.Data.IntermediateStateRoots.RawRootsList[i] = getRandomBytes(32) } // TODO(tzdybal): see https://github.com/dymensionxyz/dymint/issues/143 if nTxs == 0 { block.Data.Txs = nil - block.Data.IntermediateStateRoots.RawRootsList = nil } return block diff --git a/proto/types/dymint/dymint.proto b/proto/types/dymint/dymint.proto index d99ef3100..36d650748 100755 --- a/proto/types/dymint/dymint.proto +++ b/proto/types/dymint/dymint.proto @@ -79,8 +79,7 @@ message Commit { message Data { repeated bytes txs = 1; - repeated bytes intermediate_state_roots = 2; - repeated tendermint.abci.Evidence evidence = 3; + reserved 2,3; repeated google.protobuf.Any consensus_messages = 4; } diff --git a/rpc/client/client_test.go b/rpc/client/client_test.go index 63b7904ab..0565b0cb8 100644 --- a/rpc/client/client_test.go +++ b/rpc/client/client_test.go @@ -934,22 +934,17 @@ func getRandomBlock(height uint64, nTxs int) *types.Block { }, Data: types.Data{ Txs: make(types.Txs, nTxs), - IntermediateStateRoots: types.IntermediateStateRoots{ - RawRootsList: make([][]byte, nTxs), - }, }, } copy(block.Header.AppHash[:], getRandomBytes(32)) for i := 0; i < nTxs; i++ { block.Data.Txs[i] = getRandomTx() - block.Data.IntermediateStateRoots.RawRootsList[i] = getRandomBytes(32) } // TODO(tzdybal): see https://github.com/dymensionxyz/dymint/issues/143 if nTxs == 0 { block.Data.Txs = nil - block.Data.IntermediateStateRoots.RawRootsList = nil } tmprotoLC, err := tmtypes.CommitFromProto(&tmproto.Commit{}) diff --git a/testutil/types.go b/testutil/types.go index 409a7cb82..739584f17 100644 --- a/testutil/types.go +++ b/testutil/types.go @@ -88,9 +88,7 @@ func generateBlock(height uint64, proposerHash []byte, lastHeaderHash [32]byte) ConsensusMessagesHash: types.ConsMessagesHash(nil), }, Data: types.Data{ - Txs: nil, - IntermediateStateRoots: types.IntermediateStateRoots{RawRootsList: [][]byte{{0x1}}}, - Evidence: types.EvidenceData{Evidence: nil}, + Txs: nil, }, LastCommit: types.Commit{ Height: 8, @@ -115,14 +113,10 @@ func GenerateBlocksWithTxs(startHeight uint64, num uint64, proposerKey crypto.Pr block.Data = types.Data{ Txs: make(types.Txs, nTxs), - IntermediateStateRoots: types.IntermediateStateRoots{ - RawRootsList: make([][]byte, nTxs), - }, } for i := 0; i < nTxs; i++ { block.Data.Txs[i] = GetRandomTx() - block.Data.IntermediateStateRoots.RawRootsList[i] = GetRandomBytes(32) } signature, err := generateSignature(proposerKey, &block.Header) @@ -394,15 +388,11 @@ func GetRandomBlock(height uint64, nTxs int) *types.Block { }, Data: types.Data{ Txs: make(types.Txs, nTxs), - IntermediateStateRoots: types.IntermediateStateRoots{ - RawRootsList: make([][]byte, nTxs), - }, }, } for i := 0; i < nTxs; i++ { block.Data.Txs[i] = GetRandomTx() - block.Data.IntermediateStateRoots.RawRootsList[i] = GetRandomBytes(32) } return block diff --git a/types/block.go b/types/block.go index 36fcf2ec7..35fad578f 100644 --- a/types/block.go +++ b/types/block.go @@ -89,10 +89,8 @@ var ( // Data defines Dymint block data. type Data struct { - Txs Txs - IntermediateStateRoots IntermediateStateRoots - Evidence EvidenceData - ConsensusMessages []*proto.Any + Txs Txs + ConsensusMessages []*proto.Any } // EvidenceData defines how evidence is stored in block. diff --git a/types/pb/dymint/dymint.pb.go b/types/pb/dymint/dymint.pb.go index 4d35e8e78..3fcd6a077 100644 --- a/types/pb/dymint/dymint.pb.go +++ b/types/pb/dymint/dymint.pb.go @@ -7,8 +7,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - types2 "github.com/gogo/protobuf/types" - types1 "github.com/tendermint/tendermint/abci/types" + types1 "github.com/gogo/protobuf/types" + _ "github.com/tendermint/tendermint/abci/types" types "github.com/tendermint/tendermint/proto/tendermint/types" io "io" math "math" @@ -331,10 +331,8 @@ func (m *Commit) GetTmSignature() *types.CommitSig { } type Data struct { - Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` - IntermediateStateRoots [][]byte `protobuf:"bytes,2,rep,name=intermediate_state_roots,json=intermediateStateRoots,proto3" json:"intermediate_state_roots,omitempty"` - Evidence []*types1.Evidence `protobuf:"bytes,3,rep,name=evidence,proto3" json:"evidence,omitempty"` - ConsensusMessages []*types2.Any `protobuf:"bytes,4,rep,name=consensus_messages,json=consensusMessages,proto3" json:"consensus_messages,omitempty"` + Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + ConsensusMessages []*types1.Any `protobuf:"bytes,4,rep,name=consensus_messages,json=consensusMessages,proto3" json:"consensus_messages,omitempty"` } func (m *Data) Reset() { *m = Data{} } @@ -377,21 +375,7 @@ func (m *Data) GetTxs() [][]byte { return nil } -func (m *Data) GetIntermediateStateRoots() [][]byte { - if m != nil { - return m.IntermediateStateRoots - } - return nil -} - -func (m *Data) GetEvidence() []*types1.Evidence { - if m != nil { - return m.Evidence - } - return nil -} - -func (m *Data) GetConsensusMessages() []*types2.Any { +func (m *Data) GetConsensusMessages() []*types1.Any { if m != nil { return m.ConsensusMessages } @@ -706,66 +690,63 @@ func init() { func init() { proto.RegisterFile("types/dymint/dymint.proto", fileDescriptor_fe69c538ded4b87f) } var fileDescriptor_fe69c538ded4b87f = []byte{ - // 935 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0xcb, 0x6e, 0xdb, 0x46, - 0x14, 0x35, 0x6d, 0x59, 0x8f, 0x4b, 0xf9, 0xa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xfd, 0x3f, - 0x1a, 0xd0, 0xbc, 0x40, 0x11, 0x62, 0xc1, 0x1e, 0x41, 0xeb, 0xd2, 0xac, 0xa6, 0x45, 0xee, 0xe4, - 0x28, 0xb0, 0x2e, 0xd8, 0x4d, 0x79, 0xc9, 0xb3, 0x33, 0xe8, 0xa6, 0x22, 0x41, 0x99, 0x8b, 0x05, - 0xce, 0xe2, 0x90, 0x36, 0xec, 0x9e, 0xef, 0x7a, 0x0e, 0x77, 0x2b, 0xfc, 0x79, 0xc8, 0xee, 0x42, - 0x33, 0xc2, 0x78, 0x19, 0x29, 0x6f, 0x8f, 0x4e, 0xb4, 0x33, 0xc6, 0xa0, 0xa1, 0xe2, 0x04, 0xbd, - 0xc6, 0xd0, 0x19, 0xed, 0x71, 0x1a, 0xb3, 0x11, 0x1c, 0xaf, 0x84, 0x54, 0xb3, 0x88, 0x8a, 0x99, - 0x45, 0x42, 0x46, 0xde, 0xbe, 0xde, 0x96, 0x1f, 0x6a, 0xdc, 0xd4, 0x78, 0x21, 0x64, 0x54, 0x29, - 0x17, 0x59, 0x92, 0xc4, 0xca, 0x28, 0x9b, 0x5b, 0xe5, 0x53, 0x82, 0x49, 0x79, 0x1f, 0x3a, 0xa1, - 0x50, 0xc2, 0x48, 0x5a, 0x24, 0x69, 0x6b, 0x80, 0xc8, 0x33, 0x38, 0x5c, 0x64, 0xa9, 0xc4, 0x54, - 0xae, 0xa5, 0x51, 0xb4, 0x49, 0x71, 0x50, 0xa1, 0x24, 0xeb, 0x43, 0x5b, 0xe4, 0xb9, 0x11, 0x74, - 0x48, 0xd0, 0x12, 0x79, 0x4e, 0xd4, 0xc7, 0xd0, 0xa3, 0x42, 0x0a, 0x94, 0xeb, 0x95, 0xb2, 0x9b, - 0x00, 0x69, 0x8e, 0x34, 0xc1, 0x0d, 0x4e, 0xda, 0x47, 0x70, 0x9c, 0x17, 0x59, 0x9e, 0x49, 0x2c, - 0x66, 0x22, 0x0c, 0x0b, 0x94, 0xd2, 0x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DescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0xc6, 0x1b, 0x7f, 0xbc, 0xeb, 0x7c, 0x78, 0x1a, 0x60, 0xd3, 0x0a, 0xc7, 0x5d, 0x29, + 0x95, 0x8b, 0xc4, 0x5a, 0x35, 0x12, 0xdc, 0x40, 0x4d, 0x41, 0xa4, 0x45, 0x5c, 0x26, 0x52, 0x0f, + 0x5c, 0xac, 0xb1, 0xf7, 0x65, 0x77, 0x55, 0xef, 0x07, 0x3b, 0xe3, 0x34, 0xe6, 0xc8, 0x2f, 0xe0, + 0xcc, 0x8d, 0xbf, 0xc1, 0x2f, 0xe8, 0x8d, 0x1e, 0x39, 0x21, 0x94, 0xfc, 0x11, 0x34, 0xef, 0xcc, + 0xae, 0xdd, 0x06, 0x4e, 0x3b, 0xf3, 0x3c, 0xcf, 0xbc, 0xf3, 0x7e, 0xce, 0xc2, 0x89, 0x5a, 0x97, + 0x28, 0x27, 0xd1, 0x3a, 0x4b, 0x73, 0x65, 0x3f, 0x61, 0x59, 0x15, 0xaa, 0x60, 0x6d, 0xb3, 0xbb, + 0x7f, 0x1c, 0x17, 0x71, 0x41, 0xd0, 0x44, 0xaf, 0x0c, 0x7b, 0xff, 0xa1, 0x39, 0xa8, 0x30, 0x8f, + 0xb0, 0xa2, 0xc3, 0x62, 0xbe, 0x48, 0x27, 0x84, 0x5a, 0x49, 0x70, 0x47, 0x62, 0x81, 0x2d, 0xcd, + 0xa3, 0xff, 0xd1, 0x5c, 0x89, 0x65, 0x1a, 0x09, 0x55, 0x54, 0x56, 0x77, 0x12, 0x17, 0x45, 0xbc, + 0xc4, 0x09, 0xed, 0xe6, 0xab, 0x1f, 0x27, 0x22, 0x5f, 0x1b, 0x2a, 0x78, 0x02, 0x9d, 0x97, 0x58, + 0xc9, 0xb4, 0xc8, 0xd9, 0x31, 0xec, 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x2f, 0x6b, 0xc9, 0xb9, 0xfb, 0xe6, 0xef, 0xd3, 0x1d, + 0xbe, 0x39, 0xa3, 0x7b, 0xb1, 0xc2, 0xd7, 0xa2, 0x8a, 0xe8, 0x2e, 0xca, 0x65, 0x8f, 0x83, 0x81, + 0xf4, 0x25, 0xec, 0x09, 0x1c, 0xbf, 0x4e, 0x52, 0x85, 0xcb, 0x54, 0x2a, 0x8c, 0x66, 0x15, 0x2e, + 0xc5, 0x1a, 0x2b, 0x13, 0x55, 0x8f, 0xdf, 0xdb, 0xe2, 0xb8, 0xa5, 0x82, 0x6f, 0xa1, 0xdf, 0x04, + 0x74, 0x89, 0x8a, 0x7d, 0x01, 0xd0, 0x0c, 0xa4, 0xe9, 0x36, 0x6f, 0x3a, 0xa8, 0xd3, 0xd1, 0x28, + 0xad, 0x6f, 0x5b, 0xd2, 0xe0, 0x14, 0x7a, 0xdf, 0x5c, 0x61, 0xae, 0xbe, 0xc3, 0xb5, 0xd4, 0x0f, + 0xe4, 0x2b, 0x5c, 0xd7, 0xdd, 0x4a, 0xeb, 0xf3, 0x8b, 0x37, 0x37, 0x43, 0xe7, 0xed, 0xcd, 0xd0, + 0xf9, 0xe7, 0x66, 0xe8, 0xfc, 0x7a, 0x3b, 0xdc, 0x79, 0x7b, 0x3b, 0xdc, 0xf9, 0xeb, 0x76, 0xb8, + 0xf3, 0x43, 0x18, 0xa7, 0x2a, 0x59, 0xcd, 0xc3, 0x45, 0x91, 0xe9, 0xff, 0x16, 0xe6, 0xfa, 0x8d, + 0xbe, 0x5e, 0xff, 0x5c, 0xff, 0xcb, 0xcc, 0x7f, 0xa4, 0x9c, 0xdb, 0xfd, 0xbc, 0x4d, 0x4d, 0xfd, + 0xd9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x16, 0x93, 0xc5, 0x37, 0xf2, 0x06, 0x00, 0x00, } func (m *Version) Marshal() (dAtA []byte, err error) { @@ -1020,29 +1001,6 @@ func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if len(m.Evidence) > 0 { - for iNdEx := len(m.Evidence) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Evidence[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDymint(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.IntermediateStateRoots) > 0 { - for iNdEx := len(m.IntermediateStateRoots) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.IntermediateStateRoots[iNdEx]) - copy(dAtA[i:], m.IntermediateStateRoots[iNdEx]) - i = encodeVarintDymint(dAtA, i, uint64(len(m.IntermediateStateRoots[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } if len(m.Txs) > 0 { for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Txs[iNdEx]) @@ -1431,18 +1389,6 @@ func (m *Data) Size() (n int) { n += 1 + l + sovDymint(uint64(l)) } } - if len(m.IntermediateStateRoots) > 0 { - for _, b := range m.IntermediateStateRoots { - l = len(b) - n += 1 + l + sovDymint(uint64(l)) - } - } - if len(m.Evidence) > 0 { - for _, e := range m.Evidence { - l = e.Size() - n += 1 + l + sovDymint(uint64(l)) - } - } if len(m.ConsensusMessages) > 0 { for _, e := range m.ConsensusMessages { l = e.Size() @@ -2411,72 +2357,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 IntermediateStateRoots", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDymint - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDymint - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDymint - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IntermediateStateRoots = append(m.IntermediateStateRoots, make([]byte, postIndex-iNdEx)) - copy(m.IntermediateStateRoots[len(m.IntermediateStateRoots)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDymint - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDymint - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDymint - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Evidence = append(m.Evidence, &types1.Evidence{}) - if err := m.Evidence[len(m.Evidence)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusMessages", wireType) @@ -2506,7 +2386,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsensusMessages = append(m.ConsensusMessages, &types2.Any{}) + m.ConsensusMessages = append(m.ConsensusMessages, &types1.Any{}) if err := m.ConsensusMessages[len(m.ConsensusMessages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/types/serialization.go b/types/serialization.go index 89981daf6..959845afb 100644 --- a/types/serialization.go +++ b/types/serialization.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/dymensionxyz/gerr-cosmos/gerrc" - abci "github.com/tendermint/tendermint/abci/types" prototypes "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" @@ -178,10 +177,8 @@ func (b *Batch) ToProto() *pb.Batch { // ToProto converts Data into protobuf representation and returns it. func (d *Data) ToProto() *pb.Data { return &pb.Data{ - Txs: txsToByteSlices(d.Txs), - IntermediateStateRoots: d.IntermediateStateRoots.RawRootsList, - Evidence: evidenceToProto(d.Evidence), - ConsensusMessages: d.ConsensusMessages, + Txs: txsToByteSlices(d.Txs), + ConsensusMessages: d.ConsensusMessages, } } @@ -192,8 +189,6 @@ func (b *Block) FromProto(other *pb.Block) error { return err } b.Data.Txs = byteSlicesToTxs(other.Data.Txs) - b.Data.IntermediateStateRoots.RawRootsList = other.Data.IntermediateStateRoots - b.Data.Evidence = evidenceFromProto(other.Data.Evidence) b.Data.ConsensusMessages = other.Data.ConsensusMessages if other.LastCommit != nil { err := b.LastCommit.FromProto(other.LastCommit) @@ -391,22 +386,6 @@ func byteSlicesToTxs(bytes [][]byte) Txs { return txs } -func evidenceToProto(evidence EvidenceData) []*abci.Evidence { - var ret []*abci.Evidence - for _, e := range evidence.Evidence { - for _, ae := range e.ABCI() { - ret = append(ret, &ae) //#nosec - } - } - return ret -} - -func evidenceFromProto([]*abci.Evidence) EvidenceData { - var ret EvidenceData - // TODO(tzdybal): right now Evidence is just an interface without implementations - return ret -} - func signaturesToByteSlices(sigs []Signature) [][]byte { if sigs == nil { return nil diff --git a/types/serialization_test.go b/types/serialization_test.go index a7a7fb8a5..08534465e 100644 --- a/types/serialization_test.go +++ b/types/serialization_test.go @@ -61,10 +61,7 @@ func TestBlockSerializationRoundTrip(t *testing.T) { ConsensusMessagesHash: types.ConsMessagesHash(nil), }, Data: types.Data{ - Txs: nil, - IntermediateStateRoots: types.IntermediateStateRoots{RawRootsList: [][]byte{{0x1}}}, - // TODO(tzdybal): update when we have actual evidence types - Evidence: types.EvidenceData{Evidence: nil}, + Txs: nil, ConsensusMessages: protoutils.FromProtoMsgSliceToAnySlice(consensusMsgs...), }, LastCommit: types.Commit{