From 46aeb7a07ce4744d177a73b8f57d6fb637c369cf Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Tue, 10 Dec 2024 11:48:37 +0100 Subject: [PATCH 1/2] remove drs check/update dymint --- block/fork.go | 7 ------- block/manager.go | 8 -------- types/state.go | 6 ++++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/block/fork.go b/block/fork.go index ee37f7aa4..c559ba132 100644 --- a/block/fork.go +++ b/block/fork.go @@ -243,13 +243,6 @@ func (m *Manager) updateStateForNextRevision() error { m.State.RevisionStartHeight = nextRevision.StartHeight m.State.SetRevision(nextRevision.Number) - // we set rollappparam to node drs version to pass ValidateConfigWithRollappParams check, when drs upgrade is necessary. - // if the node starts with the wrong version at revision start height, it will stop after applyBlock. - drsVersion, err := version.GetDRSVersion() - if err != nil { - return err - } - m.State.RollappParams.DrsVersion = drsVersion // update stored state _, err = m.Store.SaveState(m.State, nil) return err diff --git a/block/manager.go b/block/manager.go index da2b46ae8..aa75d3d29 100644 --- a/block/manager.go +++ b/block/manager.go @@ -16,7 +16,6 @@ import ( "github.com/dymensionxyz/dymint/store" uerrors "github.com/dymensionxyz/dymint/utils/errors" uevent "github.com/dymensionxyz/dymint/utils/event" - "github.com/dymensionxyz/dymint/version" "github.com/libp2p/go-libp2p/core/crypto" @@ -375,13 +374,6 @@ func (m *Manager) UpdateTargetHeight(h uint64) { // ValidateConfigWithRollappParams checks the configuration params are consistent with the params in the dymint state (e.g. DA and version) func (m *Manager) ValidateConfigWithRollappParams() error { - drsVersion, err := version.GetDRSVersion() - if err != nil { - return err - } - if drsVersion != m.State.RollappParams.DrsVersion { - return fmt.Errorf("DRS version mismatch. rollapp param: %d binary used:%d", m.State.RollappParams.DrsVersion, drsVersion) - } if da.Client(m.State.RollappParams.Da) != m.DAClient.GetClientType() { return fmt.Errorf("da client mismatch. rollapp param: %s da configured: %s", m.State.RollappParams.Da, m.DAClient.GetClientType()) diff --git a/types/state.go b/types/state.go index a02a8355e..aa96bc985 100644 --- a/types/state.go +++ b/types/state.go @@ -14,6 +14,8 @@ import ( "github.com/dymensionxyz/dymint/types/pb/dymint" ) +const rollappparams_modulename = "rollappparams" + // State contains information about current state of the blockchain. type State struct { Version tmstate.Version @@ -105,9 +107,9 @@ func (s *State) SetRollappParamsFromGenesis(appState json.RawMessage) error { if err != nil { return err } - params, ok := objmap["rollappparams"] + params, ok := objmap[rollappparams_modulename] if !ok { - return fmt.Errorf("rollappparams not defined in genesis") + return fmt.Errorf("module not defined in genesis: %s", rollappparams_modulename) } var rollappParams RollappParams From d611f5721ea131aa29563daafd39e8bdcdad2f25 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Tue, 10 Dec 2024 12:10:38 +0100 Subject: [PATCH 2/2] lint fix --- block/manager.go | 1 - 1 file changed, 1 deletion(-) diff --git a/block/manager.go b/block/manager.go index aa75d3d29..61d74a6ab 100644 --- a/block/manager.go +++ b/block/manager.go @@ -374,7 +374,6 @@ func (m *Manager) UpdateTargetHeight(h uint64) { // ValidateConfigWithRollappParams checks the configuration params are consistent with the params in the dymint state (e.g. DA and version) func (m *Manager) ValidateConfigWithRollappParams() error { - if da.Client(m.State.RollappParams.Da) != m.DAClient.GetClientType() { return fmt.Errorf("da client mismatch. rollapp param: %s da configured: %s", m.State.RollappParams.Da, m.DAClient.GetClientType()) }