-
Notifications
You must be signed in to change notification settings - Fork 231
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: ensure max_fee_per_blob_gas
field handles Some(0)
gracefully
#1389
Conversation
max_fee_per_blob_gas
field handles Some(0)
gracefully
// Nothing to fill if non-eip4844 tx or `max_fee_per_blob_gas` is already set to a valid | ||
// value. | ||
if tx.blob_sidecar().is_none() | ||
|| tx.max_fee_per_blob_gas().is_some_and(|gas| gas >= BLOB_TX_MIN_BLOB_GASPRICE) |
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.
If the field is set to Some(0)
(which happens because of serialization) we force setting it to .next_block_blob_fee()
as 0 is always invalid as it is less than BLOB_TX_MIN_BLOB_GASPRICE
(1).
to: Some(address!("d8dA6BF26964aF9D7eEd9e03E53415D37aA96045").into()), | ||
sidecar: Some(sidecar), | ||
..Default::default() |
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.
Tests both cases, implicit Some(0) / None
and explicit Some(0)
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.
lgtm, this is effectively a safe guard to prevent user error, right?
It is but it mostly enables you do not define the field and rely on the filler. What happens is that the transaction is serialized as 0 as the field is required. This is then interpreted as |
…alloy-rs#1389) * max_fee_per_blob_gas with Some(0) will always fail because it is below BLOB_TX_MIN_BLOB_GASPRICE (1) * add basic EIP-4844 test without defining max_fee_per_blob_gas * test both cases, explicit Some(0) and implicit Some(0) / None * fix clippy
Motivation
Closes: #1371
Solution
Related Foundry PR: foundry-rs/foundry#8963 that depends on this implementation
If
max_fee_per_blob_gas
isSome(0)
orNone
we set it to a valid valuenext_block_blob_fee()
.PR Checklist