From 301b9c4e6167c07a2c1762d9f84d60772d51db90 Mon Sep 17 00:00:00 2001 From: alchemist-ti <134163224+alchemist-ti@users.noreply.github.com> Date: Wed, 31 May 2023 19:11:16 +0800 Subject: [PATCH] migrate staking (#241) --- app/testing/test_suite.go | 1 + app/upgrades/v4/upgrades.go | 7 ++++++- go.mod | 4 ++-- go.sum | 4 ++-- scripts/run-node.sh | 5 ++++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/testing/test_suite.go b/app/testing/test_suite.go index bb3972a47..580a7fb68 100644 --- a/app/testing/test_suite.go +++ b/app/testing/test_suite.go @@ -213,6 +213,7 @@ func genesisStateWithValSet(t *testing.T, defaultStParams.MaxEntries, defaultStParams.HistoricalEntries, appparams.BondDenom, + defaultStParams.MinCommissionRate, ) // set validators and delegations diff --git a/app/upgrades/v4/upgrades.go b/app/upgrades/v4/upgrades.go index b9f0267fe..d3698d1f7 100644 --- a/app/upgrades/v4/upgrades.go +++ b/app/upgrades/v4/upgrades.go @@ -5,6 +5,7 @@ import ( "github.com/classic-terra/core/app/upgrades" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/staking/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -12,9 +13,13 @@ func CreateV4UpgradeHandler( mm *module.Manager, cfg module.Configurator, _ upgrades.BaseAppParamManager, - _ *keepers.AppKeepers, + keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + // to run staking store migration + stakingKeeper := keepers.StakingKeeper + stkingMigrator := keeper.NewMigrator(stakingKeeper) + stkingMigrator.Migrate13to14(ctx) // to run wasm store migration return mm.RunMigrations(ctx, cfg, fromVM) } diff --git a/go.mod b/go.mod index c6618bdab..b40323b24 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ module github.com/classic-terra/core require ( github.com/CosmWasm/wasmd v0.30.0 github.com/CosmWasm/wasmvm v1.1.1 - github.com/cosmos/cosmos-sdk v0.45.13 + github.com/cosmos/cosmos-sdk v0.45.14 github.com/cosmos/gogoproto v1.4.4 github.com/cosmos/ibc-go/v4 v4.3.1 github.com/gogo/protobuf v1.3.3 @@ -132,7 +132,7 @@ replace ( github.com/CosmWasm/wasmd => github.com/classic-terra/wasmd v0.30.0-terra.1 github.com/aws/aws-sdk-go v1.25.48 => github.com/aws/aws-sdk-go v1.33.0 github.com/aws/aws-sdk-go v1.27.0 => github.com/aws/aws-sdk-go v1.33.0 - github.com/cosmos/cosmos-sdk => github.com/classic-terra/cosmos-sdk v0.45.13-classic + github.com/cosmos/cosmos-sdk => github.com/classic-terra/cosmos-sdk v0.45.14-classic github.com/cosmos/ledger-cosmos-go => github.com/terra-money/ledger-terra-go v0.11.2 github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf => github.com/docker/docker v1.6.1 github.com/ethereum/go-ethereum v1.9.25 => github.com/ethereum/go-ethereum v1.10.9 diff --git a/go.sum b/go.sum index 8828067d9..5bbb580e1 100644 --- a/go.sum +++ b/go.sum @@ -158,8 +158,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/classic-terra/cosmos-sdk v0.45.13-classic h1:gJ1waM0wDVoa4XpJqTn/AvtUOcjJUohnwiG9haiAIuE= -github.com/classic-terra/cosmos-sdk v0.45.13-classic/go.mod h1:KaUwQKijD7mOiKnPa/7JOJoGfDt4Mq+1CGlODMHPmfM= +github.com/classic-terra/cosmos-sdk v0.45.14-classic h1:R3WBEoqnBDGef3LCCq0uTWEqFO8pwwqkIv3nQWv5Z+E= +github.com/classic-terra/cosmos-sdk v0.45.14-classic/go.mod h1:KaUwQKijD7mOiKnPa/7JOJoGfDt4Mq+1CGlODMHPmfM= github.com/classic-terra/tendermint v0.34.24-terra.0 h1:ZGaJpmKfxjlmmLO80t03jlK2SBQfJKlLsF+ItDbXtko= github.com/classic-terra/tendermint v0.34.24-terra.0/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/classic-terra/wasmd v0.30.0-terra.1 h1:Qc3zlrMpzFUd/wUAQ4fceiVbV+uCXRyT3QhUt/wMPKM= diff --git a/scripts/run-node.sh b/scripts/run-node.sh index f5bed0fe3..4d80ec0d7 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -7,6 +7,9 @@ BINARY=$1 # check DENOM is set. If not, set to uluna DENOM=${2:-uluna} +COMMISSION_RATE=0.01 +COMMISSION_MAX_RATE=0.02 + SED_BINARY=sed # check if this is OS X if [[ "$OSTYPE" == "darwin"* ]]; then @@ -61,7 +64,7 @@ $SED_BINARY -i '0,/enable = false/s//enable = true/' $HOME/config/app.toml $SED_BINARY -i 's/swagger = false/swagger = true/' $HOME/config/app.toml # Sign genesis transaction -$BINARY gentx $KEY "1000000${DENOM}" --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME +$BINARY gentx $KEY "1000000${DENOM}" --commission-rate=$COMMISSION_RATE --commission-max-rate=$COMMISSION_MAX_RATE --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME # Collect genesis tx $BINARY collect-gentxs --home $HOME