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 casting db type as nullable rather than optional #474

Merged
merged 2 commits into from
Mar 14, 2025

Conversation

JonoPrest
Copy link
Collaborator

Unfortunately the bug was an indexer casting latest_processed_block to option type when it was nullable.

It then failed the switch case on option and called the prometheus gauge function with a null value.

@JonoPrest JonoPrest requested a review from DZakh March 13, 2025 14:36
@as("first_event_block_number") firstEventBlockNumber: option<int>,
@as("latest_processed_block") latestProcessedBlock: option<int>,
@as("num_events_processed") numEventsProcessed: option<int>,
@as("end_block") endBlock: Js.Nullable.t<int>,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be Js.Null.t instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It could be but I didn't test, just based on the error message so I'm worried if it's possible to get undefined as well 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Happy to use Js.Null.t though if I'm being silly

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine. But I'd like to ask to leave a comment that it's probably Null and we use Nullable only because we didn't confirm it yet. So in the future we don't have hard assumptions that there's an undefined incoming

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@DZakh done 🙏🏼

@JonoPrest JonoPrest merged commit 90f866e into main Mar 14, 2025
1 check passed
@JonoPrest JonoPrest deleted the jp/fix-chain-metadata-startup branch March 14, 2025 08:05
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