@mikeargento/bitgraph-verify 1.24.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/__tests__/carrier2.test.js +1 -1
- package/dist/__tests__/carrier2.test.js.map +1 -1
- package/dist/__tests__/carrier5.test.d.ts +9 -0
- package/dist/__tests__/carrier5.test.d.ts.map +1 -0
- package/dist/__tests__/carrier5.test.js +62 -0
- package/dist/__tests__/carrier5.test.js.map +1 -0
- package/dist/carrier-verify.d.ts +1 -1
- package/dist/carrier-verify.d.ts.map +1 -1
- package/dist/carrier-verify.js +5 -1
- package/dist/carrier-verify.js.map +1 -1
- package/dist/carrier.d.ts +10 -2
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js +20 -1
- package/dist/carrier.js.map +1 -1
- package/dist/carrier5.d.ts +24 -0
- package/dist/carrier5.d.ts.map +1 -0
- package/dist/carrier5.js +93 -0
- package/dist/carrier5.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/tree-member.d.ts +22 -0
- package/dist/tree-member.d.ts.map +1 -1
- package/dist/tree-member.js +27 -0
- package/dist/tree-member.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/carrier2.test.ts +1 -1
- package/src/__tests__/carrier5.test.ts +65 -0
- package/src/__tests__/fixtures/carrier5/ceiling.json +95 -0
- package/src/__tests__/fixtures/carrier5/proof.json +53 -0
- package/src/__tests__/fixtures/carrier5/single.txt +1 -0
- package/src/carrier-verify.ts +6 -3
- package/src/carrier.ts +19 -3
- package/src/carrier5.ts +105 -0
- package/src/index.ts +4 -0
- package/src/tree-member.ts +26 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "bitgraph-ceiling/1",
|
|
3
|
+
"proofHash": "FZ6kwMXALB2q2zg+WIswYBUL+8WlzizsC2d4XAfWQh8=",
|
|
4
|
+
"leafIndex": 0,
|
|
5
|
+
"leafCount": 1,
|
|
6
|
+
"merklePath": [],
|
|
7
|
+
"root": "0x3cf036e62b4d0ce2bc67b1b9c395dd279c6f7fcc783a0b5cf00228c891c4f81a",
|
|
8
|
+
"anchor": {
|
|
9
|
+
"chainId": 8453,
|
|
10
|
+
"writer": "0xf3972408d853c975f86351c311f4310220bbf2a3",
|
|
11
|
+
"txHash": "0x08e04797ec79ee3813266ca3e44d1ab30d88b145e6c32a29c33618df36889daf",
|
|
12
|
+
"rawTx": "0x02f8c1822105820bec830f424083a7d8c08271cd94f3972408d853c975f86351c311f4310220bbf2a380b854424743313cf036e62b4d0ce2bc67b1b9c395dd279c6f7fcc783a0b5cf00228c891c4f81a6887534b962cb57b22dbac30dfc52915580d965fdb6ae99e0da37dc2cfb7d43100000000000000100000000000000010c080a0d24304257b0da2d18265c767163578a0caa36613ffbda61bb68a8187d571f431a006fc07acf64e4729e31205f5f4a69c958d63643fecbe342af9f433295214094e",
|
|
13
|
+
"payload": "0x424743313cf036e62b4d0ce2bc67b1b9c395dd279c6f7fcc783a0b5cf00228c891c4f81a6887534b962cb57b22dbac30dfc52915580d965fdb6ae99e0da37dc2cfb7d43100000000000000100000000000000010",
|
|
14
|
+
"blockNumber": 52878658,
|
|
15
|
+
"blockHash": "0x6e1f1ee94404cdb4040ee1e2c78bb04a695138f2d5a4809535d522ada0468972",
|
|
16
|
+
"blockTimestamp": 1792546663,
|
|
17
|
+
"blockHeader": "0xf9027aa0010668d38e716cba7dccad2e5886f55649a1ebbea99b22c34b4a78cf52afd131a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a04e25ca15b3baef483711422730d65ed0d21414b27389f40cbec1b9913b1016ada0fadebde0178b033075620d07c39205c197d46d97243275d346d93c3a7da328baa006a1e8b2b4634c04658a39999064ec1b0201613f63529e7554ac975670bd0805b90100f7bb9f2b71851e7ef847386eda0bff35bd7fa47caef7a1cd6eeedeb6f83d7e5f9be9f5c7bb6a664b0ec7f9d3f29ebd7be63d9caf7e6fa3c3ee729eebfaecffe0fef8bffc9ef5d67fd6cd5cbd2d950f34d26d44187fcff2fc1a7dc7eefd779dc0fceaecbebfbec67874279fa7cdd25ede972fb803e9b64d2299d2fed77bfaafcf939c363e3d4d7abac46bbab3e762fdede27f974f3c2df84afbaab1fed5691778ee43ad2792c6d76f77f391a8eb17e7c77f3546df3aba16aef1efbf71fe4fddfa587eda7fd8cffcefcf7519dcc634d1ab757ee13dbe3bf6fe57a1bdf3bc42e8aed1f6ef1f8707f2b333cdcbaad9f713aff8b7af8bd9cf73cbf796af799fffde7480840326dd428417d784008402926612846ad817679101000000640000000500000000004c4b40a09badf4f209d44fdafef15f594feb89ee282b2740dbd6732948346af5b0f29581880000000000000000834c4b40a0138bf64cdff3f55f63751117a4ba29a851798cbc7627c2f68ee2639e37322866835fe0e080a01f90238840c2a6e1adf1cbc522620a5d24e6ecd1b781ff339de29d86d871712aa0e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
18
|
+
"txIndex": 52,
|
|
19
|
+
"txInclusionProof": [
|
|
20
|
+
"0xf90131a022a4e49f96bd981015c415945c77666854f93ff00290bc47f136b0f84dc9d42ea0e0cfb69ef887b12968fc5eb868d379ff0e736471f31785dbc437f0ee43014c2da02ddcc7c630f3202f482302b19c95f549723b20996707c4eab1898aad82f174a8a061b1acdd64abc536dddbd8e898e03067c28bcf0557dabea43c5e9887832b33f3a09bc9175805e3f802c45d6ed2fa79a55c4dc063aeaf603b672279dc54b9472b76a09304c427fc17553b11708dc21415f7c3b4013147fa12fbad8ce854861b1ad6e7a0514ccf4f76553917d6e64aa2a7b4f325dc8c48a11003b5ce8c22d82f88a90faaa00503739b6cf2b6fc1e34179098ca6f3be0338313f9418f501c4a7f2ae7a802e3a0a3cd883820a70e63b13065521c7b9c8311ba8c811785ee3bc986431629d836ca8080808080808080",
|
|
21
|
+
"0xf90211a0d8838c20f64f59309d1278716d418e82cf780993eb3e672607f5faeb17888d4aa0d8396c0fd66b8d0814f89be5d93880811de89a7c0d1fd947bb587f2906106954a094d43e1942c78951fe4681baee6ce3dab4c7176fb592f27c0ea3fd2e2d341537a05269713675ecc76af303459c0256dd70cee2ae5ffbfbbdcb1b573d98d4f8168aa0d3e771f1c5bcd6e5c4fc35a77ac54329b27a3321ea8f2d374c6392f9fb96caeda0f03e0af9da6765a8420d29173d415efff0076146bc751f4801d8e8e3c5b2cb98a052ad8b55e5b857df160f38445a9e673a8ff7424ae1d617d8430b6f167707b610a04b8665ff4234fbdc684271a818ceaeb00f5c27a2d6d6d836b1a4b2b0792183dba0c8cdc9101076dc166dc716f5303595c6ba48610aa789badad370acca4fc5cef1a085d7ab6f18f77e6080f21aeea924621496a26e1f62c7462c13f5ed866a465116a0b065d73116cf1bdf2b2b5cf777999e3020678c8cd923b3ab6225530b5ba282c0a072e0e96fe80b4570a8e2e27d5cd7fc2f0dfa0f2dd9cb156432787b7149659127a0b1006dce46b45505a7da52fa7e700fea6d0b33a44130ea8acf68c488d5f960fba05de1222a3e0ca75c55157b1ad45e4387dab0caa348c73c3b9213ef6fe6599665a0c50fbcc26c1ba310629d82e20deb984a8726974ce7ba2d507becd151a1036dcfa0940ff9ee61cbf49539f4701655b5905b2321374e3b4b22c1ea5b9cda8f9dedcf80",
|
|
22
|
+
"0xf8c720b8c402f8c1822105820bec830f424083a7d8c08271cd94f3972408d853c975f86351c311f4310220bbf2a380b854424743313cf036e62b4d0ce2bc67b1b9c395dd279c6f7fcc783a0b5cf00228c891c4f81a6887534b962cb57b22dbac30dfc52915580d965fdb6ae99e0da37dc2cfb7d43100000000000000100000000000000010c080a0d24304257b0da2d18265c767163578a0caa36613ffbda61bb68a8187d571f431a006fc07acf64e4729e31205f5f4a69c958d63643fecbe342af9f433295214094e"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"status": "safe",
|
|
26
|
+
"statusObserved": {
|
|
27
|
+
"included": "2026-10-21T01:37:43.665Z",
|
|
28
|
+
"safe": "2026-10-21T01:38:07.243Z",
|
|
29
|
+
"finalized": null
|
|
30
|
+
},
|
|
31
|
+
"floor": null,
|
|
32
|
+
"settlement": {
|
|
33
|
+
"version": "bitgraph-settlement/1",
|
|
34
|
+
"baseBlockNumber": 52878658,
|
|
35
|
+
"baseBlockHash": "0x6e1f1ee94404cdb4040ee1e2c78bb04a695138f2d5a4809535d522ada0468972",
|
|
36
|
+
"l1": {
|
|
37
|
+
"chainId": 1,
|
|
38
|
+
"txHash": "0x9cbfde345706cb66d726fdb7d60309ebea7ba97c0651f8e2076a8e8266793ade",
|
|
39
|
+
"rawTx": "0x03f9013b0183265ae884959b8f808501c0d2ae8082520894ff000000000000000000000000000000000084538080c0843b9aca00f8c6a00181df7ea9f124b913e875d66fbaa06dbd2b529d10393a17a8346bedba6f301ba00162fae0a5007f9c149bf6d53868ce7708812dfd8f97fac3fcd3d1472371c4b7a001d6c806943dacdb66b984b944f8bcefaf502dc3bdc99081c129482c67442385a0010b17127fe34515a2f79b11e78d16fa777210493f255a7b36b697f83be68c4ba0016876a37912590c9a7760b94f660a96af23e7c810f2dced99124f717e74c1f6a001f727e77651ca61fcbb7250508764b76b93833e9f4d2304cd37107ecdb2bf9180a0eb43f9f0a95fdab6bd3f2c947cb8b08491f2a18c8acef1a5eba83b545d95c4a1a007422f6a83b6c3352630f99f3975011b83966ac973700bbf33704bd756684211",
|
|
40
|
+
"blockNumber": 26237730,
|
|
41
|
+
"blockHash": "0xd94501e40511be0ba54a6d18321e78410c144d9a91e6567c3865ae4a45867702",
|
|
42
|
+
"blockTimestamp": 1792546679,
|
|
43
|
+
"blockHeader": "0xf90286a0f743b836ba769f54882200386655702cef355e916b8e5a28e9f38a1b4185c085a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944838b106fce9647bdf1e7877bf73ce8b0bad5f97a0cf7a26dc369264aa4648ca6a74fb001fb4c9ab756a24da17eff6989386d70cb7a092285538af1fcd5d7ea4b66e48c3e422ac324ed77e3c6adb5cbae8ec5de2dc1ba0afc3b7b60c5af9a10a03c3af705bacd93148ea78c47597067960c0b440ad91f6b90100feeeffff7feffffdfeff7effffebf7bfffddff7ffffdff7abffbf5ff7fffbcdffbbff7eff7ed7f9feff9ffdbdf7ffffffffff7ffffffffff9ffd7fffebf5ffdfdfdfffbff7dbcffff9ee7ffaff7d7fffbbcff777fd7effff5ffedfbfffbfffff7ff7e5fff3ff5ffeffb7fffefffbdfbfbff7f7fefdf7f77ffff6f1dff7fffefdfd7f7ffb7ff7ffff6ffffdfb4bfedfff92fdffeffbdeafbff9fffffffffd7affff7fbff7fcfaffcf9fff5fffdebeffe9ff7ef9ffffff6f7fffe7ff7fafde9ffcef3bfdbfdebfffffbfdf6f7ddffffcf6dffef3ffdffdfffe7ffbfffffefffbfffffe7ef9fddeffbfdfffffffedfffff7fdfff3fffffbfdffbfbffbeffeffffff808401905b2284039387008403931dcb846ad8177798546974616e2028746974616e6275696c6465722e78797a29a0b8d75c6324097a12a639327f6fab43e4c241669e3efca49a5acee0d9685416ad88000000000000000084023ecc82a0c4c7b90df57c937b6d023554180a0145ec6b92e7796813509d4959134246459d831e0000840a295f9ea03d2e4f4c47967da3518fc7c595aa7b56e77a3574bfac23e8ed1efcd384e9daeba0ada0321ebef3a3c2dd8ed7ed64215e4e6d363374c44e3fb32a2a44891655fc0e",
|
|
44
|
+
"txIndex": 93,
|
|
45
|
+
"txInclusionProof": [
|
|
46
|
+
"0xf90131a04c23198ef1c9d569f67d9cdfac6810e2419ccdd24128be03a66f693c2b27f0b4a01c0e1f43227ba9969f08201a18c475289a0a20b0d4ff613325c0ef3331b1b5e4a0060d053d13f001c2a64f16e2c14811b663d50ada79da13aab15dec68d462644fa0df329c40d4f2f3bb4bf1939bb46b5a8c8595c4b436c40b41ab74a6c1dbb018dfa02b86640b38144768ea6ee48d32c856c4061d9cbfe56c468da6ac0b5a56e53693a075cea7267ffb395fc3c801912848a1a663a7e5a0a63abb36849ad4c6dcd536fda0cf1b4447882f6f675efb5cf7a9b25314bd5975de04a9dcc726c3872959174925a0095d531dfc51c6feb4aea9111f4a3c6b698329540d6c0009b0de56a3742c1d2ea00631e5d6af6b4eb80dff790c7d020151eb3a1dadf42cbd8c491183c64e13e0408080808080808080",
|
|
47
|
+
"0xf90211a080924e90defcdaaa005f75c2a51e3293053308f9f3c82498deac09cf3a143abaa0b0eb0b3259f1b6aaaf4a624ccfa94a9a1419f317aaea1c30adf4270a1f9ea24ba0febdc7da7cfb2215e1245c49accc83af65d2a9b8d84815714b10658265000882a017e9fe17f4463d806939966fbea64c785140ebf237d2acbc3dce1e74b804281aa038facc15282ea27ff32f10d56aa2ded66f5b9154cbdd4b63d035b44b4b23949ba0ff53efb72433c1dbeb0444437377082b30b9f8ed382c24252b15703cef906f42a0305de1b9097202d97af76a123e59019e134734b2571704621b1549a13f00c4a2a08f1b42a83f3d2fde2e16837838e56ff6a2f411b39b63abfa6ed7503f0c6088d8a0115bdecce15c4ee8aa310810b8074f6c871ab7b2183ba5cf1bbe48dca2083404a0cc510d57fa55baec561a5832aec83fa2c6442a1289dfa4b399f834998dca9567a016d7e5c45213205d073ea2f2402c03f29d11c926126291d442b6357eba562ce8a0a920193092740051822516b257a4f1ab621d3b084211671d318bbd338f9fe2eba0132c0f8b8f8d0cd9abf630f27f54ef83cd2155c4bd634e00789c63d960f1d46ca0387b6db34d6a82745589e754139f2a1af9a8371d5354d2124705b27ba012600aa01ee6e7219dd7af06b031b696f3a41321b8c81e58eb296204859db1a2e64e67a6a092ebea689e9e1973fbf9ea001fa84474cc70d1e53bee20672c5a4a197a380e9f80",
|
|
48
|
+
"0xf9014320b9013f03f9013b0183265ae884959b8f808501c0d2ae8082520894ff000000000000000000000000000000000084538080c0843b9aca00f8c6a00181df7ea9f124b913e875d66fbaa06dbd2b529d10393a17a8346bedba6f301ba00162fae0a5007f9c149bf6d53868ce7708812dfd8f97fac3fcd3d1472371c4b7a001d6c806943dacdb66b984b944f8bcefaf502dc3bdc99081c129482c67442385a0010b17127fe34515a2f79b11e78d16fa777210493f255a7b36b697f83be68c4ba0016876a37912590c9a7760b94f660a96af23e7c810f2dced99124f717e74c1f6a001f727e77651ca61fcbb7250508764b76b93833e9f4d2304cd37107ecdb2bf9180a0eb43f9f0a95fdab6bd3f2c947cb8b08491f2a18c8acef1a5eba83b545d95c4a1a007422f6a83b6c3352630f99f3975011b83966ac973700bbf33704bd756684211"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"blobs": [
|
|
52
|
+
{
|
|
53
|
+
"versionedHash": "0x0181df7ea9f124b913e875d66fbaa06dbd2b529d10393a17a8346bedba6f301b",
|
|
54
|
+
"kzgCommitment": "0xa5538090020ae0832b095a44fc4fa62accb3d501540f15a8ff0e28d73003289655af506b9dc5b2182ea179e40659bf3d",
|
|
55
|
+
"index": 0,
|
|
56
|
+
"file": "0x0181df7ea9f124b913e875d66fbaa06dbd2b529d10393a17a8346bedba6f301b.bin"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"versionedHash": "0x0162fae0a5007f9c149bf6d53868ce7708812dfd8f97fac3fcd3d1472371c4b7",
|
|
60
|
+
"kzgCommitment": "0x87590e427c40364bc4e4047d93ccce50a644db4b1db36d4bdb339a9c79c1f0969f05728066fbeb300b951e79a4fe4109",
|
|
61
|
+
"index": 1,
|
|
62
|
+
"file": "0x0162fae0a5007f9c149bf6d53868ce7708812dfd8f97fac3fcd3d1472371c4b7.bin"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"versionedHash": "0x01d6c806943dacdb66b984b944f8bcefaf502dc3bdc99081c129482c67442385",
|
|
66
|
+
"kzgCommitment": "0x823b562f0ec334e5d60fd12e117d4974b4565f2cad2d03041ac2df25ee364f1c4f24dad162b82e38d0aaef2625b03711",
|
|
67
|
+
"index": 2,
|
|
68
|
+
"file": "0x01d6c806943dacdb66b984b944f8bcefaf502dc3bdc99081c129482c67442385.bin"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"versionedHash": "0x010b17127fe34515a2f79b11e78d16fa777210493f255a7b36b697f83be68c4b",
|
|
72
|
+
"kzgCommitment": "0xad3ed79a555cc5b00509d668599678429cd9f9004414a91b801d9239c53614857953a7f7bf660f4f95f62833ae5d31a7",
|
|
73
|
+
"index": 3,
|
|
74
|
+
"file": "0x010b17127fe34515a2f79b11e78d16fa777210493f255a7b36b697f83be68c4b.bin"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"versionedHash": "0x016876a37912590c9a7760b94f660a96af23e7c810f2dced99124f717e74c1f6",
|
|
78
|
+
"kzgCommitment": "0xac898cf557c6d16785f724c6f8e88d59a9fb46947ac695df5e0009a3e65c706ed2e3bc37821ae270aed574d8faa3e044",
|
|
79
|
+
"index": 4,
|
|
80
|
+
"file": "0x016876a37912590c9a7760b94f660a96af23e7c810f2dced99124f717e74c1f6.bin"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"channel": {
|
|
84
|
+
"id": "0x87c2d92872a6ffdd5aa981af50cb0b2f",
|
|
85
|
+
"frames": 7,
|
|
86
|
+
"compression": "brotli",
|
|
87
|
+
"firstBaseBlock": 52878639,
|
|
88
|
+
"lastBaseBlock": 52878663
|
|
89
|
+
},
|
|
90
|
+
"located": {
|
|
91
|
+
"baseTxIndex": 51,
|
|
92
|
+
"txHash": "0x08e04797ec79ee3813266ca3e44d1ab30d88b145e6c32a29c33618df36889daf"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "bitgraph/1",
|
|
3
|
+
"artifact": {
|
|
4
|
+
"hashAlg": "sha256",
|
|
5
|
+
"digestB64": "oA0/HmjgHEW/33SzNe/xgsPhg1pRIeNKZdeMT+MGbDw="
|
|
6
|
+
},
|
|
7
|
+
"commit": {
|
|
8
|
+
"nonceB64": "B9rv7Fo2kUaYD6n+/kKig6fvwC2HSq/qOzCowPf2ooY=",
|
|
9
|
+
"counter": "16",
|
|
10
|
+
"slotCounter": "15",
|
|
11
|
+
"slotHashB64": "gGb3D8ppWP38W2CFVJOgnHZ/INCkV3UWpQ4l27PIjlw=",
|
|
12
|
+
"epochId": "oHvGTWiSbQpI3UDznWAouVY326yK+8Lm7ivhAvVN3SE=",
|
|
13
|
+
"atomic": true,
|
|
14
|
+
"prevB64": "ZC02Q4pJIXEw2OzgBjRCfEREz82SFoFCNeGV87x9cfI=",
|
|
15
|
+
"chainId": "bitgraph:main"
|
|
16
|
+
},
|
|
17
|
+
"signer": {
|
|
18
|
+
"publicKeyB64": "MzXya3Kn2WOeQFpEaetweRMuDF/23195Qd7JdJxrPCU=",
|
|
19
|
+
"signatureB64": "jBh0gplVa4VCEmEritmyLm3VMGrjD9xlO517b5VyCBAN195TSffHO8rgphAFIVOTO58OwTjSJ4bIlM+EugUJCw=="
|
|
20
|
+
},
|
|
21
|
+
"environment": {
|
|
22
|
+
"enforcement": "measured-tee",
|
|
23
|
+
"measurement": "adaad0bef62292d35197ae8db19e40685229f1a1e6070a7c77a148c4ada88ee66a1ca50819eebc2017c6716a49f2692f",
|
|
24
|
+
"attestation": {
|
|
25
|
+
"format": "aws-nitro",
|
|
26
|
+
"reportB64": "hEShATgioFkRIL9pbW9kdWxlX2lkeCdpLTA2NTAyNzM0MjNmZjY3NTY3LWVuYzAxYTE1YmMxMTNiNWE5MDNmZGlnZXN0ZlNIQTM4NGl0aW1lc3RhbXAbAAABoVwbYmBkcGNyc7AAWDCtqtC+9iKS01GXro2xnkBoUinxoeYHCnx3oUjEraiO5mocpQgZ7rwgF8ZxaknyaS8BWDBLTVs2YbPvwSkgkAyA4Sbkzng8Ui3mwCoqW/evOiuTJ7hndvGI5L4cHEBKEp29pJMCWDDKyCscLu+j8QrYrh3GTPEzDxvyUHTarepFivQ7E9mAJfzjsJRgkzNKkRExtaCGItADWDD+UwK5y1gm9u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NnADBkAjA2RoJFNdFNKgSBrpD4Q9pnZkBKpnziootm3sZumrtvdVfzQ4Gq/jYC3ZczUMYnrZsCMFju/v6vVd15wjK6yrWE3BeummZCxUT2XD8zjo6E7AVy1kd4aletvr/4oQgDZ4/7VWpwdWJsaWNfa2V59ml1c2VyX2RhdGFYIBWepMDFwCwdqts4PliLMGAVC/vFpc4s7AtneFwH1kIfZW5vbmNl9v9YYGysknKyOMSuYhB1KH0mHKvcFmCVBTJSd9MFChl5tg0kxy9ni0ftm3KilQ+NWfWXVnWQcUDgixZ15ocFbHLKNdS8+UfYTjp9WlwvH5fX6WCoiTVDF/ljchept6o3BvOeog=="
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"slotAllocation": {
|
|
30
|
+
"version": "bitgraph/slot/1",
|
|
31
|
+
"nonceB64": "B9rv7Fo2kUaYD6n+/kKig6fvwC2HSq/qOzCowPf2ooY=",
|
|
32
|
+
"counter": "15",
|
|
33
|
+
"epochId": "oHvGTWiSbQpI3UDznWAouVY326yK+8Lm7ivhAvVN3SE=",
|
|
34
|
+
"publicKeyB64": "MzXya3Kn2WOeQFpEaetweRMuDF/23195Qd7JdJxrPCU=",
|
|
35
|
+
"chainId": "bitgraph:main",
|
|
36
|
+
"signatureB64": "6FcjorWPtNrvYclWV87+/oBMCNHRJBEJZrETcwKoB80RqLbUGVNbeY6fO9k1B+5QWe6z1cJXLzsovTbTYVXMAQ=="
|
|
37
|
+
},
|
|
38
|
+
"proofHash": "FZ6kwMXALB2q2zg+WIswYBUL+8WlzizsC2d4XAfWQh8=",
|
|
39
|
+
"metadata": {
|
|
40
|
+
"bitgraph-tree-member/1": {
|
|
41
|
+
"format": "bitgraph-tree-member/1",
|
|
42
|
+
"files": 2,
|
|
43
|
+
"index": 1,
|
|
44
|
+
"path": "wigPkJrKM5c2PYu0rV+7FXJE2R+HkvzrXD527qkwHdA=",
|
|
45
|
+
"rootText": "Merkle root (RFC 6962, SHA-256; each leaf is a file's SHA-256) of 2 files:\nfb0a4c0c0f6badaff393e5bb9dd46beb268bf5cb49355b024eaa58326c2f5640\n",
|
|
46
|
+
"floor": {
|
|
47
|
+
"file": "{\n \"format\": \"bitgraph-base-block/1\",\n \"chain\": \"base-mainnet\",\n \"chainId\": 8453,\n \"number\": 52878656,\n \"hash\": \"0xaab17436a76289d87c5427141bc7d85e77dab10e4d6c3a371db9ced0d4d89bc4\",\n \"timestamp\": 1792546659,\n \"note\": \"The first leaf of a BitGraph tree. Everything in the tree was bound after this Base block existed.\"\n}\n",
|
|
48
|
+
"index": 0,
|
|
49
|
+
"path": "6KIDpl13h/6D76Nj74sIn6Jff5sdruiNJD1uq3gBWNQ="
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
single file floor test 2026-10-21T01:34:02Z
|
package/src/carrier-verify.ts
CHANGED
|
@@ -55,9 +55,10 @@ import { PUBLISHED_PCR0S, publishedMeasurement } from "./measurements.js";
|
|
|
55
55
|
import { verifySettlementPointer, checkSettlementOnline, BASE_MAINNET_SETTLEMENT_PINS, type SettlementPointer, type SettlementPins } from "./settlement.js";
|
|
56
56
|
import type { BitGraphProof } from "./types.js";
|
|
57
57
|
import { sha256 } from "@noble/hashes/sha256";
|
|
58
|
+
import { verifyCarrierV5 } from "./carrier5.js";
|
|
58
59
|
import {
|
|
59
60
|
parseCarrier, checkFloorBinding, checkCeilingBinding, anchorMessageBytes,
|
|
60
|
-
verifyWitnessHeader, carrierBounds, innerDigestMatches, carrierVersionOf, CARRIER_VERSION_4,
|
|
61
|
+
verifyWitnessHeader, carrierBounds, innerDigestMatches, carrierVersionOf, CARRIER_VERSION_4, CARRIER_VERSION_5,
|
|
61
62
|
type CarrierBounds, type CarrierPayload,
|
|
62
63
|
} from "./carrier.js";
|
|
63
64
|
|
|
@@ -115,7 +116,7 @@ export interface CarrierVerifyResult {
|
|
|
115
116
|
floorTimeWithheld?: string | null;
|
|
116
117
|
/** "ok" | "none" | "corrupt" — whether the bytes carried a readable block at all. */
|
|
117
118
|
carrier: "ok" | "none" | "corrupt";
|
|
118
|
-
version: 1 | 2 | 3 | 4 | null;
|
|
119
|
+
version: 1 | 2 | 3 | 4 | 5 | null;
|
|
119
120
|
/** v4: the leaf the committed bytes are, once its path reached the signed root; null otherwise (and on v1 to v3). */
|
|
120
121
|
member?: TreeVerifyResult["member"];
|
|
121
122
|
/** v4: "content" when the bytes carry the commitment (a placed leaf), "record" when kept as is; null when the bytes were not matched or not in hand. */
|
|
@@ -169,6 +170,8 @@ function envelopeSentence(outer: Uint8Array, inner: Uint8Array, member = false):
|
|
|
169
170
|
* as not carried, and everything else is judged exactly as for a file.
|
|
170
171
|
*/
|
|
171
172
|
export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8Array | null, opts: CarrierVerifyOptions = {}): Promise<CarrierVerifyResult> {
|
|
173
|
+
// v5: its own path (carrier5.ts), with no floor anchor to look for.
|
|
174
|
+
if (payload.carrier === CARRIER_VERSION_5) return verifyCarrierV5(payload, inner, { ...(opts.pins?.pcr0 ? { pcr0: opts.pins.pcr0 } : {}), ...(opts.pins?.rootDer ? { rootDer: opts.pins.rootDer } : {}) });
|
|
172
175
|
const claims: CarrierClaim[] = [];
|
|
173
176
|
const add = (id: string, name: string, result: ClaimResult, restsOn: string, detail: string, level: "offline" | "confirmed" = "offline") =>
|
|
174
177
|
claims.push({ id, name, result, restsOn, detail, level });
|
|
@@ -179,7 +182,7 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
179
182
|
} catch (e) {
|
|
180
183
|
const detail = `a part of this proof block is malformed: ${e instanceof Error ? e.message : String(e)}`;
|
|
181
184
|
add("wellformed", "Every part of the proof block is well formed", "FALSE", "", detail);
|
|
182
|
-
let version: 1 | 2 | 3 | 4 | null = null;
|
|
185
|
+
let version: 1 | 2 | 3 | 4 | 5 | null = null;
|
|
183
186
|
try { version = carrierVersionOf(payload); } catch { /* unreadable */ }
|
|
184
187
|
const ceilingStatus = (payload as { ceiling?: { status?: unknown } } | null)?.ceiling?.status;
|
|
185
188
|
return {
|
package/src/carrier.ts
CHANGED
|
@@ -96,7 +96,15 @@ export const CARRIER_VERSION = "bitgraph-carrier/1";
|
|
|
96
96
|
export const CARRIER_VERSION_2 = "bitgraph-carrier/2";
|
|
97
97
|
export const CARRIER_VERSION_3 = "bitgraph-carrier/3";
|
|
98
98
|
export const CARRIER_VERSION_4 = "bitgraph-carrier/4";
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* v5 (2026-10-20): the BitGraphed file for proofs made in one atomic action (enclave v11 on), which sign no floor of
|
|
101
|
+
* their own. The block carries the proof exactly as the ledger serves it for these bytes (for a file of a tree, with
|
|
102
|
+
* its bitgraph-tree-member/1 block in the proof's unsigned metadata: the path to the root, and the tree's floor leaf,
|
|
103
|
+
* base-block.json) and its Base ceiling (bitgraph-ceiling/1). No anchor, no header: the floor is a leaf of the tree.
|
|
104
|
+
* Checked by carrier5.ts.
|
|
105
|
+
*/
|
|
106
|
+
export const CARRIER_VERSION_5 = "bitgraph-carrier/5";
|
|
107
|
+
export type CarrierVersion = typeof CARRIER_VERSION | typeof CARRIER_VERSION_2 | typeof CARRIER_VERSION_3 | typeof CARRIER_VERSION_4 | typeof CARRIER_VERSION_5;
|
|
100
108
|
/** The sidecar and pointer formats a v2 block carries; their shapes are checked by their own modules. */
|
|
101
109
|
export const CEILING_SIDECAR_VERSION = "bitgraph-ceiling/1";
|
|
102
110
|
export const SETTLEMENT_POINTER_VERSION = "bitgraph-settlement/1";
|
|
@@ -308,6 +316,14 @@ function treeShapeError(t: unknown): string | null {
|
|
|
308
316
|
function payloadShapeError(p: unknown): string | null {
|
|
309
317
|
const o = record(p);
|
|
310
318
|
if (o === null) return "payload is not an object";
|
|
319
|
+
if (o["carrier"] === CARRIER_VERSION_5) {
|
|
320
|
+
// v5: exactly the proof and its ceiling in time; whether either holds is verifyCarrier's question.
|
|
321
|
+
if (Object.keys(o).sort().join(",") !== "carrier,ceilingInTime,proof") return `a ${CARRIER_VERSION_5} block holds exactly carrier, proof and ceilingInTime`;
|
|
322
|
+
if (record(o["proof"]) === null) return "payload carries no proof object";
|
|
323
|
+
const c = record(o["ceilingInTime"]);
|
|
324
|
+
if (c === null || !(c["status"] === "unfetched" || (c["status"] === "present" && record(c["sidecar"]) !== null))) return "ceilingInTime must be present (with its sidecar) or unfetched";
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
311
327
|
const v4 = o["carrier"] === CARRIER_VERSION_4;
|
|
312
328
|
const v3 = o["carrier"] === CARRIER_VERSION_3;
|
|
313
329
|
const v2 = o["carrier"] === CARRIER_VERSION_2 || v3 || v4;
|
|
@@ -370,8 +386,8 @@ function payloadShapeError(p: unknown): string | null {
|
|
|
370
386
|
}
|
|
371
387
|
|
|
372
388
|
/** 1, 2, 3 or 4, from a parsed payload. */
|
|
373
|
-
export function carrierVersionOf(payload: CarrierPayload): 1 | 2 | 3 | 4 {
|
|
374
|
-
return payload.carrier === CARRIER_VERSION_4 ? 4 : payload.carrier === CARRIER_VERSION_3 ? 3 : payload.carrier === CARRIER_VERSION_2 ? 2 : 1;
|
|
389
|
+
export function carrierVersionOf(payload: CarrierPayload): 1 | 2 | 3 | 4 | 5 {
|
|
390
|
+
return payload.carrier === CARRIER_VERSION_5 ? 5 : payload.carrier === CARRIER_VERSION_4 ? 4 : payload.carrier === CARRIER_VERSION_3 ? 3 : payload.carrier === CARRIER_VERSION_2 ? 2 : 1;
|
|
375
391
|
}
|
|
376
392
|
|
|
377
393
|
export function parseCarrier(bytes: Uint8Array): CarrierParse {
|
package/src/carrier5.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright (c) Argento Computing Inc. All rights reserved. See LICENSE.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The BitGraphed file, version 5 (2026-10-20): a file that carries its own proof, for proofs made in one atomic action
|
|
5
|
+
* (enclave v11 on). The bytes are the file exactly as it was bound, then the block (carrier.ts framing) holding:
|
|
6
|
+
*
|
|
7
|
+
* { carrier: "bitgraph-carrier/5", proof, ceilingInTime }
|
|
8
|
+
*
|
|
9
|
+
* proof the bitgraph/1 proof as the ledger serves it for these bytes. For a file of a tree (every drop on
|
|
10
|
+
* bitgraph.ing from 2026-10-20) it carries, in its unsigned metadata, the file's bitgraph-tree-member/1
|
|
11
|
+
* block: its path to the bound root, and the tree's floor leaf, base-block.json (the latest Base block
|
|
12
|
+
* read just before the bind).
|
|
13
|
+
* ceilingInTime the proof's Base ceiling (bitgraph-ceiling/1: the batch transaction, its block header, the trie and
|
|
14
|
+
* Merkle paths), or "unfetched".
|
|
15
|
+
*
|
|
16
|
+
* Checked offline, in this order: the bytes before the block are the bound bytes (directly, or as the member the tree
|
|
17
|
+
* names); the proof is BitGraph's (verifyAttested: signature, atomic counts, AWS Nitro attestation, published image);
|
|
18
|
+
* the floor block is a leaf of the very tree the proof binds, and the attested bind time is after its timestamp; the
|
|
19
|
+
* ceiling's batch holds this proof and its transaction is in the Base block it names. Whether those two Base blocks are
|
|
20
|
+
* on Base's canonical chain is a check against Base (Basescan), not one a file can carry.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
24
|
+
import { CARRIER_VERSION_5, buildCarrier, type CarrierPayload, type CarrierBounds } from "./carrier.js";
|
|
25
|
+
import { verifyAttested } from "./attested.js";
|
|
26
|
+
import { verifyCeiling, type CeilingSidecar } from "./ceiling.js";
|
|
27
|
+
import { checkTreeFloor, treeMemberOf } from "./tree-member.js";
|
|
28
|
+
import type { BitGraphProof } from "./types.js";
|
|
29
|
+
import type { CarrierClaim, CarrierVerifyResult, ClaimResult } from "./carrier-verify.js";
|
|
30
|
+
|
|
31
|
+
export const BITGRAPH_CEILING_WRITER_V5 = "0xf3972408D853c975F86351C311f4310220bbF2a3";
|
|
32
|
+
const BASE_CHAIN_ID = 8453;
|
|
33
|
+
|
|
34
|
+
export interface CarrierV5Payload {
|
|
35
|
+
carrier: typeof CARRIER_VERSION_5;
|
|
36
|
+
proof: Record<string, unknown>;
|
|
37
|
+
ceilingInTime: { status: "unfetched" } | { status: "present"; sidecar: Record<string, unknown> };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The v5 payload for a proof (as the ledger serves it for these bytes) and its ceiling sidecar, if written yet. */
|
|
41
|
+
export function assembleCarrierV5Payload(proof: Record<string, unknown>, ceilingSidecar: Record<string, unknown> | null): CarrierV5Payload {
|
|
42
|
+
return { carrier: CARRIER_VERSION_5, proof, ceilingInTime: ceilingSidecar ? { status: "present", sidecar: ceilingSidecar } : { status: "unfetched" } };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The BitGraphed file: the bound bytes, unchanged, followed by the v5 block. */
|
|
46
|
+
export function buildBitGraphedFileV5(bytes: Uint8Array, proof: Record<string, unknown>, ceilingSidecar: Record<string, unknown> | null): Uint8Array {
|
|
47
|
+
return buildCarrier(bytes, assembleCarrierV5Payload(proof, ceilingSidecar) as unknown as CarrierPayload);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const hex = (b: Uint8Array) => Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
|
|
51
|
+
const iso = (s: number) => new Date(s * 1000).toISOString().replace(".000Z", "Z");
|
|
52
|
+
|
|
53
|
+
export async function verifyCarrierV5(payloadIn: CarrierPayload, inner: Uint8Array | null, opts: { pcr0?: readonly string[]; rootDer?: Uint8Array } = {}): Promise<CarrierVerifyResult> {
|
|
54
|
+
const payload = payloadIn as unknown as CarrierV5Payload;
|
|
55
|
+
const proof = payload.proof as unknown as BitGraphProof;
|
|
56
|
+
const claims: CarrierClaim[] = [];
|
|
57
|
+
const add = (id: string, name: string, result: ClaimResult, restsOn: string, detail: string) => claims.push({ id, name, result, restsOn, detail, level: "offline" });
|
|
58
|
+
const member = treeMemberOf(proof);
|
|
59
|
+
|
|
60
|
+
// 1 + 2. The bytes, and the proof: verifyAttested walks a member's hash up its path first, then checks the proof
|
|
61
|
+
// against the root text it signs; plain bytes are checked against the proof's digest.
|
|
62
|
+
const r = await verifyAttested({ proof, ...(inner ? { bytes: inner } : {}), ...(opts.pcr0 ? { pcr0: opts.pcr0 } : {}), ...(opts.rootDer ? { rootDer: opts.rootDer } : {}) });
|
|
63
|
+
if (!inner) add("bytes.digest", "The file is the bound bytes", "NOT_CARRIED", "SHA-256", "no file in hand");
|
|
64
|
+
else if (member) add("tree.member", "The file is in the tree the proof binds", r.treeMember ? "TRUE" : "FALSE", "SHA-256", r.treeMember ? `file ${r.treeMember.index + 1} of ${r.treeMember.files}: its hash walks up the tree to the root the proof binds` : (r.reason ?? "its hash does not reach the root"));
|
|
65
|
+
else add("bytes.digest", "The file is the bound bytes", r.valid || !/digest/.test(r.reason ?? "") ? "TRUE" : "FALSE", "SHA-256", "the bytes before the block hash to the proof's digest");
|
|
66
|
+
for (const c of r.checks) add(`attestation.${c.name.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`, c.name, c.pass ? "TRUE" : "FALSE", "the AWS Nitro attestation", c.detail);
|
|
67
|
+
add("attestation.pins", "The image is one BitGraph published", r.image ? "TRUE" : "FALSE", "BitGraph's published enclave images", r.image ? `PCR0 ${String(r.pcr0).slice(0, 16)}… is the ${r.image.version} image` : `PCR0 ${String(r.pcr0 ?? "").slice(0, 16)}… is not one of BitGraph's`);
|
|
68
|
+
add("proof.signature", "The signature, the nonce's record and the two consecutive counts", r.valid ? "TRUE" : "FALSE", "Ed25519", r.valid ? "the enclave's key signed this body" : (r.reason ?? "did not verify"));
|
|
69
|
+
|
|
70
|
+
// 3. The floor: a leaf of the very tree the proof binds, and before the attested bind time.
|
|
71
|
+
let notBefore: CarrierBounds["notBefore"] | null = null;
|
|
72
|
+
if (member?.floor) {
|
|
73
|
+
const f = checkTreeFloor(proof, member);
|
|
74
|
+
const after = f !== null && r.attestedAtMs !== null && r.attestedAtMs >= f.timestamp * 1000;
|
|
75
|
+
add("floor.leaf", "The floor block is a leaf of the tree the proof binds", f ? "TRUE" : "FALSE", "SHA-256", f ? `Base block ${f.number} (${f.hash.slice(0, 12)}…): base-block.json walks up the tree to the bound root, so the bind came after this block existed` : "base-block.json does not reach the bound root");
|
|
76
|
+
if (f) {
|
|
77
|
+
add("floor.time", "The bind came after the floor block's time", after ? "TRUE" : "FALSE", "the AWS Nitro attestation's time", after ? `bound ${iso(Math.floor(r.attestedAtMs! / 1000))}, block ${iso(f.timestamp)}` : "the attested bind time is not after the block's time");
|
|
78
|
+
notBefore = { chain: "base", blockNumber: f.number, blockHash: f.hash, timestamp: f.timestamp };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 4. The ceiling: this proof's hash is in the batch the Base transaction carries, and that transaction is in its block.
|
|
83
|
+
let existedBy: CarrierBounds["existedBy"] = null;
|
|
84
|
+
if (payload.ceilingInTime.status === "present") {
|
|
85
|
+
const c = await verifyCeiling(proof, payload.ceilingInTime.sidecar as unknown as CeilingSidecar, { writerAddress: BITGRAPH_CEILING_WRITER_V5, chainId: BASE_CHAIN_ID, proofAlreadyVerified: r.valid });
|
|
86
|
+
const w = c.window?.ceiling;
|
|
87
|
+
add("ceiling.time", "Written to Base, in a batch from BitGraph's writer", c.ok ? "TRUE" : "FALSE", "Base: the batch root, the transaction and the block header", c.ok && w ? `Base block ${w.blockNumber} (${iso(w.blockTimestamp)}): the proof existed by then` : (c.reason ?? "the ceiling does not verify"));
|
|
88
|
+
if (c.ok && w) existedBy = { chain: "base", blockNumber: w.blockNumber, blockHash: w.blockHash, timestamp: w.blockTimestamp };
|
|
89
|
+
} else add("ceiling.time", "Written to Base", "NOT_CARRIED", "", "this file was made before the Base write landed; the ceiling can be looked up by the proof's hash");
|
|
90
|
+
|
|
91
|
+
const failed = claims.filter((c) => c.result === "FALSE");
|
|
92
|
+
const verdict: CarrierVerifyResult["verdict"] = failed.length > 0 ? "FALSE" : r.valid ? "TRUE" : "UNDETERMINED";
|
|
93
|
+
const where = member ? `file ${member.index + 1} of a tree of ${member.files}` : "these exact bytes";
|
|
94
|
+
const reading = verdict === "TRUE"
|
|
95
|
+
? `BitGraph #${proof.commit?.counter}: ${where}, bound by BitGraph's published enclave image ${r.image?.version ?? ""}${notBefore ? ` after Base block ${notBefore.blockNumber}` : ""}${existedBy ? ` and written to Base by block ${existedBy.blockNumber}` : ""}. Check those blocks on Base to place it in real time.`
|
|
96
|
+
: `This BitGraphed file does not check: ${failed.map((c) => c.detail).join("; ") || "the proof did not verify"}.`;
|
|
97
|
+
return {
|
|
98
|
+
verdict, carrier: "ok", version: 5, reasons: claims.filter((c) => c.result !== "TRUE" && c.result !== "NOT_CARRIED").map((c) => c.detail),
|
|
99
|
+
bounds: notBefore ? { notBefore, notAfter: null, existedBy, settledBy: null } : null,
|
|
100
|
+
ceiling: null, claims, reading, payload: payloadIn, inner,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The bound bytes' SHA-256 as hex (for callers printing the envelope rule). */
|
|
105
|
+
export const innerHex = (inner: Uint8Array) => hex(sha256(inner));
|
package/src/index.ts
CHANGED
|
@@ -149,6 +149,10 @@ export type { CarrierV3Parts } from "./carrier-assemble.js";
|
|
|
149
149
|
|
|
150
150
|
/* bitgraph-carrier/4 (2026-10-11): one member of a tree/1 BitGraph carries its own proof: the bytes are the leaf's, the block walks them to the signed root document. */
|
|
151
151
|
export { CARRIER_VERSION_4, memberArtifactDigest } from "./carrier.js";
|
|
152
|
+
// The BitGraphed file for atomic proofs: the proof (with its tree path and floor leaf) and its Base ceiling (2026-10-20).
|
|
153
|
+
export { CARRIER_VERSION_5 } from "./carrier.js";
|
|
154
|
+
export { assembleCarrierV5Payload, buildBitGraphedFileV5, verifyCarrierV5, type CarrierV5Payload } from "./carrier5.js";
|
|
155
|
+
export { checkTreeFloor, BASE_BLOCK_FORMAT, type TreeFloor, type TreeFloorBlock } from "./tree-member.js";
|
|
152
156
|
export type { CarrierTree } from "./carrier.js";
|
|
153
157
|
export { assembleCarrierV4Payload } from "./carrier-assemble.js";
|
|
154
158
|
export type { CarrierV4Parts } from "./carrier-assemble.js";
|
package/src/tree-member.ts
CHANGED
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
import { sha256 } from "@noble/hashes/sha256";
|
|
22
22
|
|
|
23
23
|
export const TREE_MEMBER_METADATA_KEY = "bitgraph-tree-member/1" as const;
|
|
24
|
-
|
|
24
|
+
/** The tree's floor (bitgraph.ing, 2026-10-20): base-block.json, the latest Base block read just before the bind, as the
|
|
25
|
+
* tree's first leaf; `file` is its exact text, `index` and `path` place it in the same tree. */
|
|
26
|
+
export interface TreeFloor { file: string; index: number; path: string }
|
|
27
|
+
export interface TreeMemberBlock { format: typeof TREE_MEMBER_METADATA_KEY; files: number; index: number; path: string; rootText: string; floor?: TreeFloor }
|
|
28
|
+
export const BASE_BLOCK_FORMAT = "bitgraph-base-block/1" as const;
|
|
29
|
+
export interface TreeFloorBlock { chain: string; chainId: number; number: number; hash: string; timestamp: number }
|
|
25
30
|
|
|
26
31
|
const enc = new TextEncoder();
|
|
27
32
|
const HEX = "0123456789abcdef";
|
|
@@ -96,5 +101,25 @@ export function checkTreeMember(proof: unknown, fileDigest: Uint8Array | string,
|
|
|
96
101
|
return treeRootFromPath(sha256(cat(new Uint8Array([0]), d)), block.index, block.files, path) === parsed.root;
|
|
97
102
|
}
|
|
98
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The tree's floor block, when the member carries one and base-block.json is in the very tree the proof binds (its hash
|
|
106
|
+
* walks up its path to the root rootText names, and SHA-256(rootText) is what the proof signs). Null otherwise. That the
|
|
107
|
+
* block exists on Base with that hash and time is a separate check, against Base.
|
|
108
|
+
*/
|
|
109
|
+
export function checkTreeFloor(proof: unknown, block: TreeMemberBlock | null = treeMemberOf(proof)): TreeFloorBlock | null {
|
|
110
|
+
const f = block?.floor;
|
|
111
|
+
if (!block || !f || typeof f.file !== "string" || typeof f.path !== "string" || !Number.isSafeInteger(f.index) || f.file.length > 2048) return null;
|
|
112
|
+
const parsed = parseDigestTreeRootText(block.rootText);
|
|
113
|
+
const bound = (proof as { artifact?: { digestB64?: string } } | null)?.artifact?.digestB64;
|
|
114
|
+
if (!parsed || parsed.files !== block.files || typeof bound !== "string" || unb64(bound) === null || b64(sha256(enc.encode(block.rootText))) !== b64(unb64(bound)!)) return null;
|
|
115
|
+
const path = unb64(f.path);
|
|
116
|
+
if (!path || treeRootFromPath(sha256(cat(new Uint8Array([0]), sha256(enc.encode(f.file)))), f.index, block.files, path) !== parsed.root) return null;
|
|
117
|
+
try {
|
|
118
|
+
const o = JSON.parse(f.file) as Partial<TreeFloorBlock> & { format?: string };
|
|
119
|
+
if (o.format !== BASE_BLOCK_FORMAT || typeof o.chain !== "string" || !Number.isSafeInteger(o.chainId) || !Number.isSafeInteger(o.number) || typeof o.hash !== "string" || !/^0x[0-9a-f]{64}$/i.test(o.hash) || !Number.isSafeInteger(o.timestamp)) return null;
|
|
120
|
+
return { chain: o.chain, chainId: o.chainId!, number: o.number!, hash: o.hash, timestamp: o.timestamp! };
|
|
121
|
+
} catch { return null; }
|
|
122
|
+
}
|
|
123
|
+
|
|
99
124
|
/** The bytes a member's proof signs: its root text. */
|
|
100
125
|
export const treeRootTextBytes = (block: TreeMemberBlock): Uint8Array => enc.encode(block.rootText);
|