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

make context WithBlockTime() provide guarantees consistent with CometBFT block time #15057

Closed
p0mvn opened this issue Feb 17, 2023 · 0 comments · Fixed by #15124
Closed

make context WithBlockTime() provide guarantees consistent with CometBFT block time #15057

p0mvn opened this issue Feb 17, 2023 · 0 comments · Fixed by #15124

Comments

@p0mvn
Copy link
Member

p0mvn commented Feb 17, 2023

Summary

Note that CometBFT block times have nanosecond precision, rounded to the nearest 0 in UTC and stripped off of any monotonic component:
https://github.com/osmosis-labs/tendermint/blob/167fa738a379147f333b86f539bc03f597b978e5/libs/time/time.go#L17

Problem Definition

At the same time, Context.WithBlockTime() does not perform the rounding to the nearest zero and stripping away any monotonic component:
https://github.com/cosmos/cosmos-sdk/blob/v0.46.10/types/context.go#L149

The behavior is inconsistent with CometBFT

Proposal

Make WithBlockTime() consistent with CometBFT canonical time.

Improve documentation around this nuance, including:

  • a comment in the spec for WithBlockTime().
  • a comment in the spec for BlockTime()
@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Feb 17, 2023
@github-project-automation github-project-automation bot moved this to 📝 Todo in Cosmos-SDK Feb 17, 2023
@tac0turtle tac0turtle added T:Sprint and removed needs-triage Issue that needs to be triaged labels Feb 17, 2023
@likhita-809 likhita-809 self-assigned this Feb 22, 2023
@likhita-809 likhita-809 moved this from 📝 Todo to 💪 In Progress in Cosmos-SDK Feb 22, 2023
@github-project-automation github-project-automation bot moved this from 💪 In Progress to 👏 Done in Cosmos-SDK Feb 22, 2023
@tac0turtle tac0turtle removed this from Cosmos-SDK May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants