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

feat: add required params for cons pubkey rotation #18142

Merged
merged 28 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
73c508d
proto
atheeshp Oct 17, 2023
0c3ff40
updates
atheeshp Oct 17, 2023
2024850
feat: add proto for cons rotate key
atheeshp Oct 17, 2023
6c66c9a
fix tests
atheeshp Oct 17, 2023
4e70611
fix typo
atheeshp Oct 17, 2023
bc3a7b8
fix type
atheeshp Oct 17, 2023
0a21620
Merge branch 'main' of github.com:cosmos/cosmos-sdk into ap/add-params
atheeshp Oct 17, 2023
698493b
Merge branch 'main' into ap/consensus-key-rotation-proto
atheeshp Oct 17, 2023
84680a6
Merge branch 'ap/consensus-key-rotation-proto' of github.com:cosmos/c…
atheeshp Oct 17, 2023
b63359e
feat: add required parasm for cons pubkey rotation
atheeshp Oct 17, 2023
ff6b260
Merge branch 'main' of github.com:cosmos/cosmos-sdk into ap/add-pubke…
atheeshp Oct 17, 2023
105261b
tests
atheeshp Oct 17, 2023
edf8d20
Merge branch 'main' into ap/consensus-key-rotation-proto
atheeshp Oct 17, 2023
9506504
Merge branch 'ap/consensus-key-rotation-proto' of github.com:cosmos/c…
atheeshp Oct 17, 2023
b008991
proto-gen
atheeshp Oct 17, 2023
a1acd5b
params
atheeshp Oct 17, 2023
ff5b5b2
Merge branch 'main' of github.com:cosmos/cosmos-sdk into ap/add-pubke…
atheeshp Oct 17, 2023
61ae584
fix tests
atheeshp Oct 18, 2023
35c4020
proto
atheeshp Oct 18, 2023
fe7f097
fix tests
atheeshp Oct 18, 2023
9d1aa5a
fix tests
atheeshp Oct 18, 2023
675f515
changelog
atheeshp Oct 18, 2023
8666bcc
Merge branch 'main' of github.com:cosmos/cosmos-sdk into ap/add-pubke…
atheeshp Oct 18, 2023
68be849
review change
atheeshp Oct 18, 2023
d0abe0a
review changes
atheeshp Oct 18, 2023
b0f4804
Merge branch 'main' of github.com:cosmos/cosmos-sdk into ap/add-pubke…
atheeshp Oct 18, 2023
159b615
proto-gen
atheeshp Oct 18, 2023
29e8a01
Merge branch 'main' into ap/add-pubkey-rotation-params
atheeshp Oct 18, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* (x/staking) [#18142](https://github.com/cosmos/cosmos-sdk/pull/18142) introduce `key_rotation_fee` param to calculate fees while rotating the keys
* (server) [#18110](https://github.com/cosmos/cosmos-sdk/pull/18110) Start gRPC & API server in standalone mode
* (client) [#18101](https://github.com/cosmos/cosmos-sdk/pull/18101) Add a `keyring-default-keyname` in `client.toml` for specifying a default key name, and skip the need to use the `--from` flag when signing transactions.
* (tests) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) Added helper method `SubmitTestTx` in testutil to broadcast test txns to test e2e tests.
Expand Down
355 changes: 225 additions & 130 deletions api/cosmos/staking/v1beta1/staking.pulsar.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions api/cosmos/staking/v1beta1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ message Params {
(amino.dont_omitempty) = true,
(cosmos_proto.scalar) = "cosmos.Dec"
];

// key_rotation_fee is fee to be spent when rotating validator's key
// (either consensus pubkey or operator key)
cosmos.base.v1beta1.Coin key_rotation_fee = 7 [(gogoproto.nullable) = false];
}

// DelegationResponse is equivalent to Delegation except that it contains a
Expand Down
4 changes: 2 additions & 2 deletions proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@
// MsgRotateConsPubKey is the Msg/RotateConsPubKey request type.
//
// Since: cosmos-sdk 0.51
message MsgRotateConsPubKey {

Check failure on line 216 in proto/cosmos/staking/v1beta1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Previously present field "3" with name "new_pubkey" on message "MsgRotateConsPubKey" was deleted.
option (cosmos.msg.v1.signer) = "validator_address";
option (amino.name) = "cosmos-sdk/MsgRotateConsPubKey";

option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;

string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];
google.protobuf.Any new_pubkey = 3 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
google.protobuf.Any new_pubkey = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];

