Parity-ethereum: Split ethcore crate up into multiple parts

Created on 4 Nov 2016  ·  4Comments  ·  Source: openethereum/parity-ethereum

Stuff like blockchain, client, snapshot, common types, executive/externalities can basically all be their own crates.

F8-enhancement 🎊 M4-core ⛓ Q7-involved 💪 Z3-stale 🍃

Most helpful comment

Hi @rphmeier .
I want to take a crack at this, but I am hitting issues.
The modules in ethcore use each other, so making a crate for executive/externalities/types/snapshot or most of the modules would result in circular dependencies that cargo forbids.
I have made a matrix of dependencies per module, see https://gist.github.com/nicolasochem/6a813b2cd1af3c7e9837d3b37d6c9b75

Looking at this, it is not going to be possible to simply separate the modules by moving files around. New abstractions are needed. Is my assumption correct ?

All 4 comments

Hi @rphmeier .
I want to take a crack at this, but I am hitting issues.
The modules in ethcore use each other, so making a crate for executive/externalities/types/snapshot or most of the modules would result in circular dependencies that cargo forbids.
I have made a matrix of dependencies per module, see https://gist.github.com/nicolasochem/6a813b2cd1af3c7e9837d3b37d6c9b75

Looking at this, it is not going to be possible to simply separate the modules by moving files around. New abstractions are needed. Is my assumption correct ?

it's mostly correct. this is a fairly big job.

@nicolasochem That's right. As Gav says, making this change will probably require decent familiarity with the internal workings of Parity.

The types module is largely obsolete with the advent of procedural macros for serde derivation (we can strip out the unused IPC stuff for the time being until the codegen is rewritten as a macro). The way I'd start to take a crack at this would go something like this:

  • move all parts of the types modules back to where they largely belong.
  • break out an ethereum-core-types crate with Header, Block, and Transaction types
  • break out an engine crate which defines the engines (later on we'll split the implementations out). needs to abstract over something more general than ExecutedBlock since we want to have State processing higher up as well.
  • breaking out evm should be mostly painless.
  • ... and from there the remainder of ethcore would be client, blockchain, miner, and snapshot. Not sure of the best way to take those out just yet but they are definitely some of the most "entangled" pieces.

Btw, types in types::* are exactly collection of types that cross api boundaries between main components (sync, client, probably miner)

So it may worth splitting them into separate crate roughly as they are present now in the said module.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

famfamfam picture famfamfam  ·  3Comments

vmenond picture vmenond  ·  3Comments

barakman picture barakman  ·  3Comments

gaoxiangxyz picture gaoxiangxyz  ·  3Comments

mr-older picture mr-older  ·  3Comments