-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: upgrade cosmos-sdk v0.45.4 #356
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments to help your reviews. Thanks in advance
// numbers, checks signatures & account numbers, and deducts fees from the first | ||
// signer. | ||
// Copied from wasmd, https://github.com/CosmWasm/wasmd/blob/v0.24.0/app/ante.go | ||
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This NewAnteHandler
is to receive all positional params as ante.HandlerOptions
struct. If required fields aren't set, throws error accordingly. (https://github.com/cosmos/cosmos-sdk/pull/8682/files)
Plus, referred wasm's NewAnteHandler
. (https://github.com/CosmWasm/wasmd/blob/v0.24.0/app/ante.go)
@@ -360,7 +389,7 @@ func New( | |||
app.CrisisKeeper = crisiskeeper.NewKeeper( | |||
app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, | |||
) | |||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath) | |||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, bApp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade Keeper takes new argument ProtocolVersionSetter
which implements setting a protocol version on baseapp. (cosmos/cosmos-sdk#8897)
@@ -372,7 +401,7 @@ func New( | |||
|
|||
// Create IBC Keeper | |||
app.IBCKeeper = ibckeeper.NewKeeper( | |||
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, scopedIBCKeeper, | |||
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IBC Keeper now takes in the Upgrade Keeper (https://github.com/cosmos/ibc-go/blob/main/docs/migrations/sdk-to-v1.md#ibc-keeper-changes)
@@ -381,7 +410,7 @@ func New( | |||
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). | |||
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). | |||
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). | |||
AddRoute(ibchost.RouterKey, ibcclient.NewClientUpdateProposalHandler(app.IBCKeeper.ClientKeeper)) | |||
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ClientUpdateProposalHandler
has been renamed to ClientProposalHandler
. It handles both UpdateClientProposals
and UpgradeProposals
. (https://github.com/cosmos/ibc-go/blob/main/docs/migrations/sdk-to-v1.md#proposal-handler-registration)
@@ -440,7 +462,7 @@ func New( | |||
&app.IBCKeeper.PortKeeper, | |||
scopedWasmKeeper, | |||
app.TransferKeeper, | |||
app.Router(), | |||
app.MsgServiceRouter(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, the wasm.NewKeeper
takes MessageRouter
interface which is defined in https://github.com/CosmWasm/wasmd/blob/3bc0bdeab3fa2b3f7de745622226ff36c2ec6d6a/x/wasm/keeper/handler_plugin.go#L25
go.mod
Outdated
@@ -39,4 +39,4 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2 | |||
|
|||
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | |||
|
|||
replace github.com/cosmos/cosmos-sdk => github.com/medibloc/cosmos-sdk v0.42.11-panacea.1 | |||
//replace github.com/cosmos/cosmos-sdk => github.com/medibloc/cosmos-sdk v0.45.4-panacea.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: after release upgraded version of medibloc/cosmos-sdk
for min-commission-rate
, replace it
x/burn/keeper/burn_test.go
Outdated
@@ -45,20 +46,15 @@ func (suite *BurnTestSuite) BeforeTest(_, _ string) { | |||
bankKeeper := suite.BankKeeper | |||
|
|||
for _, addr := range address { | |||
err := bankKeeper.AddCoins(ctx, addr, initCoins) | |||
// mint coins and send to each account | |||
err := simapp.FundAccount(suite.BankKeeper, suite.Ctx, addr, initCoins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddCoins
is deleted in x/bank
, so replace to simapp.FundAccount
to mint and send coins to the account
package expected | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/bank/exported" | ||
) | ||
|
||
type BankKeeperI interface { | ||
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins | ||
|
||
SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error | ||
|
||
GetSupply(ctx sdk.Context) exported.SupplyI | ||
SetSupply(ctx sdk.Context, supply exported.SupplyI) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be not used, so deleted
GetSupply(ctx sdk.Context) exported.SupplyI | ||
SetSupply(ctx sdk.Context, supply exported.SupplyI) | ||
BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error | ||
GetSupply(ctx sdk.Context, denom string) sdk.Coin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetSupply
in x/bank
takes one more arg, denom
, and returns Coin
.
@@ -164,3 +164,6 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} | |||
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { | |||
return []abci.ValidatorUpdate{} | |||
} | |||
|
|||
// ConsensusVersion implements AppModule/ConsensusVersion. | |||
func (AppModule) ConsensusVersion() uint64 { return 1 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConsensusVersion
is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1.
(https://github.com/cosmos/cosmos-sdk/blob/ad9e5620fb3445c716e9de45cfcdb56e8f1745bf/types/module/module.go#L176)
"oracle": 1, | ||
} | ||
|
||
app.IBCKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For in-place ibc migration, a new param, MaxExpectedTimePerBlock
, should be set.
In this commit, default value of |
…sdk-upgrade # Conflicts: # go.mod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard working.
I left a few comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
go.mod
Outdated
@@ -3,35 +3,35 @@ module github.com/medibloc/panacea-core/v2 | |||
go 1.15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be changed from 1.15 to 1.18.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.18? not 1.17?
Cosmos-sdk v0.45.4
requires min ver of go of 1.17.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I was talking about looking at cosmos-sdk v0.45.6.
As you said, 1.17 seems to be correct. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The required minimum go version is updated in 79db4e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
danke
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks for your effort!
When upgrading next time, I could try it.
As I said offline, the version |
Upgrade cosmos-sdk to
v0.45.4
Final ver of each package
cosmos-sdk :
v0.45.4
ibc-go :
v2.0.3
wasmd :
v0.24.0
wasmvm :
v1.0.0-beta7
Main changes
SubtractsCoins
andSetSupply
are removed inx/bank
module. So I modifiedx/burn
module to burn coins usingBurnCoins
inx/bank
module.In v0.42.11, ibc module was in comsos-sdk, under
x/
. But it has been moved to its own repo.The upgrade to v0.44 or upper(v0.45 as in this PR) can be done using upgrade handler as suggested in guide. So I've also registered upgrade handler in
app.go
underv2.2.0-alpha1
removed
x/token
module because the module is useless anymore as we discussedadded
feegrant
andauthz
modulesMain Breaking Changes
v0.43
SetSupply
,SetBalance
(safety issue)Supply
,SupplyI
VersionMap
argument to upgradeHandlerv0.44.0
v0.44.4
v0.45.0
v0.45.3
unsafe-reset-all
to tendermint subcommandTODO
medibloc/cosmos-sdk
package after release. It is not released yet, so I'll update after merge and release this PRconfig.json