diff --git a/circuits/json/parser/hash_machine.circom b/circuits/json/parser/hash_machine.circom index a8e063f..6ebd9e4 100644 --- a/circuits/json/parser/hash_machine.circom +++ b/circuits/json/parser/hash_machine.circom @@ -377,7 +377,7 @@ template RewriteStack(n) { signal end_hash0[n]; signal not_end_char_for_first <== IsZero()(readColon + readComma + readQuote + (1-next_parsing_number)); - signal to_change_first <== not_end_char_for_first * (is_object_value + is_array) + still_parsing_string; + signal to_change_first <== (not_end_char_for_first + still_parsing_string) * (is_object_value + is_array); signal tree_hash_change_value[2] <== [to_change_zeroth * next_state_hash[0], to_change_first * next_state_hash[1]]; for(var i = 0; i < n; i++) { diff --git a/circuits/test/json/parser/hash_machine.test.ts b/circuits/test/json/parser/hash_machine.test.ts index c1bad89..54a9b97 100644 --- a/circuits/test/json/parser/hash_machine.test.ts +++ b/circuits/test/json/parser/hash_machine.test.ts @@ -4,21 +4,21 @@ import { PoseidonModular } from "../../common/poseidon"; describe("hash_machine", () => { let circuit: WitnessTester<["data"]>; - it(`array_only_input`, async () => { - let filename = "array_only"; - let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, [0]); + // it(`array_only_input`, async () => { + // let filename = "array_only"; + // let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, [0]); - circuit = await circomkit.WitnessTester(`Parser`, { - file: "json/parser/hash_parser", - template: "ParserHasher", - params: [input.length, 3], - }); - console.log("#constraints:", await circuit.getConstraintCount()); + // circuit = await circomkit.WitnessTester(`Parser`, { + // file: "json/parser/hash_parser", + // template: "ParserHasher", + // params: [input.length, 3], + // }); + // console.log("#constraints:", await circuit.getConstraintCount()); - await circuit.expectPass({ - data: input - }); - }); + // await circuit.expectPass({ + // data: input + // }); + // }); // Numbers for the 42 read in 0th index console.log("[0,\"4\"] hash: ", PoseidonModular([0, 52])); @@ -54,19 +54,19 @@ describe("hash_machine", () => { // }); - // it(`spotify_input`, async () => { - // let filename = "spotify"; - // let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, ["data"]); + it(`spotify_input`, async () => { + let filename = "spotify"; + let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, ["data"]); - // circuit = await circomkit.WitnessTester(`Parser`, { - // file: "json/parser/hash_parser", - // template: "ParserHasher", - // params: [input.length, 7], - // }); - // console.log("#constraints:", await circuit.getConstraintCount()); + circuit = await circomkit.WitnessTester(`Parser`, { + file: "json/parser/hash_parser", + template: "ParserHasher", + params: [input.length, 7], + }); + console.log("#constraints:", await circuit.getConstraintCount()); - // await circuit.expectPass({ - // data: input - // }); - // }); + await circuit.expectPass({ + data: input + }); + }); }) \ No newline at end of file