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

Conversation

javiersuweijie
Copy link
Contributor

@javiersuweijie javiersuweijie commented May 9, 2023

Description

Closes: #15879

When running x/staking simulations, it is assumed that all delegators are EOA accounts with a private key. Staking module allows cosmwasm contracts and other modules as delegators so running the simulation when another module is the delegator will fail with

delegation addr: cosmos1srd5yxrg346qd7mne893gy3g43elh2sw7lz0s3 does not exist in simulation accounts

Removed the check in simulation to allow non-EOA accounts to stake.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@@ -394,7 +394,7 @@ func SimulateMsgUndelegate(
}
// if simaccount.PrivKey == nil, delegation address does not exist in accs. Return error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update this comment and explain the reasoning of why an error isn't returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. You are right, the comment there needs to be updated. Sent a fix for review.

@javiersuweijie javiersuweijie force-pushed the fix/15879/allow-non-eoa-staking-sim branch from 172d50c to 7c71da5 Compare May 11, 2023 02:24
@javiersuweijie
Copy link
Contributor Author

Rebased to include merge conflicts in changelog

@julienrbrt julienrbrt added the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label May 11, 2023
@julienrbrt julienrbrt added this pull request to the merge queue May 12, 2023
Merged via the queue into cosmos:main with commit ddf51cc May 12, 2023
mergify bot pushed a commit that referenced this pull request May 12, 2023
Co-authored-by: Marko <marbar3778@yahoo.com>
(cherry picked from commit ddf51cc)

# Conflicts:
#	CHANGELOG.md
#	x/staking/simulation/operations.go
tac0turtle pushed a commit that referenced this pull request May 12, 2023
…16130)

Co-authored-by: Javier Su <javier.su.weijie@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
roy-dydx pushed a commit to dydxprotocol/cosmos-sdk that referenced this pull request Jul 11, 2023
…6068) (cosmos#16130)

Co-authored-by: Javier Su <javier.su.weijie@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
kakysha pushed a commit to InjectiveLabs/cosmos-sdk that referenced this pull request Aug 15, 2023
…6068) (cosmos#16130)

Co-authored-by: Javier Su <javier.su.weijie@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release C:Simulations C:x/staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: x/staking simulation operations assumes all delegators are EOA accounts
3 participants