github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/consensus/compliance.go (about) 1 package consensus 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/model/messages" 6 "github.com/onflow/flow-go/module/component" 7 ) 8 9 // Compliance defines the interface to the consensus logic that precedes hotstuff logic. 10 // It's responsible for processing incoming block proposals broadcast by other consensus nodes 11 // as well as blocks obtained via the sync protocol. 12 // Compliance logic performs validation of incoming blocks depending on internal implementation. 13 // Main consensus logic performs full validation by checking headers and payloads. 14 // Follower consensus logic checks header validity and by observing a valid QC can make a statement about 15 // payload validity of parent block. 16 // Compliance logic guarantees that only valid blocks are added to chain state, passed to hotstuff and other 17 // components. 18 // Implementation need to be non-blocking and concurrency safe. 19 type Compliance interface { 20 component.Component 21 22 // OnBlockProposal feeds a new block proposal into the processing pipeline. 23 // Incoming proposals will be queued and eventually dispatched by worker. 24 // This method is non-blocking. 25 OnBlockProposal(proposal flow.Slashable[*messages.BlockProposal]) 26 27 // OnSyncedBlocks feeds a batch of blocks obtained from sync into the processing pipeline. 28 // Implementors shouldn't assume that blocks are arranged in any particular order. 29 // Incoming proposals will be queued and eventually dispatched by worker. 30 // This method is non-blocking. 31 OnSyncedBlocks(blocks flow.Slashable[[]*messages.BlockProposal]) 32 }