diff --git a/mod/beacon/blockchain/process.go b/mod/beacon/blockchain/process.go index 8c60e33975..17b6952241 100644 --- a/mod/beacon/blockchain/process.go +++ b/mod/beacon/blockchain/process.go @@ -126,10 +126,9 @@ func (s *Service[ // of validators in their process proposal call and thus // the "verification aspect" of this NewPayload call is // actually irrelevant at this point. - SkipPayloadVerification: false, - - ProposerAddress: blk.GetProposerAddress(), - ConsensusTime: blk.GetConsensusTime(), + SkipPayloadVerification: !blk.GetConsensusSyncing(), + ProposerAddress: blk.GetProposerAddress(), + ConsensusTime: blk.GetConsensusTime(), }, st, blk.GetBeaconBlock(), diff --git a/mod/beacon/blockchain/types.go b/mod/beacon/blockchain/types.go index 0338c68f70..8de5b5cefb 100644 --- a/mod/beacon/blockchain/types.go +++ b/mod/beacon/blockchain/types.go @@ -52,6 +52,11 @@ type ConsensusBlock[BeaconBlockT any] interface { // GetConsensusTime returns the timestamp of current consensus request. // It is used to build next payload and to validate currentpayload. GetConsensusTime() math.U64 + + // GetConsensusSyncing signals whether consensus is working normally + // or is still syncing. In the former case we can skip execution payload + // verification on finalized blocks. + GetConsensusSyncing() bool } // BeaconBlock represents a beacon block interface. diff --git a/mod/consensus/pkg/cometbft/service/middleware/abci.go b/mod/consensus/pkg/cometbft/service/middleware/abci.go index b31ae16189..f71ab40ba9 100644 --- a/mod/consensus/pkg/cometbft/service/middleware/abci.go +++ b/mod/consensus/pkg/cometbft/service/middleware/abci.go @@ -221,6 +221,7 @@ func (h *ABCIMiddleware[ blk, req.GetProposerAddress(), req.GetTime(), + false, // ProcessProposal is not called during state sync ) blkEvent := async.NewEvent(ctx, async.BeaconBlockReceived, consensusBlk) if err = h.dispatcher.Publish(blkEvent); err != nil { @@ -346,6 +347,11 @@ func (h *ABCIMiddleware[ blk, req.GetProposerAddress(), req.GetTime(), + + // Finalize may be called while syncing. In such a case + // we must perform payload verification since block we do + // not verify block with ProcessBlock. + req.SyncingToHeight != req.Height, ) blkEvent := async.NewEvent( ctx, diff --git a/mod/consensus/pkg/types/consensus_block.go b/mod/consensus/pkg/types/consensus_block.go index 1ca6dc98c2..de31a56dd0 100644 --- a/mod/consensus/pkg/types/consensus_block.go +++ b/mod/consensus/pkg/types/consensus_block.go @@ -31,6 +31,8 @@ type ConsensusBlock[BeaconBlockT any] struct { // some consensus data useful to build and verify the block *commonConsensusData + + isConsensusSyncing bool } // New creates a new ConsensusBlock instance. @@ -38,6 +40,7 @@ func (b *ConsensusBlock[BeaconBlockT]) New( beaconBlock BeaconBlockT, proposerAddress []byte, consensusTime time.Time, + isConsensusSyncing bool, ) *ConsensusBlock[BeaconBlockT] { b = &ConsensusBlock[BeaconBlockT]{ blk: beaconBlock, @@ -45,6 +48,7 @@ func (b *ConsensusBlock[BeaconBlockT]) New( proposerAddress: proposerAddress, consensusTime: math.U64(consensusTime.Unix()), }, + isConsensusSyncing: isConsensusSyncing, } return b } @@ -52,3 +56,7 @@ func (b *ConsensusBlock[BeaconBlockT]) New( func (b *ConsensusBlock[BeaconBlockT]) GetBeaconBlock() BeaconBlockT { return b.blk } + +func (b *ConsensusBlock[BeaconBlockT]) GetConsensusSyncing() bool { + return b.isConsensusSyncing +} diff --git a/mod/node-core/pkg/components/interfaces.go b/mod/node-core/pkg/components/interfaces.go index a5687910ba..00e91b565f 100644 --- a/mod/node-core/pkg/components/interfaces.go +++ b/mod/node-core/pkg/components/interfaces.go @@ -90,6 +90,11 @@ type ( // GetConsensusTime returns the timestamp of current consensus request. // It is used to build next payload and to validate currentpayload. GetConsensusTime() math.U64 + + // GetConsensusSyncing signals whether consensus is working normally + // or is still syncing. In the former case we can skip execution payload + // verification on finalized blocks. + GetConsensusSyncing() bool } // BeaconBlock represents a generic interface for a beacon block.