Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(code standards): inline NextValSetFromResponses #870

Merged
merged 3 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading