From ccb86bfb2990c9b02d07c904fe3d3a180b4d65d9 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Tue, 13 Aug 2024 14:47:12 -0600 Subject: [PATCH] changeable stack height --- circuits.json | 15 ++++++++++----- circuits/extract.circom | 5 ++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/circuits.json b/circuits.json index f1c6e83..9396cbc 100644 --- a/circuits.json +++ b/circuits.json @@ -3,35 +3,40 @@ "file": "extract", "template": "Extract", "params": [ - 157 + 157, + 13 ] }, "value_string": { "file": "extract", "template": "Extract", "params": [ - 12 + 12, + 2 ] }, "value_number": { "file": "extract", "template": "Extract", "params": [ - 12 + 12, + 2 ] }, "value_array": { "file": "extract", "template": "Extract", "params": [ - 18 + 18, + 3 ] }, "value_object": { "file": "extract", "template": "Extract", "params": [ - 21 + 21, + 4 ] } } \ No newline at end of file diff --git a/circuits/extract.circom b/circuits/extract.circom index 5e735e7..ce6983b 100644 --- a/circuits/extract.circom +++ b/circuits/extract.circom @@ -3,7 +3,7 @@ pragma circom 2.1.9; include "utils.circom"; include "parser.circom"; -template Extract(DATA_BYTES) { +template Extract(DATA_BYTES, MAX_STACK_HEIGHT) { signal input data[DATA_BYTES]; // TODO: Add assertions on the inputs here! @@ -14,7 +14,6 @@ template Extract(DATA_BYTES) { component dataASCII = ASCII(DATA_BYTES); dataASCII.in <== data; //--------------------------------------------------------------------------------------------// - var MAX_STACK_HEIGHT = 16; // Initialze the parser component State[DATA_BYTES]; State[0] = StateUpdate(MAX_STACK_HEIGHT); @@ -50,7 +49,7 @@ template Extract(DATA_BYTES) { // Debugging log("State[", DATA_BYTES, "].pointer ", "= ", State[DATA_BYTES -1].next_pointer); - for(var i = 0; i<4; i++) { + for(var i = 0; i < MAX_STACK_HEIGHT; i++) { log("State[", DATA_BYTES, "].stack[", i,"] ", "= ", State[DATA_BYTES -1 ].next_stack[i]); } log("State[", DATA_BYTES, "].parsing_string", "= ", State[DATA_BYTES-1].next_parsing_string);