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

Upgrade IRISHub to v2.1 #2863

Merged
merged 27 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b003c71
bump-up: cosmos-sdk v0.47.4
taramakage Aug 24, 2023
c7a1993
bump-up: ibc, tibc, irismod, ethermint
taramakage Aug 24, 2023
d0ce629
fix: tibc keeper compile error
taramakage Aug 24, 2023
cec2a7b
feat: load ibc nft-transfer module
taramakage Aug 24, 2023
4c4e18e
upgrade: add plan v2.1 and fix consensus params migration logic
taramakage Aug 26, 2023
8b5dc01
chore: update change log
taramakage Aug 28, 2023
16cdaf8
chore: update changelog
taramakage Aug 28, 2023
40a6463
chore: format code
taramakage Aug 29, 2023
36a49a9
bump-up: add v2 suffix to module paths
taramakage Aug 30, 2023
ea62179
fix: revert path in docs
taramakage Aug 30, 2023
56fa2de
proto: regeneration
taramakage Aug 31, 2023
45f2365
bump-up: irismod supports x/nft api
taramakage Sep 11, 2023
c2d5ea6
bump-up: nft-transfer
taramakage Sep 11, 2023
b03afbf
fix: vesting account loophole
taramakage Sep 12, 2023
535c5c6
chore: fix typo
taramakage Sep 12, 2023
08455d5
fix: adjust ante sequence
taramakage Sep 12, 2023
1a98a50
ibc: register client app basic module
taramakage Sep 13, 2023
419abb5
Merge pull request #2865 from irisnet/yuandu/fix-vesting-loophole
Sep 13, 2023
167415b
bump-up ethermint to resolve panic of accessing consensus parmas at u…
taramakage Sep 14, 2023
faba90d
fix: support legacy proposal and query on ibc nft
taramakage Sep 18, 2023
4bddc5c
fix: use no-op-mempool to avoid evm tx failure with no signer
taramakage Sep 20, 2023
9439b1c
fix collect-gentxs command (#2866)
Sep 21, 2023
3de5405
fix: adjust keeper init sequence of gov & farm
taramakage Sep 27, 2023
99d8d4b
refine custom base option function
taramakage Oct 9, 2023
4cde6c3
fix: set localhost for ibc allow clients
taramakage Oct 9, 2023
ee49348
chore: fix typo in dockerfile
taramakage Oct 9, 2023
05e1f7b
bump-up: irismod fix farm genesis validation
taramakage Oct 10, 2023
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@

## [Unreleased]

### API Breaking

* (Auth) Query for BaseAccount type account is no longer supported and is replaced by EthAccount type.

### State Machine Breaking

* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up tibc-go version to xxx
* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up irismod version to xxx
taramakage marked this conversation as resolved.
Show resolved Hide resolved
* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up ethermint version to v0.22.0
* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up ibc-go version to v7.3.0
* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up cosmos-sdk to v0.47.4
* (IRISHub) [\#2863](https://github.com/irisnet/irishub/pull/2863) Bump up cometbft to v0.37.2

### Features

* (NFT-Transfer) [\#2863](https://github.com/irisnet/irishub/pull/2863) Feat: support inter nft-transfer module

### Bug Fixes
* (IRISHub) [\#2852](https://github.com/irisnet/irishub/pull/2852) refactor: fix eip712 signature and inject ParseChainID method
* (IRISMod) [irismod \#367](https://github.com/irisnet/irismod/pull/367) Fix rest uri conflict in mt module

## 2.0.0

Expand Down
91 changes: 70 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ import (
tibcroutingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
tibckeeper "github.com/bianjieai/tibc-go/modules/tibc/core/keeper"

nfttransfer "github.com/bianjieai/nft-transfer"
ibcnfttransferkeeper "github.com/bianjieai/nft-transfer/keeper"
ibcnfttransfertypes "github.com/bianjieai/nft-transfer/types"

"github.com/evmos/ethermint/ethereum/eip712"
srvflags "github.com/evmos/ethermint/server/flags"
ethermint "github.com/evmos/ethermint/types"
Expand All @@ -113,6 +117,7 @@ import (
"github.com/irisnet/irishub/lite"
guardiankeeper "github.com/irisnet/irishub/modules/guardian/keeper"
guardiantypes "github.com/irisnet/irishub/modules/guardian/types"
"github.com/irisnet/irishub/modules/internft"
mintkeeper "github.com/irisnet/irishub/modules/mint/keeper"
minttypes "github.com/irisnet/irishub/modules/mint/types"
iristypes "github.com/irisnet/irishub/types"
Expand Down Expand Up @@ -156,8 +161,9 @@ type IrisApp struct {
ConsensusParamsKeeper consensuskeeper.Keeper

//ibc
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCTransferKeeper ibctransferkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCTransferKeeper ibctransferkeeper.Keeper
IBCNFTTransferKeeper ibcnfttransferkeeper.Keeper

// make scoped keepers public for test purposes
scopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -193,9 +199,10 @@ type IrisApp struct {
// simulation manager
sm *module.SimulationManager

transferModule transfer.AppModule
nfttransferModule tibcnfttransfer.AppModule
mttransferModule tibcmttransfer.AppModule
transferModule transfer.AppModule
nfttransferModule tibcnfttransfer.AppModule
mttransferModule tibcmttransfer.AppModule
ibcnfttransferModule nfttransfer.AppModule
}

// NewIrisApp returns a reference to an initialized IrisApp.
Expand Down Expand Up @@ -237,6 +244,7 @@ func NewIrisApp(
consensustypes.StoreKey,
evidencetypes.StoreKey,
ibctransfertypes.StoreKey,
ibcnfttransfertypes.StoreKey,
capabilitytypes.StoreKey,
guardiantypes.StoreKey,
tokentypes.StoreKey,
Expand Down Expand Up @@ -306,6 +314,7 @@ func NewIrisApp(
)
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedNFTTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibcnfttransfertypes.ModuleName)

app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec,
Expand Down Expand Up @@ -420,7 +429,8 @@ func NewIrisApp(
app.TIBCKeeper = tibckeeper.NewKeeper(
appCodec,
keys[tibchost.StoreKey],
app.GetSubspace(tibchost.ModuleName), app.StakingKeeper,
app.StakingKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.NFTKeeper = nftkeeper.NewKeeper(
Expand Down Expand Up @@ -467,10 +477,25 @@ func NewIrisApp(
app.transferModule = transfer.NewAppModule(app.IBCTransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.IBCTransferKeeper)

app.IBCNFTTransferKeeper = ibcnfttransferkeeper.NewKeeper(
appCodec,
keys[ibcnfttransfertypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
internft.NewInterNftKeeper(appCodec, app.NFTKeeper, app.AccountKeeper),
scopedNFTTransferKeeper,
)
app.ibcnfttransferModule = nfttransfer.NewAppModule(app.IBCNFTTransferKeeper)
nfttransferIBCModule := nfttransfer.NewIBCModule(app.IBCNFTTransferKeeper)

// routerModule := router.NewAppModule(app.RouterKeeper, transferIBCModule)
// create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule).
AddRoute(ibcnfttransfertypes.ModuleName, nfttransferIBCModule)
app.IBCKeeper.SetRouter(ibcRouter)

app.nfttransferModule = tibcnfttransfer.NewAppModule(app.TIBCNFTTransferKeeper)
Expand Down Expand Up @@ -715,9 +740,32 @@ func (app *IrisApp) BeginBlocker(
ctx sdk.Context,
req abci.RequestBeginBlock,
) abci.ResponseBeginBlock {
// NOTE: if we can't get conParmas from x/consensus, we go for the default x/params
// WARNING: this line of code must be removed once the x/params is deprecated
ctx = app.getConsensusParams(ctx)
return app.mm.BeginBlock(ctx, req)
}

// getConsensusParams gets the consensus parameters from the x/consensus module or the x/params module
// Note: some modules require consensus params from the sdk.Context.
// By default, baseapp.BeginBlock accesses the consensus params from x/consensus
// module before calling each module's BeginBlock. However, for the first time of
// consensus params migration, it will only get an empty value until we finalize
// the upgrade block. So we must access the consensus params from the legacy x/params
// module instead for that case.
func (app *IrisApp) getConsensusParams(ctx sdk.Context) sdk.Context {
consParams := ctx.ConsensusParams()
if consParams.Block == nil && consParams.Evidence == nil && consParams.Validator == nil {
baseAppLegacySS, ok := app.ParamsKeeper.GetSubspace(baseapp.Paramspace)
if !ok {
panic("cannot get param subspace")
}
consParams = baseapp.GetConsensusParams(ctx, baseAppLegacySS)
return ctx.WithConsensusParams(consParams)
}
return ctx
}

// EndBlocker application updates every end block
func (app *IrisApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
return app.mm.EndBlock(ctx, req)
Expand Down Expand Up @@ -879,27 +927,28 @@ func initParamsKeeper(
) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)

paramsKeeper.Subspace(authtypes.ModuleName)
paramsKeeper.Subspace(banktypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName)
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable())
paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable())
paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable())
paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable())
paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable())
paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable())
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable())
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(tokentypes.ModuleName)
paramsKeeper.Subspace(tokentypes.ModuleName).WithKeyTable(tokenv1.ParamKeyTable())
paramsKeeper.Subspace(recordtypes.ModuleName)
paramsKeeper.Subspace(htlctypes.ModuleName)
paramsKeeper.Subspace(coinswaptypes.ModuleName)
paramsKeeper.Subspace(servicetypes.ModuleName)
paramsKeeper.Subspace(htlctypes.ModuleName).WithKeyTable(htlctypes.ParamKeyTable())
paramsKeeper.Subspace(coinswaptypes.ModuleName).WithKeyTable(coinswaptypes.ParamKeyTable())
paramsKeeper.Subspace(servicetypes.ModuleName).WithKeyTable(servicetypes.ParamKeyTable())
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(farmtypes.ModuleName)
paramsKeeper.Subspace(farmtypes.ModuleName).WithKeyTable(farmtypes.ParamKeyTable())
paramsKeeper.Subspace(tibchost.ModuleName)
paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())

// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName)
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable())
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())

return paramsKeeper
}
12 changes: 12 additions & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
ibcnfttransfertypes "github.com/bianjieai/nft-transfer/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -74,6 +75,8 @@ import (
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibccli "github.com/bianjieai/tibc-go/modules/tibc/core/client/cli"

nfttransfer "github.com/bianjieai/nft-transfer"

taramakage marked this conversation as resolved.
Show resolved Hide resolved
"github.com/evmos/ethermint/x/evm"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/evmos/ethermint/x/feemarket"
Expand Down Expand Up @@ -138,6 +141,7 @@ var (
tibcnfttransfer.AppModuleBasic{},
tibcmttransfer.AppModuleBasic{},
mt.AppModuleBasic{},
nfttransfer.AppModuleBasic{},

evm.AppModuleBasic{},
feemarket.AppModuleBasic{},
Expand Down Expand Up @@ -257,6 +261,7 @@ func appModules(
ibc.NewAppModule(app.IBCKeeper), tibc.NewAppModule(app.TIBCKeeper),
params.NewAppModule(app.ParamsKeeper),
app.transferModule,
app.ibcnfttransferModule,
app.nfttransferModule,
app.mttransferModule,
guardian.NewAppModule(appCodec, app.GuardianKeeper),
Expand Down Expand Up @@ -384,6 +389,7 @@ func simulationModules(
),
ibc.NewAppModule(app.IBCKeeper),
app.transferModule,
app.ibcnfttransferModule,
guardian.NewAppModule(appCodec, app.GuardianKeeper),
token.NewAppModule(
appCodec,
Expand Down Expand Up @@ -488,6 +494,8 @@ func orderBeginBlockers() []string {
tibcnfttypes.ModuleName,
tibcmttypes.ModuleName,
guardiantypes.ModuleName,

ibcnfttransfertypes.ModuleName,
}
}

Expand Down Expand Up @@ -538,6 +546,8 @@ func orderEndBlockers() []string {
tibcnfttypes.ModuleName,
tibcmttypes.ModuleName,
guardiantypes.ModuleName,

ibcnfttransfertypes.ModuleName,
}
}

Expand Down Expand Up @@ -592,5 +602,7 @@ func orderInitBlockers() []string {
guardiantypes.ModuleName,
// NOTE: crisis module must go at the end to check for invariants on each module
crisistypes.ModuleName,

ibcnfttransfertypes.ModuleName,
}
}
30 changes: 17 additions & 13 deletions app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
v130 "github.com/irisnet/irishub/app/upgrades/v130"
v140 "github.com/irisnet/irishub/app/upgrades/v140"
v200 "github.com/irisnet/irishub/app/upgrades/v200"
v210 "github.com/irisnet/irishub/app/upgrades/v210"
)

var (
Expand All @@ -19,7 +20,8 @@ var (
Register(v120.Upgrade).
Register(v130.Upgrade).
Register(v140.Upgrade).
Register(v200.Upgrade)
Register(v200.Upgrade).
Register(v210.Upgrade)
)

// RegisterUpgradePlans register a handler of upgrade plan
Expand All @@ -30,18 +32,20 @@ func (app *IrisApp) RegisterUpgradePlans() {

func (app *IrisApp) appKeepers() upgrades.AppKeepers {
return upgrades.AppKeepers{
AppCodec: app.AppCodec(),
HTLCKeeper: app.HTLCKeeper,
BankKeeper: app.BankKeeper,
AccountKeeper: app.AccountKeeper,
ServiceKeeper: app.ServiceKeeper,
GetKey: app.GetKey,
ModuleManager: app.mm,
TIBCkeeper: app.TIBCKeeper,
EvmKeeper: app.EvmKeeper,
FeeMarketKeeper: app.FeeMarketKeeper,
TokenKeeper: app.TokenKeeper,
ReaderWriter: app,
AppCodec: app.AppCodec(),
HTLCKeeper: app.HTLCKeeper,
BankKeeper: app.BankKeeper,
AccountKeeper: app.AccountKeeper,
ServiceKeeper: app.ServiceKeeper,
GetKey: app.GetKey,
ModuleManager: app.mm,
TIBCkeeper: app.TIBCKeeper,
EvmKeeper: app.EvmKeeper,
FeeMarketKeeper: app.FeeMarketKeeper,
TokenKeeper: app.TokenKeeper,
ReaderWriter: app,
ConsensusParamsKeeper: app.ConsensusParamsKeeper,
ParamsKeeper: app.ParamsKeeper,
}
}

Expand Down
11 changes: 7 additions & 4 deletions app/upgrades/v210/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ibcnfttransfertypes "github.com/bianjieai/nft-transfer/types"

"github.com/irisnet/irishub/app/upgrades"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: "v2.1",
UpgradeHandlerConstructor: upgradeHandlerConstructor,
StoreUpgrades: &storetypes.StoreUpgrades{
Added: []string{crisistypes.StoreKey, consensustypes.StoreKey},
Added: []string{crisistypes.StoreKey, consensustypes.StoreKey, ibcnfttransfertypes.StoreKey},
},
}

Expand All @@ -40,8 +41,10 @@ func upgradeHandlerConstructor(

// Migrate Tendermint consensus parameters from x/params module to a
// dedicated x/consensus module.
baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).
WithKeyTable(paramstypes.ConsensusParamsKeyTable())
baseAppLegacySS, ok := app.ParamsKeeper.GetSubspace(baseapp.Paramspace)
if !ok {
panic("failed to get legacy param subspace")
}
baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper)
return app.ModuleManager.RunMigrations(ctx, c, fromVM)
}
Expand Down
Loading