-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(types): modify types to use native u128 where possible #790
Conversation
looks good but we need to fix the unit tests and linting |
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.
Looks good just a few nits
.pre_verification_gas | ||
.uint_try_to() | ||
.context("pre verification gas out of bounds")?; | ||
let pvg: u128 = user_op.pre_verification_gas; |
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.
nit: we do not need the explicit type definition if its defined at the UO struct
.pre_verification_gas | ||
.uint_try_to() | ||
.context("pre verification gas out of bounds")?; | ||
let pvg: u128 = user_op.pre_verification_gas; |
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.
same here
* (self.pre_verification_gas | ||
+ U256::from(self.call_gas_limit) |
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.
low chance of this happening but if someone inputs an arbitrarily large value for one of these fields we may have an overflow calling function so might be a good idea to saturate.
not sure if this is checked before this but worth the safety
Proposed Changes
preVerificationGas
which onchain can be a U256. It is assumed there are no use cases where PVG needs to be > u128. We we're already relying on a U256 -> u128 conversion for gas limit calculation anyway.