diff --git a/README.md b/README.md index 03fee46e..61e777da 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ fund the sequencer account (if you're using a remote hub node, you must fund the ```shell # retrieve the minimal bond amount from hub sequencer params # you have to account for gas fees so it should the final value should be increased -BOND_AMOUNT="$(dymd q sequencer params -o json | jq -r '.params.min_bond.amount')$(dymd q sequencer params -o json | jq -r '.params.min_bond.denom')" +BOND_AMOUNT="$(dymd q rollapp params -o json | jq -r '.params.min_sequencer_bond_global.amount')$(dymd q rollapp params -o json | jq -r '.params.min_sequencer_bond_global.denom')" # Extract the numeric part NUMERIC_PART=$(echo $BOND_AMOUNT | sed 's/adym//') diff --git a/app/app.go b/app/app.go index 21d3311c..e657721e 100644 --- a/app/app.go +++ b/app/app.go @@ -163,6 +163,7 @@ import ( drs2 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-2" drs3 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-3" drs4 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-4" + drs5 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-5" ) const ( @@ -188,7 +189,7 @@ var ( erc20types.StoreKey, } // Upgrades contains the upgrade handlers for the application - Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade, drs4.Upgrade} + Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade, drs4.Upgrade, drs5.Upgrade} ) func getGovProposalHandlers() []govclient.ProposalHandler { diff --git a/app/upgrades/drs-2/upgrade.go b/app/upgrades/drs-2/upgrade.go index ad866dd1..e7b467ed 100644 --- a/app/upgrades/drs-2/upgrade.go +++ b/app/upgrades/drs-2/upgrade.go @@ -4,9 +4,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + evmkeeper "github.com/evmos/evmos/v12/x/evm/keeper" + rollappparamskeeper "github.com/dymensionxyz/dymension-rdk/x/rollappparams/keeper" rollappparamstypes "github.com/dymensionxyz/dymension-rdk/x/rollappparams/types" - evmkeeper "github.com/evmos/evmos/v12/x/evm/keeper" ) func CreateUpgradeHandler( @@ -16,11 +17,6 @@ func CreateUpgradeHandler( configurator module.Configurator, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // upgrade drs to 2 - if err := rpKeeper.SetVersion(ctx, uint32(2)); err != nil { - return nil, err - } - if err := HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { return nil, err } @@ -33,6 +29,11 @@ func HandleUpgrade( rpKeeper rollappparamskeeper.Keeper, evmKeeper *evmkeeper.Keeper, ) error { + // upgrade drs to 2 + if err := rpKeeper.SetVersion(ctx, uint32(2)); err != nil { + return err + } + // migrate rollapp params with missing min-gas-prices if err := rpKeeper.SetMinGasPrices(ctx, rollappparamstypes.DefaultParams().MinGasPrices); err != nil { return err diff --git a/app/upgrades/drs-4/upgrade.go b/app/upgrades/drs-4/upgrade.go index 6e9b39fa..3864a2d2 100644 --- a/app/upgrades/drs-4/upgrade.go +++ b/app/upgrades/drs-4/upgrade.go @@ -17,16 +17,23 @@ func CreateUpgradeHandler( configurator module.Configurator, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - if rpKeeper.Version(ctx) < 3 { - // first run drs-3 migration - if err := drs3.HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { - return nil, err - } - } - // upgrade drs to 4 - if err := rpKeeper.SetVersion(ctx, uint32(4)); err != nil { + if err := HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { return nil, err } return mm.RunMigrations(ctx, configurator, fromVM) } } + +func HandleUpgrade(ctx sdk.Context, rpKeeper rollappparamskeeper.Keeper, evmKeeper *evmkeeper.Keeper) error { + if rpKeeper.Version(ctx) < 3 { + // first run drs-3 migration + if err := drs3.HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { + return err + } + } + // upgrade drs to 4 + if err := rpKeeper.SetVersion(ctx, uint32(4)); err != nil { + return err + } + return nil +} diff --git a/app/upgrades/drs-5/constants.go b/app/upgrades/drs-5/constants.go new file mode 100644 index 00000000..01980da1 --- /dev/null +++ b/app/upgrades/drs-5/constants.go @@ -0,0 +1,17 @@ +package drs5 + +import ( + storetypes "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/dymensionxyz/rollapp-evm/app/upgrades" +) + +const ( + UpgradeName = "drs-5" +) + +var Upgrade = upgrades.Upgrade{ + Name: UpgradeName, + CreateHandler: CreateUpgradeHandler, + StoreUpgrades: storetypes.StoreUpgrades{}, +} diff --git a/app/upgrades/drs-5/upgrade.go b/app/upgrades/drs-5/upgrade.go new file mode 100644 index 00000000..58f9fbcd --- /dev/null +++ b/app/upgrades/drs-5/upgrade.go @@ -0,0 +1,39 @@ +package drs5 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + rollappparamskeeper "github.com/dymensionxyz/dymension-rdk/x/rollappparams/keeper" + evmkeeper "github.com/evmos/evmos/v12/x/evm/keeper" + + drs4 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-4" +) + +func CreateUpgradeHandler( + rpKeeper rollappparamskeeper.Keeper, + evmKeeper *evmkeeper.Keeper, + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + if err := HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { + return nil, err + } + return mm.RunMigrations(ctx, configurator, fromVM) + } +} + +func HandleUpgrade(ctx sdk.Context, rpKeeper rollappparamskeeper.Keeper, evmKeeper *evmkeeper.Keeper) error { + if rpKeeper.Version(ctx) < 4 { + // first run drs-4 migration + if err := drs4.HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil { + return err + } + } + // upgrade drs to 5 + if err := rpKeeper.SetVersion(ctx, uint32(5)); err != nil { + return err + } + return nil +} diff --git a/scripts/settlement/register_sequencer_to_hub.sh b/scripts/settlement/register_sequencer_to_hub.sh index 606a0c8b..ec5e7b23 100755 --- a/scripts/settlement/register_sequencer_to_hub.sh +++ b/scripts/settlement/register_sequencer_to_hub.sh @@ -37,7 +37,7 @@ fi #Register Sequencer # DESCRIPTION="{\"Moniker\":\"${ROLLAPP_CHAIN_ID}-sequencer\",\"Identity\":\"\",\"Website\":\"\",\"SecurityContact\":\"\",\"Details\":\"\"}" SEQ_PUB_KEY="$("$ROLLAPP_EXECUTABLE" dymint show-sequencer)" -BOND_AMOUNT="$("$SETTLEMENT_EXECUTABLE" q sequencer params -o json --node "$HUB_RPC_URL" | jq -r '.params.min_bond.amount')$("$SETTLEMENT_EXECUTABLE" q sequencer params -o json --node "$HUB_RPC_URL" | jq -r '.params.min_bond.denom')" +BOND_AMOUNT="$("$SETTLEMENT_EXECUTABLE" q rollapp params -o json --node "$HUB_RPC_URL" | jq -r '.params.min_sequencer_bond_global.amount')$("$SETTLEMENT_EXECUTABLE" q rollapp params -o json --node "$HUB_RPC_URL" | jq -r '.params.min_sequencer_bond_global.denom')" echo "$BOND_AMOUNT"