reth icon indicating copy to clipboard operation
reth copied to clipboard

Feature audit: `optimism`

Open onbjerg opened this issue 1 year ago • 7 comments

Describe the feature

A lot of optimism crates have an optimism feature that enables optimism features in common crates. The optimism specific crates should just have these enabled by default, and not have them gated by an optimism feature.

For example, reth-evm-optimism has this feature which is pointless, it should just enable optimism in all the subcrates by default:

https://github.com/paradigmxyz/reth/blob/2684594ec163ec8553b633356960a9711fd2b688/crates/optimism/evm/Cargo.toml#L44-L50

We should go over all op-reth specific crates and remove the optimism feature, and instead enable the optimism feature on common subcrates by default in these

Additional context

No response

onbjerg avatar Sep 23 '24 03:09 onbjerg

can take this

just to understand, there are two parts:

  • remove optimism feature from optimism crates
  • enable optimism feature on common subcrates, wdym by common here?

0xkrane avatar Sep 23 '24 06:09 0xkrane

I mean for example in reth-evm-optimism we depend on reth-primitives. That crate has a feature called optimism which is only activated when the feature is also enabled in reth-evm-optimism. Instead, we should remove the optimism feature from reth-evm-optimism, and just enable optimism on reth-primitives directly. Does that make sense?

onbjerg avatar Sep 23 '24 06:09 onbjerg

thanks! yeah that makes sense. its what i thought you meant but just wasn't sure what common meant there. Will work on this.

0xkrane avatar Sep 23 '24 11:09 0xkrane

I mean for example in reth-evm-optimism we depend on reth-primitives. That crate has a feature called optimism which is only activated when the feature is also enabled in reth-evm-optimism. Instead, we should remove the optimism feature from reth-evm-optimism, and just enable optimism on reth-primitives directly. Does that make sense?

I don't think it's possible to do this for all op crates, because of the remaining optimism features in non-op-reth crates, but we can try complete this issue for some optimism crates

emhane avatar Sep 23 '24 15:09 emhane

What crates would this not be possible for?

onbjerg avatar Sep 23 '24 18:09 onbjerg

for example this optimism-feature related bug appears, wasn't straight forward to debug so didn't allocate more time to it previously when I tried

2024-09-24T04:10:34.667888Z ERROR reth_tasks: Critical task `payload builder service` panicked: `This should not be called in optimism mode. Use `optimism_receipts_root_slow` instead.`

you can see this error in failing test in https://github.com/paradigmxyz/reth/pull/11136

emhane avatar Sep 29 '24 20:09 emhane

If all the optimism features in the common crates are enabled, and all the optimism features are removed from the optimism specific crates, as this issue suggests, then this should be a non issue:)

onbjerg avatar Sep 30 '24 08:09 onbjerg

closing this for now because we no longer have feature gated types and the optism features we still have will go away naturally with new revm bump

mattsse avatar Jan 22 '25 20:01 mattsse