Skip to content

fix(gov/simulation): return zero if max-min <= 0 for certain generated params #168

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

giunatale
Copy link
Collaborator

The failed run for PR #167 for the nondeterminism test (see https://github.com/atomone-hub/atomone/actions/runs/16119695430/job/45482097081?pr=167)

made me realize we need to avoid to have n <= 0 for Intn() (called by RandIntBetween) since this triggers a panic.
This can happen if max ends up being == min (== 0) which may very well happen for certain generated genesis parameters in simulation that have parametric maximum.

Therefore, I added an if statement that returns a sdk.ZeroDec value in case this happen, avoiding failure.

Copy link
Collaborator

@tbruyelle tbruyelle left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants