alloy-rs / alloy

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

consensus: make `Header` `nonce` u64 #1385

Open tcoratger opened 1 month ago

tcoratger commented 1 month ago

Component

consensus, eips, genesis

Describe the feature you would like

At the moment, the nonce field in Header consensus struct is B64:

https://github.com/alloy-rs/alloy/blob/e01492a7ea88e13bcfddb357ade539fc5672baad/crates/consensus/src/header.rs#L77

To match the definition we expect in reth and other repos:

https://github.com/paradigmxyz/reth/blob/3a255a1cabd1f19399b42c1fe9bdcc130ac61c2e/crates/storage/codecs/src/alloy/header.rs#L30

it would be nice to make it u64, would you agree @mattsse ?

Additional context

No response

Rjected commented 1 month ago

Just noting that to do this correctly, we also need to bring back the Encodable / Decodable implementations from before reth switched to alloy types, otherwise this would break RLP encoding.

mattsse commented 1 month ago

technically this is 8bytes, I think we can keep B64, dont think this type is used that often and we can add a helper that converts this to u64