Commit 1517b34
authored
fix(sqlite-storage): fix snapshot group_id encoding mismatch and switch MLS codec to postcard (marmot-protocol#179)
* fix(sqlite-storage): use JsonCodec-serialized keys for OpenMLS snapshot queries
The snapshot/restore code used group_id.as_slice() (raw bytes) to query
OpenMLS tables, but the StorageProvider writes group_id via
JsonCodec::serialize() (JSON-encoded bytes). The WHERE clauses never
matched, so snapshots silently captured zero OpenMLS rows and rollbacks
left MLS cryptographic state untouched — creating a metadata/crypto
split-brain where MDK thought it was at epoch N but the MLS engine had
epoch N+1 keys.
Add 9 failing-then-fixed tests to mdk-sqlite-storage and 4 regression
guard tests to mdk-memory-storage that exercise the MLS StorageProvider
code path for snapshot capture and rollback.
* refactor(storage): replace JSON codec with postcard binary codec for MLS storage
Switch MLS storage serialization from serde_json to postcard, a compact
binary serde format. A 32-byte group_id now serializes to ~33 bytes
instead of ~130 bytes with JSON, reducing storage overhead and index
size for database lookups.
Rename JsonCodec to MlsCodec across the codebase. This is a breaking
change for any persisted MLS data — existing databases are incompatible
and must be recreated.
* docs: add changelog entries and fix import placement
Add changelog entries for PR marmot-protocol#179 across all four affected crates.
Move MdkStorageProvider import to module scope in memory storage tests
per STYLE.md import placement rules.1 parent d6777f7 commit 1517b34
13 files changed
Lines changed: 1193 additions & 106 deletions
File tree
- crates
- mdk-core
- src
- mdk-memory-storage
- src
- mls_storage
- mdk-sqlite-storage
- src
- mls_storage
- mdk-storage-traits
- src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
| 532 | + | |
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
0 commit comments