Skip to content

Commit 7c88480

Browse files
committed
fixup! tapdb: add supply_tree.md documentation for supply tree
1 parent 55b8cdd commit 7c88480

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tapdb/supply_tree.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,29 @@ The persistence layer utilizes two main tables, introduced in migration `000035_
3131
erDiagram
3232
universe_supply_roots ||--o{ universe_supply_leaves : contains
3333
universe_supply_roots }|--|| mssmt_roots : uses_namespace
34-
universe_supply_leaves }|..|| mssmt_nodes : points_to_subtree_root
35-
34+
universe_supply_leaves }|--|| mssmt_nodes : points_to_subtree_root
35+
universe_supply_leaves }|--|| proof_types : has_type
36+
universe_supply_roots ||--o| asset_groups : conceptual_link
37+
3638
universe_supply_roots {
3739
INTEGER id PK
3840
VARCHAR namespace_root UK "FK(mssmt_roots.namespace)"
3941
BLOB group_key UK
4042
}
41-
43+
4244
universe_supply_leaves {
4345
INTEGER id PK
4446
BIGINT supply_root_id FK
4547
TEXT sub_tree_type "FK(proof_types.proof_type)"
4648
BLOB leaf_node_key
4749
VARCHAR leaf_node_namespace "Namespace for sub-tree in mssmt_nodes"
4850
}
49-
51+
5052
mssmt_roots {
5153
VARCHAR namespace PK
5254
BLOB root_hash "FK(mssmt_nodes.hash_key, mssmt_nodes.namespace)"
5355
}
54-
56+
5557
mssmt_nodes {
5658
BLOB hash_key PK
5759
VARCHAR namespace PK
@@ -61,19 +63,20 @@ erDiagram
6163
BLOB value
6264
BIGINT sum
6365
}
64-
66+
6567
proof_types {
6668
TEXT proof_type PK
6769
}
6870
69-
%% Conceptual Link
70-
universe_supply_roots ||--o| asset_groups : represents_group (conceptual)
7171
asset_groups {
7272
INTEGER group_id PK
7373
BLOB tweaked_group_key UK
74-
%% ... other columns
74+
BLOB tapscript_root "NULL"
75+
BIGINT internal_key_id FK "REFERENCES internal_keys(key_id)"
76+
BIGINT genesis_point_id FK "REFERENCES genesis_points(genesis_id)"
77+
INTEGER version
78+
INTEGER custom_subtree_root_id FK "REFERENCES tapscript_roots(root_id) NULL"
7579
}
76-
7780
```
7881
*Note: The link between `universe_supply_leaves` and `mssmt_nodes` is indirect. The `leaf_node_namespace` identifies the sub-tree, and the actual sub-tree root node's hash and sum are stored as the `value` and `sum` of the leaf node identified by `leaf_node_key` within the *root* tree's namespace (`universe_supply_roots.namespace_root`).*
7982

0 commit comments

Comments
 (0)