From 1222d07178cbb3dc6edc3770255ae765a8382dcc Mon Sep 17 00:00:00 2001 From: Sergio Mena Date: Fri, 18 Nov 2022 11:18:26 +0100 Subject: [PATCH] Re-sync some things with original patch --- state/execution.go | 2 +- types/params.go | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/state/execution.go b/state/execution.go index 47eeb6930..a942e9214 100644 --- a/state/execution.go +++ b/state/execution.go @@ -552,7 +552,7 @@ func updateState( return state, fmt.Errorf("updating consensus params: %w", err) } - err = state.ConsensusParams.ValidateUpdate(&nextParams, header.Height) + err = state.ConsensusParams.ValidateUpdate(abciResponses.EndBlock.ConsensusParamUpdates, header.Height) if err != nil { return state, fmt.Errorf("updating consensus params: %w", err) } diff --git a/types/params.go b/types/params.go index 0aafa004e..8245cb345 100644 --- a/types/params.go +++ b/types/params.go @@ -194,14 +194,17 @@ func (params ConsensusParams) ValidateBasic() error { return nil } -func (params ConsensusParams) ValidateUpdate(updated *ConsensusParams, h int64) error { - if params.ABCI.VoteExtensionsEnableHeight == updated.ABCI.VoteExtensionsEnableHeight { +func (params ConsensusParams) ValidateUpdate(updated *tmproto.ConsensusParams, h int64) error { + if updated.Abci == nil { return nil } - if params.ABCI.VoteExtensionsEnableHeight != 0 && updated.ABCI.VoteExtensionsEnableHeight == 0 { + if params.ABCI.VoteExtensionsEnableHeight == updated.Abci.VoteExtensionsEnableHeight { + return nil + } + if params.ABCI.VoteExtensionsEnableHeight != 0 && updated.Abci.VoteExtensionsEnableHeight == 0 { return errors.New("vote extensions cannot be disabled once enabled") } - if updated.ABCI.VoteExtensionsEnableHeight <= h { + if updated.Abci.VoteExtensionsEnableHeight <= h { return fmt.Errorf("VoteExtensionsEnableHeight cannot be updated to a past height, "+ "initial height: %d, current height %d", params.ABCI.VoteExtensionsEnableHeight, h)