-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: Update ctx BlockTime for simulations #10467
fix: Update ctx BlockTime for simulations #10467
Conversation
This is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me, as it only affects the CheckTx state
using |
@alexanderbez I would prefer to make the change here instead of in |
…d-figure/cosmos-sdk into update_ctx_time_for_simulations
@alexanderbez I updated the way we create the genesis time to not be able to be so far into the future (it can still be up to 200 years from now) which also fixed this problem. Would you be okay with that solution? Thanks for your feedback on this! |
…_time_for_simulations
…d-figure/cosmos-sdk into update_ctx_time_for_simulations
…d-figure/cosmos-sdk into update_ctx_time_for_simulations
@alexanderbez I had to make a minor change to fix tests that required timestamps to be in the future and consistent results based on the random seed. Could you take a look at those changes when you have a chance? This should be ready for merge. |
@alexanderbez @AmauryM can this branch be merged? |
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description When running simulation tests with wasmd I am running into this error: https://github.com/CosmWasm/wasmd/blob/14e58bfa81ea2ade0ff00ebd067ac0bc75e37cf8/x/wasm/types/types.go#L258 This is because when we are running in simulation mode we randomly create a date before the year 9999. However, if a date is after the year 2262 `UnixNano` will overflow and possibly return a negative number. To fix this I updated how we set the random genesis start time to be between the epoch and 200 years from now which means this error won't show itself again for another 40+ years. Closes: cosmos#10466 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### 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... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
Description
When running simulation tests with wasmd I am running into this error: https://github.com/CosmWasm/wasmd/blob/14e58bfa81ea2ade0ff00ebd067ac0bc75e37cf8/x/wasm/types/types.go#L258
This is because when we are running in simulation mode we randomly create a date before the year 9999. However, if a date is after the year 2262
UnixNano
will overflow and possibly return a negative number. To fix this I updated how we set the random genesis start time to be between the epoch and 200 years from now which means this error won't show itself again for another 40+ years.Closes: #10466
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change