Skip to content

Commit

Permalink
feat(block): removes evidence list, intermediate roots from block (#1317
Browse files Browse the repository at this point in the history
)
  • Loading branch information
danwt authored Jan 9, 2025
1 parent a1c2c28 commit 132f916
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 246 deletions.
6 changes: 2 additions & 4 deletions block/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
5 changes: 0 additions & 5 deletions da/celestia/celestia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions da/da_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions proto/types/dymint/dymint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 0 additions & 5 deletions rpc/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down
12 changes: 1 addition & 11 deletions testutil/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 132f916

Please sign in to comment.