From ca3bb4629726533569c605adbf2b7807ea010e03 Mon Sep 17 00:00:00 2001 From: danwt <30197399+danwt@users.noreply.github.com> Date: Thu, 16 May 2024 10:47:25 +0100 Subject: [PATCH 1/3] inline NextValSetFromResponses --- block/block.go | 4 +++- block/executor_test.go | 4 +++- block/state.go | 7 ------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/block.go b/block/block.go index 78d8255f9..2a35b8e81 100644 --- a/block/block.go +++ b/block/block.go @@ -59,7 +59,9 @@ 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) + // 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 + validators := m.State.NextValidators.Copy() if err != nil { return fmt.Errorf("update state from responses: %w", err) } diff --git a/block/executor_test.go b/block/executor_test.go index e4eca2f55..7495a4953 100644 --- a/block/executor_test.go +++ b/block/executor_test.go @@ -232,7 +232,9 @@ func TestApplyBlock(t *testing.T) { resp, err = executor.ExecuteBlock(state, block) require.NoError(err) require.NotNil(resp) - vals, err := executor.NextValSetFromResponses(state, resp, block) + // 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 + vals := state.NextValidators.Copy() require.NoError(err) _, _, err = executor.Commit(state, block, resp) require.NoError(err) diff --git a/block/state.go b/block/state.go index 35ca63c3d..5fa53260c 100644 --- a/block/state.go +++ b/block/state.go @@ -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[:]) From a58ab2abedc0515f75bafb8122ad64a44447804f Mon Sep 17 00:00:00 2001 From: danwt <30197399+danwt@users.noreply.github.com> Date: Thu, 16 May 2024 10:48:36 +0100 Subject: [PATCH 2/3] removes err checks --- block/block.go | 3 --- block/executor_test.go | 1 - 2 files changed, 4 deletions(-) diff --git a/block/block.go b/block/block.go index 2a35b8e81..aebce47c5 100644 --- a/block/block.go +++ b/block/block.go @@ -62,9 +62,6 @@ func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMeta // 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 validators := m.State.NextValidators.Copy() - if err != nil { - return fmt.Errorf("update state from responses: %w", err) - } dbBatch, err = m.Store.SaveValidators(block.Header.Height, validators, dbBatch) if err != nil { diff --git a/block/executor_test.go b/block/executor_test.go index 7495a4953..b1620e528 100644 --- a/block/executor_test.go +++ b/block/executor_test.go @@ -235,7 +235,6 @@ func TestApplyBlock(t *testing.T) { // 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 vals := state.NextValidators.Copy() - require.NoError(err) _, _, err = executor.Commit(state, block, resp) require.NoError(err) executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, vals) From 3d6d9cc1d988ab567735019c3ae4669422ec9c6b Mon Sep 17 00:00:00 2001 From: danwt <30197399+danwt@users.noreply.github.com> Date: Thu, 16 May 2024 10:49:30 +0100 Subject: [PATCH 3/3] remove bogus comments --- block/block.go | 4 +--- block/executor_test.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/block/block.go b/block/block.go index aebce47c5..2785d7719 100644 --- a/block/block.go +++ b/block/block.go @@ -59,9 +59,7 @@ func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMeta } // Get the validator changes from the app - // 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 - validators := m.State.NextValidators.Copy() + 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 { diff --git a/block/executor_test.go b/block/executor_test.go index b1620e528..fe675aa98 100644 --- a/block/executor_test.go +++ b/block/executor_test.go @@ -232,9 +232,7 @@ func TestApplyBlock(t *testing.T) { resp, err = executor.ExecuteBlock(state, block) require.NoError(err) require.NotNil(resp) - // 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 - vals := state.NextValidators.Copy() + 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)