+8
-1
lib/api/dune
+8
-1
lib/api/dune
+8
-1
lib/crypto/dune
+8
-1
lib/crypto/dune
···
1
1
(library
2
2
(name atproto_crypto)
3
3
(public_name atproto-crypto)
4
-
(libraries atproto_multibase mirage-crypto-ec mirage-crypto-rng digestif zarith base64 atproto_json)
4
+
(libraries
5
+
atproto_multibase
6
+
mirage-crypto-ec
7
+
mirage-crypto-rng
8
+
digestif
9
+
zarith
10
+
base64
11
+
atproto_json)
5
12
(preprocess no_preprocessing))
+11
-2
lib/xrpc/dune
+11
-2
lib/xrpc/dune
···
1
1
(library
2
2
(name atproto_xrpc)
3
3
(public_name atproto-xrpc)
4
-
(libraries atproto_effects atproto_syntax atproto_lexicon atproto_json uri
5
-
mirage-crypto-rng digestif base64 cstruct unix))
4
+
(libraries
5
+
atproto_effects
6
+
atproto_syntax
7
+
atproto_lexicon
8
+
atproto_json
9
+
uri
10
+
mirage-crypto-rng
11
+
digestif
12
+
base64
13
+
cstruct
14
+
unix))
+37
-37
test/mst/debug_mst.ml
+37
-37
test/mst/debug_mst.ml
···
2
2
open Atproto_mst
3
3
open Atproto_ipld
4
4
5
-
let leaf_value = match Cid.of_string "bafyreie5cvv4h45feadgeuwhbcutmh6t2ceseocckahdoe6uat64zmz454" with
5
+
let leaf_value =
6
+
match
7
+
Cid.of_string "bafyreie5cvv4h45feadgeuwhbcutmh6t2ceseocckahdoe6uat64zmz454"
8
+
with
6
9
| Ok cid -> cid
7
10
| Error _ -> failwith "Invalid CID"
8
11
9
-
let keys = [
10
-
"A0/374913";
11
-
"B1/986427";
12
-
"C0/451630";
13
-
"E0/670489";
14
-
"F1/085263";
15
-
"G0/765327";
16
-
]
12
+
let keys =
13
+
[
14
+
"A0/374913"; "B1/986427"; "C0/451630"; "E0/670489"; "F1/085263"; "G0/765327";
15
+
]
17
16
18
17
let () =
19
18
Printf.printf "=== MST Debug ===\n\n";
20
-
19
+
21
20
(* Print key heights *)
22
21
Printf.printf "Key heights:\n";
23
-
List.iter (fun k ->
24
-
Printf.printf " %-15s -> height %d\n" k (key_height k)
25
-
) keys;
26
-
22
+
List.iter
23
+
(fun k -> Printf.printf " %-15s -> height %d\n" k (key_height k))
24
+
keys;
25
+
27
26
let store = Memory_blockstore.create () in
28
-
let module M = Make(Memory_blockstore) in
29
-
27
+
let module M = Make (Memory_blockstore) in
30
28
(* Build MST *)
31
29
let entries = List.map (fun k -> (k, leaf_value)) keys in
32
30
let root = M.of_entries store entries in
33
-
31
+
34
32
Printf.printf "\nRoot CID: %s\n" (Cid.to_string root);
35
-
Printf.printf "Expected: bafyreicraprx2xwnico4tuqir3ozsxpz46qkcpox3obf5bagicqwurghpy\n";
36
-
33
+
Printf.printf
34
+
"Expected: bafyreicraprx2xwnico4tuqir3ozsxpz46qkcpox3obf5bagicqwurghpy\n";
35
+
37
36
(* Dump the encoded node *)
38
37
let blocks = Memory_blockstore.blocks store in
39
38
Printf.printf "\n%d blocks in store:\n" (List.length blocks);
40
-
List.iter (fun (cid, data) ->
41
-
Printf.printf "\nCID: %s\n" (Cid.to_string cid);
42
-
Printf.printf " Raw bytes (%d): " (String.length data);
43
-
String.iter (fun c -> Printf.printf "%02x" (Char.code c)) data;
44
-
Printf.printf "\n";
45
-
match decode_node_raw data with
46
-
| Ok node ->
47
-
Printf.printf " Left: %s\n"
48
-
(match node.l with Some c -> Cid.to_string c | None -> "None");
49
-
Printf.printf " Entries (%d):\n" (List.length node.e);
50
-
List.iter (fun e ->
51
-
Printf.printf " p=%d k=%S v=%s t=%s\n"
52
-
e.p e.k (Cid.to_string e.v)
53
-
(match e.t with Some c -> Cid.to_string c | None -> "None")
54
-
) node.e
55
-
| Error (`Decode_error msg) ->
56
-
Printf.printf " DECODE ERROR: %s\n" msg
57
-
) blocks
39
+
List.iter
40
+
(fun (cid, data) ->
41
+
Printf.printf "\nCID: %s\n" (Cid.to_string cid);
42
+
Printf.printf " Raw bytes (%d): " (String.length data);
43
+
String.iter (fun c -> Printf.printf "%02x" (Char.code c)) data;
44
+
Printf.printf "\n";
45
+
match decode_node_raw data with
46
+
| Ok node ->
47
+
Printf.printf " Left: %s\n"
48
+
(match node.l with Some c -> Cid.to_string c | None -> "None");
49
+
Printf.printf " Entries (%d):\n" (List.length node.e);
50
+
List.iter
51
+
(fun e ->
52
+
Printf.printf " p=%d k=%S v=%s t=%s\n" e.p e.k
53
+
(Cid.to_string e.v)
54
+
(match e.t with Some c -> Cid.to_string c | None -> "None"))
55
+
node.e
56
+
| Error (`Decode_error msg) -> Printf.printf " DECODE ERROR: %s\n" msg)
57
+
blocks
+8
-1
test/repo/dune
+8
-1
test/repo/dune
···
1
1
(test
2
2
(name test_repo)
3
3
(package atproto-repo)
4
-
(libraries atproto-repo atproto-crypto atproto-ipld atproto-mst atproto-syntax mirage-crypto-rng.unix alcotest))
4
+
(libraries
5
+
atproto-repo
6
+
atproto-crypto
7
+
atproto-ipld
8
+
atproto-mst
9
+
atproto-syntax
10
+
mirage-crypto-rng.unix
11
+
alcotest))