MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / ValidateBlock

Method ValidateBlock

state/execution.go:117–123  ·  view source on GitHub ↗

ValidateBlock validates the given block against the given state. If the block is invalid, it returns an error. Validation does not mutate state, but does require historical information from the stateDB, ie. to verify evidence from a validator at an old height.

(state State, block *types.Block)

Source from the content-addressed store, hash-verified

115// Validation does not mutate state, but does require historical information from the stateDB,
116// ie. to verify evidence from a validator at an old height.
117func (blockExec *BlockExecutor) ValidateBlock(state State, block *types.Block) error {
118 err := validateBlock(state, block)
119 if err != nil {
120 return err
121 }
122 return blockExec.evpool.CheckEvidence(block.Evidence.Evidence)
123}
124
125// ApplyBlock validates the block against the state, executes it against the app,
126// fires the relevant events, commits the app, and saves the new state and responses.

Callers 13

TestValidateBlockHeaderFunction · 0.95
TestValidateBlockCommitFunction · 0.95
TestCreateProposalBlockFunction · 0.95
makeAndApplyGoodBlockFunction · 0.80
DoublePrevoteMisbehaviorFunction · 0.80
defaultEnterPrevoteFunction · 0.80
defaultEnterPrecommitFunction · 0.80
finalizeCommitMethod · 0.80
poolRoutineMethod · 0.80
defaultDoPrevoteMethod · 0.80
enterPrecommitMethod · 0.80

Calls 2

validateBlockFunction · 0.70
CheckEvidenceMethod · 0.65

Tested by 5

TestValidateBlockHeaderFunction · 0.76
TestValidateBlockCommitFunction · 0.76
TestCreateProposalBlockFunction · 0.76
makeAndApplyGoodBlockFunction · 0.64