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: better conversion error handling in block_hash_ref #5870

Merged
merged 4 commits into from
Dec 28, 2023

Conversation

tcoratger
Copy link
Contributor

@tcoratger tcoratger commented Dec 27, 2023

Related to #5864 (review)

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this still panics, no?

@tcoratger
Copy link
Contributor Author

tcoratger commented Dec 27, 2023

this still panics, no?

True, was thinking wrong, this is better now no @mattsse ?

@tcoratger tcoratger changed the title fix: use uint uint_try_to method with error handling in block_hash_ref fix: better conversion error handling in block_hash_ref Dec 27, 2023
crates/interfaces/src/provider.rs Outdated Show resolved Hide resolved
Comment on lines 116 to 120
// Attempt to convert U256 to u64
let block_number = match number.try_into() {
Ok(value) => value,
Err(_) => return Err(Self::Error::ConversionError(number)),
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

wasn't there another case of try_into?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just found another one in the same file which is fixed now. I searched the rest of the codebase and couldn't find any others.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

pending @DaniPopes

crates/interfaces/src/provider.rs Outdated Show resolved Hide resolved
@mattsse mattsse added the C-debt Refactor of code section that is hard to understand or maintain label Dec 28, 2023
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
@DaniPopes DaniPopes added this pull request to the merge queue Dec 28, 2023
Merged via the queue into paradigmxyz:main with commit 365acf0 Dec 28, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants