Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
PrathyushaLakkireddy committed Jan 3, 2025
2 parents 5cf581e + 1fcdfb3 commit cf722ae
Show file tree
Hide file tree
Showing 20 changed files with 1,376 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT_NAME=rollappd
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
DRS_VERSION = 3
DRS_VERSION = 5

#ifndef $(AVAIL_NETWORK)
# AVAIL_NETWORK=mock
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,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//')
Expand Down
2 changes: 2 additions & 0 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func MustCreateHandler(codec codec.BinaryCodec,
distrKeeper distrkeeper.Keeper,
sequencerKeeper seqkeeper.Keeper,
feeGrantKeeper authante.FeegrantKeeper,
authzKeeper evmosanteevm.AuthzKeeper,
) sdk.AnteHandler {
ethOpts := evmosante.HandlerOptions{
Cdc: codec,
Expand All @@ -60,6 +61,7 @@ func MustCreateHandler(codec codec.BinaryCodec,
SigGasConsumer: evmosante.SigVerificationGasConsumer,
MaxTxGasWanted: maxGasWanted,
TxFeeChecker: evmosanteevm.NewDynamicFeeChecker(evmKeeper),
AuthzKeeper: authzKeeper,
}

opts := HandlerOptions{
Expand Down
1 change: 1 addition & 0 deletions app/ante/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func newEVMAnteHandler(options HandlerOptions) sdk.AnteHandler {
evmante.NewEthMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
evmante.NewEthValidateBasicDecorator(options.EvmKeeper),
evmante.NewEthSigVerificationDecorator(options.EvmKeeper),
evmante.NewEthAuthorizationDecorator(options.AuthzKeeper),
evmante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
evmante.NewCanTransferDecorator(options.EvmKeeper),
// we intentionally omit the eth vesting transaction decorator
Expand Down
8 changes: 6 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/dymensionxyz/dymension-rdk/server/proposal"
"github.com/gogo/protobuf/proto"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -161,6 +162,8 @@ import (
"github.com/dymensionxyz/rollapp-evm/app/upgrades"
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 (
Expand All @@ -186,7 +189,7 @@ var (
erc20types.StoreKey,
}
// Upgrades contains the upgrade handlers for the application
Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade}
Upgrades = []upgrades.Upgrade{drs2.Upgrade, drs3.Upgrade, drs4.Upgrade, drs5.Upgrade}
)

func getGovProposalHandlers() []govclient.ProposalHandler {
Expand Down Expand Up @@ -539,7 +542,7 @@ func NewRollapp(
govRouter := govv1beta1.NewRouter()
govRouter.
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(paramproposal.RouterKey, proposal.NewCustomParamChangeProposalHandler(app.ParamsKeeper, app.BankKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
Expand Down Expand Up @@ -821,6 +824,7 @@ func NewRollapp(
app.DistrKeeper,
app.SequencersKeeper,
app.FeeGrantKeeper,
app.AuthzKeeper,
)
app.SetAnteHandler(h)
app.setPostHandler()
Expand Down
13 changes: 7 additions & 6 deletions app/upgrades/drs-2/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
}
Expand All @@ -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
Expand Down
24 changes: 15 additions & 9 deletions app/upgrades/drs-3/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +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.GetParams(ctx).DrsVersion == 1 {
// first run drs-2 migration
if err := drs2.HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil {
return nil, err
}
}
// upgrade drs to 3
err := rpKeeper.SetVersion(ctx, uint32(3))
if 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) < 2 {
// first run drs-2 migration
if err := drs2.HandleUpgrade(ctx, rpKeeper, evmKeeper); err != nil {
return err
}
}
// upgrade drs to 3
if err := rpKeeper.SetVersion(ctx, uint32(3)); err != nil {
return err
}
return nil
}
17 changes: 17 additions & 0 deletions app/upgrades/drs-4/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package drs4

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"

"github.com/dymensionxyz/rollapp-evm/app/upgrades"
)

const (
UpgradeName = "drs-4"
)

var Upgrade = upgrades.Upgrade{
Name: UpgradeName,
CreateHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{},
}
39 changes: 39 additions & 0 deletions app/upgrades/drs-4/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package drs4

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"

drs3 "github.com/dymensionxyz/rollapp-evm/app/upgrades/drs-3"
)

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) < 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
}
17 changes: 17 additions & 0 deletions app/upgrades/drs-5/constants.go
Original file line number Diff line number Diff line change
@@ -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{},
}
39 changes: 39 additions & 0 deletions app/upgrades/drs-5/upgrade.go
Original file line number Diff line number Diff line change
@@ -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
}
Loading

0 comments on commit cf722ae

Please sign in to comment.