Check failure on line 224 in proto/cosmos/staking/v1beta1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "2" with name "new_pubkey" on message "MsgRotateConsPubKey" changed option "json_name" from "validatorAddress" to "newPubkey".

Check failure on line 224 in proto/cosmos/staking/v1beta1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "2" on message "MsgRotateConsPubKey" changed type from "string" to "message".

Check failure on line 224 in proto/cosmos/staking/v1beta1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "2" on message "MsgRotateConsPubKey" changed name from "validator_address" to "new_pubkey".
}

// MsgRotateConsPubKeyResponse defines the response structure for executing a
Expand Down
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests
go 1.21

require (
cosmossdk.io/api v0.7.2
cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.12.0
cosmossdk.io/depinject v1.0.0-alpha.4
Expand Down
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4=
cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504 h1:DrOuHptmmjB+jIsOG/eLq9cLdb5BZy3y70E60gnZINw=
cosmossdk.io/api v0.7.3-0.20231018072017-35c402025504/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU=
Expand Down
15 changes: 9 additions & 6 deletions tests/integration/staking/keeper/deterministic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func TestGRPCValidatorDelegations(t *testing.T) {
ValidatorAddr: validator.OperatorAddress,
}

testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorDelegations, 14475, false)
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorDelegations, 14637, false)
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}

func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
Expand Down Expand Up @@ -502,7 +502,7 @@ func TestGRPCDelegation(t *testing.T) {
DelegatorAddr: delegator1,
}

testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Delegation, 4635, false)
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Delegation, 4689, false)
}

func TestGRPCUnbondingDelegation(t *testing.T) {
Expand Down Expand Up @@ -577,7 +577,7 @@ func TestGRPCDelegatorDelegations(t *testing.T) {
DelegatorAddr: delegator1,
}

testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorDelegations, 4238, false)
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorDelegations, 4292, false)
}

func TestGRPCDelegatorValidator(t *testing.T) {
Expand Down Expand Up @@ -742,7 +742,7 @@ func TestGRPCPool(t *testing.T) {

f = initDeterministicFixture(t) // reset
getStaticValidator(t, f)
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 6242, false)
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 6296, false)
}

func TestGRPCRedelegations(t *testing.T) {
Expand Down Expand Up @@ -815,13 +815,15 @@ func TestGRPCParams(t *testing.T) {
f := initDeterministicFixture(t)

rapid.Check(t, func(rt *rapid.T) {
bondDenom := rapid.StringMatching(sdk.DefaultCoinDenomRegex()).Draw(rt, "bond-denom")
params := stakingtypes.Params{
BondDenom: rapid.StringMatching(sdk.DefaultCoinDenomRegex()).Draw(rt, "bond-denom"),
BondDenom: bondDenom,
UnbondingTime: durationGenerator().Draw(rt, "duration"),
MaxValidators: rapid.Uint32Min(1).Draw(rt, "max-validators"),
MaxEntries: rapid.Uint32Min(1).Draw(rt, "max-entries"),
HistoricalEntries: rapid.Uint32Min(1).Draw(rt, "historical-entries"),
MinCommissionRate: math.LegacyNewDecWithPrec(rapid.Int64Range(0, 100).Draw(rt, "commission"), 2),
KeyRotationFee: sdk.NewInt64Coin(bondDenom, rapid.Int64Range(10000, 100000).Draw(rt, "amount")),
}

err := f.stakingKeeper.Params.Set(f.ctx, params)
Expand All @@ -837,10 +839,11 @@ func TestGRPCParams(t *testing.T) {
MaxEntries: 5,
HistoricalEntries: 5,
MinCommissionRate: math.LegacyNewDecWithPrec(5, 2),
KeyRotationFee: sdk.NewInt64Coin("denom", 10000),
}

err := f.stakingKeeper.Params.Set(f.ctx, params)
assert.NilError(t, err)

testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 1114, false)
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 1162, false)
}
14 changes: 14 additions & 0 deletions tests/integration/tx/aminojson/aminojson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ func TestAminoJSON_LegacyParity(t *testing.T) {
MinSignedPerWindow: dec10bz,
},
},
"staking/msg_update_params": {
gogo: &stakingtypes.MsgUpdateParams{
Params: stakingtypes.Params{
UnbondingTime: 0,
KeyRotationFee: types.Coin{},
},
},
pulsar: &stakingapi.MsgUpdateParams{
Params: &stakingapi.Params{
UnbondingTime: &durationpb.Duration{Seconds: 0},
KeyRotationFee: &v1beta1.Coin{},
},
},
},
"staking/create_validator": {
gogo: &stakingtypes.MsgCreateValidator{Pubkey: pubkeyAny},
pulsar: &stakingapi.MsgCreateValidator{
Expand Down
32 changes: 16 additions & 16 deletions x/staking/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (s *KeeperTestSuite) TestLastTotalPowerMigrationToColls() {

s.ctx.KVStore(s.key).Set(getLastValidatorPowerKey(valAddrs[i]), bz)
},
"f28811f2b0a0ab9db60cdcae93680faff9dbadd4a3a8a2d088bb19b0428ad3a9",
"198aa9b8c1d9bc02308b7b2a48944f3e4b05c6b8312cb0bcc73518d1260f682d",
)
s.Require().NoError(err)

Expand All @@ -266,7 +266,7 @@ func (s *KeeperTestSuite) TestLastTotalPowerMigrationToColls() {
err = s.stakingKeeper.LastValidatorPower.Set(s.ctx, valAddrs[i], intV)
s.Require().NoError(err)
},
"f28811f2b0a0ab9db60cdcae93680faff9dbadd4a3a8a2d088bb19b0428ad3a9",
"198aa9b8c1d9bc02308b7b2a48944f3e4b05c6b8312cb0bcc73518d1260f682d",
)
s.Require().NoError(err)
}
Expand All @@ -284,7 +284,7 @@ func (s *KeeperTestSuite) TestSrcRedelegationsMigrationToColls() {
// legacy method to set in the state
s.ctx.KVStore(s.key).Set(getREDByValSrcIndexKey(addrs[i], valAddrs[i], valAddrs[i+1]), []byte{})
},
"cb7b7086b1e03add24f85f894531fb36b3b9746f2e661e1640ec528a4f23a3d9",
"cae99e5c0498356a290f9478b7db73d522840b736878a9d4c00b56d1ddd7fd04",
)
s.Require().NoError(err)

