Restructure codebase for a module-based separation of concerns #2111
Labels
modularization
Part of Namada's modularization effort
pre-mainnet
Must happen before mainnet.
prio:medium
refactor / code quality
At the moment, we split the codebase into separate directories and sub-packages based on technical aspects:
apps/
includes CLI code, wallet code, and a bunch of ABCI handling codecore/
includes types, storage layouts, and some miscellaneous state machine logicethereum-bridge/
contains a bunch of Ethereum bridge-related codeproof-of-stake/
contains a bunch of proof-of-stake related codesdk/
contains the SDK code (client code)shared/
contains validity predicate logic, miscellaneous types and events logic, some protocol structure, and some WASM VP wrapper functionstx_prelude
,vp_prelude
, andvm_env
contain some WASM standard library code (as far as I can tell)At least personally, I find this separation somewhat confusing, for a few reasons:
I propose for discussion a rework of the structure of the codebase focused on feature modules, e.g.:
modules/
directorySome precedent for this abstraction can be found in the modules system of the Cosmos SDK, which, although it has a lot of boilerplate, implements this basic module abstraction in a reasonably clean manner.
I think that if we do this well, it could make the codebase much easier to navigate, reduce file conflicts, and make it easier to add new modules in the future. Commentary & discussion welcome.
The dependency graph from 0.31.8:
(generated with
cargo depgraph --workspace-only --dedup-transitive-deps | dot -Tpng
)Module dependencies that should be removed:
The text was updated successfully, but these errors were encountered: