From cd9e9e9f455328db4399ae191e147bdb5f79f885 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 17 Apr 2017 15:24:44 -0700 Subject: [PATCH] s/ExecBlock/ValExecBlock/g; s/sm.ApplyBlock/sm.ExecCommitBlock/g --- consensus/replay.go | 4 ++-- state/execution.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/consensus/replay.go b/consensus/replay.go index f43c5ecad..441b27018 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -318,7 +318,7 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store // App is further behind than it should be, so we need to replay blocks. // We replay all blocks from appBlockHeight+1. // Note that we don't have an old version of the state, - // so we by-pass state validation/mutation using sm.ApplyBlock. + // so we by-pass state validation/mutation using sm.ExecCommitBlock. // If mutateState == true, stop short of the last block // so it can be replayed with a real state.ApplyBlock @@ -331,7 +331,7 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store for i := appBlockHeight + 1; i <= finalBlock; i++ { log.Info("Applying block", "height", i) block := h.store.LoadBlock(i) - appHash, err = sm.ApplyBlock(proxyApp.Consensus(), block) + appHash, err = sm.ExecCommitBlock(proxyApp.Consensus(), block) if err != nil { return nil, err } diff --git a/state/execution.go b/state/execution.go index 959231eed..4874fdc70 100644 --- a/state/execution.go +++ b/state/execution.go @@ -16,10 +16,10 @@ import ( //-------------------------------------------------- // Execute the block -// ExecBlock executes the block, but does NOT mutate State. +// ValExecBlock executes the block, but does NOT mutate State. // + validates the block // + executes block.Txs on the proxyAppConn -func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error) { +func (s *State) ValExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error) { // Validate the block. if err := s.validateBlock(block); err != nil { return nil, ErrInvalidBlock(err) @@ -201,15 +201,15 @@ func (s *State) validateBlock(block *types.Block) error { } //----------------------------------------------------------------------------- -// ApplyBlock executes the block, updates state w/ ABCI responses, +// ApplyBlock validates & executes the block, updates state w/ ABCI responses, // then commits and updates the mempool atomically, then saves state. // Transaction results are optionally indexed. -// Execute and commit block against app, save block and state +// Validate, execute, and commit block against app, save block and state func (s *State) ApplyBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block, partsHeader types.PartSetHeader, mempool types.Mempool) error { - abciResponses, err := s.ExecBlock(eventCache, proxyAppConn, block) + abciResponses, err := s.ValExecBlock(eventCache, proxyAppConn, block) if err != nil { return fmt.Errorf("Exec failed for application: %v", err) } @@ -285,9 +285,9 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) { s.TxIndexer.Batch(batch) } -// Apply and commit a block on the proxyApp without validating or mutating the state +// Exec and commit a block on the proxyApp without validating or mutating the state // Returns the application root hash (result of abci.Commit) -func ApplyBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error) { +func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error) { var eventCache types.Fireable // nil _, err := execBlockOnProxyApp(eventCache, appConnConsensus, block) if err != nil {