Expand All @@ -297,7 +297,7 @@ func (s *KeeperTestSuite) TestSrcRedelegationsMigrationToColls() {
err := s.stakingKeeper.RedelegationsByValSrc.Set(s.ctx, collections.Join3(valAddrs[i].Bytes(), addrs[i].Bytes(), valAddrs[i+1].Bytes()), []byte{})
s.Require().NoError(err)
},
"cb7b7086b1e03add24f85f894531fb36b3b9746f2e661e1640ec528a4f23a3d9",
"cae99e5c0498356a290f9478b7db73d522840b736878a9d4c00b56d1ddd7fd04",
)

s.Require().NoError(err)
Expand All @@ -316,7 +316,7 @@ func (s *KeeperTestSuite) TestDstRedelegationsMigrationToColls() {
// legacy method to set in the state
s.ctx.KVStore(s.key).Set(getREDByValDstIndexKey(addrs[i], valAddrs[i], valAddrs[i+1]), []byte{})
},
"4beb77994beff3c8ad9cecca9ee3a74fb551356250f0b8bd3936c4e4f506443b", // this hash obtained when ran this test in main branch
"1b7687449a83f8176a60aeced7bcfc69a2b957b9eefad60c69a9fae9acfdaa81", // this hash obtained when ran this test in main branch
)
s.Require().NoError(err)

Expand All @@ -329,7 +329,7 @@ func (s *KeeperTestSuite) TestDstRedelegationsMigrationToColls() {
err := s.stakingKeeper.RedelegationsByValDst.Set(s.ctx, collections.Join3(valAddrs[i+1].Bytes(), addrs[i].Bytes(), valAddrs[i].Bytes()), []byte{})
s.Require().NoError(err)
},
"4beb77994beff3c8ad9cecca9ee3a74fb551356250f0b8bd3936c4e4f506443b",
"1b7687449a83f8176a60aeced7bcfc69a2b957b9eefad60c69a9fae9acfdaa81",
)

