Skip to content

Commit

Permalink
fix(code standards): inline NextValSetFromResponses (dymensionxyz#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt authored May 16, 2024
1 parent 7bcc837 commit 5a491ac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
5 changes: 1 addition & 4 deletions block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMeta
}

// Get the validator changes from the app
validators, err := m.Executor.NextValSetFromResponses(m.State, responses, block)
if err != nil {
return fmt.Errorf("update state from responses: %w", err)
}
validators := m.State.NextValidators.Copy() // TODO: this will be changed when supporting multiple sequencers from the hub

dbBatch, err = m.Store.SaveValidators(block.Header.Height, validators, dbBatch)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions block/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ func TestApplyBlock(t *testing.T) {
resp, err = executor.ExecuteBlock(state, block)
require.NoError(err)
require.NotNil(resp)
vals, err := executor.NextValSetFromResponses(state, resp, block)
require.NoError(err)
vals := state.NextValidators.Copy() // TODO: this will be changed when supporting multiple sequencers from the hub
_, _, err = executor.Commit(state, block, resp)
require.NoError(err)
executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, vals)
Expand Down
7 changes: 0 additions & 7 deletions block/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ func (e *Executor) UpdateMempoolAfterInitChain(s *types.State) {
e.mempool.SetPostCheckFn(mempool.PostCheckMaxGas(s.ConsensusParams.Block.MaxGas))
}

// NextValSetFromResponses updates state based on the ABCIResponses.
func (e *Executor) NextValSetFromResponses(state *types.State, resp *tmstate.ABCIResponses, block *types.Block) (*tmtypes.ValidatorSet, error) {
// Dymint ignores any setValidator responses from the app, as it is manages the validator set based on the settlement consensus
// TODO: this will be changed when supporting multiple sequencers from the hub
return state.NextValidators.Copy(), nil
}

// Update state from Commit response
func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, height uint64, valSet *tmtypes.ValidatorSet) {
copy(s.AppHash[:], appHash[:])
Expand Down

0 comments on commit 5a491ac

Please sign in to comment.