|
| 1 | +# Dependencies |
| 2 | + |
| 3 | +The main Rust SRI stack is split across two monorepos: |
| 4 | +- [`sv2-apps`](https://github.com/stratum-mining/sv2-apps): high-level application crates |
| 5 | +- [`stratum`](https://github.com/stratum-mining/stratum): low-level foundational crates |
| 6 | + |
| 7 | +All crates across these two repositories follow a well-defined dependency hierarchy: |
| 8 | + |
| 9 | +```mermaid |
| 10 | +%%{init: { |
| 11 | + 'theme': 'base', |
| 12 | + 'themeVariables': { |
| 13 | + 'background': '#0b1220', |
| 14 | + 'primaryColor': '#111827', |
| 15 | + 'primaryTextColor': '#f8fafc', |
| 16 | + 'primaryBorderColor': '#e2e8f0', |
| 17 | + 'lineColor': '#93c5fd', |
| 18 | + 'secondaryColor': '#0f172a', |
| 19 | + 'tertiaryColor': '#111827', |
| 20 | + 'clusterBkg': '#1f2937', |
| 21 | + 'clusterBorder': '#94a3b8', |
| 22 | + 'edgeLabelBackground': '#0f172a' |
| 23 | + }, |
| 24 | + 'flowchart': { |
| 25 | + 'curve': 'linear', |
| 26 | + 'nodeSpacing': 55, |
| 27 | + 'rankSpacing': 95, |
| 28 | + 'padding': 12 |
| 29 | + } |
| 30 | +}}%% |
| 31 | +flowchart BT |
| 32 | + subgraph STR["stratum repo (low-level crates)"] |
| 33 | + direction BT |
| 34 | +
|
| 35 | + subgraph STR_L0["Layer 0: foundations"] |
| 36 | + direction LR |
| 37 | + derive["derive_codec_sv2"] |
| 38 | + buffer["buffer_sv2"] |
| 39 | + noise["noise_sv2"] |
| 40 | + end |
| 41 | +
|
| 42 | + subgraph STR_L1["Layer 1: wire primitives"] |
| 43 | + direction LR |
| 44 | + binary["binary_sv2"] |
| 45 | + framing["framing_sv2"] |
| 46 | + sv1["sv1_api"] |
| 47 | + end |
| 48 | +
|
| 49 | + subgraph STR_L2["Layer 2: protocol messages"] |
| 50 | + direction LR |
| 51 | + common["common_messages_sv2"] |
| 52 | + job["job_declaration_sv2"] |
| 53 | + mining["mining_sv2"] |
| 54 | + template["template_distribution_sv2"] |
| 55 | + ext["extensions_sv2"] |
| 56 | + end |
| 57 | +
|
| 58 | + subgraph STR_L3["Layer 3: composition"] |
| 59 | + direction LR |
| 60 | + codec["codec_sv2"] |
| 61 | + channels["channels_sv2"] |
| 62 | + parsers["parsers_sv2"] |
| 63 | + translation["stratum_translation"] |
| 64 | + end |
| 65 | +
|
| 66 | + subgraph STR_L4["Layer 4: handlers"] |
| 67 | + direction LR |
| 68 | + handlers["handlers_sv2"] |
| 69 | + end |
| 70 | +
|
| 71 | + subgraph STR_L5["Layer 5: facade"] |
| 72 | + direction LR |
| 73 | + core["stratum-core"] |
| 74 | + end |
| 75 | + end |
| 76 | +
|
| 77 | + subgraph APPS["sv2-apps repo (application crates)"] |
| 78 | + direction BT |
| 79 | +
|
| 80 | + subgraph APPS_L0["Layer A0: shared libraries"] |
| 81 | + direction LR |
| 82 | + sapps["stratum-apps"] |
| 83 | + bcsv2["bitcoin_core_sv2"] |
| 84 | + end |
| 85 | +
|
| 86 | + subgraph APPS_L1["Layer A1: app crates"] |
| 87 | + direction LR |
| 88 | + jdc["jd_client_sv2"] |
| 89 | + tr["translator_sv2"] |
| 90 | + jds["jd_server_sv2"] |
| 91 | + pool["pool_sv2"] |
| 92 | + end |
| 93 | +
|
| 94 | + subgraph APPS_L2["Layer A2: integration"] |
| 95 | + direction LR |
| 96 | + it["integration_tests_sv2"] |
| 97 | + end |
| 98 | + end |
| 99 | +
|
| 100 | + classDef l0 fill:#0b1220,stroke:#94a3b8,stroke-width:2px,color:#e2e8f0; |
| 101 | + classDef l1 fill:#082f49,stroke:#38bdf8,stroke-width:2px,color:#e2e8f0; |
| 102 | + classDef l2 fill:#431407,stroke:#fb923c,stroke-width:2px,color:#e2e8f0; |
| 103 | + classDef l3 fill:#2e1065,stroke:#a78bfa,stroke-width:2px,color:#e2e8f0; |
| 104 | + classDef l4 fill:#052e2b,stroke:#2dd4bf,stroke-width:2px,color:#e2e8f0; |
| 105 | + classDef l5 fill:#3f3f46,stroke:#fde047,stroke-width:2.5px,color:#fefce8; |
| 106 | + classDef appsA1 fill:#052e16,stroke:#22c55e,stroke-width:2px,color:#dcfce7; |
| 107 | + classDef appsA2 fill:#083344,stroke:#14b8a6,stroke-width:2.2px,color:#ccfbf1; |
| 108 | + classDef appsCore fill:#450a0a,stroke:#f43f5e,stroke-width:2.5px,color:#ffe4e6; |
| 109 | +
|
| 110 | + class derive,buffer,noise l0; |
| 111 | + class binary,framing,sv1 l1; |
| 112 | + class common,job,mining,template,ext l2; |
| 113 | + class codec,channels,parsers,translation l3; |
| 114 | + class handlers l4; |
| 115 | + class core l5; |
| 116 | + class jdc,tr,jds,pool appsA1; |
| 117 | + class it appsA2; |
| 118 | + class sapps,bcsv2 appsCore; |
| 119 | +
|
| 120 | + style STR fill:#111827,stroke:#cbd5e1,stroke-width:1.5px |
| 121 | + style APPS fill:#111827,stroke:#cbd5e1,stroke-width:1.5px |
| 122 | + style STR_L0 fill:#0b1220,stroke:#155e75,stroke-width:1.5px |
| 123 | + style STR_L1 fill:#0b2038,stroke:#38bdf8,stroke-width:1.5px |
| 124 | + style STR_L2 fill:#2a140a,stroke:#fb923c,stroke-width:1.5px |
| 125 | + style STR_L3 fill:#241238,stroke:#a78bfa,stroke-width:1.5px |
| 126 | + style STR_L4 fill:#0d2522,stroke:#2dd4bf,stroke-width:1.5px |
| 127 | + style STR_L5 fill:#27272a,stroke:#facc15,stroke-width:1.5px |
| 128 | + style APPS_L0 fill:#2a0f16,stroke:#f43f5e,stroke-width:1.5px |
| 129 | + style APPS_L1 fill:#14532d,stroke:#22c55e,stroke-width:1.5px |
| 130 | + style APPS_L2 fill:#0f3b38,stroke:#14b8a6,stroke-width:1.6px |
| 131 | +
|
| 132 | + derive --> binary |
| 133 | + buffer -. "with_buffer_pool" .-> binary |
| 134 | + noise --> framing |
| 135 | + binary --> framing |
| 136 | + buffer -. "with_buffer_pool" .-> framing |
| 137 | + binary --> codec |
| 138 | + framing --> codec |
| 139 | + buffer --> codec |
| 140 | + noise -. "noise_sv2 feature" .-> codec |
| 141 | +
|
| 142 | + binary --> common |
| 143 | + binary --> job |
| 144 | + binary --> mining |
| 145 | + binary --> template |
| 146 | + binary --> ext |
| 147 | + binary --> sv1 |
| 148 | +
|
| 149 | + binary --> channels |
| 150 | + mining --> channels |
| 151 | + template --> channels |
| 152 | +
|
| 153 | + binary --> parsers |
| 154 | + framing --> parsers |
| 155 | + common --> parsers |
| 156 | + job --> parsers |
| 157 | + mining --> parsers |
| 158 | + template --> parsers |
| 159 | + ext --> parsers |
| 160 | +
|
| 161 | + parsers --> handlers |
| 162 | + framing --> handlers |
| 163 | + common --> handlers |
| 164 | + job --> handlers |
| 165 | + mining --> handlers |
| 166 | + template --> handlers |
| 167 | + ext --> handlers |
| 168 | + binary --> handlers |
| 169 | +
|
| 170 | + sv1 --> translation |
| 171 | + mining --> translation |
| 172 | + channels --> translation |
| 173 | + binary --> translation |
| 174 | +
|
| 175 | + binary --> core |
| 176 | + buffer --> core |
| 177 | + noise --> core |
| 178 | + framing --> core |
| 179 | + codec --> core |
| 180 | + common --> core |
| 181 | + job --> core |
| 182 | + mining --> core |
| 183 | + template --> core |
| 184 | + ext --> core |
| 185 | + channels --> core |
| 186 | + parsers --> core |
| 187 | + handlers --> core |
| 188 | + sv1 -. "sv1 feature" .-> core |
| 189 | + translation -. "translation feature" .-> core |
| 190 | +
|
| 191 | + core -. "git/cargo dep" .-> sapps |
| 192 | + core -- "git/cargo dep" --> bcsv2 |
| 193 | +
|
| 194 | + sapps --> jdc |
| 195 | + sapps --> tr |
| 196 | + sapps --> jds |
| 197 | + sapps --> pool |
| 198 | + sapps --> it |
| 199 | +
|
| 200 | + bcsv2 --> jdc |
| 201 | + bcsv2 --> jds |
| 202 | + bcsv2 --> pool |
| 203 | +
|
| 204 | + jds --> pool |
| 205 | + jdc --> it |
| 206 | + tr --> it |
| 207 | + pool --> it |
| 208 | +
|
| 209 | + linkStyle 0,1,2,3,4,14 stroke:#38bdf8,stroke-width:2.2px,opacity:0.95 |
| 210 | + linkStyle 9,10,11,12,13 stroke:#fb923c,stroke-width:2.2px,opacity:0.95 |
| 211 | + linkStyle 5,6,7,8,15,16,17,18,19,20,21,22,23,24,33,34,35,36 stroke:#a78bfa,stroke-width:2.2px,opacity:0.95 |
| 212 | + linkStyle 25,26,27,28,29,30,31,32 stroke:#2dd4bf,stroke-width:2.2px,opacity:0.95 |
| 213 | + linkStyle 37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 stroke:#fde047,stroke-width:2.3px,opacity:0.98 |
| 214 | + linkStyle 52,53 stroke:#f43f5e,stroke-width:2.4px,opacity:1 |
| 215 | + linkStyle 54,55,56,57,59,60,61,62 stroke:#22c55e,stroke-width:2.4px,opacity:1 |
| 216 | + linkStyle 58,63,64,65 stroke:#14b8a6,stroke-width:2.5px,opacity:1 |
| 217 | +
|
| 218 | + linkStyle 0,1,3,14 stroke:#38bdf8,stroke-width:4.6px,opacity:1 |
| 219 | + linkStyle 5,6,7,8,18 stroke:#a78bfa,stroke-width:4.6px,opacity:1 |
| 220 | + linkStyle 37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 stroke:#fde047,stroke-width:4.8px,opacity:1 |
| 221 | + linkStyle 52,53 stroke:#f43f5e,stroke-width:4.8px,opacity:1 |
| 222 | + linkStyle 54,55,57,62 stroke:#22c55e,stroke-width:4.6px,opacity:1 |
| 223 | +``` |
| 224 | + |
| 225 | +```mermaid |
| 226 | +flowchart TB |
| 227 | + subgraph LEG["Arrow Legend"] |
| 228 | + direction TB |
| 229 | +
|
| 230 | + subgraph L1[" "] |
| 231 | + direction LR |
| 232 | + d1(( )) -. "feature-gated dependency" .-> d2(( )) |
| 233 | + end |
| 234 | +
|
| 235 | + subgraph L2[" "] |
| 236 | + direction LR |
| 237 | + r1(( )) -- "private dependency" --> r2(( )) |
| 238 | + end |
| 239 | +
|
| 240 | + subgraph L3[" "] |
| 241 | + direction LR |
| 242 | + p1(( )) == "public dependency" ==> p2(( )) |
| 243 | + end |
| 244 | + end |
| 245 | +
|
| 246 | + style LEG fill:#0b1220,stroke:#cbd5e1,stroke-width:1.5px |
| 247 | + style L1 fill:transparent,stroke:transparent |
| 248 | + style L2 fill:transparent,stroke:transparent |
| 249 | + style L3 fill:transparent,stroke:transparent |
| 250 | +``` |
| 251 | + |
| 252 | +Please note that the diagrams above are meant to be rendered via [Mermaid](https://mermaid.ai/). Github renders it automatically. |
| 253 | +If you're reading this file somewhere else, you may need to use a Mermaid renderer to view the diagrams as intended. |
0 commit comments