s.Require().NoError(err)
Expand Down Expand Up @@ -360,7 +360,7 @@ func (s *KeeperTestSuite) TestUnbondingDelegationsMigrationToColls() {
s.ctx.KVStore(s.key).Set(getUBDKey(delAddrs[i], valAddrs[i]), bz)
s.ctx.KVStore(s.key).Set(getUBDByValIndexKey(delAddrs[i], valAddrs[i]), []byte{})
},
"d03ca412f3f6849b5148a2ca49ac2555f65f90b7fab6a289575ed337f15c0f4b",
"70454ad98368368aaff32d207a7a115fba49133ecf2a225d8e3eca88c6b2324c",
)
s.Require().NoError(err)

Expand All @@ -384,7 +384,7 @@ func (s *KeeperTestSuite) TestUnbondingDelegationsMigrationToColls() {
err := s.stakingKeeper.SetUnbondingDelegation(s.ctx, ubd)
s.Require().NoError(err)
},
"d03ca412f3f6849b5148a2ca49ac2555f65f90b7fab6a289575ed337f15c0f4b",
"70454ad98368368aaff32d207a7a115fba49133ecf2a225d8e3eca88c6b2324c",
)
s.Require().NoError(err)
}
Expand All @@ -401,7 +401,7 @@ func (s *KeeperTestSuite) TestUBDQueueMigrationToColls() {
// legacy Set method
s.ctx.KVStore(s.key).Set(getUnbondingDelegationTimeKey(date), []byte{})
},
"7b8965aacc97646d6766a5a53bae397fe149d1c98fed027bea8774a18621ce6a",
"2dd1dd08ea1cc2b0a076c420e3888b218647b9409b435f75e5730b0e4f25e890",
)
s.Require().NoError(err)

Expand All @@ -414,7 +414,7 @@ func (s *KeeperTestSuite) TestUBDQueueMigrationToColls() {
err := s.stakingKeeper.SetUBDQueueTimeSlice(s.ctx, date, nil)
s.Require().NoError(err)
},
"7b8965aacc97646d6766a5a53bae397fe149d1c98fed027bea8774a18621ce6a",
"2dd1dd08ea1cc2b0a076c420e3888b218647b9409b435f75e5730b0e4f25e890",
)
s.Require().NoError(err)
}
Expand Down Expand Up @@ -448,7 +448,7 @@ func (s *KeeperTestSuite) TestValidatorsMigrationToColls() {
// legacy Set method
s.ctx.KVStore(s.key).Set(getValidatorKey(valAddrs[i]), valBz)
},
"6a8737af6309d53494a601e900832ec27763adefd7fe8ff104477d8130d7405f",
"aa495d55fb45df89fcf1d4326331bfc1244ef879764abe76f6ce2a41ccd4180d",
)
s.Require().NoError(err)

Expand All @@ -474,7 +474,7 @@ func (s *KeeperTestSuite) TestValidatorsMigrationToColls() {
err := s.stakingKeeper.SetValidator(s.ctx, val)
s.Require().NoError(err)
},
"6a8737af6309d53494a601e900832ec27763adefd7fe8ff104477d8130d7405f",
"aa495d55fb45df89fcf1d4326331bfc1244ef879764abe76f6ce2a41ccd4180d",
)
s.Require().NoError(err)
}
Expand All @@ -497,7 +497,7 @@ func (s *KeeperTestSuite) TestValidatorQueueMigrationToColls() {
// legacy Set method
s.ctx.KVStore(s.key).Set(getValidatorQueueKey(endTime, endHeight), bz)
},
"8cf5fb4def683e83ea4cc4f14d8b2abc4c6af66709ad8af391dc749e63ef7524",
"b23a5905ced2b76c46ddd0f7d39e2ed7dcc68cd81993c497ee314b2e1a158595",
)
s.Require().NoError(err)

Expand All @@ -512,7 +512,7 @@ func (s *KeeperTestSuite) TestValidatorQueueMigrationToColls() {
err := s.stakingKeeper.SetUnbondingValidatorsQueue(s.ctx, endTime, endHeight, addrs)
s.Require().NoError(err)
},
"8cf5fb4def683e83ea4cc4f14d8b2abc4c6af66709ad8af391dc749e63ef7524",
"b23a5905ced2b76c46ddd0f7d39e2ed7dcc68cd81993c497ee314b2e1a158595",
)
s.Require().NoError(err)
}
Expand Down Expand Up @@ -540,7 +540,7 @@ func (s *KeeperTestSuite) TestRedelegationQueueMigrationToColls() {
s.Require().NoError(err)
s.ctx.KVStore(s.key).Set(getRedelegationTimeKey(date), bz)
},
"de104dd19c7a72c6b0ad03d25c897313bb1473befc118952ad88e6a8726749c9",
"d6a1c46c7c5793ff7094b67252c82883aecb75c8359428a59aacd3657fa16235",
)
s.Require().NoError(err)

