block을 state에 비교해 검증한 후, app에 대해 이를 실행시켜 반영한다.
(evt fire, commits the app, saves new state and response)
새 state값과 block height를 반환
dir : state/execution.go
block 검증
if err := validateBlock(state, block); err != nil {
return state, 0, ErrInvalidBlock(err)
}
block과 state에 관한 정보를 application layer에 전송 후, 응답을 받아옴.
// ...
abciResponses, err := execBlockOnProxyApp(
blockExec.logger, blockExec.proxyApp, block, blockExec.store, state.InitialHeight
)
// commit 전 result를 저장
if err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil {...}
validator 정보 업데이트
abciValUpdates := abciResponses.EndBlock.ValidatorUpdates
err = validateValidatorUpdates(abciValUpdates, state.ConsensusParams.Validator)
// ...
validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciValUpdates)
// ...
block, response 기반으로 state 업데이트
state, err = updateState(state, blockID, &block.Header, abciResponses, validatorUpdates)
commit app state, mempool, evpool 업데이트
appHash, retainHeight, err := blockExec.Commit(state, block, abciResponses.DeliverTxs)
// ... err chk
// update evpool
blockExec.evpool.Update(state, block.Evidence.Evidence)
apphash update, state 저장
state.AppHash = appHash
if err := blockExec.store.Save(state); err != nil {
return state, 0, err
}