From 9162b6e0c4146ea56c5f91c8ea32142909da29f6 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 11:09:49 -0700 Subject: [PATCH 01/19] initial circuits --- circuits/http/nivc/body_mask.circom | 39 +++ circuits/http/nivc/lock_header.circom | 88 +++++++ .../nivc/parse_and_lock_start_line.circom | 127 ++++++++++ circuits/json/nivc/extractor.circom | 39 +++ circuits/json/nivc/masker.circom | 231 ++++++++++++++++++ circuits/json/nivc/parse.circom | 61 +++++ 6 files changed, 585 insertions(+) create mode 100644 circuits/http/nivc/body_mask.circom create mode 100644 circuits/http/nivc/lock_header.circom create mode 100644 circuits/http/nivc/parse_and_lock_start_line.circom create mode 100644 circuits/json/nivc/extractor.circom create mode 100644 circuits/json/nivc/masker.circom create mode 100644 circuits/json/nivc/parse.circom diff --git a/circuits/http/nivc/body_mask.circom b/circuits/http/nivc/body_mask.circom new file mode 100644 index 0000000..121ea23 --- /dev/null +++ b/circuits/http/nivc/body_mask.circom @@ -0,0 +1,39 @@ +pragma circom 2.1.9; + +include "parser-attestor/circuits/http/interpreter.circom"; + +template HTTPMaskBodyNIVC(TOTAL_BYTES, DATA_BYTES) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + var PER_ITERATION_DATA_LENGTH = 5; + // -> var TOTAL_BYTES = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Unravel from previous NIVC step ~ + // Read in from previous NIVC step (HttpParseAndLockStartLine or HTTPLockHeader) + signal input step_in[TOTAL_BYTES + 1]; // ADD ONE FOR JSON LATER + + signal data[DATA_BYTES]; + signal parsing_body[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[i]; + parsing_body[i] <== step_in[DATA_BYTES + i * 5 + 4]; + } + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Write out to next NIVC step + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + step_out[i] <== data[i] * parsing_body[i]; + } + // Write out padded with zeros + for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + step_out[i] <== 0; + } + step_out[TOTAL_BYTES] <== 0; +} + +component main { public [step_in] } = HTTPMaskBodyNIVC(4160, 320); + diff --git a/circuits/http/nivc/lock_header.circom b/circuits/http/nivc/lock_header.circom new file mode 100644 index 0000000..bdfb4b5 --- /dev/null +++ b/circuits/http/nivc/lock_header.circom @@ -0,0 +1,88 @@ +pragma circom 2.1.9; + +include "parser-attestor/circuits/http/interpreter.circom"; +include "parser-attestor/circuits/utils/array.circom"; + +template LockHeader(TOTAL_BYTES, DATA_BYTES, headerNameLen, headerValueLen) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + var PER_ITERATION_DATA_LENGTH = 5; + var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Unravel from previous NIVC step ~ + // Read in from previous NIVC step (HttpParseAndLockStartLine or HTTPLockHeader) + signal input step_in[TOTAL_BYTES + 1]; // ADD ONE FOR JSON LATER ON + + signal data[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[i]; + } + + signal input header[headerNameLen]; + signal input value[headerValueLen]; + + component headerNameLocation = FirstStringMatch(DATA_BYTES, headerNameLen); + headerNameLocation.data <== data; + headerNameLocation.key <== header; + + component headerFieldNameValueMatch; + headerFieldNameValueMatch = HeaderFieldNameValueMatch(DATA_BYTES, headerNameLen, headerValueLen); + headerFieldNameValueMatch.data <== data; + headerFieldNameValueMatch.headerName <== header; + headerFieldNameValueMatch.headerValue <== value; + headerFieldNameValueMatch.index <== headerNameLocation.position; + + // TODO: Make this assert we are parsing header!!! + // This is the assertion that we have locked down the correct header + headerFieldNameValueMatch.out === 1; + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Write out to next NIVC step + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + // add plaintext http input to step_out + step_out[i] <== step_in[i]; + + // add parser state + step_out[DATA_BYTES + i * 5] <== step_in[DATA_BYTES + i * 5]; + step_out[DATA_BYTES + i * 5 + 1] <== step_in[DATA_BYTES + i * 5 + 1]; + step_out[DATA_BYTES + i * 5 + 2] <== step_in[DATA_BYTES + i * 5 + 2]; + step_out[DATA_BYTES + i * 5 + 3] <== step_in[DATA_BYTES + i * 5 + 3]; + step_out[DATA_BYTES + i * 5 + 4] <== step_in[DATA_BYTES + i * 5 + 4]; + } + // Pad remaining with zeros + for (var i = TOTAL_BYTES_USED ; i < TOTAL_BYTES ; i++ ) { + step_out[i] <== 0; + } + step_out[TOTAL_BYTES] <== 0; +} + +// TODO: Handrolled template that I haven't tested YOLO. +template FirstStringMatch(dataLen, keyLen) { + signal input data[dataLen]; + signal input key[keyLen]; + signal output position; + + var matched = 0; + var counter = 0; + component stringMatch[dataLen - keyLen]; + component hasMatched[dataLen - keyLen]; + for (var idx = 0 ; idx < dataLen - keyLen ; idx++) { + stringMatch[idx] = IsEqualArray(keyLen); + stringMatch[idx].in[0] <== key; + for (var key_idx = 0 ; key_idx < keyLen ; key_idx++) { + stringMatch[idx].in[1][key_idx] <== data[idx + key_idx] * (1 - matched); + } + hasMatched[idx] = IsEqual(); + hasMatched[idx].in <== [stringMatch[idx].out, 1]; + matched += hasMatched[idx].out; + counter += (1 - matched); // TODO: Off by one? Move before? + } + position <== counter; +} + +component main { public [step_in] } = LockHeader(4160, 320, 12, 31); + diff --git a/circuits/http/nivc/parse_and_lock_start_line.circom b/circuits/http/nivc/parse_and_lock_start_line.circom new file mode 100644 index 0000000..39d82ef --- /dev/null +++ b/circuits/http/nivc/parse_and_lock_start_line.circom @@ -0,0 +1,127 @@ +pragma circom 2.1.9; + +include "parser-attestor/circuits/http/parser/machine.circom"; +include "parser-attestor/circuits/http/interpreter.circom"; +include "parser-attestor/circuits/utils/bytes.circom"; + +// TODO: Note that TOTAL_BYTES will match what we have for AESGCMFOLD step_out +// I have not gone through to double check the sizes of everything yet. +template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLen) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + var AES_BYTES = DATA_BYTES + 50; // TODO: Might be wrong, but good enough for now + var PER_ITERATION_DATA_LENGTH = 5; + var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Unravel from previous NIVC step ~ + // Read in from previous NIVC step (JsonParseNIVC) + signal input step_in[TOTAL_BYTES + 1]; // ADD 1 FOR JSON STUFF LATER + + signal data[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[50 + i]; + } + + // // TODO: check if these needs to here or not + // component dataASCII = ASCII(DATA_BYTES); + // dataASCII.in <== data; + + signal input beginning[beginningLen]; + signal input middle[middleLen]; + signal input final[finalLen]; + + // Initialze the parser + component State[DATA_BYTES]; + State[0] = HttpStateUpdate(); + State[0].byte <== data[0]; + State[0].parsing_start <== 1; + State[0].parsing_header <== 0; + State[0].parsing_field_name <== 0; + State[0].parsing_field_value <== 0; + State[0].parsing_body <== 0; + State[0].line_status <== 0; + + /* + Note, because we know a beginning is the very first thing in a request + we can make this more efficient by just comparing the first `beginningLen` bytes + of the data ASCII against the beginning ASCII itself. + */ + // Check first beginning byte + signal beginningIsEqual[beginningLen]; + beginningIsEqual[0] <== IsEqual()([data[0],beginning[0]]); + beginningIsEqual[0] === 1; + + // Setup to check middle bytes + signal startLineMask[DATA_BYTES]; + signal middleMask[DATA_BYTES]; + signal finalMask[DATA_BYTES]; + + var middle_start_counter = 1; + var middle_end_counter = 1; + var final_end_counter = 1; + for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { + State[data_idx] = HttpStateUpdate(); + State[data_idx].byte <== data[data_idx]; + State[data_idx].parsing_start <== State[data_idx - 1].next_parsing_start; + State[data_idx].parsing_header <== State[data_idx - 1].next_parsing_header; + State[data_idx].parsing_field_name <== State[data_idx - 1].next_parsing_field_name; + State[data_idx].parsing_field_value <== State[data_idx - 1].next_parsing_field_value; + State[data_idx].parsing_body <== State[data_idx - 1].next_parsing_body; + State[data_idx].line_status <== State[data_idx - 1].next_line_status; + + // Check remaining beginning bytes + if(data_idx < beginningLen) { + beginningIsEqual[data_idx] <== IsEqual()([data[data_idx], beginning[data_idx]]); + beginningIsEqual[data_idx] === 1; + } + + // Set the masks based on parser state + startLineMask[data_idx] <== inStartLine()(State[data_idx].parsing_start); + middleMask[data_idx] <== inStartMiddle()(State[data_idx].parsing_start); + finalMask[data_idx] <== inStartEnd()(State[data_idx].parsing_start); + + // Increment counters based on mask information + middle_start_counter += startLineMask[data_idx] - middleMask[data_idx] - finalMask[data_idx]; + middle_end_counter += startLineMask[data_idx] - finalMask[data_idx]; + final_end_counter += startLineMask[data_idx]; + } + + // Additionally verify beginning had correct length + beginningLen === middle_start_counter - 1; + + // Check middle is correct by substring match and length check + signal middleMatch <== SubstringMatchWithIndex(DATA_BYTES, middleLen)(data, middle, middle_start_counter); + middleMatch === 1; + middleLen === middle_end_counter - middle_start_counter - 1; + + // Check final is correct by substring match and length check + signal finalMatch <== SubstringMatchWithIndex(DATA_BYTES, finalLen)(data, final, middle_end_counter); + finalMatch === 1; + // -2 here for the CRLF + finalLen === final_end_counter - middle_end_counter - 2; + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Write out to next NIVC step (Lock Header) + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + // add plaintext http input to step_out + step_out[i] <== step_in[50 + i]; + + // add parser state + step_out[DATA_BYTES + i * 5] <== State[i].next_parsing_start; + step_out[DATA_BYTES + i * 5 + 1] <== State[i].next_parsing_header; + step_out[DATA_BYTES + i * 5 + 2] <== State[i].next_parsing_field_name; + step_out[DATA_BYTES + i * 5 + 3] <== State[i].next_parsing_field_value; + step_out[DATA_BYTES + i * 5 + 4] <== State[i].next_parsing_body; + } + // Pad remaining with zeros + for (var i = TOTAL_BYTES_USED ; i < TOTAL_BYTES ; i++ ) { + step_out[i] <== 0; + } + step_out[TOTAL_BYTES] <== 0; +} + +component main { public [step_in] } = LockStartLine(4160, 320, 8, 3, 2); \ No newline at end of file diff --git a/circuits/json/nivc/extractor.circom b/circuits/json/nivc/extractor.circom new file mode 100644 index 0000000..ed7db26 --- /dev/null +++ b/circuits/json/nivc/extractor.circom @@ -0,0 +1,39 @@ +pragma circom 2.1.9; + +include "circomlib/circuits/gates.circom"; +include "@zk-email/circuits/utils/array.circom"; + +template MaskExtractFinal(TOTAL_BYTES, DATA_BYTES, maxValueLen) { + signal input step_in[TOTAL_BYTES + 1]; + signal output step_out[TOTAL_BYTES + 1]; + + signal is_zero_mask[DATA_BYTES]; + signal is_prev_starting_index[DATA_BYTES]; + signal value_starting_index[DATA_BYTES]; + + signal data[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[i]; + } + + value_starting_index[0] <== 0; + is_prev_starting_index[0] <== 0; + is_zero_mask[0] <== IsZero()(step_in[0]); + for (var i=1 ; i= 2); + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Unravel from previous NIVC step ~ + // Read in from previous NIVC step (JsonParseNIVC) + signal input step_in[TOTAL_BYTES + 1]; // ADD 1 TO TRACK CURRENT STACK POINTER + + // Grab the raw data bytes from the `step_in` variable + signal data[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[i]; + } + + // Decode the encoded data in `step_in` back into parser variables + signal stack[DATA_BYTES][MAX_STACK_HEIGHT][2]; + signal parsingData[DATA_BYTES][2]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + for (var j = 0 ; j < MAX_STACK_HEIGHT ; j++) { + stack[i][j][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2]; + stack[i][j][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2 + 1]; + } + parsingData[i][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2]; + parsingData[i][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2 + 1]; + } + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Object masking ~ + // Key data to use to point to which object to extract + signal input key[maxKeyLen]; + signal input keyLen; + + // flag determining whether this byte is matched value + signal is_value_match[DATA_BYTES - maxKeyLen]; + // final mask + signal mask[DATA_BYTES - maxKeyLen]; + + + // signal parsing_object_value[DATA_BYTES - maxKeyLen]; + signal is_key_match[DATA_BYTES - maxKeyLen]; + signal is_key_match_for_value[DATA_BYTES + 1 - maxKeyLen]; + is_key_match_for_value[0] <== 0; + signal is_next_pair_at_depth[DATA_BYTES - maxKeyLen]; + signal or[DATA_BYTES - maxKeyLen]; + + // Signals to detect if we are parsing a key or value with initial setup + signal parsing_key[DATA_BYTES - maxKeyLen]; + signal parsing_value[DATA_BYTES - maxKeyLen]; + // TODO: Can't these just be 0 since the start of object can't be either of these? + // parsing_key[0] <== InsideKey()(stack[0][0], parsingData[0][0], parsingData[0][1]); + // parsing_value[0] <== InsideValueObject()(stack[0][0], stack[0][1], parsingData[0][0], parsingData[0][1]); + + // Initialize values knowing 0th bit of data will never be a key/value + parsing_key[0] <== 0; + parsing_value[0] <== 0; + is_key_match[0] <== 0; + + component stackSelector[DATA_BYTES]; + stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[0].in <== stack[0]; + stackSelector[0].index <== step_in[TOTAL_BYTES]; + + is_next_pair_at_depth[0] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[0], data[0],step_in[TOTAL_BYTES]); + is_key_match_for_value[1] <== Mux1()([is_key_match_for_value[0] * (1-is_next_pair_at_depth[0]), is_key_match[0] * (1-is_next_pair_at_depth[0])], is_key_match[0]); + is_value_match[0] <== parsing_value[0] * is_key_match_for_value[1]; + + mask[0] <== data[0] * is_value_match[0]; + + for(var data_idx = 1; data_idx < DATA_BYTES - maxKeyLen; data_idx++) { + stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[data_idx].in <== stack[data_idx]; + stackSelector[data_idx].index <== step_in[TOTAL_BYTES]; + parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); + parsing_value[data_idx] <== InsideValueObject()(stackSelector[data_idx].out, stack[data_idx][1], parsingData[data_idx][0], parsingData[data_idx][1]); + + // to get correct value, check: + // - key matches at current index and depth of key is as specified + // - whether next KV pair starts + // - whether key matched for a value (propogate key match until new KV pair of lower depth starts) + is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, maxKeyLen, data_idx)(data, key, keyLen, parsing_key[data_idx]); + is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES]); + is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); + is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; + + or[data_idx] <== OR()(is_value_match[data_idx], is_value_match[data_idx - 1]); + + // mask = currently parsing value and all subsequent keys matched + mask[data_idx] <== data[data_idx] * or[data_idx]; + + } + + // Write the `step_out` with masked data + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES - maxKeyLen ; i++) { + step_out[i] <== mask[i]; + } + for (var i = 0 ; i < maxKeyLen ; i++) { + step_out[DATA_BYTES - maxKeyLen + i] <== 0; + } + // Append the parser state back on `step_out` + for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + step_out[i] <== step_in[i]; + } + // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED + step_out[TOTAL_BYTES] <== step_in[TOTAL_BYTES] + 1; +} + +template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + assert(MAX_STACK_HEIGHT >= 2); + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Unravel from previous NIVC step ~ + // Read in from previous NIVC step (JsonParseNIVC) + signal input step_in[TOTAL_BYTES + 1]; // ADD 1 FOR CURRENT STACK POINTER + + // Grab the raw data bytes from the `step_in` variable + signal data[DATA_BYTES]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + data[i] <== step_in[i]; + } + + // Decode the encoded data in `step_in` back into parser variables + signal stack[DATA_BYTES][MAX_STACK_HEIGHT][2]; + signal parsingData[DATA_BYTES][2]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + for (var j = 0 ; j < MAX_STACK_HEIGHT ; j++) { + stack[i][j][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2]; + stack[i][j][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2 + 1]; + } + parsingData[i][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2]; + parsingData[i][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2 + 1]; + } + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Array index masking ~ + signal input index; + + // value starting index in `data` + signal value_starting_index[DATA_BYTES]; + signal mask[DATA_BYTES]; + + signal parsing_array[DATA_BYTES]; + signal or[DATA_BYTES]; + + component stackSelector[DATA_BYTES]; + stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[0].in <== stack[0]; + stackSelector[0].index <== step_in[TOTAL_BYTES]; + + component nextStackSelector[DATA_BYTES]; + nextStackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + nextStackSelector[0].in <== stack[0]; + nextStackSelector[0].index <== step_in[TOTAL_BYTES] + 1; + + parsing_array[0] <== InsideArrayIndexObject()(stackSelector[0].out, nextStackSelector[0].out, parsingData[0][0], parsingData[0][1], index); + mask[0] <== data[0] * parsing_array[0]; + + for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { + stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[data_idx].in <== stack[data_idx]; + stackSelector[data_idx].index <== step_in[TOTAL_BYTES]; + + nextStackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + nextStackSelector[data_idx].in <== stack[data_idx]; + nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES] + 1; + + parsing_array[data_idx] <== InsideArrayIndexObject()(stackSelector[data_idx].out, nextStackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1], index); + + or[data_idx] <== OR()(parsing_array[data_idx], parsing_array[data_idx - 1]); + mask[data_idx] <== data[data_idx] * or[data_idx]; + } + + // Write the `step_out` with masked data + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + step_out[i] <== mask[i]; + } + // Append the parser state back on `step_out` + for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + step_out[i] <== step_in[i]; + } + // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED + step_out[TOTAL_BYTES] <== step_in[TOTAL_BYTES] + 1; +} + +template ArraySelector(m, n) { + signal input in[m][n]; + signal input index; + signal output out[n]; + assert(index >= 0 && index < m); + + signal selector[m]; + component Equal[m]; + for (var i = 0; i < m; i++) { + selector[i] <== IsEqual()([index, i]); + } + + var sum = 0; + for (var i = 0; i < m; i++) { + sum += selector[i]; + } + sum === 1; + + signal sums[n][m+1]; + // note: loop order is column-wise, not row-wise + for (var j = 0; j < n; j++) { + sums[j][0] <== 0; + for (var i = 0; i < m; i++) { + sums[j][i+1] <== sums[j][i] + in[i][j] * selector[i]; + } + out[j] <== sums[j][m]; + } +} \ No newline at end of file diff --git a/circuits/json/nivc/parse.circom b/circuits/json/nivc/parse.circom new file mode 100644 index 0000000..eb08fe9 --- /dev/null +++ b/circuits/json/nivc/parse.circom @@ -0,0 +1,61 @@ +pragma circom 2.1.9; + +include "parser-attestor/circuits/json/parser/parser.circom"; + +template JsonParseNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); + // ------------------------------------------------------------------------------------------------------------------ // + + // Read in from previous NIVC step (AESNIVC) + signal input step_in[TOTAL_BYTES + 1]; // ADD 1 TO TRACK DEPTH LAATER ON + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Parse JSON ~ + // Initialize the parser + component State[DATA_BYTES]; + State[0] = StateUpdate(MAX_STACK_HEIGHT); + for(var i = 0; i < MAX_STACK_HEIGHT; i++) { + State[0].stack[i] <== [0,0]; + } + State[0].parsing_string <== 0; + State[0].parsing_number <== 0; + State[0].byte <== step_in[0]; + + // Parse all the data to generate the complete parser state + for(var i = 1; i < DATA_BYTES; i++) { + State[i] = StateUpdate(MAX_STACK_HEIGHT); + State[i].byte <== step_in[i]; + State[i].stack <== State[i - 1].next_stack; + State[i].parsing_string <== State[i - 1].next_parsing_string; + State[i].parsing_number <== State[i - 1].next_parsing_number; + } + // ------------------------------------------------------------------------------------------------------------------ // + + // ------------------------------------------------------------------------------------------------------------------ // + // ~ Write to `step_out` for next NIVC step + // Pass the data bytes back out in the first `step_out` signals + signal output step_out[TOTAL_BYTES + 1]; + for (var i = 0 ; i < DATA_BYTES ; i++) { + step_out[i] <== step_in[i]; + } + + // Decode the parser state into the `step_out` remaining signals + for (var i = 0 ; i < DATA_BYTES ; i++) { + for (var j = 0 ; j < MAX_STACK_HEIGHT ; j++) { + step_out[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2] <== State[i].next_stack[j][0]; + step_out[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2 + 1] <== State[i].next_stack[j][1]; + } + step_out[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2] <== State[i].next_parsing_string; + step_out[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2 + 1] <== State[i].next_parsing_number; + } + // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED + step_out[TOTAL_BYTES] <== 0; // Initial depth set to 0 for extraction + // ------------------------------------------------------------------------------------------------------------------ // +} + +component main { public [step_in] } = JsonParseNIVC(4160, 320, 5); + From 45d5ac5dd7588ac3b5f83ac0c6bff2ca76b944a4 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 18:08:52 -0600 Subject: [PATCH 02/19] initial passing tests Passing for `parse` and for initial object masking. However, when the value is not an object starting with `{` we don't handle this correctly. We need to handle the case that it is a `[` or `"` or a number, ideally. --- circuits/json/nivc/masker.circom | 61 +- circuits/json/nivc/parse.circom | 14 +- circuits/test/common/index.ts | 19 + circuits/test/json/nivc/masker_nivc.test.ts | 108 + .../test/json/nivc/nivc_extract_key0.json | 2631 +++++++++++++++++ .../test/json/nivc/nivc_extract_key1.json | 2631 +++++++++++++++++ circuits/test/json/nivc/nivc_parse.json | 2631 +++++++++++++++++ 7 files changed, 8055 insertions(+), 40 deletions(-) create mode 100644 circuits/test/json/nivc/masker_nivc.test.ts create mode 100644 circuits/test/json/nivc/nivc_extract_key0.json create mode 100644 circuits/test/json/nivc/nivc_extract_key1.json create mode 100644 circuits/test/json/nivc/nivc_parse.json diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index 30554c3..5a13ef7 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -1,20 +1,20 @@ pragma circom 2.1.9; -include "parser-attestor/circuits/json/interpreter.circom"; +include "../interpreter.circom"; -template JsonMaskObjectNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT, maxKeyLen) { +template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // ------------------------------------------------------------------------------------------------------------------ // // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data assert(MAX_STACK_HEIGHT >= 2); var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; - var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) - signal input step_in[TOTAL_BYTES + 1]; // ADD 1 TO TRACK CURRENT STACK POINTER + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; // Grab the raw data bytes from the `step_in` variable signal data[DATA_BYTES]; @@ -38,28 +38,23 @@ template JsonMaskObjectNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT, maxKeyLen // ------------------------------------------------------------------------------------------------------------------ // // ~ Object masking ~ // Key data to use to point to which object to extract - signal input key[maxKeyLen]; + signal input key[MAX_KEY_LENGTH]; signal input keyLen; // flag determining whether this byte is matched value - signal is_value_match[DATA_BYTES - maxKeyLen]; + signal is_value_match[DATA_BYTES - MAX_KEY_LENGTH]; // final mask - signal mask[DATA_BYTES - maxKeyLen]; + signal mask[DATA_BYTES - MAX_KEY_LENGTH]; - - // signal parsing_object_value[DATA_BYTES - maxKeyLen]; - signal is_key_match[DATA_BYTES - maxKeyLen]; - signal is_key_match_for_value[DATA_BYTES + 1 - maxKeyLen]; + // signal parsing_object_value[DATA_BYTES - MAX_KEY_LENGTH]; + signal is_key_match[DATA_BYTES - MAX_KEY_LENGTH]; + signal is_key_match_for_value[DATA_BYTES + 1 - MAX_KEY_LENGTH]; is_key_match_for_value[0] <== 0; - signal is_next_pair_at_depth[DATA_BYTES - maxKeyLen]; - signal or[DATA_BYTES - maxKeyLen]; + signal is_next_pair_at_depth[DATA_BYTES - MAX_KEY_LENGTH]; // Signals to detect if we are parsing a key or value with initial setup - signal parsing_key[DATA_BYTES - maxKeyLen]; - signal parsing_value[DATA_BYTES - maxKeyLen]; - // TODO: Can't these just be 0 since the start of object can't be either of these? - // parsing_key[0] <== InsideKey()(stack[0][0], parsingData[0][0], parsingData[0][1]); - // parsing_value[0] <== InsideValueObject()(stack[0][0], stack[0][1], parsingData[0][0], parsingData[0][1]); + signal parsing_key[DATA_BYTES - MAX_KEY_LENGTH]; + signal parsing_value[DATA_BYTES - MAX_KEY_LENGTH]; // Initialize values knowing 0th bit of data will never be a key/value parsing_key[0] <== 0; @@ -69,18 +64,18 @@ template JsonMaskObjectNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT, maxKeyLen component stackSelector[DATA_BYTES]; stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); stackSelector[0].in <== stack[0]; - stackSelector[0].index <== step_in[TOTAL_BYTES]; + stackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; - is_next_pair_at_depth[0] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[0], data[0],step_in[TOTAL_BYTES]); + is_next_pair_at_depth[0] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[0], data[0],step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); is_key_match_for_value[1] <== Mux1()([is_key_match_for_value[0] * (1-is_next_pair_at_depth[0]), is_key_match[0] * (1-is_next_pair_at_depth[0])], is_key_match[0]); is_value_match[0] <== parsing_value[0] * is_key_match_for_value[1]; mask[0] <== data[0] * is_value_match[0]; - for(var data_idx = 1; data_idx < DATA_BYTES - maxKeyLen; data_idx++) { + for(var data_idx = 1; data_idx < DATA_BYTES - MAX_KEY_LENGTH; data_idx++) { stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); stackSelector[data_idx].in <== stack[data_idx]; - stackSelector[data_idx].index <== step_in[TOTAL_BYTES]; + stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); parsing_value[data_idx] <== InsideValueObject()(stackSelector[data_idx].out, stack[data_idx][1], parsingData[data_idx][0], parsingData[data_idx][1]); @@ -88,32 +83,32 @@ template JsonMaskObjectNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT, maxKeyLen // - key matches at current index and depth of key is as specified // - whether next KV pair starts // - whether key matched for a value (propogate key match until new KV pair of lower depth starts) - is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, maxKeyLen, data_idx)(data, key, keyLen, parsing_key[data_idx]); - is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES]); + is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); + is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; - or[data_idx] <== OR()(is_value_match[data_idx], is_value_match[data_idx - 1]); - // mask = currently parsing value and all subsequent keys matched - mask[data_idx] <== data[data_idx] * or[data_idx]; + mask[data_idx] <== data[data_idx] * is_value_match[data_idx]; } // Write the `step_out` with masked data - signal output step_out[TOTAL_BYTES + 1]; - for (var i = 0 ; i < DATA_BYTES - maxKeyLen ; i++) { + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; + for (var i = 0 ; i < DATA_BYTES - MAX_KEY_LENGTH ; i++) { step_out[i] <== mask[i]; } - for (var i = 0 ; i < maxKeyLen ; i++) { - step_out[DATA_BYTES - maxKeyLen + i] <== 0; + for (var i = 0 ; i < MAX_KEY_LENGTH ; i++) { + step_out[DATA_BYTES - MAX_KEY_LENGTH + i] <== 0; } // Append the parser state back on `step_out` - for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC - 1 ; i++) { step_out[i] <== step_in[i]; } // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED - step_out[TOTAL_BYTES] <== step_in[TOTAL_BYTES] + 1; + + // Finally, update the current depth we are extracting from + step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; } template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { diff --git a/circuits/json/nivc/parse.circom b/circuits/json/nivc/parse.circom index eb08fe9..4650dfa 100644 --- a/circuits/json/nivc/parse.circom +++ b/circuits/json/nivc/parse.circom @@ -1,17 +1,17 @@ pragma circom 2.1.9; -include "parser-attestor/circuits/json/parser/parser.circom"; +include "../parser/parser.circom"; -template JsonParseNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { +template JsonParseNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // ------------------------------------------------------------------------------------------------------------------ // // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; - var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // Read in from previous NIVC step (AESNIVC) - signal input step_in[TOTAL_BYTES + 1]; // ADD 1 TO TRACK DEPTH LAATER ON + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; // ------------------------------------------------------------------------------------------------------------------ // // ~ Parse JSON ~ @@ -38,7 +38,7 @@ template JsonParseNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { // ------------------------------------------------------------------------------------------------------------------ // // ~ Write to `step_out` for next NIVC step // Pass the data bytes back out in the first `step_out` signals - signal output step_out[TOTAL_BYTES + 1]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; for (var i = 0 ; i < DATA_BYTES ; i++) { step_out[i] <== step_in[i]; } @@ -53,9 +53,9 @@ template JsonParseNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { step_out[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + MAX_STACK_HEIGHT * 2 + 1] <== State[i].next_parsing_number; } // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED - step_out[TOTAL_BYTES] <== 0; // Initial depth set to 0 for extraction + step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== 0; // Initial depth set to 0 for extraction // ------------------------------------------------------------------------------------------------------------------ // } -component main { public [step_in] } = JsonParseNIVC(4160, 320, 5); +// component main { public [step_in] } = JsonParseNIVC(320, 5); diff --git a/circuits/test/common/index.ts b/circuits/test/common/index.ts index ecc66f5..65f1bdb 100644 --- a/circuits/test/common/index.ts +++ b/circuits/test/common/index.ts @@ -61,6 +61,25 @@ export function readJSONInputFile(filename: string, key: any[]): [number[], numb return [input, keyUnicode, output]; } +import fs from 'fs'; + +export function readJsonFile(filePath: string): T { + // Read the file synchronously + const fileContents = fs.readFileSync(filePath, 'utf-8'); + + // Parse the JSON content + const jsonData = JSON.parse(fileContents, (key, value) => { + // Check if the value is a string that ends with 'n' (for BigInt) + if (typeof value === 'string' && value.endsWith('n')) { + // Convert it back to a BigInt + return BigInt(value.slice(0, -1)); + } + return value; + }); + + return jsonData as T; +} + export function toByte(data: string): number[] { const byteArray = []; for (let i = 0; i < data.length; i++) { diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts new file mode 100644 index 0000000..b46fc70 --- /dev/null +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -0,0 +1,108 @@ +import { circomkit, WitnessTester, generateDescription, readJsonFile } from "../../common"; +import { join } from "path"; + +// HTTP/1.1 200 OK +// content-type: application/json; charset=utf-8 +// content-encoding: gzip +// Transfer-Encoding: chunked +// +// { +// "data": { +// "items": [ +// { +// "data": "Artist", +// "profile": { +// "name": "Taylor Swift" +// } +// } +// ] +// } +// } + +interface NIVCData { + step_out: number[]; +} + +// // 202 bytes in the JSON +let json_input = [123, 13, 10, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, + 32, 34, 105, 116, 101, 109, 115, 34, 58, 32, 91, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 100, 97, 116, + 97, 34, 58, 32, 34, 65, 114, 116, 105, 115, 116, 34, 44, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 34, 112, 114, 111, 102, 105, 108, 101, 34, 58, 32, 123, 13, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 110, 97, 109, 101, 34, 58, 32, + 34, 84, 97, 121, 108, 111, 114, 32, 83, 119, 105, 102, 116, 34, 13, 10, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, + 13, 10, 32, 32, 32, 32, 32, 32, 32, 93, 13, 10, 32, 32, 32, 125, 13, 10, 125]; + +let nivc_parse = readJsonFile(join(__dirname, "..", "nivc/nivc_parse.json")); +let nivc_extract_key0 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key0.json")); +let nivc_extract_key1 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key1.json")); + + +describe("JsonParseNIVC", async () => { + let circuit: WitnessTester<["step_in"], ["step_out"]>; + + let DATA_BYTES = 202; + let MAX_STACK_HEIGHT = 5; + let PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + + let TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + + before(async () => { + circuit = await circomkit.WitnessTester(`JsonParseNIVC`, { + file: "json/nivc/parse", + template: "JsonParseNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${description} ${desc}`, async () => { + await circuit.expectPass(input, expected); + }); + + } + + let extended_json_input = json_input.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - json_input.length)).fill(0)); + + await generatePassCase({ step_in: extended_json_input }, { step_out: nivc_parse.step_out }, "parsing JSON"); + +}); + +describe("JsonMaskObjectNIVC", async () => { + let circuit: WitnessTester<["step_in", "key", "keyLen"], ["step_out"]>; + + let DATA_BYTES = 202; + let MAX_STACK_HEIGHT = 5; + let MAX_KEY_LENGTH = 7; + + before(async () => { + circuit = await circomkit.WitnessTester(`JsonMaskObjectNIVC`, { + file: "json/nivc/masker", + template: "JsonMaskObjectNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${description} ${desc}`, async () => { + console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + } + + let key0 = [100, 97, 116, 97, 0, 0, 0]; // "data" + let key0Len = 4; + generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); + + let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" + let key1Len = 5; + generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); +}); \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key0.json b/circuits/test/json/nivc/nivc_extract_key0.json new file mode 100644 index 0000000..d5f36aa --- /dev/null +++ b/circuits/test/json/nivc/nivc_extract_key0.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 105, + 116, + 101, + 109, + 115, + 34, + 58, + 32, + 91, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 93, + 13, + 10, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] +} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key1.json b/circuits/test/json/nivc/nivc_extract_key1.json new file mode 100644 index 0000000..4d49a93 --- /dev/null +++ b/circuits/test/json/nivc/nivc_extract_key1.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 58, + 32, + 91, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 93, + 13, + 10, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2 + ] +} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_parse.json b/circuits/test/json/nivc/nivc_parse.json new file mode 100644 index 0000000..66d60fc --- /dev/null +++ b/circuits/test/json/nivc/nivc_parse.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 123, + 13, + 10, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 105, + 116, + 101, + 109, + 115, + 34, + 58, + 32, + 91, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 93, + 13, + 10, + 32, + 32, + 32, + 125, + 13, + 10, + 125, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] +} \ No newline at end of file From 1e073f479fd5b5c86ee791b688f3c60da1d37432 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 18:19:28 -0600 Subject: [PATCH 03/19] simplify `JsonMaskObjectNIVC` --- .gitignore | 7 +++- circuits/json/nivc/masker.circom | 60 +++++++++++++++----------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index faa5f81..3fe3e13 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,9 @@ circuits/main/* # Rust generated inputs/**/*.json -!inputs/search/witness.json \ No newline at end of file +!inputs/search/witness.json + +# Circom-witnesscalc generated +ir_log/* +log_input_signals.txt +*.bin \ No newline at end of file diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index 5a13ef7..8de8484 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -39,22 +39,19 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // ~ Object masking ~ // Key data to use to point to which object to extract signal input key[MAX_KEY_LENGTH]; - signal input keyLen; + signal input keyLen; - // flag determining whether this byte is matched value - signal is_value_match[DATA_BYTES - MAX_KEY_LENGTH]; - // final mask - signal mask[DATA_BYTES - MAX_KEY_LENGTH]; + // Signals to detect if we are parsing a key or value with initial setup + signal parsing_key[DATA_BYTES - MAX_KEY_LENGTH]; + signal parsing_value[DATA_BYTES - MAX_KEY_LENGTH]; - // signal parsing_object_value[DATA_BYTES - MAX_KEY_LENGTH]; + // Flags at each byte to indicate if we are matching correct key and in subsequent value signal is_key_match[DATA_BYTES - MAX_KEY_LENGTH]; + signal is_value_match[DATA_BYTES - MAX_KEY_LENGTH]; + + signal is_next_pair_at_depth[DATA_BYTES - MAX_KEY_LENGTH]; signal is_key_match_for_value[DATA_BYTES + 1 - MAX_KEY_LENGTH]; is_key_match_for_value[0] <== 0; - signal is_next_pair_at_depth[DATA_BYTES - MAX_KEY_LENGTH]; - - // Signals to detect if we are parsing a key or value with initial setup - signal parsing_key[DATA_BYTES - MAX_KEY_LENGTH]; - signal parsing_value[DATA_BYTES - MAX_KEY_LENGTH]; // Initialize values knowing 0th bit of data will never be a key/value parsing_key[0] <== 0; @@ -62,41 +59,38 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { is_key_match[0] <== 0; component stackSelector[DATA_BYTES]; - stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); - stackSelector[0].in <== stack[0]; + stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[0].in <== stack[0]; stackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; is_next_pair_at_depth[0] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[0], data[0],step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); is_key_match_for_value[1] <== Mux1()([is_key_match_for_value[0] * (1-is_next_pair_at_depth[0]), is_key_match[0] * (1-is_next_pair_at_depth[0])], is_key_match[0]); is_value_match[0] <== parsing_value[0] * is_key_match_for_value[1]; - mask[0] <== data[0] * is_value_match[0]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; + step_out[0] <== data[0] * is_value_match[0]; for(var data_idx = 1; data_idx < DATA_BYTES - MAX_KEY_LENGTH; data_idx++) { - stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); - stackSelector[data_idx].in <== stack[data_idx]; + // Grab the stack at the indicated height (from `step_in`) + stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[data_idx].in <== stack[data_idx]; stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; - parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); + + // Detect if we are parsing + parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); parsing_value[data_idx] <== InsideValueObject()(stackSelector[data_idx].out, stack[data_idx][1], parsingData[data_idx][0], parsingData[data_idx][1]); // to get correct value, check: // - key matches at current index and depth of key is as specified // - whether next KV pair starts // - whether key matched for a value (propogate key match until new KV pair of lower depth starts) - is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); - is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); + is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); + is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); - is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; - - // mask = currently parsing value and all subsequent keys matched - mask[data_idx] <== data[data_idx] * is_value_match[data_idx]; - - } - - // Write the `step_out` with masked data - signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; - for (var i = 0 ; i < DATA_BYTES - MAX_KEY_LENGTH ; i++) { - step_out[i] <== mask[i]; + is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; + + // Set the next NIVC step to only have the masked data + step_out[data_idx] <== data[data_idx] * is_value_match[data_idx]; } for (var i = 0 ; i < MAX_KEY_LENGTH ; i++) { step_out[DATA_BYTES - MAX_KEY_LENGTH + i] <== 0; @@ -105,7 +99,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC - 1 ; i++) { step_out[i] <== step_in[i]; } - // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED + // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_ACROSS_NIVC // Finally, update the current depth we are extracting from step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; @@ -223,4 +217,6 @@ template ArraySelector(m, n) { } out[j] <== sums[j][m]; } -} \ No newline at end of file +} + +// component main { public [step_in] } = JsonMaskObjectNIVC(320, 5, 7); \ No newline at end of file From b52a8019e8418eca3dca12c38cc1ba30b561762f Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 18:50:17 -0600 Subject: [PATCH 04/19] passing `JsonMaskArrayIndexNIVC` --- circuits/json/nivc/masker.circom | 20 +- circuits/test/json/nivc/masker_nivc.test.ts | 31 +- circuits/test/json/nivc/nivc_extract_arr.json | 2631 +++++++++++++++++ 3 files changed, 2671 insertions(+), 11 deletions(-) create mode 100644 circuits/test/json/nivc/nivc_extract_arr.json diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index 8de8484..3bfe81d 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -105,19 +105,19 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; } -template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { +template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // ------------------------------------------------------------------------------------------------------------------ // // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data assert(MAX_STACK_HEIGHT >= 2); var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; - var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) - signal input step_in[TOTAL_BYTES + 1]; // ADD 1 FOR CURRENT STACK POINTER + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; // ADD 1 FOR CURRENT STACK POINTER // Grab the raw data bytes from the `step_in` variable signal data[DATA_BYTES]; @@ -152,12 +152,12 @@ template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { component stackSelector[DATA_BYTES]; stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); stackSelector[0].in <== stack[0]; - stackSelector[0].index <== step_in[TOTAL_BYTES]; + stackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; component nextStackSelector[DATA_BYTES]; nextStackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); nextStackSelector[0].in <== stack[0]; - nextStackSelector[0].index <== step_in[TOTAL_BYTES] + 1; + nextStackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; parsing_array[0] <== InsideArrayIndexObject()(stackSelector[0].out, nextStackSelector[0].out, parsingData[0][0], parsingData[0][1], index); mask[0] <== data[0] * parsing_array[0]; @@ -165,11 +165,11 @@ template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); stackSelector[data_idx].in <== stack[data_idx]; - stackSelector[data_idx].index <== step_in[TOTAL_BYTES]; + stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; nextStackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); nextStackSelector[data_idx].in <== stack[data_idx]; - nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES] + 1; + nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; parsing_array[data_idx] <== InsideArrayIndexObject()(stackSelector[data_idx].out, nextStackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1], index); @@ -178,16 +178,16 @@ template JsonMaskArrayIndexNIVC(TOTAL_BYTES, DATA_BYTES, MAX_STACK_HEIGHT) { } // Write the `step_out` with masked data - signal output step_out[TOTAL_BYTES + 1]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; for (var i = 0 ; i < DATA_BYTES ; i++) { step_out[i] <== mask[i]; } // Append the parser state back on `step_out` - for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC - 1 ; i++) { step_out[i] <== step_in[i]; } // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED - step_out[TOTAL_BYTES] <== step_in[TOTAL_BYTES] + 1; + step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; } template ArraySelector(m, n) { diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index b46fc70..bb6a8ce 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -37,7 +37,7 @@ let json_input = [123, 13, 10, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 123 let nivc_parse = readJsonFile(join(__dirname, "..", "nivc/nivc_parse.json")); let nivc_extract_key0 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key0.json")); let nivc_extract_key1 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key1.json")); - +let nivc_extract_arr = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_arr.json")); describe("JsonParseNIVC", async () => { let circuit: WitnessTester<["step_in"], ["step_out"]>; @@ -105,4 +105,33 @@ describe("JsonMaskObjectNIVC", async () => { let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" let key1Len = 5; generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); +}); + +describe("JsonMaskArrayIndexNIVC", async () => { + let circuit: WitnessTester<["step_in", "index"], ["step_out"]>; + + let DATA_BYTES = 202; + let MAX_STACK_HEIGHT = 5; + let MAX_KEY_LENGTH = 7; + + before(async () => { + circuit = await circomkit.WitnessTester(`JsonMaskArrayIndexNIVC`, { + file: "json/nivc/masker", + template: "JsonMaskArrayIndexNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${description} ${desc}`, async () => { + console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + } + + let index = 0; + generatePassCase({ step_in: nivc_extract_key1.step_out, index: index }, { step_out: nivc_extract_arr.step_out }, "masking json object at depth 0"); }); \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_arr.json b/circuits/test/json/nivc/nivc_extract_arr.json new file mode 100644 index 0000000..04f2f23 --- /dev/null +++ b/circuits/test/json/nivc/nivc_extract_arr.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3 + ] +} \ No newline at end of file From ca23d2df7ad8d708f6a2ca8179357abac83d9894 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 19:04:15 -0600 Subject: [PATCH 05/19] bug: incorrect mask for "profile" key --- circuits/test/json/nivc/masker_nivc.test.ts | 6 +- .../test/json/nivc/nivc_extract_key2.json | 2631 +++++++++++++++++ 2 files changed, 2636 insertions(+), 1 deletion(-) create mode 100644 circuits/test/json/nivc/nivc_extract_key2.json diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index bb6a8ce..754d7fb 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -105,6 +105,11 @@ describe("JsonMaskObjectNIVC", async () => { let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" let key1Len = 5; generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + + // Ran after doing arr masking + let key2 = [112, 114, 111, 102, 105, 108, 101]; // "profile" + let key2Len = 7; + generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); }); describe("JsonMaskArrayIndexNIVC", async () => { @@ -112,7 +117,6 @@ describe("JsonMaskArrayIndexNIVC", async () => { let DATA_BYTES = 202; let MAX_STACK_HEIGHT = 5; - let MAX_KEY_LENGTH = 7; before(async () => { circuit = await circomkit.WitnessTester(`JsonMaskArrayIndexNIVC`, { diff --git a/circuits/test/json/nivc/nivc_extract_key2.json b/circuits/test/json/nivc/nivc_extract_key2.json new file mode 100644 index 0000000..ae19f04 --- /dev/null +++ b/circuits/test/json/nivc/nivc_extract_key2.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4 + ] +} \ No newline at end of file From b40464d8b7bed56e3823dc5e7e03dfb3d3862bf1 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 18 Oct 2024 20:57:10 -0600 Subject: [PATCH 06/19] bug: not extracting `"profile"` --- circuits/json/nivc/masker.circom | 27 ++++++++++--- circuits/test/json/nivc/masker_nivc.test.ts | 42 ++++++++++++--------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index 3bfe81d..f9d31e2 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -76,16 +76,26 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { stackSelector[data_idx].in <== stack[data_idx]; stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; + log("stackSelector[", data_idx, "].out[0] = ", stackSelector[data_idx].out[0]); + log("stackSelector[", data_idx, "].out[1] = ", stackSelector[data_idx].out[1]); + // Detect if we are parsing parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); parsing_value[data_idx] <== InsideValueObject()(stackSelector[data_idx].out, stack[data_idx][1], parsingData[data_idx][0], parsingData[data_idx][1]); + log("parsing_key[", data_idx, "] = ", parsing_key[data_idx]); + log("parsing_value[", data_idx, "] = ", parsing_value[data_idx]); + // to get correct value, check: // - key matches at current index and depth of key is as specified // - whether next KV pair starts // - whether key matched for a value (propogate key match until new KV pair of lower depth starts) is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); + + log("is_key_match[", data_idx, "] = ", is_key_match[data_idx]); + log("is_next_pair_at_depth[", data_idx, "] = ", is_next_pair_at_depth[data_idx]); + is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; @@ -147,15 +157,15 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { signal mask[DATA_BYTES]; signal parsing_array[DATA_BYTES]; - signal or[DATA_BYTES]; + signal or[DATA_BYTES]; // Maybe don't need component stackSelector[DATA_BYTES]; - stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); - stackSelector[0].in <== stack[0]; + stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[0].in <== stack[0]; stackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; component nextStackSelector[DATA_BYTES]; - nextStackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); + nextStackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); nextStackSelector[0].in <== stack[0]; nextStackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; @@ -163,14 +173,19 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { mask[0] <== data[0] * parsing_array[0]; for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { - stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); stackSelector[data_idx].in <== stack[data_idx]; stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; - nextStackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); + nextStackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT, 2); nextStackSelector[data_idx].in <== stack[data_idx]; nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; + log("stackSelector[", data_idx, "].out[0] = ", stackSelector[data_idx].out[0]); + log("stackSelector[", data_idx, "].out[1] = ", stackSelector[data_idx].out[1]); + log("nextStackSelector[", data_idx, "].out[0] = ", nextStackSelector[data_idx].out[0]); + log("nextStackSelector[", data_idx, "].out[1] = ", nextStackSelector[data_idx].out[1]); + parsing_array[data_idx] <== InsideArrayIndexObject()(stackSelector[data_idx].out, nextStackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1], index); or[data_idx] <== OR()(parsing_array[data_idx], parsing_array[data_idx - 1]); diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 754d7fb..0f42c88 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -7,18 +7,26 @@ import { join } from "path"; // Transfer-Encoding: chunked // // { -// "data": { -// "items": [ -// { -// "data": "Artist", -// "profile": { -// "name": "Taylor Swift" -// } -// } -// ] -// } +// "data": { +// "items": [ +// { +// "data": "Artist", +// "profile": { +// "name": "Taylor Swift" +// } +// } +// ] +// } // } +// Notes: +// - "data"'s object appears at byte 14 +// - colon after "items" appears at byte 31 +// - 0th index of arr appears at byte 47 +// - byte 64 is `"` for the data inside the array obj +// - byte 81 is where `Artist",` ends +// - byte 100 is where `"profile"` starts + interface NIVCData { step_out: number[]; } @@ -93,18 +101,18 @@ describe("JsonMaskObjectNIVC", async () => { const description = generateDescription(input); it(`(valid) witness: ${description} ${desc}`, async () => { - console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) await circuit.expectPass(input, expected); }); } - let key0 = [100, 97, 116, 97, 0, 0, 0]; // "data" - let key0Len = 4; - generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); + // let key0 = [100, 97, 116, 97, 0, 0, 0]; // "data" + // let key0Len = 4; + // generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); - let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" - let key1Len = 5; - generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + // let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" + // let key1Len = 5; + // generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); // Ran after doing arr masking let key2 = [112, 114, 111, 102, 105, 108, 101]; // "profile" From 93a6e1db2ea9887c8fa7bb0d8954085d4947bb6f Mon Sep 17 00:00:00 2001 From: lonerapier Date: Sun, 20 Oct 2024 19:09:38 +0530 Subject: [PATCH 07/19] add extra key index to match end quote --- circuits/json/interpreter.circom | 14 +- circuits/json/nivc/masker.circom | 21 +- circuits/test/json/nivc/masker_nivc.test.ts | 29 +- .../test/json/nivc/nivc_extract_key3.json | 2631 +++++++++++++++++ 4 files changed, 2675 insertions(+), 20 deletions(-) create mode 100644 circuits/test/json/nivc/nivc_extract_key3.json diff --git a/circuits/json/interpreter.circom b/circuits/json/interpreter.circom index ce0e34c..82db99d 100644 --- a/circuits/json/interpreter.circom +++ b/circuits/json/interpreter.circom @@ -421,6 +421,7 @@ template MatchPaddedKey(n) { } signal isEndOfKeyEqualToQuote <== IsEqual()([endOfKeyAccum[n], 1]); + // log("isEndOfKeyEqualToQuote", isEndOfKeyEqualToQuote); component totalEqual = IsEqual(); totalEqual.in[0] <== n; @@ -448,6 +449,11 @@ template KeyMatchAtIndex(dataLen, maxKeyLen, index) { signal input keyLen; signal input parsing_key; + signal paddedKey[maxKeyLen + 1]; + for (var i = 0 ; i < maxKeyLen ; i++) { + paddedKey[i] <== key[i]; + } + paddedKey[maxKeyLen] <== 0; // `"` -> 34 // start of key equal to quote @@ -455,12 +461,14 @@ template KeyMatchAtIndex(dataLen, maxKeyLen, index) { signal isParsingCorrectKey <== parsing_key * startOfKeyEqualToQuote; // key matches - component isSubstringMatch = MatchPaddedKey(maxKeyLen); - isSubstringMatch.in[0] <== key; + component isSubstringMatch = MatchPaddedKey(maxKeyLen+1); + isSubstringMatch.in[0] <== paddedKey; isSubstringMatch.keyLen <== keyLen; - for(var matcher_idx = 0; matcher_idx < maxKeyLen; matcher_idx++) { + for(var matcher_idx = 0; matcher_idx <= maxKeyLen; matcher_idx++) { + // log("matcher_idx", index, matcher_idx, data[index + matcher_idx]); isSubstringMatch.in[1][matcher_idx] <== data[index + matcher_idx]; } + // log("keyMatchAtIndex", isParsingCorrectKey, isSubstringMatch.out); signal output out <== isSubstringMatch.out * isParsingCorrectKey; } \ No newline at end of file diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index f9d31e2..dc256c2 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -8,19 +8,23 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // Total number of variables in the parser for each byte of data assert(MAX_STACK_HEIGHT >= 2); var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; - var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) - signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; // Grab the raw data bytes from the `step_in` variable - signal data[DATA_BYTES]; + var paddedDataLen = DATA_BYTES + MAX_KEY_LENGTH + 1; + signal data[paddedDataLen]; for (var i = 0 ; i < DATA_BYTES ; i++) { data[i] <== step_in[i]; } + for (var i = 0 ; i <= MAX_KEY_LENGTH ; i++) { + data[DATA_BYTES + i] <== 0; + } // Decode the encoded data in `step_in` back into parser variables signal stack[DATA_BYTES][MAX_STACK_HEIGHT][2]; @@ -39,7 +43,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // ~ Object masking ~ // Key data to use to point to which object to extract signal input key[MAX_KEY_LENGTH]; - signal input keyLen; + signal input keyLen; // Signals to detect if we are parsing a key or value with initial setup signal parsing_key[DATA_BYTES - MAX_KEY_LENGTH]; @@ -56,7 +60,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // Initialize values knowing 0th bit of data will never be a key/value parsing_key[0] <== 0; parsing_value[0] <== 0; - is_key_match[0] <== 0; + is_key_match[0] <== 0; component stackSelector[DATA_BYTES]; stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT, 2); @@ -76,6 +80,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { stackSelector[data_idx].in <== stack[data_idx]; stackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1]; + log("step_in[", data_idx, "] =", step_in[data_idx]); log("stackSelector[", data_idx, "].out[0] = ", stackSelector[data_idx].out[0]); log("stackSelector[", data_idx, "].out[1] = ", stackSelector[data_idx].out[1]); @@ -90,7 +95,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // - key matches at current index and depth of key is as specified // - whether next KV pair starts // - whether key matched for a value (propogate key match until new KV pair of lower depth starts) - is_key_match[data_idx] <== KeyMatchAtIndex(DATA_BYTES, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); + is_key_match[data_idx] <== KeyMatchAtIndex(paddedDataLen, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); log("is_key_match[", data_idx, "] = ", is_key_match[data_idx]); @@ -98,9 +103,11 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; - + // Set the next NIVC step to only have the masked data + log("is_value_match", is_value_match[data_idx]); step_out[data_idx] <== data[data_idx] * is_value_match[data_idx]; + log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } for (var i = 0 ; i < MAX_KEY_LENGTH ; i++) { step_out[DATA_BYTES - MAX_KEY_LENGTH + i] <== 0; diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 0f42c88..1890210 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -22,7 +22,7 @@ import { join } from "path"; // Notes: // - "data"'s object appears at byte 14 // - colon after "items" appears at byte 31 -// - 0th index of arr appears at byte 47 +// - 0th index of arr appears at byte 47 // - byte 64 is `"` for the data inside the array obj // - byte 81 is where `Artist",` ends // - byte 100 is where `"profile"` starts @@ -46,6 +46,7 @@ let nivc_parse = readJsonFile(join(__dirname, "..", "nivc/nivc_parse.j let nivc_extract_key0 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key0.json")); let nivc_extract_key1 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key1.json")); let nivc_extract_arr = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_arr.json")); +let nivc_extract_key3 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key3.json")); describe("JsonParseNIVC", async () => { let circuit: WitnessTester<["step_in"], ["step_out"]>; @@ -77,7 +78,7 @@ describe("JsonParseNIVC", async () => { let extended_json_input = json_input.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - json_input.length)).fill(0)); - await generatePassCase({ step_in: extended_json_input }, { step_out: nivc_parse.step_out }, "parsing JSON"); + generatePassCase({ step_in: extended_json_input }, { step_out: nivc_parse.step_out }, "parsing JSON"); }); @@ -87,6 +88,7 @@ describe("JsonMaskObjectNIVC", async () => { let DATA_BYTES = 202; let MAX_STACK_HEIGHT = 5; let MAX_KEY_LENGTH = 7; + let step_out: bigint[] = []; before(async () => { circuit = await circomkit.WitnessTester(`JsonMaskObjectNIVC`, { @@ -100,9 +102,12 @@ describe("JsonMaskObjectNIVC", async () => { function generatePassCase(input: any, expected: any, desc: string) { const description = generateDescription(input); - it(`(valid) witness: ${description} ${desc}`, async () => { + it(`(valid) witness: ${desc}`, async () => { // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); + let wit = await circuit.calculateWitness(input); + console.log("wit", wit.slice(0, 100)); + // step_out = wit; + // await circuit.expectPass(input, expected); }); } @@ -110,14 +115,18 @@ describe("JsonMaskObjectNIVC", async () => { // let key0Len = 4; // generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); - // let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" - // let key1Len = 5; - // generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" + let key1Len = 5; + generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); // Ran after doing arr masking - let key2 = [112, 114, 111, 102, 105, 108, 101]; // "profile" - let key2Len = 7; - generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + // let key2 = [112, 114, 111, 102, 105, 108, 101]; // "profile" + // let key2Len = 7; + // generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + + // let key3 = [110, 97, 109, 101, 0, 0, 0]; // "name" + // let key3Len = 4; + // generatePassCase({ step_in: nivc_extract_key3.step_out, key: key3, keyLen: key3Len }, {}, "masking json at depth 4"); }); describe("JsonMaskArrayIndexNIVC", async () => { diff --git a/circuits/test/json/nivc/nivc_extract_key3.json b/circuits/test/json/nivc/nivc_extract_key3.json new file mode 100644 index 0000000..4dbe2ac --- /dev/null +++ b/circuits/test/json/nivc/nivc_extract_key3.json @@ -0,0 +1,2631 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4 + ] +} \ No newline at end of file From acd2f2c38d0970300c55e49c2e7e82ca869f4a1c Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Sun, 20 Oct 2024 09:04:29 -0600 Subject: [PATCH 08/19] fix: masking tests pass --- circuits/json/interpreter.circom | 3 + circuits/json/nivc/extractor.circom | 28 +- circuits/json/nivc/masker.circom | 106 +- circuits/json/nivc/nivc_extract_final.json | 2647 +++++++++++++++++ circuits/test/json/nivc/masker_nivc.test.ts | 68 +- .../test/json/nivc/nivc_extract_key0.json | 8 +- .../test/json/nivc/nivc_extract_key1.json | 8 +- .../test/json/nivc/nivc_extract_key2.json | 118 +- .../test/json/nivc/nivc_extract_key3.json | 122 +- 9 files changed, 2909 insertions(+), 199 deletions(-) create mode 100644 circuits/json/nivc/nivc_extract_final.json diff --git a/circuits/json/interpreter.circom b/circuits/json/interpreter.circom index 82db99d..3ccd7ad 100644 --- a/circuits/json/interpreter.circom +++ b/circuits/json/interpreter.circom @@ -393,7 +393,10 @@ template KeyMatchAtDepth(dataLen, n, keyLen, depth) { signal output out <== substring_match * is_parsing_correct_key_at_depth; } +// TODO: Not checking start of key is quote since that is handled by `parsing_key`? template MatchPaddedKey(n) { + // TODO: If key is not padded at all, then `in[1]` will not contain an end quote. + // Perhaps we modify this to handle that, or just always pad the key at least once. signal input in[2][n]; signal input keyLen; signal output out; diff --git a/circuits/json/nivc/extractor.circom b/circuits/json/nivc/extractor.circom index ed7db26..aadb436 100644 --- a/circuits/json/nivc/extractor.circom +++ b/circuits/json/nivc/extractor.circom @@ -3,9 +3,16 @@ pragma circom 2.1.9; include "circomlib/circuits/gates.circom"; include "@zk-email/circuits/utils/array.circom"; -template MaskExtractFinal(TOTAL_BYTES, DATA_BYTES, maxValueLen) { - signal input step_in[TOTAL_BYTES + 1]; - signal output step_out[TOTAL_BYTES + 1]; +template MaskExtractFinal(DATA_BYTES, MAX_STACK_HEIGHT, MAX_VALUE_LENGTH) { + // ------------------------------------------------------------------------------------------------------------------ // + // ~~ Set sizes at compile time ~~ + // Total number of variables in the parser for each byte of data + assert(MAX_STACK_HEIGHT >= 2); + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + // ------------------------------------------------------------------------------------------------------------------ // + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; signal is_zero_mask[DATA_BYTES]; signal is_prev_starting_index[DATA_BYTES]; @@ -19,21 +26,22 @@ template MaskExtractFinal(TOTAL_BYTES, DATA_BYTES, maxValueLen) { value_starting_index[0] <== 0; is_prev_starting_index[0] <== 0; is_zero_mask[0] <== IsZero()(step_in[0]); - for (var i=1 ; i(join(__dirname, "..", "nivc/nivc_parse.j let nivc_extract_key0 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key0.json")); let nivc_extract_key1 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key1.json")); let nivc_extract_arr = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_arr.json")); +let nivc_extract_key2 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key2.json")); let nivc_extract_key3 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key3.json")); describe("JsonParseNIVC", async () => { @@ -70,7 +71,7 @@ describe("JsonParseNIVC", async () => { function generatePassCase(input: any, expected: any, desc: string) { const description = generateDescription(input); - it(`(valid) witness: ${description} ${desc}`, async () => { + it(`(valid) witness: ${desc}`, async () => { await circuit.expectPass(input, expected); }); @@ -87,7 +88,7 @@ describe("JsonMaskObjectNIVC", async () => { let DATA_BYTES = 202; let MAX_STACK_HEIGHT = 5; - let MAX_KEY_LENGTH = 7; + let MAX_KEY_LENGTH = 8; let step_out: bigint[] = []; before(async () => { @@ -105,28 +106,28 @@ describe("JsonMaskObjectNIVC", async () => { it(`(valid) witness: ${desc}`, async () => { // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) let wit = await circuit.calculateWitness(input); - console.log("wit", wit.slice(0, 100)); + // console.log("wit", wit.slice(0, 100)); // step_out = wit; - // await circuit.expectPass(input, expected); + await circuit.expectPass(input, expected); }); } - // let key0 = [100, 97, 116, 97, 0, 0, 0]; // "data" - // let key0Len = 4; - // generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); + let key0 = [100, 97, 116, 97, 0, 0, 0, 0]; // "data" + let key0Len = 4; + generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); - let key1 = [105, 116, 101, 109, 115, 0, 0]; // "items" + let key1 = [105, 116, 101, 109, 115, 0, 0, 0]; // "items" let key1Len = 5; - generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 1"); // Ran after doing arr masking - // let key2 = [112, 114, 111, 102, 105, 108, 101]; // "profile" - // let key2Len = 7; - // generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 0"); + let key2 = [112, 114, 111, 102, 105, 108, 101, 0]; // "profile" + let key2Len = 7; + generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key2.step_out }, "masking json object at depth 3"); - // let key3 = [110, 97, 109, 101, 0, 0, 0]; // "name" - // let key3Len = 4; - // generatePassCase({ step_in: nivc_extract_key3.step_out, key: key3, keyLen: key3Len }, {}, "masking json at depth 4"); + let key3 = [110, 97, 109, 101, 0, 0, 0, 0]; // "name" + let key3Len = 4; + generatePassCase({ step_in: nivc_extract_key2.step_out, key: key3, keyLen: key3Len }, { step_out: nivc_extract_key3.step_out }, "masking json object at depth 4"); }); describe("JsonMaskArrayIndexNIVC", async () => { @@ -147,12 +148,41 @@ describe("JsonMaskArrayIndexNIVC", async () => { function generatePassCase(input: any, expected: any, desc: string) { const description = generateDescription(input); - it(`(valid) witness: ${description} ${desc}`, async () => { - console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) await circuit.expectPass(input, expected); }); } let index = 0; - generatePassCase({ step_in: nivc_extract_key1.step_out, index: index }, { step_out: nivc_extract_arr.step_out }, "masking json object at depth 0"); -}); \ No newline at end of file + generatePassCase({ step_in: nivc_extract_key1.step_out, index: index }, { step_out: nivc_extract_arr.step_out }, "masking json array index at depth 2"); +}); + + +describe("JsonExtractNIVC", async () => { + let circuit: WitnessTester<["step_in"], ["step_out"]>; + + let DATA_BYTES = 202; + let MAX_STACK_HEIGHT = 5; + + before(async () => { + circuit = await circomkit.WitnessTester(`JsonMaskExtractFinal`, { + file: "json/nivc/extractor", + template: "MaskExtractFinal", + params: [DATA_BYTES, MAX_STACK_HEIGHT, 14], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) + await circuit.expectPass(input, expected); + }); + } + + + generatePassCase({ step_in: nivc_extract_key3.step_out }, {}, "masking json at depth 4"); +}); diff --git a/circuits/test/json/nivc/nivc_extract_key0.json b/circuits/test/json/nivc/nivc_extract_key0.json index d5f36aa..dbd4304 100644 --- a/circuits/test/json/nivc/nivc_extract_key0.json +++ b/circuits/test/json/nivc/nivc_extract_key0.json @@ -195,10 +195,10 @@ 93, 13, 10, - 0, - 0, - 0, - 0, + 32, + 32, + 32, + 125, 0, 0, 0, diff --git a/circuits/test/json/nivc/nivc_extract_key1.json b/circuits/test/json/nivc/nivc_extract_key1.json index 4d49a93..7d787ad 100644 --- a/circuits/test/json/nivc/nivc_extract_key1.json +++ b/circuits/test/json/nivc/nivc_extract_key1.json @@ -31,8 +31,8 @@ 0, 0, 0, - 58, - 32, + 0, + 0, 91, 13, 10, @@ -193,8 +193,8 @@ 32, 32, 93, - 13, - 10, + 0, + 0, 0, 0, 0, diff --git a/circuits/test/json/nivc/nivc_extract_key2.json b/circuits/test/json/nivc/nivc_extract_key2.json index ae19f04..09d1b80 100644 --- a/circuits/test/json/nivc/nivc_extract_key2.json +++ b/circuits/test/json/nivc/nivc_extract_key2.json @@ -110,65 +110,65 @@ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, 0, 0, 0, diff --git a/circuits/test/json/nivc/nivc_extract_key3.json b/circuits/test/json/nivc/nivc_extract_key3.json index 4dbe2ac..2282500 100644 --- a/circuits/test/json/nivc/nivc_extract_key3.json +++ b/circuits/test/json/nivc/nivc_extract_key3.json @@ -108,35 +108,35 @@ 0, 0, 0, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, 34, 84, 97, @@ -151,37 +151,37 @@ 102, 116, 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, 0, 0, 0, @@ -2626,6 +2626,6 @@ 0, 0, 0, - 4 + 5 ] } \ No newline at end of file From 09629908503ad05c84281b41f73487e9f2c88b0f Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Sun, 20 Oct 2024 09:30:34 -0600 Subject: [PATCH 09/19] fix: final extraction --- circuits/test/json/nivc/masker_nivc.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 6540df9..c942387 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -178,11 +178,11 @@ describe("JsonExtractNIVC", async () => { const description = generateDescription(input); it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) + console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) await circuit.expectPass(input, expected); }); } - - generatePassCase({ step_in: nivc_extract_key3.step_out }, {}, "masking json at depth 4"); + let value = [34, 84, 97, 121, 108, 111, 114, 32, 83, 119, 105, 102, 116, 34] // `"Taylor Swift" + generatePassCase({ step_in: nivc_extract_key3.step_out }, { value: value }, "masking json at depth 4"); }); From 57b054203496f7c679575ef8dd09a5e9775d3901 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Sun, 20 Oct 2024 15:30:28 -0600 Subject: [PATCH 10/19] cleanup: unused signals, consistency Found unused signals with the circom-witnesscalc `build-circuit` binary. These are now removed. --- circuits/json/nivc/masker.circom | 85 +++++---------------- circuits/test/json/nivc/masker_nivc.test.ts | 5 +- circuits/utils/array.circom | 31 ++++++++ 3 files changed, 50 insertions(+), 71 deletions(-) diff --git a/circuits/json/nivc/masker.circom b/circuits/json/nivc/masker.circom index 5db15a9..66dbf81 100644 --- a/circuits/json/nivc/masker.circom +++ b/circuits/json/nivc/masker.circom @@ -1,6 +1,7 @@ pragma circom 2.1.9; include "../interpreter.circom"; +include "../../utils/array.circom"; template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // ------------------------------------------------------------------------------------------------------------------ // @@ -15,6 +16,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; // Grab the raw data bytes from the `step_in` variable var paddedDataLen = DATA_BYTES + MAX_KEY_LENGTH + 1; @@ -22,7 +24,7 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { for (var i = 0 ; i < DATA_BYTES ; i++) { data[i] <== step_in[i]; } - for (var i = 0 ; i <= MAX_KEY_LENGTH ; i++) { + for (var i = 0 ; i < MAX_KEY_LENGTH + 1 ; i++) { data[DATA_BYTES + i] <== 0; } @@ -35,8 +37,8 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { stack[i][j][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2]; stack[i][j][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2 + 1]; } else { - // TODO: Now need to do "if curr_depth == MAX_STACK_HEIGHT", set nextStackSelector <== [0,0] // Add one extra stack element without doing this while parsing. + // Stack under/overflow caught in parsing. stack[i][j][0] <== 0; stack[i][j][1] <== 0; } @@ -84,10 +86,10 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { is_key_match_for_value[1] <== Mux1()([is_key_match_for_value[0] * (1-is_next_pair_at_depth[0]), is_key_match[0] * (1-is_next_pair_at_depth[0])], is_key_match[0]); is_value_match[0] <== parsing_value[0] * is_key_match_for_value[1]; - signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; - step_out[0] <== data[0] * is_value_match[0]; - signal or[DATA_BYTES]; + or[0] <== is_value_match[0]; + step_out[0] <== data[0] * or[0]; + for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { // Grab the stack at the indicated height (from `step_in`) stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT + 1, 2); @@ -98,16 +100,10 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { nextStackSelector[data_idx].in <== stack[data_idx]; nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; - // log("stackSelector[", data_idx, "].out[0] = ", stackSelector[data_idx].out[0]); - // log("stackSelector[", data_idx, "].out[1] = ", stackSelector[data_idx].out[1]); - // Detect if we are parsing parsing_key[data_idx] <== InsideKey()(stackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); parsing_value[data_idx] <== InsideValueObject()(stackSelector[data_idx].out, nextStackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1]); - // log("parsing_key[", data_idx, "] = ", parsing_key[data_idx]); - // log("parsing_value[", data_idx, "] = ", parsing_value[data_idx]); - // to get correct value, check: // - key matches at current index and depth of key is as specified // - whether next KV pair starts @@ -115,16 +111,12 @@ template JsonMaskObjectNIVC(DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH) { is_key_match[data_idx] <== KeyMatchAtIndex(paddedDataLen, MAX_KEY_LENGTH, data_idx)(data, key, keyLen, parsing_key[data_idx]); is_next_pair_at_depth[data_idx] <== NextKVPairAtDepth(MAX_STACK_HEIGHT + 1)(stack[data_idx], data[data_idx], step_in[TOTAL_BYTES_ACROSS_NIVC - 1]); - // log("is_key_match[", data_idx, "] = ", is_key_match[data_idx]); - // log("is_next_pair_at_depth[", data_idx, "] = ", is_next_pair_at_depth[data_idx]); - is_key_match_for_value[data_idx+1] <== Mux1()([is_key_match_for_value[data_idx] * (1-is_next_pair_at_depth[data_idx]), is_key_match[data_idx] * (1-is_next_pair_at_depth[data_idx])], is_key_match[data_idx]); is_value_match[data_idx] <== is_key_match_for_value[data_idx+1] * parsing_value[data_idx]; // Set the next NIVC step to only have the masked data - or[data_idx] <== OR()(is_value_match[data_idx], is_value_match[data_idx -1]); + or[data_idx] <== OR()(is_value_match[data_idx], is_value_match[data_idx -1]); step_out[data_idx] <== data[data_idx] * or[data_idx]; - // log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } // Append the parser state back on `step_out` for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC - 1 ; i++) { @@ -148,7 +140,8 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) - signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; // ADD 1 FOR CURRENT STACK POINTER + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; // Grab the raw data bytes from the `step_in` variable signal data[DATA_BYTES]; @@ -165,8 +158,8 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { stack[i][j][0] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2]; stack[i][j][1] <== step_in[DATA_BYTES + i * PER_ITERATION_DATA_LENGTH + j * 2 + 1]; } else { - // TODO: Now need to do "if curr_depth == MAX_STACK_HEIGHT", set nextStackSelector <== [0,0] // Add one extra stack element without doing this while parsing. + // Stack under/overflow caught in parsing. stack[i][j][0] <== 0; stack[i][j][1] <== 0; } @@ -181,12 +174,7 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // ~ Array index masking ~ signal input index; - // value starting index in `data` - signal value_starting_index[DATA_BYTES]; - signal mask[DATA_BYTES]; - - signal parsing_array[DATA_BYTES]; - signal or[DATA_BYTES]; // Maybe don't need + signal parsing_array[DATA_BYTES]; component stackSelector[DATA_BYTES]; stackSelector[0] = ArraySelector(MAX_STACK_HEIGHT + 1, 2); @@ -199,8 +187,10 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { nextStackSelector[0].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; parsing_array[0] <== InsideArrayIndexObject()(stackSelector[0].out, nextStackSelector[0].out, parsingData[0][0], parsingData[0][1], index); - mask[0] <== data[0] * parsing_array[0]; + signal or[DATA_BYTES]; + or[0] <== parsing_array[0]; + step_out[0] <== data[0] * or[0]; for(var data_idx = 1; data_idx < DATA_BYTES; data_idx++) { stackSelector[data_idx] = ArraySelector(MAX_STACK_HEIGHT + 1, 2); stackSelector[data_idx].in <== stack[data_idx]; @@ -210,22 +200,14 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { nextStackSelector[data_idx].in <== stack[data_idx]; nextStackSelector[data_idx].index <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; - // log("stackSelector[", data_idx, "].out[0] = ", stackSelector[data_idx].out[0]); - // log("stackSelector[", data_idx, "].out[1] = ", stackSelector[data_idx].out[1]); - // log("nextStackSelector[", data_idx, "].out[0] = ", nextStackSelector[data_idx].out[0]); - // log("nextStackSelector[", data_idx, "].out[1] = ", nextStackSelector[data_idx].out[1]); - parsing_array[data_idx] <== InsideArrayIndexObject()(stackSelector[data_idx].out, nextStackSelector[data_idx].out, parsingData[data_idx][0], parsingData[data_idx][1], index); - or[data_idx] <== OR()(parsing_array[data_idx], parsing_array[data_idx - 1]); - mask[data_idx] <== data[data_idx] * or[data_idx]; + or[data_idx] <== OR()(parsing_array[data_idx], parsing_array[data_idx - 1]); + step_out[data_idx] <== data[data_idx] * or[data_idx]; } // Write the `step_out` with masked data - signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; - for (var i = 0 ; i < DATA_BYTES ; i++) { - step_out[i] <== mask[i]; - } + // Append the parser state back on `step_out` for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC - 1 ; i++) { step_out[i] <== step_in[i]; @@ -233,34 +215,3 @@ template JsonMaskArrayIndexNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // No need to pad as this is currently when TOTAL_BYTES == TOTAL_BYTES_USED step_out[TOTAL_BYTES_ACROSS_NIVC - 1] <== step_in[TOTAL_BYTES_ACROSS_NIVC - 1] + 1; } - -template ArraySelector(m, n) { - signal input in[m][n]; - signal input index; - signal output out[n]; - assert(index >= 0 && index < m); - - signal selector[m]; - component Equal[m]; - for (var i = 0; i < m; i++) { - selector[i] <== IsEqual()([index, i]); - } - - var sum = 0; - for (var i = 0; i < m; i++) { - sum += selector[i]; - } - sum === 1; - - signal sums[n][m+1]; - // note: loop order is column-wise, not row-wise - for (var j = 0; j < n; j++) { - sums[j][0] <== 0; - for (var i = 0; i < m; i++) { - sums[j][i+1] <== sums[j][i] + in[i][j] * selector[i]; - } - out[j] <== sums[j][m]; - } -} - -// component main { public [step_in] } = JsonMaskObjectNIVC(320, 5, 7); \ No newline at end of file diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index c942387..08217da 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -105,9 +105,6 @@ describe("JsonMaskObjectNIVC", async () => { it(`(valid) witness: ${desc}`, async () => { // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - let wit = await circuit.calculateWitness(input); - // console.log("wit", wit.slice(0, 100)); - // step_out = wit; await circuit.expectPass(input, expected); }); } @@ -178,7 +175,7 @@ describe("JsonExtractNIVC", async () => { const description = generateDescription(input); it(`(valid) witness: ${desc}`, async () => { - console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) + // console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) await circuit.expectPass(input, expected); }); } diff --git a/circuits/utils/array.circom b/circuits/utils/array.circom index d19b4d6..fb28002 100644 --- a/circuits/utils/array.circom +++ b/circuits/utils/array.circom @@ -196,6 +196,8 @@ template ScalarArrayMul(n) { } } +// TODO: Below really needs documentation. + // from: https://github.com/pluto/aes-proof/blob/main/circuits/aes-gcm/helper_functions.circom template SumMultiple(n) { signal input nums[n]; @@ -229,4 +231,33 @@ template IndexSelector(total) { } out <== calcTotal.sum; +} + +template ArraySelector(m, n) { + signal input in[m][n]; + signal input index; + signal output out[n]; + assert(index >= 0 && index < m); + + signal selector[m]; + component Equal[m]; + for (var i = 0; i < m; i++) { + selector[i] <== IsEqual()([index, i]); + } + + var sum = 0; + for (var i = 0; i < m; i++) { + sum += selector[i]; + } + sum === 1; + + signal sums[n][m+1]; + // note: loop order is column-wise, not row-wise + for (var j = 0; j < n; j++) { + sums[j][0] <== 0; + for (var i = 0; i < m; i++) { + sums[j][i+1] <== sums[j][i] + in[i][j] * selector[i]; + } + out[j] <== sums[j][m]; + } } \ No newline at end of file From 81937bca49a3d7411525a3ce54c4f7fe6acb2dff Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Sun, 20 Oct 2024 16:10:26 -0600 Subject: [PATCH 11/19] feat: passing HTTP NIVC tests --- circuits/http/nivc/body_mask.circom | 21 +- circuits/http/nivc/lock_header.circom | 38 +- .../nivc/parse_and_lock_start_line.circom | 60 +- circuits/test/http/nivc/body_mask.json | 4165 +++++++++++++++++ circuits/test/http/nivc/nivc.test.ts | 152 + .../http/nivc/parse_and_lock_start_line.json | 4165 +++++++++++++++++ circuits/test/json/nivc/masker_nivc.test.ts | 8 - 7 files changed, 8549 insertions(+), 60 deletions(-) create mode 100644 circuits/test/http/nivc/body_mask.json create mode 100644 circuits/test/http/nivc/nivc.test.ts create mode 100644 circuits/test/http/nivc/parse_and_lock_start_line.json diff --git a/circuits/http/nivc/body_mask.circom b/circuits/http/nivc/body_mask.circom index 121ea23..5ac67f9 100644 --- a/circuits/http/nivc/body_mask.circom +++ b/circuits/http/nivc/body_mask.circom @@ -1,39 +1,36 @@ pragma circom 2.1.9; -include "parser-attestor/circuits/http/interpreter.circom"; +include "../interpreter.circom"; -template HTTPMaskBodyNIVC(TOTAL_BYTES, DATA_BYTES) { +template HTTPMaskBodyNIVC(DATA_BYTES, MAX_STACK_HEIGHT) { // ------------------------------------------------------------------------------------------------------------------ // - // ~~ Set sizes at compile time ~~ + // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data - var PER_ITERATION_DATA_LENGTH = 5; - // -> var TOTAL_BYTES = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (HttpParseAndLockStartLine or HTTPLockHeader) - signal input step_in[TOTAL_BYTES + 1]; // ADD ONE FOR JSON LATER + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; signal data[DATA_BYTES]; signal parsing_body[DATA_BYTES]; for (var i = 0 ; i < DATA_BYTES ; i++) { data[i] <== step_in[i]; - parsing_body[i] <== step_in[DATA_BYTES + i * 5 + 4]; + parsing_body[i] <== step_in[DATA_BYTES + i * 5 + 4]; // `parsing_body` stored in every 5th slot of step_in/out } // ------------------------------------------------------------------------------------------------------------------ // // ~ Write out to next NIVC step - signal output step_out[TOTAL_BYTES + 1]; for (var i = 0 ; i < DATA_BYTES ; i++) { step_out[i] <== data[i] * parsing_body[i]; } // Write out padded with zeros - for (var i = DATA_BYTES ; i < TOTAL_BYTES ; i++) { + for (var i = DATA_BYTES ; i < TOTAL_BYTES_ACROSS_NIVC ; i++) { step_out[i] <== 0; } - step_out[TOTAL_BYTES] <== 0; } -component main { public [step_in] } = HTTPMaskBodyNIVC(4160, 320); - diff --git a/circuits/http/nivc/lock_header.circom b/circuits/http/nivc/lock_header.circom index bdfb4b5..a9e532c 100644 --- a/circuits/http/nivc/lock_header.circom +++ b/circuits/http/nivc/lock_header.circom @@ -1,35 +1,46 @@ pragma circom 2.1.9; -include "parser-attestor/circuits/http/interpreter.circom"; -include "parser-attestor/circuits/utils/array.circom"; +include "../interpreter.circom"; +include "../../utils/array.circom"; -template LockHeader(TOTAL_BYTES, DATA_BYTES, headerNameLen, headerValueLen) { +// TODO: should use a MAX_HEADER_NAME_LENGTH and a MAX_HEADER_VALUE_LENGTH +template LockHeader(DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH) { // ------------------------------------------------------------------------------------------------------------------ // - // ~~ Set sizes at compile time ~~ + // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data - var PER_ITERATION_DATA_LENGTH = 5; - var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + /* 5 is for the variables: + next_parsing_start + next_parsing_header + next_parsing_field_name + next_parsing_field_value + State[i].next_parsing_body + */ + var TOTAL_BYTES_HTTP_STATE = DATA_BYTES * (5 + 1); // data + parser vars + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (HttpParseAndLockStartLine or HTTPLockHeader) - signal input step_in[TOTAL_BYTES + 1]; // ADD ONE FOR JSON LATER ON + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; signal data[DATA_BYTES]; for (var i = 0 ; i < DATA_BYTES ; i++) { data[i] <== step_in[i]; } - signal input header[headerNameLen]; - signal input value[headerValueLen]; + // TODO: Better naming for these variables + signal input header[HEADER_NAME_LENGTH]; + signal input value[HEADER_VALUE_LENGTH]; - component headerNameLocation = FirstStringMatch(DATA_BYTES, headerNameLen); + component headerNameLocation = FirstStringMatch(DATA_BYTES, HEADER_NAME_LENGTH); headerNameLocation.data <== data; headerNameLocation.key <== header; component headerFieldNameValueMatch; - headerFieldNameValueMatch = HeaderFieldNameValueMatch(DATA_BYTES, headerNameLen, headerValueLen); + headerFieldNameValueMatch = HeaderFieldNameValueMatch(DATA_BYTES, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH); headerFieldNameValueMatch.data <== data; headerFieldNameValueMatch.headerName <== header; headerFieldNameValueMatch.headerValue <== value; @@ -41,7 +52,6 @@ template LockHeader(TOTAL_BYTES, DATA_BYTES, headerNameLen, headerValueLen) { // ------------------------------------------------------------------------------------------------------------------ // // ~ Write out to next NIVC step - signal output step_out[TOTAL_BYTES + 1]; for (var i = 0 ; i < DATA_BYTES ; i++) { // add plaintext http input to step_out step_out[i] <== step_in[i]; @@ -54,10 +64,9 @@ template LockHeader(TOTAL_BYTES, DATA_BYTES, headerNameLen, headerValueLen) { step_out[DATA_BYTES + i * 5 + 4] <== step_in[DATA_BYTES + i * 5 + 4]; } // Pad remaining with zeros - for (var i = TOTAL_BYTES_USED ; i < TOTAL_BYTES ; i++ ) { + for (var i = TOTAL_BYTES_HTTP_STATE ; i < TOTAL_BYTES_ACROSS_NIVC ; i++ ) { step_out[i] <== 0; } - step_out[TOTAL_BYTES] <== 0; } // TODO: Handrolled template that I haven't tested YOLO. @@ -84,5 +93,4 @@ template FirstStringMatch(dataLen, keyLen) { position <== counter; } -component main { public [step_in] } = LockHeader(4160, 320, 12, 31); diff --git a/circuits/http/nivc/parse_and_lock_start_line.circom b/circuits/http/nivc/parse_and_lock_start_line.circom index 39d82ef..755c5e0 100644 --- a/circuits/http/nivc/parse_and_lock_start_line.circom +++ b/circuits/http/nivc/parse_and_lock_start_line.circom @@ -1,37 +1,48 @@ pragma circom 2.1.9; -include "parser-attestor/circuits/http/parser/machine.circom"; -include "parser-attestor/circuits/http/interpreter.circom"; -include "parser-attestor/circuits/utils/bytes.circom"; +include "../parser/machine.circom"; +include "../interpreter.circom"; +include "../../utils/bytes.circom"; // TODO: Note that TOTAL_BYTES will match what we have for AESGCMFOLD step_out // I have not gone through to double check the sizes of everything yet. -template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLen) { +template ParseAndLockStartLine(DATA_BYTES, MAX_STACK_HEIGHT, BEGINNING_LENGTH, MIDDLE_LENGTH, FINAL_LENGTH) { // ------------------------------------------------------------------------------------------------------------------ // // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data - var AES_BYTES = DATA_BYTES + 50; // TODO: Might be wrong, but good enough for now - var PER_ITERATION_DATA_LENGTH = 5; - var TOTAL_BYTES_USED = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1); // data + parser vars + // var AES_BYTES = DATA_BYTES + 50; // TODO: Might be wrong, but good enough for now + /* 5 is for the variables: + next_parsing_start + next_parsing_header + next_parsing_field_name + next_parsing_field_value + State[i].next_parsing_body + */ + var TOTAL_BYTES_HTTP_STATE = DATA_BYTES * (5 + 1); // data + parser vars + var PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + var TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; // ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (JsonParseNIVC) - signal input step_in[TOTAL_BYTES + 1]; // ADD 1 FOR JSON STUFF LATER + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; signal data[DATA_BYTES]; for (var i = 0 ; i < DATA_BYTES ; i++) { - data[i] <== step_in[50 + i]; + // data[i] <== step_in[50 + i]; // THIS WAS OFFSET FOR AES, WHICH WE NEED TO TAKE INTO ACCOUNT + data[i] <== step_in[i]; } // // TODO: check if these needs to here or not + // DON'T THINK WE NEED THIS SINCE AES SHOULD OUTPUT ASCII OR FAIL // component dataASCII = ASCII(DATA_BYTES); // dataASCII.in <== data; - signal input beginning[beginningLen]; - signal input middle[middleLen]; - signal input final[finalLen]; + signal input beginning[BEGINNING_LENGTH]; + signal input middle[MIDDLE_LENGTH]; + signal input final[FINAL_LENGTH]; // Initialze the parser component State[DATA_BYTES]; @@ -46,11 +57,11 @@ template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLe /* Note, because we know a beginning is the very first thing in a request - we can make this more efficient by just comparing the first `beginningLen` bytes + we can make this more efficient by just comparing the first `BEGINNING_LENGTH` bytes of the data ASCII against the beginning ASCII itself. */ // Check first beginning byte - signal beginningIsEqual[beginningLen]; + signal beginningIsEqual[BEGINNING_LENGTH]; beginningIsEqual[0] <== IsEqual()([data[0],beginning[0]]); beginningIsEqual[0] === 1; @@ -73,7 +84,7 @@ template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLe State[data_idx].line_status <== State[data_idx - 1].next_line_status; // Check remaining beginning bytes - if(data_idx < beginningLen) { + if(data_idx < BEGINNING_LENGTH) { beginningIsEqual[data_idx] <== IsEqual()([data[data_idx], beginning[data_idx]]); beginningIsEqual[data_idx] === 1; } @@ -90,25 +101,25 @@ template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLe } // Additionally verify beginning had correct length - beginningLen === middle_start_counter - 1; + BEGINNING_LENGTH === middle_start_counter - 1; // Check middle is correct by substring match and length check - signal middleMatch <== SubstringMatchWithIndex(DATA_BYTES, middleLen)(data, middle, middle_start_counter); + signal middleMatch <== SubstringMatchWithIndex(DATA_BYTES, MIDDLE_LENGTH)(data, middle, middle_start_counter); middleMatch === 1; - middleLen === middle_end_counter - middle_start_counter - 1; + MIDDLE_LENGTH === middle_end_counter - middle_start_counter - 1; // Check final is correct by substring match and length check - signal finalMatch <== SubstringMatchWithIndex(DATA_BYTES, finalLen)(data, final, middle_end_counter); + signal finalMatch <== SubstringMatchWithIndex(DATA_BYTES, FINAL_LENGTH)(data, final, middle_end_counter); finalMatch === 1; // -2 here for the CRLF - finalLen === final_end_counter - middle_end_counter - 2; + FINAL_LENGTH === final_end_counter - middle_end_counter - 2; // ------------------------------------------------------------------------------------------------------------------ // // ~ Write out to next NIVC step (Lock Header) - signal output step_out[TOTAL_BYTES + 1]; for (var i = 0 ; i < DATA_BYTES ; i++) { // add plaintext http input to step_out - step_out[i] <== step_in[50 + i]; + // step_out[i] <== step_in[50 + i]; // AGAIN, NEED TO ACCOUNT FOR AES VARIABLES POSSIBLY + step_out[i] <== step_in[i]; // add parser state step_out[DATA_BYTES + i * 5] <== State[i].next_parsing_start; @@ -118,10 +129,9 @@ template LockStartLine(TOTAL_BYTES, DATA_BYTES, beginningLen, middleLen, finalLe step_out[DATA_BYTES + i * 5 + 4] <== State[i].next_parsing_body; } // Pad remaining with zeros - for (var i = TOTAL_BYTES_USED ; i < TOTAL_BYTES ; i++ ) { + for (var i = TOTAL_BYTES_HTTP_STATE ; i < TOTAL_BYTES_ACROSS_NIVC ; i++ ) { step_out[i] <== 0; } - step_out[TOTAL_BYTES] <== 0; } -component main { public [step_in] } = LockStartLine(4160, 320, 8, 3, 2); \ No newline at end of file +// component main { public [step_in] } = LockStartLine(320, 8, 3, 2); \ No newline at end of file diff --git a/circuits/test/http/nivc/body_mask.json b/circuits/test/http/nivc/body_mask.json new file mode 100644 index 0000000..3e1ad3a --- /dev/null +++ b/circuits/test/http/nivc/body_mask.json @@ -0,0 +1,4165 @@ +{ + "step_out": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 123, + 13, + 10, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 105, + 116, + 101, + 109, + 115, + 34, + 58, + 32, + 91, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 93, + 13, + 10, + 32, + 32, + 32, + 125, + 13, + 10, + 125, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] +} \ No newline at end of file diff --git a/circuits/test/http/nivc/nivc.test.ts b/circuits/test/http/nivc/nivc.test.ts new file mode 100644 index 0000000..814892b --- /dev/null +++ b/circuits/test/http/nivc/nivc.test.ts @@ -0,0 +1,152 @@ +import { circomkit, WitnessTester, generateDescription, readJsonFile } from "../../common"; +import { join } from "path"; + +// HTTP/1.1 200 OK +// content-type: application/json; charset=utf-8 +// content-encoding: gzip +// Transfer-Encoding: chunked +// +// { +// "data": { +// "items": [ +// { +// "data": "Artist", +// "profile": { +// "name": "Taylor Swift" +// } +// } +// ] +// } +// } + +interface NIVCData { + step_out: number[]; +} + +// 320 bytes in the HTTP response +let http_response_plaintext = [ + 72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75, 13, 10, 99, 111, 110, 116, 101, 110, + 116, 45, 116, 121, 112, 101, 58, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, + 115, 111, 110, 59, 32, 99, 104, 97, 114, 115, 101, 116, 61, 117, 116, 102, 45, 56, 13, 10, 99, + 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 58, 32, 103, 122, 105, + 112, 13, 10, 84, 114, 97, 110, 115, 102, 101, 114, 45, 69, 110, 99, 111, 100, 105, 110, 103, 58, + 32, 99, 104, 117, 110, 107, 101, 100, 13, 10, 13, 10, 123, 13, 10, 32, 32, 32, 34, 100, 97, 116, + 97, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 34, 105, 116, 101, 109, 115, 34, 58, 32, + 91, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 34, 65, 114, 116, 105, 115, + 116, 34, 44, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 112, 114, + 111, 102, 105, 108, 101, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 34, 110, 97, 109, 101, 34, 58, 32, 34, 84, 97, 121, 108, 111, 114, 32, 83, 119, + 105, 102, 116, 34, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 93, 13, + 10, 32, 32, 32, 125, 13, 10, 125]; + +let http_parse_and_lock_start_line = readJsonFile(join(__dirname, "..", "nivc/parse_and_lock_start_line.json")); +let http_body_mask = readJsonFile(join(__dirname, "..", "nivc/body_mask.json")); + +describe("HTTPParseAndLockStartLineNIVC", async () => { + let circuit: WitnessTester<["step_in"], ["step_out"]>; + + let DATA_BYTES = 320; + let MAX_STACK_HEIGHT = 5; + let PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + + let TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + + let beginning = [72, 84, 84, 80, 47, 49, 46, 49]; // HTTP/1.1 + let BEGINNING_LENGTH = 8; + let middle = [50, 48, 48]; // 200 + let MIDDLE_LENGTH = 3; + let final = [79, 75]; // OK + let FINAL_LENGTH = 2; + + before(async () => { + circuit = await circomkit.WitnessTester(`ParseAndLockStartLine`, { + file: "http/nivc/parse_and_lock_start_line", + template: "ParseAndLockStartLine", + params: [DATA_BYTES, MAX_STACK_HEIGHT, BEGINNING_LENGTH, MIDDLE_LENGTH, FINAL_LENGTH], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + + } + + let extended_json_input = http_response_plaintext.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - http_response_plaintext.length)).fill(0)); + + generatePassCase({ step_in: extended_json_input, beginning: beginning, middle: middle, final: final }, { step_out: http_parse_and_lock_start_line.step_out }, "parsing HTTP"); +}); + +describe("HTTPLockHeaderNIVC", async () => { + let circuit: WitnessTester<["step_in", "header", "value"], ["step_out"]>; + + let DATA_BYTES = 320; + let MAX_STACK_HEIGHT = 5; + + let header_name = [99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101]; // content-type + let HEADER_NAME_LENGTH = 12; + let header_value = [ + 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 59, 32, 99, 104, 97, + 114, 115, 101, 116, 61, 117, 116, 102, 45, 56, + ]; // application/json; charset=utf-8 + let HEADER_VALUE_LENGTH = 31; + + before(async () => { + circuit = await circomkit.WitnessTester(`LockHeader`, { + file: "http/nivc/lock_header", + template: "LockHeader", + params: [DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + + } + + generatePassCase({ step_in: http_parse_and_lock_start_line.step_out, header: header_name, value: header_value }, { step_out: http_parse_and_lock_start_line.step_out }, "locking HTTP header"); +}); + +describe("HTTPBodyMaskNIVC", async () => { + let circuit: WitnessTester<["step_in"], ["step_out"]>; + + let DATA_BYTES = 320; + let MAX_STACK_HEIGHT = 5; + + before(async () => { + circuit = await circomkit.WitnessTester(`BodyMask`, { + file: "http/nivc/body_mask", + template: "HTTPMaskBodyNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT], + }); + console.log("#constraints:", await circuit.getConstraintCount()); + + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + + } + + generatePassCase({ step_in: http_parse_and_lock_start_line.step_out }, { step_out: http_body_mask.step_out }, "locking HTTP header"); +}); \ No newline at end of file diff --git a/circuits/test/http/nivc/parse_and_lock_start_line.json b/circuits/test/http/nivc/parse_and_lock_start_line.json new file mode 100644 index 0000000..659d281 --- /dev/null +++ b/circuits/test/http/nivc/parse_and_lock_start_line.json @@ -0,0 +1,4165 @@ +{ + "step_out": [ + 72, + 84, + 84, + 80, + 47, + 49, + 46, + 49, + 32, + 50, + 48, + 48, + 32, + 79, + 75, + 13, + 10, + 99, + 111, + 110, + 116, + 101, + 110, + 116, + 45, + 116, + 121, + 112, + 101, + 58, + 32, + 97, + 112, + 112, + 108, + 105, + 99, + 97, + 116, + 105, + 111, + 110, + 47, + 106, + 115, + 111, + 110, + 59, + 32, + 99, + 104, + 97, + 114, + 115, + 101, + 116, + 61, + 117, + 116, + 102, + 45, + 56, + 13, + 10, + 99, + 111, + 110, + 116, + 101, + 110, + 116, + 45, + 101, + 110, + 99, + 111, + 100, + 105, + 110, + 103, + 58, + 32, + 103, + 122, + 105, + 112, + 13, + 10, + 84, + 114, + 97, + 110, + 115, + 102, + 101, + 114, + 45, + 69, + 110, + 99, + 111, + 100, + 105, + 110, + 103, + 58, + 32, + 99, + 104, + 117, + 110, + 107, + 101, + 100, + 13, + 10, + 13, + 10, + 123, + 13, + 10, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 105, + 116, + 101, + 109, + 115, + 34, + 58, + 32, + 91, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 100, + 97, + 116, + 97, + 34, + 58, + 32, + 34, + 65, + 114, + 116, + 105, + 115, + 116, + 34, + 44, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + 34, + 58, + 32, + 123, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 34, + 110, + 97, + 109, + 101, + 34, + 58, + 32, + 34, + 84, + 97, + 121, + 108, + 111, + 114, + 32, + 83, + 119, + 105, + 102, + 116, + 34, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 125, + 13, + 10, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 93, + 13, + 10, + 32, + 32, + 32, + 125, + 13, + 10, + 125, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 4, + 1, + 0, + 0, + 0, + 4, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] +} \ No newline at end of file diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 08217da..7f53f16 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -19,14 +19,6 @@ import { join } from "path"; // } // } -// Notes: -// - "data"'s object appears at byte 14 -// - colon after "items" appears at byte 31 -// - 0th index of arr appears at byte 47 -// - byte 64 is `"` for the data inside the array obj -// - byte 81 is where `Artist",` ends -// - byte 100 is where `"profile"` starts - interface NIVCData { step_out: number[]; } From 0e98a0d8f7c9e354aeaee633e1c207ba4e017102 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Sun, 20 Oct 2024 16:18:03 -0600 Subject: [PATCH 12/19] fix: unallocated signals `HTTPParseAndLockStartLine` had unused signals. I set these properly now. --- circuits/http/nivc/parse_and_lock_start_line.circom | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/circuits/http/nivc/parse_and_lock_start_line.circom b/circuits/http/nivc/parse_and_lock_start_line.circom index 755c5e0..d16ae6d 100644 --- a/circuits/http/nivc/parse_and_lock_start_line.circom +++ b/circuits/http/nivc/parse_and_lock_start_line.circom @@ -69,6 +69,10 @@ template ParseAndLockStartLine(DATA_BYTES, MAX_STACK_HEIGHT, BEGINNING_LENGTH, M signal startLineMask[DATA_BYTES]; signal middleMask[DATA_BYTES]; signal finalMask[DATA_BYTES]; + startLineMask[0] <== inStartLine()(State[0].parsing_start); + middleMask[0] <== inStartMiddle()(State[0].parsing_start); + finalMask[0] <== inStartEnd()(State[0].parsing_start); + var middle_start_counter = 1; var middle_end_counter = 1; @@ -133,5 +137,3 @@ template ParseAndLockStartLine(DATA_BYTES, MAX_STACK_HEIGHT, BEGINNING_LENGTH, M step_out[i] <== 0; } } - -// component main { public [step_in] } = LockStartLine(320, 8, 3, 2); \ No newline at end of file From 0550f51b6e0b545271e7b1fb17656f1b1df95930 Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 15:46:41 +0530 Subject: [PATCH 13/19] rename SubstringMatchWithIndex --- circuits/test/utils/search.test.ts | 4 ++-- circuits/utils/search.circom | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/circuits/test/utils/search.test.ts b/circuits/test/utils/search.test.ts index 98b8bd8..f172fa1 100644 --- a/circuits/test/utils/search.test.ts +++ b/circuits/test/utils/search.test.ts @@ -152,14 +152,14 @@ describe("search", () => { }); }); - describe("SubstringMatchWithIndexx", () => { + describe("SubstringMatchWithIndexPadded", () => { let circuit: WitnessTester<["data", "key", "keyLen", "start"], ["out"]>; let maxKeyLen = 30; before(async () => { circuit = await circomkit.WitnessTester(`SubstringSearch`, { file: "utils/search", - template: "SubstringMatchWithIndexx", + template: "SubstringMatchWithIndexPadded", params: [787, maxKeyLen], }); console.log("#constraints:", await circuit.getConstraintCount()); diff --git a/circuits/utils/search.circom b/circuits/utils/search.circom index 821051d..6b9e1aa 100644 --- a/circuits/utils/search.circom +++ b/circuits/utils/search.circom @@ -232,7 +232,7 @@ template SubstringMatchWithIndex(dataLen, keyLen) { signal output out <== isStartLessThanMaxLength * isSubarrayMatch; } -template SubstringMatchWithIndexx(dataLen, maxKeyLen) { +template SubstringMatchWithIndexPadded(dataLen, maxKeyLen) { signal input data[dataLen]; signal input key[maxKeyLen]; signal input keyLen; From c6f5353597cf5a63217e183ccad917eeea13e3e0 Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 15:47:14 +0530 Subject: [PATCH 14/19] add `HeaderFieldNameValueMatchPadded` --- circuits/http/interpreter.circom | 27 +++++++- circuits/test/http/interpreter.test.ts | 69 +++++++++++++++++++++ circuits/test/json/nivc/masker_nivc.test.ts | 4 +- 3 files changed, 96 insertions(+), 4 deletions(-) diff --git a/circuits/http/interpreter.circom b/circuits/http/interpreter.circom index ddcd52b..79e6278 100644 --- a/circuits/http/interpreter.circom +++ b/circuits/http/interpreter.circom @@ -47,8 +47,6 @@ template HeaderFieldNameValueMatch(dataLen, nameLen, valueLen) { signal input headerValue[valueLen]; signal input index; - // signal output value[valueLen]; - // is name matches signal headerNameMatch <== SubstringMatchWithIndex(dataLen, nameLen)(data, headerName, index); @@ -65,6 +63,31 @@ template HeaderFieldNameValueMatch(dataLen, nameLen, valueLen) { signal output out <== headerNameMatchAndNextByteColon * headerValueMatch; } +// https://www.rfc-editor.org/rfc/rfc9112.html#name-field-syntax +template HeaderFieldNameValueMatchPadded(dataLen, maxNameLen, maxValueLen) { + signal input data[dataLen]; + signal input headerName[maxNameLen]; + signal input nameLen; + signal input headerValue[maxValueLen]; + signal input valueLen; + signal input index; + + // is name matchesnameLen + signal headerNameMatch <== SubstringMatchWithIndexPadded(dataLen, maxNameLen)(data, headerName, nameLen, index); + + // next byte to name should be COLON + signal endOfHeaderName <== IndexSelector(dataLen)(data, index + nameLen); + signal isNextByteColon <== IsEqual()([endOfHeaderName, 58]); + + signal headerNameMatchAndNextByteColon <== headerNameMatch * isNextByteColon; + + // field-name: SP field-value + signal headerValueMatch <== SubstringMatchWithIndexPadded(dataLen, maxValueLen)(data, headerValue, valueLen, index + nameLen + 2); + + // header name matches + header value matches + signal output out <== headerNameMatchAndNextByteColon * headerValueMatch; +} + // https://www.rfc-editor.org/rfc/rfc9112.html#name-field-syntax template HeaderFieldNameMatch(dataLen, nameLen) { signal input data[dataLen]; diff --git a/circuits/test/http/interpreter.test.ts b/circuits/test/http/interpreter.test.ts index 24113c7..5bc6968 100644 --- a/circuits/test/http/interpreter.test.ts +++ b/circuits/test/http/interpreter.test.ts @@ -39,4 +39,73 @@ describe("HTTP :: Interpreter", async () => { generatePassCase(parsedHttp.input, toByte("GET"), 0, ""); generateFailCase(parsedHttp.input, toByte("POST"), 0, ""); }); +}); + +// 320 bytes in the HTTP response +let http_response_plaintext = [ + 72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75, 13, 10, 99, 111, 110, 116, 101, 110, + 116, 45, 116, 121, 112, 101, 58, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, + 115, 111, 110, 59, 32, 99, 104, 97, 114, 115, 101, 116, 61, 117, 116, 102, 45, 56, 13, 10, 99, + 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 58, 32, 103, 122, 105, + 112, 13, 10, 84, 114, 97, 110, 115, 102, 101, 114, 45, 69, 110, 99, 111, 100, 105, 110, 103, 58, + 32, 99, 104, 117, 110, 107, 101, 100, 13, 10, 13, 10, 123, 13, 10, 32, 32, 32, 34, 100, 97, 116, + 97, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 34, 105, 116, 101, 109, 115, 34, 58, 32, + 91, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 34, 65, 114, 116, 105, 115, + 116, 34, 44, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 112, 114, + 111, 102, 105, 108, 101, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 34, 110, 97, 109, 101, 34, 58, 32, 34, 84, 97, 121, 108, 111, 114, 32, 83, 119, + 105, 102, 116, 34, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 93, 13, + 10, 32, 32, 32, 125, 13, 10, 125]; + +describe("HeaderFieldNameValueMatchPadded", async () => { + let circuit: WitnessTester<["data", "headerName", "nameLen", "headerValue", "valueLen", "index"], ["out"]>; + + let DATA_BYTES = 320; + let MAX_NAME_LENGTH = 20; + let MAX_VALUE_LENGTH = 35; + + before(async () => { + circuit = await circomkit.WitnessTester(`HeaderFieldNameValueMatchPadded`, { + file: "http/interpreter", + template: "HeaderFieldNameValueMatchPadded", + params: [DATA_BYTES, MAX_NAME_LENGTH, MAX_VALUE_LENGTH], + }); + }); + + function generatePassCase(input: any, expected: any, desc: string) { + const description = generateDescription(input); + input["headerName"] = input["headerName"].concat(Array(MAX_NAME_LENGTH - input["headerName"].length).fill(0)); + input["headerValue"] = input["headerValue"].concat(Array(MAX_VALUE_LENGTH - input["headerValue"].length).fill(0)); + + it(`(valid) witness: ${desc}`, async () => { + // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) + await circuit.expectPass(input, expected); + }); + + } + + let header_name = toByte("content-type"); + let header_value = toByte("application/json; charset=utf-8"); + + let input = { + data: http_response_plaintext, + headerName: header_name, + nameLen: header_name.length, + headerValue: header_value, + valueLen: header_value.length, + index: 17, + } + generatePassCase(input, { out: 1 }, "header name and value matches"); + + let input2 = { + data: http_response_plaintext, + headerName: header_name, + nameLen: header_name.length, + headerValue: header_value, + valueLen: header_value.length, + index: 16, + } + generatePassCase(input2, { out: 0 }, "incorrect index"); }); \ No newline at end of file diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 7f53f16..21f69ae 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -23,7 +23,7 @@ interface NIVCData { step_out: number[]; } -// // 202 bytes in the JSON +// 202 bytes in the JSON let json_input = [123, 13, 10, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 34, 105, 116, 101, 109, 115, 34, 58, 32, 91, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 100, 97, 116, @@ -172,6 +172,6 @@ describe("JsonExtractNIVC", async () => { }); } - let value = [34, 84, 97, 121, 108, 111, 114, 32, 83, 119, 105, 102, 116, 34] // `"Taylor Swift" + let value = [34, 84, 97, 121, 108, 111, 114, 32, 83, 119, 105, 102, 116, 34] // `"Taylor Swift"` generatePassCase({ step_in: nivc_extract_key3.step_out }, { value: value }, "masking json at depth 4"); }); From 4b4d7fcac889f44b923c456492a39cb495232640 Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 15:47:28 +0530 Subject: [PATCH 15/19] add a todo in json interpreter --- circuits/json/interpreter.circom | 2 ++ 1 file changed, 2 insertions(+) diff --git a/circuits/json/interpreter.circom b/circuits/json/interpreter.circom index 3ccd7ad..8d8d18b 100644 --- a/circuits/json/interpreter.circom +++ b/circuits/json/interpreter.circom @@ -415,8 +415,10 @@ template MatchPaddedKey(n) { isQuote[i] <== IsEqual()([in[1][i], 34]); endOfKeyAccum[i+1] <== endOfKeyAccum[i] + isEndOfKey[i] * isQuote[i]; + // TODO: might not be right to check for zero, instead check for -1? isPaddedElement[i] = IsZero(); isPaddedElement[i].in <== in[0][i]; + equalComponent[i] = IsEqual(); equalComponent[i].in[0] <== in[0][i]; equalComponent[i].in[1] <== in[1][i] * (1-isPaddedElement[i].out); From 5ad82722acbd2bd4424af9c29857b572a6fea312 Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 15:47:48 +0530 Subject: [PATCH 16/19] change `LockHeader` to handle max key and value length --- circuits/http/nivc/lock_header.circom | 67 +++++++++++++++++---------- circuits/test/http/nivc/nivc.test.ts | 23 ++++----- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/circuits/http/nivc/lock_header.circom b/circuits/http/nivc/lock_header.circom index a9e532c..fed4294 100644 --- a/circuits/http/nivc/lock_header.circom +++ b/circuits/http/nivc/lock_header.circom @@ -4,7 +4,7 @@ include "../interpreter.circom"; include "../../utils/array.circom"; // TODO: should use a MAX_HEADER_NAME_LENGTH and a MAX_HEADER_VALUE_LENGTH -template LockHeader(DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH) { +template LockHeader(DATA_BYTES, MAX_STACK_HEIGHT, MAX_HEADER_NAME_LENGTH, MAX_HEADER_VALUE_LENGTH) { // ------------------------------------------------------------------------------------------------------------------ // // ~~ Set sizes at compile time ~~ // Total number of variables in the parser for each byte of data @@ -23,32 +23,34 @@ template LockHeader(DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VAL // ------------------------------------------------------------------------------------------------------------------ // // ~ Unravel from previous NIVC step ~ // Read in from previous NIVC step (HttpParseAndLockStartLine or HTTPLockHeader) - signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; + signal input step_in[TOTAL_BYTES_ACROSS_NIVC]; signal output step_out[TOTAL_BYTES_ACROSS_NIVC]; signal data[DATA_BYTES]; for (var i = 0 ; i < DATA_BYTES ; i++) { data[i] <== step_in[i]; } + signal httpParserState[DATA_BYTES * 5]; + for (var i = 0 ; i < DATA_BYTES * 5 ; i++) { + httpParserState[i] <== step_in[DATA_BYTES + i]; + } // TODO: Better naming for these variables - signal input header[HEADER_NAME_LENGTH]; - signal input value[HEADER_VALUE_LENGTH]; - - component headerNameLocation = FirstStringMatch(DATA_BYTES, HEADER_NAME_LENGTH); - headerNameLocation.data <== data; - headerNameLocation.key <== header; + signal input header[MAX_HEADER_NAME_LENGTH]; + signal input headerNameLength; + signal input value[MAX_HEADER_VALUE_LENGTH]; + signal input headerValueLength; - component headerFieldNameValueMatch; - headerFieldNameValueMatch = HeaderFieldNameValueMatch(DATA_BYTES, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH); - headerFieldNameValueMatch.data <== data; - headerFieldNameValueMatch.headerName <== header; - headerFieldNameValueMatch.headerValue <== value; - headerFieldNameValueMatch.index <== headerNameLocation.position; + // find header location + signal headerNameLocation <== FirstStringMatch(DATA_BYTES, MAX_HEADER_NAME_LENGTH)(data, header); - // TODO: Make this assert we are parsing header!!! // This is the assertion that we have locked down the correct header - headerFieldNameValueMatch.out === 1; + signal headerFieldNameValueMatch <== HeaderFieldNameValueMatchPadded(DATA_BYTES, MAX_HEADER_NAME_LENGTH, MAX_HEADER_VALUE_LENGTH)(data, header, headerNameLength, value, headerValueLength, headerNameLocation); + headerFieldNameValueMatch === 1; + + // parser state should be parsing header + signal isParsingHeader <== IndexSelector(DATA_BYTES * 5)(httpParserState, headerNameLocation * 5 + 1); + isParsingHeader === 1; // ------------------------------------------------------------------------------------------------------------------ // // ~ Write out to next NIVC step @@ -63,27 +65,42 @@ template LockHeader(DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VAL step_out[DATA_BYTES + i * 5 + 3] <== step_in[DATA_BYTES + i * 5 + 3]; step_out[DATA_BYTES + i * 5 + 4] <== step_in[DATA_BYTES + i * 5 + 4]; } - // Pad remaining with zeros + // Pad remaining with zeros for (var i = TOTAL_BYTES_HTTP_STATE ; i < TOTAL_BYTES_ACROSS_NIVC ; i++ ) { step_out[i] <== 0; } } // TODO: Handrolled template that I haven't tested YOLO. -template FirstStringMatch(dataLen, keyLen) { +template FirstStringMatch(dataLen, maxKeyLen) { signal input data[dataLen]; - signal input key[keyLen]; + signal input key[maxKeyLen]; signal output position; + signal paddedData[dataLen + maxKeyLen]; + for (var i = 0 ; i < dataLen ; i++) { + paddedData[i] <== data[i]; + } + for (var i = 0 ; i < maxKeyLen ; i++) { + paddedData[dataLen + i] <== 0; + } + var matched = 0; var counter = 0; - component stringMatch[dataLen - keyLen]; - component hasMatched[dataLen - keyLen]; - for (var idx = 0 ; idx < dataLen - keyLen ; idx++) { - stringMatch[idx] = IsEqualArray(keyLen); + component stringMatch[dataLen]; + component hasMatched[dataLen]; + signal isKeyOutOfBounds[maxKeyLen]; + signal isFirstMatchAndInsideBound[dataLen * maxKeyLen]; + for (var i = 0 ; i < maxKeyLen ; i++) { + isKeyOutOfBounds[i] <== IsZero()(key[i]); + } + + for (var idx = 0 ; idx < dataLen ; idx++) { + stringMatch[idx] = IsEqualArray(maxKeyLen); stringMatch[idx].in[0] <== key; - for (var key_idx = 0 ; key_idx < keyLen ; key_idx++) { - stringMatch[idx].in[1][key_idx] <== data[idx + key_idx] * (1 - matched); + for (var key_idx = 0 ; key_idx < maxKeyLen ; key_idx++) { + isFirstMatchAndInsideBound[idx * maxKeyLen + key_idx] <== (1 - matched) * (1 - isKeyOutOfBounds[key_idx]); + stringMatch[idx].in[1][key_idx] <== paddedData[idx + key_idx] * isFirstMatchAndInsideBound[idx * maxKeyLen + key_idx]; } hasMatched[idx] = IsEqual(); hasMatched[idx].in <== [stringMatch[idx].out, 1]; diff --git a/circuits/test/http/nivc/nivc.test.ts b/circuits/test/http/nivc/nivc.test.ts index 814892b..caec576 100644 --- a/circuits/test/http/nivc/nivc.test.ts +++ b/circuits/test/http/nivc/nivc.test.ts @@ -1,4 +1,4 @@ -import { circomkit, WitnessTester, generateDescription, readJsonFile } from "../../common"; +import { circomkit, WitnessTester, generateDescription, readJsonFile, toByte } from "../../common"; import { join } from "path"; // HTTP/1.1 200 OK @@ -86,24 +86,19 @@ describe("HTTPParseAndLockStartLineNIVC", async () => { }); describe("HTTPLockHeaderNIVC", async () => { - let circuit: WitnessTester<["step_in", "header", "value"], ["step_out"]>; + let circuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>; let DATA_BYTES = 320; let MAX_STACK_HEIGHT = 5; - let header_name = [99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101]; // content-type - let HEADER_NAME_LENGTH = 12; - let header_value = [ - 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 59, 32, 99, 104, 97, - 114, 115, 101, 116, 61, 117, 116, 102, 45, 56, - ]; // application/json; charset=utf-8 - let HEADER_VALUE_LENGTH = 31; + let MAX_HEADER_NAME_LENGTH = 20; + let MAX_HEADER_VALUE_LENGTH = 35; before(async () => { circuit = await circomkit.WitnessTester(`LockHeader`, { file: "http/nivc/lock_header", template: "LockHeader", - params: [DATA_BYTES, MAX_STACK_HEIGHT, HEADER_NAME_LENGTH, HEADER_VALUE_LENGTH], + params: [DATA_BYTES, MAX_STACK_HEIGHT, MAX_HEADER_NAME_LENGTH, MAX_HEADER_VALUE_LENGTH], }); console.log("#constraints:", await circuit.getConstraintCount()); @@ -112,6 +107,9 @@ describe("HTTPLockHeaderNIVC", async () => { function generatePassCase(input: any, expected: any, desc: string) { const description = generateDescription(input); + input["header"] = input["header"].concat(Array(MAX_HEADER_NAME_LENGTH - input["header"].length).fill(0)); + input["value"] = input["value"].concat(Array(MAX_HEADER_VALUE_LENGTH - input["value"].length).fill(0)); + it(`(valid) witness: ${desc}`, async () => { // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) await circuit.expectPass(input, expected); @@ -119,7 +117,10 @@ describe("HTTPLockHeaderNIVC", async () => { } - generatePassCase({ step_in: http_parse_and_lock_start_line.step_out, header: header_name, value: header_value }, { step_out: http_parse_and_lock_start_line.step_out }, "locking HTTP header"); + let header_name = toByte("content-type"); + let header_value = toByte("application/json; charset=utf-8"); + + generatePassCase({ step_in: http_parse_and_lock_start_line.step_out, header: header_name, headerNameLength: header_name.length, value: header_value, headerValueLength: header_value.length }, { step_out: http_parse_and_lock_start_line.step_out }, "locking HTTP header"); }); describe("HTTPBodyMaskNIVC", async () => { From f4ebb4cc3ca458752dbfb2c92ed27f018c98ab4d Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 17:41:54 +0530 Subject: [PATCH 17/19] use circuit.compute to find witness and simplify test --- circuits/json/nivc/nivc_extract_final.json | 2647 ----------------- circuits/test/json/nivc/masker_nivc.test.ts | 154 +- circuits/test/json/nivc/nivc_extract_arr.json | 2631 ---------------- .../test/json/nivc/nivc_extract_key0.json | 2631 ---------------- .../test/json/nivc/nivc_extract_key1.json | 2631 ---------------- .../test/json/nivc/nivc_extract_key2.json | 2631 ---------------- .../test/json/nivc/nivc_extract_key3.json | 2631 ---------------- circuits/test/json/nivc/nivc_parse.json | 2631 ---------------- 8 files changed, 41 insertions(+), 18546 deletions(-) delete mode 100644 circuits/json/nivc/nivc_extract_final.json delete mode 100644 circuits/test/json/nivc/nivc_extract_arr.json delete mode 100644 circuits/test/json/nivc/nivc_extract_key0.json delete mode 100644 circuits/test/json/nivc/nivc_extract_key1.json delete mode 100644 circuits/test/json/nivc/nivc_extract_key2.json delete mode 100644 circuits/test/json/nivc/nivc_extract_key3.json delete mode 100644 circuits/test/json/nivc/nivc_parse.json diff --git a/circuits/json/nivc/nivc_extract_final.json b/circuits/json/nivc/nivc_extract_final.json deleted file mode 100644 index 82df874..0000000 --- a/circuits/json/nivc/nivc_extract_final.json +++ /dev/null @@ -1,2647 +0,0 @@ -{ - "step_out": [ - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "value": [ - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/masker_nivc.test.ts b/circuits/test/json/nivc/masker_nivc.test.ts index 21f69ae..42e6dfe 100644 --- a/circuits/test/json/nivc/masker_nivc.test.ts +++ b/circuits/test/json/nivc/masker_nivc.test.ts @@ -1,4 +1,4 @@ -import { circomkit, WitnessTester, generateDescription, readJsonFile } from "../../common"; +import { circomkit, WitnessTester, generateDescription, readJsonFile, toByte } from "../../common"; import { join } from "path"; // HTTP/1.1 200 OK @@ -19,10 +19,6 @@ import { join } from "path"; // } // } -interface NIVCData { - step_out: number[]; -} - // 202 bytes in the JSON let json_input = [123, 13, 10, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 123, 13, 10, 32, 32, 32, 32, 32, 32, 32, 34, 105, 116, 101, 109, 115, 34, 58, 32, 91, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, @@ -34,144 +30,76 @@ let json_input = [123, 13, 10, 32, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 123 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 93, 13, 10, 32, 32, 32, 125, 13, 10, 125]; -let nivc_parse = readJsonFile(join(__dirname, "..", "nivc/nivc_parse.json")); -let nivc_extract_key0 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key0.json")); -let nivc_extract_key1 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key1.json")); -let nivc_extract_arr = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_arr.json")); -let nivc_extract_key2 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key2.json")); -let nivc_extract_key3 = readJsonFile(join(__dirname, "..", "nivc/nivc_extract_key3.json")); - -describe("JsonParseNIVC", async () => { - let circuit: WitnessTester<["step_in"], ["step_out"]>; - - let DATA_BYTES = 202; - let MAX_STACK_HEIGHT = 5; - let PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; +describe("NIVC Extract", async () => { + let parse_circuit: WitnessTester<["step_in"], ["step_out"]>; + let json_mask_object_circuit: WitnessTester<["step_in", "key", "keyLen"], ["step_out"]>; + let json_mask_arr_circuit: WitnessTester<["step_in", "index"], ["step_out"]>; + let extract_value_circuit: WitnessTester<["step_in"], ["step_out"]>; - let TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + const DATA_BYTES = 202; + const MAX_STACK_HEIGHT = 5; + const MAX_KEY_LENGTH = 8; + const MAX_VALUE_LENGTH = 35; + const PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + const TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; before(async () => { - circuit = await circomkit.WitnessTester(`JsonParseNIVC`, { + parse_circuit = await circomkit.WitnessTester(`JsonParseNIVC`, { file: "json/nivc/parse", template: "JsonParseNIVC", params: [DATA_BYTES, MAX_STACK_HEIGHT], }); - console.log("#constraints:", await circuit.getConstraintCount()); - - }); - - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); + console.log("#constraints:", await parse_circuit.getConstraintCount()); - it(`(valid) witness: ${desc}`, async () => { - await circuit.expectPass(input, expected); + json_mask_arr_circuit = await circomkit.WitnessTester(`JsonMaskArrayIndexNIVC`, { + file: "json/nivc/masker", + template: "JsonMaskArrayIndexNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT], }); + console.log("#constraints:", await json_mask_arr_circuit.getConstraintCount()); - } - - let extended_json_input = json_input.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - json_input.length)).fill(0)); - - generatePassCase({ step_in: extended_json_input }, { step_out: nivc_parse.step_out }, "parsing JSON"); - -}); - -describe("JsonMaskObjectNIVC", async () => { - let circuit: WitnessTester<["step_in", "key", "keyLen"], ["step_out"]>; - - let DATA_BYTES = 202; - let MAX_STACK_HEIGHT = 5; - let MAX_KEY_LENGTH = 8; - let step_out: bigint[] = []; - - before(async () => { - circuit = await circomkit.WitnessTester(`JsonMaskObjectNIVC`, { + json_mask_object_circuit = await circomkit.WitnessTester(`JsonMaskObjectNIVC`, { file: "json/nivc/masker", template: "JsonMaskObjectNIVC", params: [DATA_BYTES, MAX_STACK_HEIGHT, MAX_KEY_LENGTH], }); - console.log("#constraints:", await circuit.getConstraintCount()); - }); - - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); + console.log("#constraints:", await json_mask_object_circuit.getConstraintCount()); - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); + extract_value_circuit = await circomkit.WitnessTester(`JsonMaskExtractFinal`, { + file: "json/nivc/extractor", + template: "MaskExtractFinal", + params: [DATA_BYTES, MAX_STACK_HEIGHT, MAX_VALUE_LENGTH], }); - } + console.log("#constraints:", await extract_value_circuit.getConstraintCount()); + }); + + let extended_json_input = json_input.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - json_input.length)).fill(0)); let key0 = [100, 97, 116, 97, 0, 0, 0, 0]; // "data" let key0Len = 4; - generatePassCase({ step_in: nivc_parse.step_out, key: key0, keyLen: key0Len }, { step_out: nivc_extract_key0.step_out }, "masking json object at depth 0"); - let key1 = [105, 116, 101, 109, 115, 0, 0, 0]; // "items" let key1Len = 5; - generatePassCase({ step_in: nivc_extract_key0.step_out, key: key1, keyLen: key1Len }, { step_out: nivc_extract_key1.step_out }, "masking json object at depth 1"); - - // Ran after doing arr masking let key2 = [112, 114, 111, 102, 105, 108, 101, 0]; // "profile" let key2Len = 7; - generatePassCase({ step_in: nivc_extract_arr.step_out, key: key2, keyLen: key2Len }, { step_out: nivc_extract_key2.step_out }, "masking json object at depth 3"); - - let key3 = [110, 97, 109, 101, 0, 0, 0, 0]; // "name" + let key3 = [110, 97, 109, 101, 0, 0, 0, 0]; "name" let key3Len = 4; - generatePassCase({ step_in: nivc_extract_key2.step_out, key: key3, keyLen: key3Len }, { step_out: nivc_extract_key3.step_out }, "masking json object at depth 4"); -}); - -describe("JsonMaskArrayIndexNIVC", async () => { - let circuit: WitnessTester<["step_in", "index"], ["step_out"]>; - let DATA_BYTES = 202; - let MAX_STACK_HEIGHT = 5; - - before(async () => { - circuit = await circomkit.WitnessTester(`JsonMaskArrayIndexNIVC`, { - file: "json/nivc/masker", - template: "JsonMaskArrayIndexNIVC", - params: [DATA_BYTES, MAX_STACK_HEIGHT], - }); - console.log("#constraints:", await circuit.getConstraintCount()); - }); + let value = toByte("\"Taylor Swift\""); - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); + it("parse and mask", async () => { + let json_parse = await parse_circuit.compute({ step_in: extended_json_input }, ["step_out"]); - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); - }); - } + let json_extract_key0 = await json_mask_object_circuit.compute({ step_in: json_parse.step_out, key: key0, keyLen: key0Len }, ["step_out"]); - let index = 0; - generatePassCase({ step_in: nivc_extract_key1.step_out, index: index }, { step_out: nivc_extract_arr.step_out }, "masking json array index at depth 2"); -}); + let json_extract_key1 = await json_mask_object_circuit.compute({ step_in: json_extract_key0.step_out, key: key1, keyLen: key1Len }, ["step_out"]); + let json_extract_arr = await json_mask_arr_circuit.compute({ step_in: json_extract_key1.step_out, index: 0 }, ["step_out"]); -describe("JsonExtractNIVC", async () => { - let circuit: WitnessTester<["step_in"], ["step_out"]>; + let json_extract_key2 = await json_mask_object_circuit.compute({ step_in: json_extract_arr.step_out, key: key2, keyLen: key2Len }, ["step_out"]); - let DATA_BYTES = 202; - let MAX_STACK_HEIGHT = 5; + let json_extract_key3 = await json_mask_object_circuit.compute({ step_in: json_extract_key2.step_out, key: key3, keyLen: key3Len }, ["step_out"]); - before(async () => { - circuit = await circomkit.WitnessTester(`JsonMaskExtractFinal`, { - file: "json/nivc/extractor", - template: "MaskExtractFinal", - params: [DATA_BYTES, MAX_STACK_HEIGHT, 14], - }); - console.log("#constraints:", await circuit.getConstraintCount()); + value = value.concat(Array(MAX_VALUE_LENGTH - value.length).fill(0)); + await extract_value_circuit.expectPass({ step_in: json_extract_key3.step_out }, { step_out: value }); }); - - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); - - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out", "value"]))) - await circuit.expectPass(input, expected); - }); - } - - let value = [34, 84, 97, 121, 108, 111, 114, 32, 83, 119, 105, 102, 116, 34] // `"Taylor Swift"` - generatePassCase({ step_in: nivc_extract_key3.step_out }, { value: value }, "masking json at depth 4"); -}); +}); \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_arr.json b/circuits/test/json/nivc/nivc_extract_arr.json deleted file mode 100644 index 04f2f23..0000000 --- a/circuits/test/json/nivc/nivc_extract_arr.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key0.json b/circuits/test/json/nivc/nivc_extract_key0.json deleted file mode 100644 index dbd4304..0000000 --- a/circuits/test/json/nivc/nivc_extract_key0.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 105, - 116, - 101, - 109, - 115, - 34, - 58, - 32, - 91, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 93, - 13, - 10, - 32, - 32, - 32, - 125, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key1.json b/circuits/test/json/nivc/nivc_extract_key1.json deleted file mode 100644 index 7d787ad..0000000 --- a/circuits/test/json/nivc/nivc_extract_key1.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 91, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 93, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key2.json b/circuits/test/json/nivc/nivc_extract_key2.json deleted file mode 100644 index 09d1b80..0000000 --- a/circuits/test/json/nivc/nivc_extract_key2.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_extract_key3.json b/circuits/test/json/nivc/nivc_extract_key3.json deleted file mode 100644 index 2282500..0000000 --- a/circuits/test/json/nivc/nivc_extract_key3.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 5 - ] -} \ No newline at end of file diff --git a/circuits/test/json/nivc/nivc_parse.json b/circuits/test/json/nivc/nivc_parse.json deleted file mode 100644 index 66d60fc..0000000 --- a/circuits/test/json/nivc/nivc_parse.json +++ /dev/null @@ -1,2631 +0,0 @@ -{ - "step_out": [ - 123, - 13, - 10, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 105, - 116, - 101, - 109, - 115, - 34, - 58, - 32, - 91, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 93, - 13, - 10, - 32, - 32, - 32, - 125, - 13, - 10, - 125, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 1, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ] -} \ No newline at end of file From 55716ed2bde31dd9ae8105628fe29533495ad7bc Mon Sep 17 00:00:00 2001 From: lonerapier Date: Mon, 21 Oct 2024 20:19:55 +0530 Subject: [PATCH 18/19] delete unused files for http tests --- circuits.json | 182 +- circuits/test/http/nivc/body_mask.json | 4165 ----------------- circuits/test/http/nivc/nivc.test.ts | 126 +- .../http/nivc/parse_and_lock_start_line.json | 4165 ----------------- 4 files changed, 130 insertions(+), 8508 deletions(-) delete mode 100644 circuits/test/http/nivc/body_mask.json delete mode 100644 circuits/test/http/nivc/parse_and_lock_start_line.json diff --git a/circuits.json b/circuits.json index 3ae4177..96677ce 100644 --- a/circuits.json +++ b/circuits.json @@ -10,6 +10,32 @@ 2 ] }, + "spotify_test": { + "file": "main/json_spotify_test", + "template": "ExtractStringValue", + "params": [ + 85, + 5, + 4, + 0, + 5, + 1, + 0, + 2, + 7, + 3, + 4, + 4, + 12 + ] + }, + "http-parser": { + "file": "http/parser/parser", + "template": "Parser", + "params": [ + 60 + ] + }, "json-parser": { "file": "json/parser/parser", "template": "Parser", @@ -29,11 +55,17 @@ 1 ] }, - "spotify_test": { - "file": "main/json_spotify_test", - "template": "ExtractStringValue", + "spotify_top_artists": { + "file": "main/extended_spotify_top_artists", + "template": "HttpJson", "params": [ + 203, 85, + 8, + 3, + 2, + 12, + 31, 5, 4, 0, @@ -48,37 +80,54 @@ 12 ] }, - "http-parser": { - "file": "http/parser/parser", - "template": "Parser", + "value_string": { + "file": "main/json_value_string", + "template": "ExtractStringValue", "params": [ - 60 + 12, + 1, + 1, + 0, + 1 ] }, - "spotify_top_artists_test": { - "file": "main/http_spotify_top_artists_test", - "template": "LockHTTPResponse", + "value_array_nested_test": { + "file": "main/json_value_array_nested_test", + "template": "ExtractNumValue", "params": [ - 203, - 85, - 8, + 24, 3, + 1, + 0, + 0, + 1, + 0, 2, - 12, - 31 + 1 ] }, - "value_array_number_test": { - "file": "main/json_value_array_number_test", - "template": "ExtractNumValue", + "two_keys_test": { + "file": "main/json_two_keys_test", + "template": "ExtractStringValue", + "params": [ + 40, + 1, + 4, + 0, + 3 + ] + }, + "value_array_string_test": { + "file": "main/json_value_array_string_test", + "template": "ExtractStringValue", "params": [ 73, 2, 1, 0, - 2, 1, - 4 + 1, + 2 ] }, "value_array_object_test": { @@ -98,28 +147,6 @@ 1 ] }, - "value_string": { - "file": "main/json_value_string", - "template": "ExtractStringValue", - "params": [ - 12, - 1, - 1, - 0, - 1 - ] - }, - "two_keys_test": { - "file": "main/json_two_keys_test", - "template": "ExtractStringValue", - "params": [ - 40, - 1, - 4, - 0, - 3 - ] - }, "get_request_test": { "file": "main/http_get_request_test", "template": "LockHTTPRequest", @@ -134,24 +161,35 @@ 9 ] }, - "value_array_nested_test": { - "file": "main/json_value_array_nested_test", + "value_array_number_test": { + "file": "main/json_value_array_number_test", "template": "ExtractNumValue", "params": [ - 24, - 3, + 73, + 2, 1, 0, - 0, + 2, 1, - 0, + 4 + ] + }, + "get_response_test": { + "file": "main/http_get_response_test", + "template": "LockHTTPResponse", + "params": [ + 89, + 18, + 8, + 3, 2, - 1 + 12, + 16 ] }, - "spotify_top_artists": { - "file": "main/extended_spotify_top_artists", - "template": "HttpJson", + "spotify_top_artists_test": { + "file": "main/http_spotify_top_artists_test", + "template": "LockHTTPResponse", "params": [ 203, 85, @@ -159,19 +197,7 @@ 3, 2, 12, - 31, - 5, - 4, - 0, - 5, - 1, - 0, - 2, - 7, - 3, - 4, - 4, - 12 + 31 ] }, "value_object_test": { @@ -186,31 +212,5 @@ 1, 1 ] - }, - "value_array_string_test": { - "file": "main/json_value_array_string_test", - "template": "ExtractStringValue", - "params": [ - 73, - 2, - 1, - 0, - 1, - 1, - 2 - ] - }, - "get_response_test": { - "file": "main/http_get_response_test", - "template": "LockHTTPResponse", - "params": [ - 89, - 18, - 8, - 3, - 2, - 12, - 16 - ] } } \ No newline at end of file diff --git a/circuits/test/http/nivc/body_mask.json b/circuits/test/http/nivc/body_mask.json deleted file mode 100644 index 3e1ad3a..0000000 --- a/circuits/test/http/nivc/body_mask.json +++ /dev/null @@ -1,4165 +0,0 @@ -{ - "step_out": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 10, - 123, - 13, - 10, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 105, - 116, - 101, - 109, - 115, - 34, - 58, - 32, - 91, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 93, - 13, - 10, - 32, - 32, - 32, - 125, - 13, - 10, - 125, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ] -} \ No newline at end of file diff --git a/circuits/test/http/nivc/nivc.test.ts b/circuits/test/http/nivc/nivc.test.ts index caec576..f9c12b3 100644 --- a/circuits/test/http/nivc/nivc.test.ts +++ b/circuits/test/http/nivc/nivc.test.ts @@ -19,10 +19,6 @@ import { join } from "path"; // } // } -interface NIVCData { - step_out: number[]; -} - // 320 bytes in the HTTP response let http_response_plaintext = [ 72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75, 13, 10, 99, 111, 110, 116, 101, 110, @@ -41,113 +37,69 @@ let http_response_plaintext = [ 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 13, 10, 32, 32, 32, 32, 32, 32, 32, 93, 13, 10, 32, 32, 32, 125, 13, 10, 125]; -let http_parse_and_lock_start_line = readJsonFile(join(__dirname, "..", "nivc/parse_and_lock_start_line.json")); -let http_body_mask = readJsonFile(join(__dirname, "..", "nivc/body_mask.json")); - describe("HTTPParseAndLockStartLineNIVC", async () => { - let circuit: WitnessTester<["step_in"], ["step_out"]>; + let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "middle", "final"], ["step_out"]>; + let lockHeaderCircuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>; + let bodyMaskCircuit: WitnessTester<["step_in"], ["step_out"]>; - let DATA_BYTES = 320; - let MAX_STACK_HEIGHT = 5; - let PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + const DATA_BYTES = 320; + const MAX_STACK_HEIGHT = 5; + const PER_ITERATION_DATA_LENGTH = MAX_STACK_HEIGHT * 2 + 2; + const TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; - let TOTAL_BYTES_ACROSS_NIVC = DATA_BYTES * (PER_ITERATION_DATA_LENGTH + 1) + 1; + const MAX_HEADER_NAME_LENGTH = 20; + const MAX_HEADER_VALUE_LENGTH = 35; - let beginning = [72, 84, 84, 80, 47, 49, 46, 49]; // HTTP/1.1 - let BEGINNING_LENGTH = 8; - let middle = [50, 48, 48]; // 200 - let MIDDLE_LENGTH = 3; - let final = [79, 75]; // OK - let FINAL_LENGTH = 2; + const beginning = [72, 84, 84, 80, 47, 49, 46, 49]; // HTTP/1.1 + const BEGINNING_LENGTH = 8; + const middle = [50, 48, 48]; // 200 + const MIDDLE_LENGTH = 3; + const final = [79, 75]; // OK + const FINAL_LENGTH = 2; before(async () => { - circuit = await circomkit.WitnessTester(`ParseAndLockStartLine`, { + httpParseAndLockStartLineCircuit = await circomkit.WitnessTester(`ParseAndLockStartLine`, { file: "http/nivc/parse_and_lock_start_line", template: "ParseAndLockStartLine", params: [DATA_BYTES, MAX_STACK_HEIGHT, BEGINNING_LENGTH, MIDDLE_LENGTH, FINAL_LENGTH], }); - console.log("#constraints:", await circuit.getConstraintCount()); - - }); - - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); - - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); - }); - - } + console.log("#constraints:", await httpParseAndLockStartLineCircuit.getConstraintCount()); - let extended_json_input = http_response_plaintext.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - http_response_plaintext.length)).fill(0)); - - generatePassCase({ step_in: extended_json_input, beginning: beginning, middle: middle, final: final }, { step_out: http_parse_and_lock_start_line.step_out }, "parsing HTTP"); -}); - -describe("HTTPLockHeaderNIVC", async () => { - let circuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>; - - let DATA_BYTES = 320; - let MAX_STACK_HEIGHT = 5; - - let MAX_HEADER_NAME_LENGTH = 20; - let MAX_HEADER_VALUE_LENGTH = 35; - - before(async () => { - circuit = await circomkit.WitnessTester(`LockHeader`, { + lockHeaderCircuit = await circomkit.WitnessTester(`LockHeader`, { file: "http/nivc/lock_header", template: "LockHeader", params: [DATA_BYTES, MAX_STACK_HEIGHT, MAX_HEADER_NAME_LENGTH, MAX_HEADER_VALUE_LENGTH], }); - console.log("#constraints:", await circuit.getConstraintCount()); + console.log("#constraints:", await lockHeaderCircuit.getConstraintCount()); + bodyMaskCircuit = await circomkit.WitnessTester(`BodyMask`, { + file: "http/nivc/body_mask", + template: "HTTPMaskBodyNIVC", + params: [DATA_BYTES, MAX_STACK_HEIGHT], + }); + console.log("#constraints:", await bodyMaskCircuit.getConstraintCount()); }); - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); + let extendedJsonInput = http_response_plaintext.concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - http_response_plaintext.length)).fill(0)); - input["header"] = input["header"].concat(Array(MAX_HEADER_NAME_LENGTH - input["header"].length).fill(0)); - input["value"] = input["value"].concat(Array(MAX_HEADER_VALUE_LENGTH - input["value"].length).fill(0)); - - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); - }); + let headerName = toByte("content-type"); + let headerValue = toByte("application/json; charset=utf-8"); - } + let headerNamePadded = headerName.concat(Array(MAX_HEADER_NAME_LENGTH - headerName.length).fill(0)); + let headerValuePadded = headerValue.concat(Array(MAX_HEADER_VALUE_LENGTH - headerValue.length).fill(0)); + it("HTTPParseAndExtract", async () => { + let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedJsonInput, beginning: beginning, middle: middle, final: final }, ["step_out"]); - let header_name = toByte("content-type"); - let header_value = toByte("application/json; charset=utf-8"); + let lockHeader = await lockHeaderCircuit.compute({ step_in: parseAndLockStartLine.step_out, header: headerNamePadded, headerNameLength: headerName.length, value: headerValuePadded, headerValueLength: headerValue.length }, ["step_out"]); - generatePassCase({ step_in: http_parse_and_lock_start_line.step_out, header: header_name, headerNameLength: header_name.length, value: header_value, headerValueLength: header_value.length }, { step_out: http_parse_and_lock_start_line.step_out }, "locking HTTP header"); -}); + let bodyMask = await bodyMaskCircuit.compute({ step_in: lockHeader.step_out }, ["step_out"]); -describe("HTTPBodyMaskNIVC", async () => { - let circuit: WitnessTester<["step_in"], ["step_out"]>; + let bodyMaskOut = bodyMask.step_out as number[]; + let idx = bodyMaskOut.indexOf('{'.charCodeAt(0)); - let DATA_BYTES = 320; - let MAX_STACK_HEIGHT = 5; - - before(async () => { - circuit = await circomkit.WitnessTester(`BodyMask`, { - file: "http/nivc/body_mask", - template: "HTTPMaskBodyNIVC", - params: [DATA_BYTES, MAX_STACK_HEIGHT], - }); - console.log("#constraints:", await circuit.getConstraintCount()); + let extended_json_input_2 = extendedJsonInput.fill(0, 0, idx); + extended_json_input_2 = extended_json_input_2.fill(0, 320); + bodyMaskOut === extended_json_input_2; }); - - function generatePassCase(input: any, expected: any, desc: string) { - const description = generateDescription(input); - - it(`(valid) witness: ${desc}`, async () => { - // console.log(JSON.stringify(await circuit.compute(input, ["step_out"]))) - await circuit.expectPass(input, expected); - }); - - } - - generatePassCase({ step_in: http_parse_and_lock_start_line.step_out }, { step_out: http_body_mask.step_out }, "locking HTTP header"); }); \ No newline at end of file diff --git a/circuits/test/http/nivc/parse_and_lock_start_line.json b/circuits/test/http/nivc/parse_and_lock_start_line.json deleted file mode 100644 index 659d281..0000000 --- a/circuits/test/http/nivc/parse_and_lock_start_line.json +++ /dev/null @@ -1,4165 +0,0 @@ -{ - "step_out": [ - 72, - 84, - 84, - 80, - 47, - 49, - 46, - 49, - 32, - 50, - 48, - 48, - 32, - 79, - 75, - 13, - 10, - 99, - 111, - 110, - 116, - 101, - 110, - 116, - 45, - 116, - 121, - 112, - 101, - 58, - 32, - 97, - 112, - 112, - 108, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 47, - 106, - 115, - 111, - 110, - 59, - 32, - 99, - 104, - 97, - 114, - 115, - 101, - 116, - 61, - 117, - 116, - 102, - 45, - 56, - 13, - 10, - 99, - 111, - 110, - 116, - 101, - 110, - 116, - 45, - 101, - 110, - 99, - 111, - 100, - 105, - 110, - 103, - 58, - 32, - 103, - 122, - 105, - 112, - 13, - 10, - 84, - 114, - 97, - 110, - 115, - 102, - 101, - 114, - 45, - 69, - 110, - 99, - 111, - 100, - 105, - 110, - 103, - 58, - 32, - 99, - 104, - 117, - 110, - 107, - 101, - 100, - 13, - 10, - 13, - 10, - 123, - 13, - 10, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 105, - 116, - 101, - 109, - 115, - 34, - 58, - 32, - 91, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 100, - 97, - 116, - 97, - 34, - 58, - 32, - 34, - 65, - 114, - 116, - 105, - 115, - 116, - 34, - 44, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - 34, - 58, - 32, - 123, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 34, - 110, - 97, - 109, - 101, - 34, - 58, - 32, - 34, - 84, - 97, - 121, - 108, - 111, - 114, - 32, - 83, - 119, - 105, - 102, - 116, - 34, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 125, - 13, - 10, - 32, - 32, - 32, - 32, - 32, - 32, - 32, - 93, - 13, - 10, - 32, - 32, - 32, - 125, - 13, - 10, - 125, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 0, - 0, - 0, - 3, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 1, - 0, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 2, - 0, - 1, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 1, - 0, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 3, - 0, - 1, - 0, - 0, - 4, - 1, - 0, - 0, - 0, - 4, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ] -} \ No newline at end of file From c220c404cf5da8c24850089bb1be4bbbcede4f7a Mon Sep 17 00:00:00 2001 From: lonerapier Date: Tue, 22 Oct 2024 17:22:28 +0530 Subject: [PATCH 19/19] revert circuit_json --- circuits.json | 182 +++++++++++++++++++++++++------------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/circuits.json b/circuits.json index 96677ce..3ae4177 100644 --- a/circuits.json +++ b/circuits.json @@ -10,32 +10,6 @@ 2 ] }, - "spotify_test": { - "file": "main/json_spotify_test", - "template": "ExtractStringValue", - "params": [ - 85, - 5, - 4, - 0, - 5, - 1, - 0, - 2, - 7, - 3, - 4, - 4, - 12 - ] - }, - "http-parser": { - "file": "http/parser/parser", - "template": "Parser", - "params": [ - 60 - ] - }, "json-parser": { "file": "json/parser/parser", "template": "Parser", @@ -55,17 +29,11 @@ 1 ] }, - "spotify_top_artists": { - "file": "main/extended_spotify_top_artists", - "template": "HttpJson", + "spotify_test": { + "file": "main/json_spotify_test", + "template": "ExtractStringValue", "params": [ - 203, 85, - 8, - 3, - 2, - 12, - 31, 5, 4, 0, @@ -80,54 +48,37 @@ 12 ] }, - "value_string": { - "file": "main/json_value_string", - "template": "ExtractStringValue", + "http-parser": { + "file": "http/parser/parser", + "template": "Parser", "params": [ - 12, - 1, - 1, - 0, - 1 + 60 ] }, - "value_array_nested_test": { - "file": "main/json_value_array_nested_test", - "template": "ExtractNumValue", + "spotify_top_artists_test": { + "file": "main/http_spotify_top_artists_test", + "template": "LockHTTPResponse", "params": [ - 24, + 203, + 85, + 8, 3, - 1, - 0, - 0, - 1, - 0, 2, - 1 - ] - }, - "two_keys_test": { - "file": "main/json_two_keys_test", - "template": "ExtractStringValue", - "params": [ - 40, - 1, - 4, - 0, - 3 + 12, + 31 ] }, - "value_array_string_test": { - "file": "main/json_value_array_string_test", - "template": "ExtractStringValue", + "value_array_number_test": { + "file": "main/json_value_array_number_test", + "template": "ExtractNumValue", "params": [ 73, 2, 1, 0, + 2, 1, - 1, - 2 + 4 ] }, "value_array_object_test": { @@ -147,6 +98,28 @@ 1 ] }, + "value_string": { + "file": "main/json_value_string", + "template": "ExtractStringValue", + "params": [ + 12, + 1, + 1, + 0, + 1 + ] + }, + "two_keys_test": { + "file": "main/json_two_keys_test", + "template": "ExtractStringValue", + "params": [ + 40, + 1, + 4, + 0, + 3 + ] + }, "get_request_test": { "file": "main/http_get_request_test", "template": "LockHTTPRequest", @@ -161,35 +134,24 @@ 9 ] }, - "value_array_number_test": { - "file": "main/json_value_array_number_test", + "value_array_nested_test": { + "file": "main/json_value_array_nested_test", "template": "ExtractNumValue", "params": [ - 73, - 2, + 24, + 3, 1, 0, - 2, + 0, 1, - 4 - ] - }, - "get_response_test": { - "file": "main/http_get_response_test", - "template": "LockHTTPResponse", - "params": [ - 89, - 18, - 8, - 3, + 0, 2, - 12, - 16 + 1 ] }, - "spotify_top_artists_test": { - "file": "main/http_spotify_top_artists_test", - "template": "LockHTTPResponse", + "spotify_top_artists": { + "file": "main/extended_spotify_top_artists", + "template": "HttpJson", "params": [ 203, 85, @@ -197,7 +159,19 @@ 3, 2, 12, - 31 + 31, + 5, + 4, + 0, + 5, + 1, + 0, + 2, + 7, + 3, + 4, + 4, + 12 ] }, "value_object_test": { @@ -212,5 +186,31 @@ 1, 1 ] + }, + "value_array_string_test": { + "file": "main/json_value_array_string_test", + "template": "ExtractStringValue", + "params": [ + 73, + 2, + 1, + 0, + 1, + 1, + 2 + ] + }, + "get_response_test": { + "file": "main/http_get_response_test", + "template": "LockHTTPResponse", + "params": [ + 89, + 18, + 8, + 3, + 2, + 12, + 16 + ] } } \ No newline at end of file