Expand All @@ -562,7 +562,7 @@ func (s *KeeperTestSuite) TestRedelegationQueueMigrationToColls() {
err := s.stakingKeeper.SetRedelegationQueueTimeSlice(s.ctx, date, dvvTriplets.Triplets)
s.Require().NoError(err)
},
"de104dd19c7a72c6b0ad03d25c897313bb1473befc118952ad88e6a8726749c9",
"d6a1c46c7c5793ff7094b67252c82883aecb75c8359428a59aacd3657fa16235",
)
s.Require().NoError(err)
}
Expand Down
11 changes: 10 additions & 1 deletion x/staking/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
unbondingTime = "unbonding_time"
maxValidators = "max_validators"
historicalEntries = "historical_entries"
keyRotationFee = "cons_pubkey_rotation_fee"
)

// genUnbondingTime returns randomized UnbondingTime
Expand All @@ -36,6 +37,11 @@ func getHistEntries(r *rand.Rand) uint32 {
return uint32(r.Intn(int(types.DefaultHistoricalEntries + 1)))
}

// getKeyRotationFee returns randomized keyRotationFee between 10000-1000000.
func getKeyRotationFee(r *rand.Rand) sdk.Coin {
return sdk.NewInt64Coin(sdk.DefaultBondDenom, r.Int63n(types.DefaultKeyRotationFee.Amount.Int64()-10000)+10000)
}

// RandomizedGenState generates a random GenesisState for staking
func RandomizedGenState(simState *module.SimulationState) {
// params
Expand All @@ -44,6 +50,7 @@ func RandomizedGenState(simState *module.SimulationState) {
maxVals uint32
histEntries uint32
minCommissionRate sdkmath.LegacyDec
rotationFee sdk.Coin
)

simState.AppParams.GetOrGenerate(unbondingTime, &unbondTime, simState.Rand, func(r *rand.Rand) { unbondTime = genUnbondingTime(r) })
Expand All @@ -52,10 +59,12 @@ func RandomizedGenState(simState *module.SimulationState) {

simState.AppParams.GetOrGenerate(historicalEntries, &histEntries, simState.Rand, func(r *rand.Rand) { histEntries = getHistEntries(r) })

simState.AppParams.GetOrGenerate(keyRotationFee, &histEntries, simState.Rand, func(r *rand.Rand) { rotationFee = getKeyRotationFee(r) })

// NOTE: the slashing module need to be defined after the staking module on the
// NewSimulationManager constructor for this to work
simState.UnbondTime = unbondTime
params := types.NewParams(simState.UnbondTime, maxVals, 7, histEntries, simState.BondDenom, minCommissionRate)
params := types.NewParams(simState.UnbondTime, maxVals, 7, histEntries, simState.BondDenom, minCommissionRate, rotationFee)

// validators & delegations
var (
Expand Down
6 changes: 3 additions & 3 deletions x/staking/simulation/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func TestRandomizedGenState(t *testing.T) {
require.Equal(t, "BOND_STATUS_UNBONDED", stakingGenesis.Validators[2].Status.String())
require.Equal(t, "1000", stakingGenesis.Validators[2].Tokens.String())
require.Equal(t, "1000.000000000000000000", stakingGenesis.Validators[2].DelegatorShares.String())
require.Equal(t, "0.292059246265731326", stakingGenesis.Validators[2].Commission.CommissionRates.Rate.String())
require.Equal(t, "0.330000000000000000", stakingGenesis.Validators[2].Commission.CommissionRates.MaxRate.String())
require.Equal(t, "0.038337453731274481", stakingGenesis.Validators[2].Commission.CommissionRates.MaxChangeRate.String())
require.Equal(t, "0.760000000000000000", stakingGenesis.Validators[2].Commission.CommissionRates.Rate.String())
require.Equal(t, "0.760000000000000000", stakingGenesis.Validators[2].Commission.CommissionRates.MaxRate.String())
require.Equal(t, "0.312739151653465930", stakingGenesis.Validators[2].Commission.CommissionRates.MaxChangeRate.String())
require.Equal(t, "1", stakingGenesis.Validators[2].MinSelfDelegation.String())
}

Expand Down
Loading
Loading