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

Timestamp::nanoseconds panics when created from tendermint::Time with negative values #1306

Closed
Farhad-Shabani opened this issue Aug 7, 2024 · 0 comments · Fixed by #1307
Closed
Assignees
Labels
A: bug Admin: something isn't working
Milestone

Comments

@Farhad-Shabani
Copy link
Member

Summary

The Timestamp::nanoseconds() method returns a u64 value, assuming that a Timestamp with a negative UNIX timestamp is never constructed. While Timestamp's own methods prevent this, a Timestamp can still be created from tendermint::Time.
The tendermint::Time struct can be constructed using the from_unix_timestamp method, which accepts an i64 for seconds. This allows negative values to be passed. As a result, Timestamp::nanoseconds() can panic when created from a tendermint::Time with negative values.

Version

<= v0.53.0

@Farhad-Shabani Farhad-Shabani added the A: bug Admin: something isn't working label Aug 7, 2024
@Farhad-Shabani Farhad-Shabani added this to the 0.54.0 milestone Aug 7, 2024
@Farhad-Shabani Farhad-Shabani self-assigned this Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Admin: something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant