-
Notifications
You must be signed in to change notification settings - Fork 49
helper: add and use cast
module
#264
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
Conversation
let body_len = head | ||
.size | ||
.try_into() | ||
.map_err(|_| BucketError::BucketExceededMaxSize)?; | ||
let body_len = u64_to_usize(head.size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know there's a max bucket size but I'm pretty sure this isn't that - it would have allowed u64::MAX
before since this is u64::try_into -> usize
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this was for 32-bit targets, size
is a field sent over the network so we can't panic here
LevinCommand::GetTxPoolCompliment => 1024 * 1024 * 4, // 4 MB | ||
|
||
LevinCommand::Unknown(_) => usize::MAX.try_into().unwrap_or(u64::MAX), | ||
LevinCommand::Unknown(_) => u64::MAX, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a cast but if we are only supporting 64-bit this is always u64::MAX
.
What
Adds a
cuprate_helper::cast
module and uses it throughout the codebase.Closes #167.