paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.94k stars 1.18k forks source link

Improve BlockInput API #8070

Open mattsse opened 6 months ago

mattsse commented 6 months ago

Describe the feature

ref https://github.com/paradigmxyz/reth/pull/7798#discussion_r1588880617

BlockInput is currently used as From<&Block, ttd) ttd validation is no longer required and we need support to omit this from the API.

this can be solved with an input type and a conversion that takes pre/post merge into account

Additional context

No response

nkysg commented 2 months ago

BlockInput is currently used as From<&Block, ttd) ttd validation is no longer required and we need support to omit this from the API.

I see different ttd value in code base. Do these codes use wrongly, just using U256::Zero is ok? So we can omit ttd from the API. @mattsse

https://github.com/paradigmxyz/reth/blob/c5a1c0e131b8cbe11e2685189037201c866ac91e/crates/consensus/auto-seal/src/lib.rs#L379

https://github.com/paradigmxyz/reth/blob/c5a1c0e131b8cbe11e2685189037201c866ac91e/crates/blockchain-tree/src/chain.rs#L212

https://github.com/paradigmxyz/reth/blob/c5a1c0e131b8cbe11e2685189037201c866ac91e/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs#L139-L148

https://github.com/paradigmxyz/reth/blob/c5a1c0e131b8cbe11e2685189037201c866ac91e/crates/ethereum-forks/src/forkcondition.rs#L87-L91