Skip to content

Commit 4778c90

Browse files
committed
fixup! fixup! tapdb: add supply_commit.md documentation
1 parent aaf4a18 commit 4778c90

File tree

1 file changed

+48
-42
lines changed

1 file changed

+48
-42
lines changed

tapdb/supply_commit.md

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,76 +65,82 @@ Migration `000036_asset_commit.up.sql` introduces several tables to manage the s
6565

6666
```mermaid
6767
erDiagram
68-
STATE-MACHINES ||--o{ TRANSITIONS : "has pending"
69-
STATE-MACHINES }|--|| STATES : "uses state"
70-
STATE-MACHINES }|--|| COMMITMENTS : "tracks latest"
71-
TRANSITIONS ||--o{ UPDATE-EVENTS : "includes events"
72-
TRANSITIONS }|--|| COMMITMENTS : "replaces old"
73-
TRANSITIONS }|--|| COMMITMENTS : "creates new"
74-
TRANSITIONS }|--|| CHAIN-TXNS : "uses pending tx"
75-
UPDATE-EVENTS ||--|| UPDATE-TYPES : "uses type"
76-
COMMITMENTS ||--|| CHAIN-TXNS : "included in tx"
77-
COMMITMENTS ||--|| INTERNAL-KEYS : "uses internal key"
78-
MINT-COMMITMENTS }|--|| COMMITMENTS : "spent by commit"
68+
supply_commit_state_machines ||--o{ supply_commit_transitions : "has_pending"
69+
supply_commit_state_machines }|--|| supply_commit_states : "uses_state"
70+
supply_commit_state_machines }|--|| supply_commitments : "tracks_latest"
71+
supply_commit_transitions ||--o{ supply_update_events : "includes_events"
72+
supply_commit_transitions }|--|| supply_commitments : "replaces_old"
73+
supply_commit_transitions }|--|| supply_commitments : "creates_new"
74+
supply_commit_transitions }|--|| chain_txns : "uses_pending_tx"
75+
supply_update_events ||--|| supply_commit_update_types : "uses_type"
76+
supply_commitments ||--|| chain_txns : "included_in_tx"
77+
supply_commitments ||--|| internal_keys : "uses_internal_key"
78+
mint_anchor_uni_commitments }|--|| supply_commitments : "spent_by_commit"
7979
80-
STATES {
80+
supply_commit_states {
8181
INTEGER id PK
8282
TEXT state_name UK
8383
}
8484
85-
UPDATE-TYPES {
85+
supply_commit_update_types {
8686
INTEGER id PK
87-
TEXT name UK
87+
TEXT update_type_name UK
8888
}
8989
90-
COMMITMENTS {
91-
INTEGER id PK
92-
BLOB group_key
93-
BIGINT txn_id FK
90+
supply_commitments {
91+
INTEGER commit_id PK
92+
BLOB group_key "Idx"
93+
BIGINT chain_txn_id FK
9494
INTEGER output_index
95-
BIGINT key_id FK
95+
BIGINT internal_key_id FK
9696
BLOB output_key
97+
BLOB supply_root_hash
98+
BIGINT supply_root_sum
9799
}
98100
99-
STATE-MACHINES {
101+
supply_commit_state_machines {
100102
BLOB group_key PK
101-
INTEGER state_id FK
102-
BIGINT commitment_id FK
103+
INTEGER current_state_id FK
104+
BIGINT latest_commitment_id FK
103105
}
104106
105-
TRANSITIONS {
106-
INTEGER id PK
107-
BLOB machine_key FK
108-
BIGINT old_id FK
109-
BIGINT new_id FK
110-
BIGINT txn_id FK
111-
BOOLEAN finalized
107+
supply_commit_transitions {
108+
INTEGER transition_id PK
109+
BLOB state_machine_group_key FK
110+
BIGINT old_commitment_id FK
111+
BIGINT new_commitment_id FK
112+
BIGINT pending_commit_txn_id FK
113+
BOOLEAN finalized "Default=0"
114+
TIMESTAMP creation_time
112115
}
113116
114-
UPDATE-EVENTS {
115-
INTEGER id PK
117+
supply_update_events {
118+
INTEGER event_id PK
116119
BIGINT transition_id FK
117-
INTEGER type_id FK
118-
BLOB data
120+
INTEGER update_type_id FK
121+
BLOB event_data
119122
}
120123
121-
CHAIN-TXNS {
122-
INTEGER id PK
124+
chain_txns {
125+
INTEGER txn_id PK
123126
BLOB txid UK
124127
BLOB raw_tx
125-
INTEGER height
128+
INTEGER block_height
129+
BLOB block_hash
130+
INTEGER tx_index
126131
}
127132
128-
INTERNAL-KEYS {
129-
INTEGER id PK
130-
BLOB key UK
133+
internal_keys {
134+
INTEGER key_id PK
135+
BLOB raw_key UK
131136
}
132137
133-
MINT-COMMITMENTS {
138+
mint_anchor_uni_commitments {
134139
INTEGER id PK
135140
BIGINT batch_id FK
136-
INTEGER index
137-
BLOB key
141+
INTEGER tx_output_index
142+
BLOB taproot_internal_key
143+
BLOB group_key
138144
BIGINT spent_by FK
139145
}
140146
```

0 commit comments

Comments
 (0)