@@ -65,94 +65,78 @@ Migration `000036_asset_commit.up.sql` introduces several tables to manage the s
65
65
66
66
``` mermaid
67
67
erDiagram
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
-
72
- supply_commit_transitions ||--o{ supply_update_events : includes_events
73
- supply_commit_transitions }|..|| supply_commitments : replaces_old
74
- supply_commit_transitions }|..|| supply_commitments : creates_new
75
- supply_commit_transitions }|..|| chain_txns : uses_pending_tx
76
-
77
- supply_update_events ||--|| supply_commit_update_types : uses_type
78
-
79
- supply_commitments ||--|| chain_txns : included_in_tx
80
- supply_commitments ||--|| internal_keys : uses_internal_key
81
-
82
- mint_anchor_uni_commitments }|..|| supply_commitments : spent_by_commit
83
-
84
- supply_commit_states {
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"
79
+
80
+ STATES {
85
81
INTEGER id PK
86
82
TEXT state_name UK
87
83
}
88
-
89
- supply_commit_update_types {
84
+
85
+ UPDATE-TYPES {
90
86
INTEGER id PK
91
- TEXT update_type_name UK
87
+ TEXT name UK
92
88
}
93
-
94
- supply_commitments {
95
- INTEGER commit_id PK
96
- BLOB group_key "Idx"
97
- BIGINT chain_txn_id FK "Idx"
98
- INTEGER output_index NULL
99
- BIGINT internal_key_id FK
89
+
90
+ COMMITMENTS {
91
+ INTEGER id PK
92
+ BLOB group_key
93
+ BIGINT txn_id FK
94
+ INTEGER output_index
95
+ BIGINT key_id FK
100
96
BLOB output_key
101
- BLOB block_header NULL
102
- INTEGER block_height NULL
103
- BLOB merkle_proof NULL
104
- BLOB supply_root_hash NULL
105
- BIGINT supply_root_sum NULL
106
97
}
107
-
108
- supply_commit_state_machines {
98
+
99
+ STATE-MACHINES {
109
100
BLOB group_key PK
110
- INTEGER current_state_id FK
111
- BIGINT latest_commitment_id FK NULL
101
+ INTEGER state_id FK
102
+ BIGINT commitment_id FK
112
103
}
113
-
114
- supply_commit_transitions {
115
- INTEGER transition_id PK
116
- BLOB state_machine_group_key FK "Idx"
117
- BIGINT old_commitment_id FK NULL
118
- BIGINT new_commitment_id FK NULL
119
- BIGINT pending_commit_txn_id FK NULL
120
- BOOLEAN finalized "Default=0, Unique Pending Idx"
121
- TIMESTAMP creation_time
104
+
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
122
112
}
123
-
124
- supply_update_events {
125
- INTEGER event_id PK
126
- BIGINT transition_id FK "Idx, Cascade Delete"
127
- INTEGER update_type_id FK
128
- BLOB event_data
113
+
114
+ UPDATE-EVENTS {
115
+ INTEGER id PK
116
+ BIGINT transition_id FK
117
+ INTEGER type_id FK
118
+ BLOB data
129
119
}
130
-
131
- chain_txns {
132
- INTEGER txn_id PK
120
+
121
+ CHAIN-TXNS {
122
+ INTEGER id PK
133
123
BLOB txid UK
134
124
BLOB raw_tx
135
- INTEGER block_height NULL
136
- BLOB block_hash NULL
137
- INTEGER tx_index NULL
138
- %% ... other columns
125
+ INTEGER height
139
126
}
140
-
141
- internal_keys {
142
- INTEGER key_id PK
143
- BLOB raw_key UK
144
- %% ... other columns
127
+
128
+ INTERNAL-KEYS {
129
+ INTEGER id PK
130
+ BLOB key UK
145
131
}
146
-
147
- mint_anchor_uni_commitments {
132
+
133
+ MINT-COMMITMENTS {
148
134
INTEGER id PK
149
135
BIGINT batch_id FK
150
- INTEGER tx_output_index
151
- BLOB taproot_internal_key NULL
152
- BLOB group_key NULL
153
- BIGINT spent_by FK NULL "REFERENCES supply_commitments(commit_id)"
136
+ INTEGER index
137
+ BLOB key
138
+ BIGINT spent_by FK
154
139
}
155
-
156
140
```
157
141
158
142
## State Machine Persistence Logic
0 commit comments