Skip to content

Commit 4fa90fc

Browse files
committed
createCommitment seems to work, added test vectors up to 29kB blob size
1 parent 6f225ec commit 4fa90fc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Diff for: src/lib/commitment/test/Commitment.t.sol

+8-8
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,25 @@ contract CommitmentTest is DSTest {
7373
}
7474

7575
function testCreateCommitmentV0() external {
76-
string memory path = "./src/lib/commitment/test/testVectors.json";
76+
string memory path = "./src/lib/commitment/test/testVectors2.json";
7777
string memory jsonData = vm.readFile(path);
7878
bytes memory vecsData = vm.parseJson(jsonData);
7979
TestVector[] memory vecs = abi.decode(vecsData, (TestVector[]));
8080

8181

82-
for (uint i = 0; i < vecs.length; i++) {
83-
bytes29 nsString = bytes29(fromHex(vecs[i].namespace));
82+
//for (uint i = 0; i < vecs.length; i++) {
83+
bytes29 nsString = bytes29(fromHex(vecs[0].namespace));
8484
Namespace memory ns = toNamespace(nsString);
85-
bytes memory data = fromHex(vecs[i].data);
85+
bytes memory data = fromHex(vecs[0].data);
8686
(bytes[] memory shares, bool err) = _bytesToSharesV0(data, ns);
8787
bytes32 commitment = _createCommitment(shares, ns);
88-
if (!compareStrings(_bytesToHexString(abi.encodePacked(commitment)), vecs[i].commitment)) {
89-
console.log("Commitment mismatch for vector ", i);
90-
console.log("expected: ", vecs[i].commitment);
88+
if (!compareStrings(_bytesToHexString(abi.encodePacked(commitment)), vecs[0].commitment)) {
89+
console.log("Commitment mismatch for vector ", 0);
90+
console.log("expected: ", vecs[0].commitment);
9191
console.log("got: ", _bytesToHexString(abi.encodePacked(commitment)));
9292
return;
9393
}
94-
}
94+
//}
9595
console.log("All good :)");
9696

9797
/*bytes32 dummy = hex"000000000000000000000000000000000000005cfe5e6a0c8e6402fd5e010000";

Diff for: src/lib/commitment/test/testVectors2.json

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)