-
Notifications
You must be signed in to change notification settings - Fork 249
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
Numeric type audit: network, consensus, provider, rpc-types #454
Conversation
* `gas_limit` -> `u128` * `gas` -> `u128` * `gas_price` -> `u128` * `max_fee_per_blob_gas` -> `u128` * `transaction_type` -> `u8` * `max_fee_per_gas` -> `u128` * `max_priority_fee_per_gas` -> `u128` * Consequently, changed fn args and return values accordingly. * Satisfies clippy, tests will fail.
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 think all of these make sense, primitive types are preferable imo.
gas being u128 should make some operations easier but should not affect math for any call arguments etc
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.
This mostly looks good to me, I'd just like to ensure we get the TODOs taken care of and add enough tests to be 100% sure we're not breaking serde
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.
just style nit for @mattsse. several more instances that i didn't explicitly mark
@@ -29,8 +29,8 @@ pub struct TxEip2930 { | |||
/// this transaction. This is paid up-front, before any | |||
/// computation is done and may not be increased | |||
/// later; formally Tg. | |||
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::u64_hex_or_decimal"))] | |||
pub gas_limit: u64, | |||
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::u128_hex_or_decimal"))] |
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.
do any endpoints use decimal here? in other PRs we've avoided allowing decimal when nobody actually uses it
#[serde( | ||
default, | ||
skip_serializing_if = "Option::is_none", | ||
with = "alloy_serde::num::u128_hex_or_decimal_opt" |
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 question. pretty sure decimal would be illegal rpc response here? I don't mind tolerating it, but @mattsse asked for removal of decimal in other PRs
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.
+ 1 to removing decimal support
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.
makes sense, let's enforce strict quantity rules everywhere for core eth types
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.
side note, the U***
type deser DO accept decimal. so this is technically a breaking behavior change
followup work: #465 |
…#454) * num_type_audit: network, consensus, provider, rpc-types * `gas_limit` -> `u128` * `gas` -> `u128` * `gas_price` -> `u128` * `max_fee_per_blob_gas` -> `u128` * `transaction_type` -> `u8` * `max_fee_per_gas` -> `u128` * `max_priority_fee_per_gas` -> `u128` * Consequently, changed fn args and return values accordingly. * Satisfies clippy, tests will fail. * fix(rpc-type): transaction requests tests * fix(rpc-types): tests - transaction type * add u128_hex_or_decimal_opt serde * fix(providers): provider::tests * fix(providers): layers::gas::tests * fix: docs ci * fix(provider): estimate_gas should return u128 * add(serde): unit test for u128_hex_or_decimal_opt * fix(rpc-types, provider): use primitives in FeeHistory and its related methods * add u128_vec serde methods * ci nits * nit
Motivation
Ref #433
Solution
gas_limit
->u128
gas
->u128
gas_price
->u128
max_fee_per_blob_gas
->u128
transaction_type
->u8
max_fee_per_gas
->u128
max_priority_fee_per_gas
->u128
PR Checklist