Skip to content

Commit

Permalink
fix: malicious test and prepare proposal (#2092)
Browse files Browse the repository at this point in the history
Closes #2091

## Testing

`make test` passes locally
  • Loading branch information
rootulp authored and evan-forbes committed Aug 2, 2023
1 parent 96bb969 commit 912e5e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions test/util/malicious/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ func TestMaliciousTestNode(t *testing.T) {
eds, err := ExtendShares(rawSquare)
require.NoError(t, err)

dah := da.NewDataAvailabilityHeader(eds)
dah, err := da.NewDataAvailabilityHeader(eds)
require.NoError(t, err)
require.Equal(t, block.Block.DataHash.Bytes(), dah.Hash())

correctSquare, err := square.Construct(block.Block.Txs.ToSliceOfBytes(), appconsts.LatestVersion, appconsts.DefaultSquareSizeUpperBound)
Expand All @@ -115,6 +116,7 @@ func TestMaliciousTestNode(t *testing.T) {
goodEds, err := da.ExtendShares(shares.ToBytes(correctSquare))
require.NoError(t, err)

goodDah := da.NewDataAvailabilityHeader(goodEds)
goodDah, err := da.NewDataAvailabilityHeader(goodEds)
require.NoError(t, err)
require.NotEqual(t, block.Block.DataHash.Bytes(), goodDah.Hash())
}
5 changes: 4 additions & 1 deletion test/util/malicious/out_of_order_prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ func (a *App) OutOfOrderPrepareProposal(req abci.RequestPrepareProposal) abci.Re

// create the new data root by creating the data availability header (merkle
// roots of each row and col of the erasure data).
dah := da.NewDataAvailabilityHeader(eds)
dah, err := da.NewDataAvailabilityHeader(eds)
if err != nil {
panic(err)
}

// tendermint doesn't need to use any of the erasure data, as only the
// protobuf encoded version of the block data is gossiped.
Expand Down

0 comments on commit 912e5e9

Please sign in to comment.