Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Feb 21, 2024
1 parent 520f2e6 commit af0b1d5
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ fn serialization_of_empty() {
}

#[test]
fn hash_smoke() {
let pcpi: PublicCircuitPublicInputs = dep::std::unsafe::zeroed();
let _hashed = pcpi.hash();
fn empty_hash() {
let inputs: PublicCircuitPublicInputs = dep::std::unsafe::zeroed();
let hash = inputs.hash();

// Value from public_circuit_public_inputs.test.ts "computes empty item hash" test
assert_eq(hash, 0x0d43290c164ebc3d80d4d17f1939482d9d01ad503cebceb8c665d2bd96597a68);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PublicCircuitPublicInputs computes empty item hash 1`] = `
Fr {
"asBigInt": 5998729082391453463848740365500417056769011535294882115251337368669961943656n,
"asBuffer": {
"data": [
13,
67,
41,
12,
22,
78,
188,
61,
128,
212,
209,
127,
25,
57,
72,
45,
157,
1,
173,
80,
60,
235,
206,
184,
198,
101,
210,
189,
150,
89,
122,
104,
],
"type": "Buffer",
},
}
`;

exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `
Fr {
"asBigInt": 888846281962498247810067532853731271075966629879817122598695403485138176580n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ describe('PublicCircuitPublicInputs', () => {
const hash = target.hash();
expect(hash).toMatchSnapshot();
});

it('computes empty item hash', () => {
const item = PublicCircuitPublicInputs.empty();
const hash = item.hash();
expect(hash).toMatchSnapshot();

// Value used in empty_hash test in public_circuit_public_inputs.nr
// console.log("hash", hash.toString());
});
});

0 comments on commit af0b1d5

Please sign in to comment.