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

fix: allow non-EOA accounts to stake in simulation #16068

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/auth) [#15867](https://github.com/cosmos/cosmos-sdk/pull/15867) Support better logging for signature verification failure.
* (types/query) [#16041](https://github.com/cosmos/cosmos-sdk/pull/16041) change pagination max limit to a variable in order to be modifed by application devs
* (server) [#16061](https://github.com/cosmos/cosmos-sdk/pull/16061) add comet bootstrap command
* (x/staking) [#16068](https://github.com/cosmos/cosmos-sdk/pull/16068) Update simulation to allow non-EOA accounts to stake
* (store) [#16067](https://github.com/cosmos/cosmos-sdk/pull/16067) Add local snapshots management commands.

### State Machine Breaking
Expand Down
8 changes: 4 additions & 4 deletions x/staking/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ func SimulateMsgUndelegate(
break
}
}
// if simaccount.PrivKey == nil, delegation address does not exist in accs. Return error
// if simaccount.PrivKey == nil, delegation address does not exist in accs. However, since smart contracts and module accounts can stake, we can ignore the error
if simAccount.PrivKey == nil {
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "account private key is nil"), nil, fmt.Errorf("delegation addr: %s does not exist in simulation accounts", delAddr)
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "account private key is nil"), nil, nil
}

account := ak.GetAccount(ctx, delAddr)
Expand Down Expand Up @@ -581,9 +581,9 @@ func SimulateMsgBeginRedelegate(
}
}

// if simaccount.PrivKey == nil, delegation address does not exist in accs. Return error
// if simaccount.PrivKey == nil, delegation address does not exist in accs. However, since smart contracts and module accounts can stake, we can ignore the error
if simAccount.PrivKey == nil {
return simtypes.NoOpMsg(types.ModuleName, msgType, "account private key is nil"), nil, fmt.Errorf("delegation addr: %s does not exist in simulation accounts", delAddr)
return simtypes.NoOpMsg(types.ModuleName, msgType, "account private key is nil"), nil, nil
}

account := ak.GetAccount(ctx, delAddr)
Expand Down