File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ pragma solidity ^0.8.28;
44
55import "./CidCbor.sol " ;
66
7- library TreeNodeDataCbor {
7+ library TreeNodeCbor {
88 using CBORDecoder for bytes ;
99
1010 struct TreeNode {
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ pragma solidity ^0.8.17;
44import {Test, console} from "forge-std/Test.sol " ;
55import "../src/CborDecode.sol " ;
66import "../src/CommitCbor.sol " ;
7- contract BskyRepoCBORTest {
7+
8+ contract CommitCborTest {
89 function test_readCommit () public pure {
910 bytes memory rootCommitData = hex "a56364696478206469643a706c633a6d74713365346d67743777796a6868616e69657a656a3637637265766d336c61796b6c746f73703232716464617461d82a5825000171122066da6655bf8da79b69a87299cf170fed8497fa3059379dc4a8bfe1e28cab5d936470726576f66776657273696f6e03 " ;
1011
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: MIT
2+ pragma solidity ^ 0.8.17 ;
3+
4+ import {Test, console} from "forge-std/Test.sol " ;
5+ import "../src/CborDecode.sol " ;
6+ import "../src/TreeNodeCbor.sol " ;
7+
8+ contract TreeNodeCborTest {
9+ function test_readTreeNode () public pure {
10+ bytes memory treeNode = hex"a2616585a4616b58236170702e62736b792e67726170682e666f6c6c6f772f336b77767534737665647332346170006174d82a58250001711220b000383f1466f65b0a02da763f46cf0e4510d832f6c609a9df56db73b81259376176d82a582500017112205cd7382608fb47afda979840cf0024b3d2d2e9e43448713909e998b6a1849490a4616b486679656a776332346170181b6174d82a58250001711220b295211bc0bfc8a6c8404f4877e96c37b25272c85e4942a29b178d26803f13996176d82a5825000171122017428f68c9c19f59b08b4b2d71ce96e04cdaf6139b94baf0a2c5ee51aa74493fa4616b486d77686f6e3232346170181b6174d82a58250001711220752be9d63155323fc5ce8753bdb5832fc7f5ad762c4e37944a6de84bbb9516876176d82a582500017112200fe8a27c597fcc6059888660b321e473bdaa94b45d0a702f3bd05e013ff17564a4616b486e337667376332346170181b6174d82a58250001711220ff7f6bd81b38a383101aec250c290ec6cd33555baf1e644f4b6d9b60a2e1fb856176d82a58250001711220a9f192fea504ecf8ae900d2a4f9f37551865132ae50bf680ac1687636afee7e1a4616b486f797875373232346170181b6174d82a582500017112204afcab072750efa8755714ca8477b35e871b71856a329c9973c4b94b7a4c98986176d82a58250001711220c46c805c774dcd3eaf4f90cef5e63f1f2a53f9c6bdb14b7397e736678b54dc97616cd82a582500017112206e7335ed248edae3ed49d47b88a5fcad2985e15f416f8ae23a49dfc1231aeb91";
11+
12+ (TreeNodeCbor.TreeNode memory node , uint byteIdx ) = TreeNodeCbor.readTreeNode (treeNode, 0 );
13+
14+ console.log ("byteIdx: %s " , byteIdx);
15+ console.log ("entries: %s " , node.entries.length );
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments