Context
Making Besu more modular requires thinking about the dimensions along which those modules are divided up and separated from each other. Those separations can be categorized into two types: areas of related business logic, and areas of related software function. The former is the domain of "stuff Ethereum needs" and the later is the domain of "stuff good Java software needs". When we modularize Besu, we are looking to produce reusable, composable software components within the business logic domain.
...
Business Logic | Cross Cutting Concerns |
---|---|
|
|
Goals
- Pick relevant modules for abstraction against the goals outlined in our Modularity Design. A good consideration is the rule of threes: we should only abstract a module when we have a need for it in three contexts.
- Begin work on one abstraction
- Document approach
- Design implementation of interface or inversion of control
- Review software engineering practices with the working group
- Review code changes and implementation details with working group
- Template design work from one slice and share learnings
- Determine remaining modules (what needs new abstraction, against our goals)
- Create working group plan and divide
Proof of Concept:
Introduce Inversion of Control to implement a vertical slice of functionality. We need to find a feature that touches on a few cross-cutting concerns, but just one Bounded Context.
Nominees:
- Transaction validation stack - touches each consensus mechanism, any L2 network, MEV, block building, and more. Good candidate.
- MetricsSystem - Each time we need to expose a metric, we need to get this MetricsSystem from upper Layers and transfer it from constructor to constructor.
- Configuration management -
- Jumpdest caching. Only relevant to the EVM, but requires caching, configuration, Observability, and hashing. Plan would be to provide each of these as a dependency.
- PoA consensus mechanisms. Impact TBD.
- Transaction pool. Impact TBD.
- Merge Context. What if the Merge Coordinator and related classes could be a dagger module?
- Protocol Schedule. Impact TBD.
...