alloy-rs / alloy

Transports, Middleware, and Networks for the Alloy project
https://alloy.rs
Apache License 2.0
652 stars 234 forks source link

fix: ensure `max_fee_per_blob_gas` field handles `Some(0)` gracefully #1389

Closed zerosnacks closed 1 month ago

zerosnacks commented 1 month ago

Motivation

Closes: https://github.com/alloy-rs/alloy/issues/1371

Solution

Related Foundry PR: https://github.com/foundry-rs/foundry/pull/8963 that depends on this implementation

If max_fee_per_blob_gas is Some(0) or None we set it to a valid value next_block_blob_fee().

PR Checklist

zerosnacks commented 1 month ago

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 Some(0) rather than None that would previously then skip the filler.