-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design mithril-common
split & re-organization in repository
#2175
Comments
Current state overviewTip The graphs have been generated using cargo module. Note For all generated graph, their code have been edited to remove a Top modules inter-dependenciesGraph codeCommandNote: Since the
Generated graphvizdigraph {
graph [
label="mithril_common",
labelloc=t,
pad=0.4,
// Consider rendering the graph using a different layout algorithm, such as:
// [dot, neato, twopi, circo, fdp, sfdp]
layout=neato,
overlap=false,
splines="line",
rankdir=LR,
fontname="Helvetica",
fontsize="36",
];
node [
fontname="monospace",
fontsize="10",
shape="record",
style="filled",
];
edge [
fontname="monospace",
fontsize="10",
];
"mithril_common::api_version" [label="pub mod|api_version", fillcolor="#81c169"]; // "mod" node
"mithril_common::cardano_block_scanner" [label="pub mod|cardano_block_scanner", fillcolor="#81c169"]; // "mod" node
"mithril_common::cardano_transactions_preloader" [label="pub mod|cardano_transactions_preloader", fillcolor="#81c169"]; // "mod" node
"mithril_common::certificate_chain" [label="pub mod|certificate_chain", fillcolor="#81c169"]; // "mod" node
"mithril_common::chain_observer" [label="pub mod|chain_observer", fillcolor="#81c169"]; // "mod" node
"mithril_common::chain_reader" [label="pub mod|chain_reader", fillcolor="#81c169"]; // "mod" node
"mithril_common::crypto_helper" [label="pub mod|crypto_helper", fillcolor="#81c169"]; // "mod" node
"mithril_common::digesters" [label="pub mod|digesters", fillcolor="#81c169"]; // "mod" node
"mithril_common::entities" [label="pub mod|entities", fillcolor="#81c169"]; // "mod" node
"mithril_common::era" [label="pub mod|era", fillcolor="#81c169"]; // "mod" node
"mithril_common::logging" [label="pub mod|logging", fillcolor="#81c169"]; // "mod" node
"mithril_common::messages" [label="pub mod|messages", fillcolor="#81c169"]; // "mod" node
"mithril_common::protocol" [label="pub mod|protocol", fillcolor="#81c169"]; // "mod" node
"mithril_common::resource_pool" [label="pub mod|resource_pool", fillcolor="#81c169"]; // "mod" node
"mithril_common::signable_builder" [label="pub mod|signable_builder", fillcolor="#81c169"]; // "mod" node
"mithril_common::signed_entity_type_lock" [label="pub mod|signed_entity_type_lock", fillcolor="#81c169"]; // "mod" node
"mithril_common::ticker_service" [label="pub(crate) mod|ticker_service", fillcolor="#f8c04c"]; // "mod" node
"mithril_common::api_version" -> "mithril_common::era" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_block_scanner" -> "mithril_common::chain_reader" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_block_scanner" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_block_scanner" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_transactions_preloader" -> "mithril_common::chain_observer" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_transactions_preloader" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_transactions_preloader" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::cardano_transactions_preloader" -> "mithril_common::signed_entity_type_lock" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::certificate_chain" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::certificate_chain" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::certificate_chain" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::certificate_chain" -> "mithril_common::protocol" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::chain_observer" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::chain_observer" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::chain_reader" -> "mithril_common::cardano_block_scanner" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::chain_reader" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::chain_reader" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::crypto_helper" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::crypto_helper" -> "mithril_common::resource_pool" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::digesters" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::digesters" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::digesters" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::entities" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::entities" -> "mithril_common::messages" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::entities" -> "mithril_common::protocol" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::entities" -> "mithril_common::signable_builder" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::era" -> "mithril_common::chain_observer" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::era" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::era" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::messages" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::messages" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::messages" -> "mithril_common::era" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::protocol" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::protocol" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::signable_builder" -> "mithril_common::crypto_helper" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::signable_builder" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::signable_builder" -> "mithril_common::era" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::signable_builder" -> "mithril_common::logging" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::ticker_service" -> "mithril_common::chain_observer" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::ticker_service" -> "mithril_common::digesters" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"mithril_common::ticker_service" -> "mithril_common::entities" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
} Modules analysissigned_entity_type_lockDependency of:
Nothing depends on it and it don't depends on anything either, it could be easily extracted. certificate_chainDependency of: Nothing
Api versionDependency of: Nothing
LoggingDependency of:
Resource poolDependency of:
The crypto helper only need them to implement the EraDependency of:
This module consist of two parts: one part to check the current era and one to read them from different providers. The read part is the one that needs the dependency to Chain observerDependency of:
Signable builderDependency of:
Ticker serviceDependency of: Nothing
This ProtocolDependency of:
Cardano block scannerDependency of:
Warning The dependency to Chain readerDependency of:
MessagesDependency of:
Crypto helperDependency of:
EntitiesDependency of:
Warning All of those dependencies are circular The |
Split proposalsCriteriaAt minimum a split must:
Additional, but conflicting, criteria:
Preliminary workRemoval of the
|
Complementary proposal: extra domain splittingNote This is based on the "Alternative Proposal" in the previous post. The It would make our code more readable, for us or auditors, if redesign what would be remaining in the "protocol" crate by domain. We could either keep the resulting structure in the "protocol" crate or extract them to dedicated crates. Domains proposalNote All names are tentative ---
config:
nodeAlignment: "left"
---
flowchart BT
beacon["`
**beacon**
epoch
block_number
block_range
cardano_chain_point
cardano_db_beacon
slot_number
time_point
signed_entity_config?
`"]
certificate["`
**certificate**
certificate_chain
genesis
entities::certificate
entities::certificate_metadata
entities::signed_entity_type
`"]
signable["`
**signable**
signable_builder
entities/signed_entity
entities/cardano_database
entities/cardano_stake_distribution
entities/cardano_transactions_snapshot
entities/mithril_stake_distribution
entities/snapshot
`"]
signer["`
**signer/protocol**
multi_signer
single_signer
signer_builder
key_certification
entities/signer
entities/single_signature
entities/protocol_message
`"]
cardano["`
**cardano**
codec
cold_key
opcert
`"]
merkle_tree["`
**merkle_tree**
merkle_tree
merkle_map
`"]
signer --> beacon & cardano
certificate --> beacon & signer
signable --> certificate & cardano & merkle_tree & signer
|
Why
In order to reduce build times, binary sizes and number of features, and also to provide more structured libraries, we want to split the
mithril-common
crate in sub-crates.What
Propose a split for the
mithril-common
crate and a plan of deployment.How
mithril-common
into sub-crates (mention responsibility of the new sub-crate, propose names and locations in the repository -internal, root, ...-)The text was updated successfully, but these errors were encountered: