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: handle underflow error #322

Merged
merged 1 commit into from
Mar 25, 2024
Merged

fix: handle underflow error #322

merged 1 commit into from
Mar 25, 2024

Conversation

pete-eiger
Copy link
Contributor

Description

The line let message_age = Utc::now().timestamp() as u64 - self.nonce; was panicking if the message nonce is "from the future", this update handles that case by returning Err and skipping the message.

Issue link (if applicable)

graphops/subgraph-radio#135

@pete-eiger pete-eiger requested a review from hopeyen March 22, 2024 09:14
Copy link
Collaborator

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

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

That's so weird, why would a message come from the future?

Alternatively if timestamp can be typed as u64, it might be cleaner to convert self.nonce to i64 when subtracting since there's the 0..LIMIT check. other than that, looks good!

@pete-eiger pete-eiger merged commit 18ea61e into dev Mar 25, 2024
7 checks passed
@pete-eiger pete-eiger deleted the petko/fix-panic branch March 25, 2024 08:20
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