You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 code
core/ includes types, storage layouts, and some miscellaneous state machine logic
ethereum-bridge/ contains a bunch of Ethereum bridge-related code
proof-of-stake/ contains a bunch of proof-of-stake related code
sdk/ contains the SDK code (client code)
shared/ contains validity predicate logic, miscellaneous types and events logic, some protocol structure, and some WASM VP wrapper functions
tx_prelude, vp_prelude, and vm_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:
it's difficult to find all of the code associated with a particular feature (e.g. governance), since it's split into many places
it's not always entirely clear whether some piece of code is in the right place, and some locations seem inconsistent
I think it probably creates more file conflicts than necessary, since code for unrelated features is not always clearly abstracted
I propose for discussion a rework of the structure of the codebase focused on feature modules, e.g.:
A module is a defined interface which must implement a bunch of functions, such as:
a validity predicate
logic to be run at the beginning/end of blocks/epochs
transaction builder logic for the sdk
commands to expose in the cli
genesis fields required
Governance/PGF, proof-of-stake, IBC, the Ethereum bridge, MASP all become modules
if convenient, these can be implemented as separate crates in some modules/ directory
all of these modules should implement this interface
no feature-specific code should live outside its module
Some 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:
trans_token <-
governance
parameters <-
governance
shielded_token
account <-
proof_of_stake
governance <-
proof_of_stake
ibc
token <-
ibc
proof_of_stake <-
ethereum_bridge
The text was updated successfully, but these errors were encountered:
Looking over our current work, particularly @tzemanovic's PRs such as #2312, I thought it would be helpful to try to define the target dependency graph of our internal structure. Based on my understanding, it should look something like this (top -> bottom = deepest dependency -> shallowest):
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:
![deps](https://private-user-images.githubusercontent.com/2284309/308912348-f163a9e9-e6b7-49d7-baaf-375d39048918.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzkwMDksIm5iZiI6MTczOTU3ODcwOSwicGF0aCI6Ii8yMjg0MzA5LzMwODkxMjM0OC1mMTYzYTllOS1lNmI3LTQ5ZDctYmFhZi0zNzVkMzkwNDg5MTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDAxODI5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2NiNzJiY2JmMzEwOGIzNDRlMzc4MzA1MWU3NmQwYTE4N2JiNzc2YjE4NTc1ZGEyMDI0NzgxMmFmZmU1MWIxMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.jy9jl_5cXP4EzXC7vhWvTsOSVBV_XtVcPBr9OZVNRPY)
(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: