Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade cosmos-sdk and ethermint versions #771

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@
"cancun_time": null,
"prague_time": null
},
"allow_unprotected_txs": false
"allow_unprotected_txs": false,
"header_hash_num": "256"
}
},
"feegrant": {
Expand Down
12 changes: 12 additions & 0 deletions app/upgrades/v8/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"

"github.com/functionx/fx-core/v8/app/keepers"
"github.com/functionx/fx-core/v8/app/upgrades/store"
Expand All @@ -24,6 +25,7 @@ import (
erc20keeper "github.com/functionx/fx-core/v8/x/erc20/keeper"
erc20v8 "github.com/functionx/fx-core/v8/x/erc20/migrations/v8"
erc20types "github.com/functionx/fx-core/v8/x/erc20/types"
fxevmkeeper "github.com/functionx/fx-core/v8/x/evm/keeper"
"github.com/functionx/fx-core/v8/x/gov/keeper"
fxgovv8 "github.com/functionx/fx-core/v8/x/gov/migrations/v8"
fxstakingv8 "github.com/functionx/fx-core/v8/x/staking/migrations/v8"
Expand All @@ -43,6 +45,10 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator,
return fromVM, err
}

if err = migrateEvmParams(cacheCtx, app.EvmKeeper); err != nil {
return fromVM, err
}

store.RemoveStoreKeys(cacheCtx, app.GetKey(stakingtypes.StoreKey), fxstakingv8.GetRemovedStoreKeys())

if err = migrationGovCustomParam(cacheCtx, app.GovKeeper, app.GetKey(govtypes.StoreKey)); err != nil {
Expand All @@ -67,6 +73,12 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator,
}
}

func migrateEvmParams(ctx sdk.Context, evmKeeper *fxevmkeeper.Keeper) error {
params := evmKeeper.GetParams(ctx)
params.HeaderHashNum = evmtypes.DefaultHeaderHashNum
return evmKeeper.SetParams(ctx, params)
}

func migrationGovCustomParam(ctx sdk.Context, keeper *keeper.Keeper, storeKey *storetypes.KVStoreKey) error {
// 1. delete fxParams key
store.RemoveStoreKeys(ctx, storeKey, fxgovv8.GetRemovedStoreKeys())
Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ go 1.23

require (
cosmossdk.io/api v0.7.6
cosmossdk.io/client/v2 v2.0.0-beta.3
cosmossdk.io/client/v2 v2.0.0-beta.5
cosmossdk.io/core v0.11.1
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.4.1
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.0
cosmossdk.io/store v1.1.1
cosmossdk.io/tools/confix v0.1.2
cosmossdk.io/x/evidence v0.1.1
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.13.5
cosmossdk.io/x/tx v0.13.6-0.20241003112805-ff8789a02871
cosmossdk.io/x/upgrade v0.1.4
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/coder/websocket v1.8.12
github.com/cometbft/cometbft v0.38.11
github.com/cometbft/cometbft v0.38.13-0.20240920204745-fdf90d16f608
github.com/cometbft/cometbft-db v0.12.0
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-db v1.0.3-0.20240408151834-e75f6e4b28d8
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/go-bip39 v1.0.0
Expand Down Expand Up @@ -47,7 +47,7 @@ require (
go.uber.org/mock v0.5.0
golang.org/x/sync v0.8.0
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094
google.golang.org/grpc v1.65.0
google.golang.org/grpc v1.66.1
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v2 v2.4.0
)
Expand Down Expand Up @@ -95,17 +95,17 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/btcsuite/btcd v0.23.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcd v0.24.2 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.6 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
Expand Down Expand Up @@ -145,7 +145,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
Expand Down Expand Up @@ -186,7 +186,7 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mtibben/percent v0.2.1 // indirect
Expand All @@ -196,9 +196,9 @@ require (
github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_golang v1.20.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/common v0.57.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
Expand Down Expand Up @@ -232,13 +232,13 @@ require (
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.186.0 // indirect
google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect
Expand All @@ -252,8 +252,8 @@ require (
)

replace (
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240902025731-535413db1bf4
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.50.6-0.20240902025731-535413db1bf4
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241018012743-d78d66e74712
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.50.6-0.20241018012743-d78d66e74712
)

replace (
Expand All @@ -263,7 +263,7 @@ replace (
github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811

github.com/ethereum/go-ethereum => github.com/functionx/go-ethereum v1.10.20-0.20240425065928-ebb09502e7a7
github.com/evmos/ethermint => github.com/functionx/ethermint v0.6.1-0.20240914063604-28a75474779c
github.com/evmos/ethermint => github.com/pundiai/ethermint v0.6.1-0.20241022071115-5e0afc7c501c

github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
Loading