Skip to content

Commit

Permalink
chore: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Mar 13, 2024
1 parent 5fb90a7 commit 39dedb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions internal/state/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ func (blockExec *BlockExecutor) FinalizeBlock(
}
endTime := time.Now().UnixNano()
blockExec.metrics.BlockProcessingTime.Observe(float64(endTime-startTime) / 1000000)
if err != nil {
return state, ErrProxyAppConn(err)
}

// Save the results before we commit.
// We need to save Prepare/ProcessProposal AND FinalizeBlock responses, as we don't have details like validators
Expand All @@ -508,8 +505,7 @@ func (blockExec *BlockExecutor) FinalizeBlock(
return state, err
}

state, err = state.Update(blockID, &block.Header, &uncommittedState)
if err != nil {
if state, err = state.Update(blockID, &block.Header, &uncommittedState); err != nil {
return state, fmt.Errorf("commit failed for application: %w", err)
}

Expand All @@ -522,7 +518,7 @@ func (blockExec *BlockExecutor) FinalizeBlock(
// Update evpool with the latest state.
blockExec.evpool.Update(ctx, state, block.Evidence)

if err := blockExec.store.Save(state); err != nil {
if err = blockExec.store.Save(state); err != nil {
return state, err
}

Expand All @@ -535,8 +531,7 @@ func (blockExec *BlockExecutor) FinalizeBlock(
// Events are fired after everything else.
// NOTE: if we crash between Commit and Save, events wont be fired during replay
es := NewFullEventSet(block, blockID, uncommittedState, fbResp, state.Validators)
err = es.Publish(blockExec.eventPublisher)
if err != nil {
if err = es.Publish(blockExec.eventPublisher); err != nil {
blockExec.logger.Error("failed publishing event", "err", err)
}

Expand Down Expand Up @@ -713,9 +708,7 @@ func execBlock(
}
blockID := block.BlockID(nil)
protoBlockID := blockID.ToProto()
if err != nil {
return nil, err
}

responseFinalizeBlock, err := appConn.FinalizeBlock(
ctx,
&abci.RequestFinalizeBlock{
Expand Down
2 changes: 1 addition & 1 deletion internal/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func setupTestCase(t *testing.T) (func(t *testing.T), dbm.DB, sm.State) {
err = stateStore.Save(state)
require.NoError(t, err)

tearDown := func(t *testing.T) { _ = os.RemoveAll(cfg.RootDir) }
tearDown := func(_ *testing.T) { _ = os.RemoveAll(cfg.RootDir) }

return tearDown, stateDB, state
}
Expand Down

0 comments on commit 39dedb6

Please sign in to comment.