@@ -210,10 +210,10 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
210210 }
211211 proposerAddr := lazyProposer .privValidatorPubKey .Address ()
212212
213- block , err := lazyProposer .blockExec .CreateProposalBlock (
213+ block , _ , err := lazyProposer .blockExec .CreateProposalBlock (
214214 ctx , lazyProposer .Height , lazyProposer .state , extCommit , proposerAddr )
215215 require .NoError (t , err )
216- blockParts , err := block .MakePartSet (types .BlockPartSizeBytes )
216+ blockParts , err := block .MakePartSet (types .PartSizeBytes )
217217 require .NoError (t , err )
218218
219219 // Flush the WAL. Otherwise, we may not recompute the same proposal to sign,
@@ -224,7 +224,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
224224
225225 // Make proposal
226226 propBlockID := types.BlockID {Hash : block .Hash (), PartSetHeader : blockParts .Header ()}
227- proposal := types .NewProposal (height , round , lazyProposer .ValidRound , propBlockID )
227+ proposal := types .NewProposal (height , round , lazyProposer .ValidRound , propBlockID , types. BlobID {} )
228228 p := proposal .ToProto ()
229229 if err := lazyProposer .privValidator .SignProposal (lazyProposer .state .ChainID , p ); err == nil {
230230 proposal .Signature = p .Signature
@@ -304,7 +304,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
304304 ctx , cancel := context .WithCancel (context .Background ())
305305 defer cancel ()
306306
307- app := newKVStore
307+ app := newKVStoreWithBlob
308308 css , cleanup := randConsensusNet (t , N , "consensus_byzantine_test" , newMockTickerFunc (false ), app )
309309 defer cleanup ()
310310
@@ -342,7 +342,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
342342 }
343343 // We are setting the prevote function to do nothing because the prevoting
344344 // and precommitting are done alongside the proposal.
345- css [i ].doPrevote = func (height int64 , round int32 ) {}
345+ css [i ].doPrevote = func (_ int64 , _ int32 ) {}
346346 }
347347
348348 eventBus := css [i ].eventBus
@@ -461,12 +461,16 @@ func byzantineDecideProposalFunc(ctx context.Context, t *testing.T, height int64
461461 // Avoid sending on internalMsgQueue and running consensus state.
462462
463463 // Create a new proposal block from state/txs from the mempool.
464- block1 , err := cs .createProposalBlock (ctx )
465- require .NoError (t , err )
466- blockParts1 , err := block1 .MakePartSet (types .BlockPartSizeBytes )
467- require .NoError (t , err )
468- polRound , propBlockID := cs .ValidRound , types.BlockID {Hash : block1 .Hash (), PartSetHeader : blockParts1 .Header ()}
469- proposal1 := types .NewProposal (height , round , polRound , propBlockID )
464+ block1 , blockParts1 , propBlockID , blob := createProposalBlockAndBlob (t , cs )
465+
466+ blobParts := types .NewPartSetFromData (blob , types .PartSizeBytes )
467+ blobID := types.BlobID {
468+ Hash : blob .Hash (),
469+ PartSetHeader : blobParts .Header (),
470+ }
471+
472+ polRound := cs .ValidRound
473+ proposal1 := types .NewProposal (height , round , polRound , propBlockID , blobID )
470474 p1 := proposal1 .ToProto ()
471475 if err := cs .privValidator .SignProposal (cs .state .ChainID , p1 ); err != nil {
472476 t .Error (err )
@@ -478,12 +482,12 @@ func byzantineDecideProposalFunc(ctx context.Context, t *testing.T, height int64
478482 deliverTxsRange (t , cs , 0 , 1 )
479483
480484 // Create a new proposal block from state/txs from the mempool.
481- block2 , err := cs .createProposalBlock (ctx )
485+ block2 , _ , err := cs .createProposalBlock (ctx )
482486 require .NoError (t , err )
483- blockParts2 , err := block2 .MakePartSet (types .BlockPartSizeBytes )
487+ blockParts2 , err := block2 .MakePartSet (types .PartSizeBytes )
484488 require .NoError (t , err )
485489 polRound , propBlockID = cs .ValidRound , types.BlockID {Hash : block2 .Hash (), PartSetHeader : blockParts2 .Header ()}
486- proposal2 := types .NewProposal (height , round , polRound , propBlockID )
490+ proposal2 := types .NewProposal (height , round , polRound , propBlockID , blobID )
487491 p2 := proposal2 .ToProto ()
488492 if err := cs .privValidator .SignProposal (cs .state .ChainID , p2 ); err != nil {
489493 t .Error (err )
@@ -499,9 +503,9 @@ func byzantineDecideProposalFunc(ctx context.Context, t *testing.T, height int64
499503 t .Logf ("Byzantine: broadcasting conflicting proposals to %d peers" , len (peers ))
500504 for i , peer := range peers {
501505 if i < len (peers )/ 2 {
502- go sendProposalAndParts (height , round , cs , peer , proposal1 , block1Hash , blockParts1 )
506+ go sendProposalAndParts (height , round , cs , peer , proposal1 , block1Hash , blockParts1 , blobParts )
503507 } else {
504- go sendProposalAndParts (height , round , cs , peer , proposal2 , block2Hash , blockParts2 )
508+ go sendProposalAndParts (height , round , cs , peer , proposal2 , block2Hash , blockParts2 , blobParts )
505509 }
506510 }
507511}
@@ -513,17 +517,17 @@ func sendProposalAndParts(
513517 peer p2p.Peer ,
514518 proposal * types.Proposal ,
515519 blockHash []byte ,
516- parts * types.PartSet ,
520+ blockParts , blobParts * types.PartSet ,
517521) {
518522 // proposal
519523 peer .Send (p2p.Envelope {
520524 ChannelID : DataChannel ,
521525 Message : & cmtcons.Proposal {Proposal : * proposal .ToProto ()},
522526 })
523527
524- // parts
525- for i := 0 ; i < int (parts .Total ()); i ++ {
526- part := parts .GetPart (i )
528+ // block parts
529+ for i := 0 ; i < int (blockParts .Total ()); i ++ {
530+ part := blockParts .GetPart (i )
527531 pp , err := part .ToProto ()
528532 if err != nil {
529533 panic (err ) // TODO: wbanfield better error handling
@@ -538,10 +542,29 @@ func sendProposalAndParts(
538542 })
539543 }
540544
545+ // blob parts
546+ if blobParts != nil {
547+ for i := 0 ; i < int (blobParts .Total ()); i ++ {
548+ part := blobParts .GetPart (i )
549+ pp , err := part .ToProto ()
550+ if err != nil {
551+ panic (err )
552+ }
553+ peer .Send (p2p.Envelope {
554+ ChannelID : DataChannel ,
555+ Message : & cmtcons.BlobPart {
556+ Height : height , // This tells peer that this part applies to us.
557+ Round : round , // This tells peer that this part applies to us.
558+ Part : * pp ,
559+ },
560+ })
561+ }
562+ }
563+
541564 // votes
542565 cs .mtx .Lock ()
543- prevote , _ := cs .signVote (cmtproto .PrevoteType , blockHash , parts .Header (), nil )
544- precommit , _ := cs .signVote (cmtproto .PrecommitType , blockHash , parts .Header (), nil )
566+ prevote , _ := cs .signVote (cmtproto .PrevoteType , blockHash , blockParts .Header (), nil )
567+ precommit , _ := cs .signVote (cmtproto .PrecommitType , blockHash , blockParts .Header (), nil )
545568 cs .mtx .Unlock ()
546569 peer .Send (p2p.Envelope {
547570 ChannelID : VoteChannel ,
0 commit comments