paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
Apache License 2.0
3.28k stars 804 forks source link

extract Chainspec type from primitives #7929

Open mattsse opened 2 weeks ago

mattsse commented 2 weeks ago

The chainspec type bloats reth-primitives

https://github.com/paradigmxyz/reth/blob/cc4a418ddf73ae5af240b403e4b6e1d191130cee/crates/primitives/src/chain/spec.rs#L509-L517

the entire mod should be converted into its own crate

https://github.com/paradigmxyz/reth/blob/cc4a418ddf73ae5af240b403e4b6e1d191130cee/crates/primitives/src/chain/mod.rs

this type is used quite a lot, we can likely re-export this type from reth-provider or similar

guha-rahul commented 2 weeks ago

hey , so we need to transfer the ChainSpec struct and the mod.rs under crates/storage/provider/src right?

mattsse commented 2 weeks ago

should be moved to its own crate like reth-chainspec

HrithikSampson commented 2 weeks ago

Hi, should the be chainSpecBuilder be also moved accordingly

HrithikSampson commented 2 weeks ago

Can I also try this issue

guha-rahul commented 2 weeks ago

Hey @mattsse , i have extracted the 3 files in a separate crate under storage, but i am getting

error: failed to load manifest for workspace member `/home/rahul/reth/bin/reth`

Caused by:
  failed to load manifest for dependency `reth-basic-payload-builder`

Caused by:
  failed to load manifest for dependency `reth-engine-primitives`

Caused by:
  failed to load manifest for dependency `reth-chainspec`

Caused by:
  failed to load manifest for dependency `reth-primitives`

Caused by:
  failed to parse manifest at `/home/rahul/reth/crates/primitives/Cargo.toml`

Caused by:
  error inheriting `reth_chainspec` from workspace root manifest's `workspace.dependencies.reth_chainspec`

Caused by:
  `dependency.reth_chainspec` was not found in `workspace.dependencies`

Even tho i have reth-chainspec = { path = "crates/storage/chainspec" } under [workspace.dependencies] . Should i open a draft so that you can take a look.

mattsse commented 2 weeks ago

could you please open a pr?