From bfc2f80c1e2836060e29b5dfa234a86142e09f86 Mon Sep 17 00:00:00 2001 From: SK0M0R0H Date: Fri, 11 Aug 2023 15:28:05 +0300 Subject: [PATCH] gate argument draft #46 --- .gitignore | 5 +- deploy/contracts/circuit_params.json | 28 + deploy/contracts/gate/gate0.sol | 1142 +++++++++++++++++++++++ deploy/contracts/gate/gate15.sol | 285 ++++++ deploy/contracts/gate/gate_argument.sol | 103 ++ deploy/contracts/gate/template.sol | 220 ----- deploy/tasks/deploy.ts | 26 +- storage-proof-app/mock_data.py | 6 + 8 files changed, 1592 insertions(+), 223 deletions(-) create mode 100644 deploy/contracts/circuit_params.json create mode 100644 deploy/contracts/gate/gate0.sol create mode 100644 deploy/contracts/gate/gate15.sol create mode 100644 deploy/contracts/gate/gate_argument.sol delete mode 100644 deploy/contracts/gate/template.sol diff --git a/.gitignore b/.gitignore index 4182166..87d8686 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,7 @@ cmake-build-debug/ deploy/artifacts deploy/cache deploy/node_modules -deploy/typechain-types \ No newline at end of file +deploy/typechain-types + +#python +__pycache__/ \ No newline at end of file diff --git a/deploy/contracts/circuit_params.json b/deploy/contracts/circuit_params.json new file mode 100644 index 0000000..fae83ae --- /dev/null +++ b/deploy/contracts/circuit_params.json @@ -0,0 +1,28 @@ +{ "_test_name":"Test name", + "arithmetization_params":[15,5,5,30], + "columns_rotations":[[-1,0,1],[-1,0,1],[-1,0,1],[-1,0,1],[-1,0,1],[-1,0,1],[-1,0,1],[-1,0,1],[-1,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]], + "modulus":28948022309329048855892746252171976963363056481941560715954676764349967630337, + "r":13, + "m":2, + "lambda":2, + "batches_num":4, + "step_list":[1,1,1,1,1,1,1,1,1,1,1,1,1], + "D_omegas":[ + 26495698845590383240609604404074423972849566255661802313591097233811292788392, + 13175653644678658737556805326666943932741525539026001701374450696535194715445, + 18589158034707770508497743761528839450567399299956641192723316341154428793508, + 5207999989657576140891498154897385491612440083899963290755562031717636435093, + 21138537593338818067112636105753818200833244613779330379839660864802343411573, + 22954361264956099995527581168615143754787441159030650146191365293282410739685, + 23692685744005816481424929253249866475360293751445976741406164118468705843520, + 7356716530956153652314774863381845254278968224778478050456563329565810467774, + 17166126583027276163107155648953851600645935739886150467584901586847365754678, + 3612152772817685532768635636100598085437510685224817206515049967552954106764, + 14450201850503471296781915119640920297985789873634237091629829669980153907901, + 199455130043951077247265858823823987229570523056509026484192158816218200659, + 24760239192664116622385963963284001971067308018068707868888628426778644166363 + ], + "rows_amount":16384, + "max_degree":16383, + "omega":26495698845590383240609604404074423972849566255661802313591097233811292788392 +} diff --git a/deploy/contracts/gate/gate0.sol b/deploy/contracts/gate/gate0.sol new file mode 100644 index 0000000..1f2e6ff --- /dev/null +++ b/deploy/contracts/gate/gate0.sol @@ -0,0 +1,1142 @@ + +// SPDX-License-Identifier: Apache-2.0. +//---------------------------------------------------------------------------// +// Copyright (c) 2022 Mikhail Komarov +// Copyright (c) 2022 Ilias Khairullin +// Copyright (c) 2022 Aleksei Moskvin +// Copyright (c) 2022-2023 Elena Tatuzova +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//---------------------------------------------------------------------------// +pragma solidity >=0.8.4; + +import "../../../contracts/types.sol"; +import "./gate_argument.sol"; + +library template_gate0{ + uint256 constant MODULUS_OFFSET = 0x0; + uint256 constant THETA_OFFSET = 0x20; + + uint256 constant CONSTRAINT_EVAL_OFFSET = 0x00; + uint256 constant GATE_EVAL_OFFSET = 0x20; + uint256 constant GATES_EVALUATIONS_OFFSET = 0x40; + uint256 constant THETA_ACC_OFFSET = 0x60; + + uint256 constant WITNESS_EVALUATIONS_OFFSET = 0x80; + uint256 constant CONSTANT_EVALUATIONS_OFFSET = 0xa0; + uint256 constant SELECTOR_EVALUATIONS_OFFSET = 0xc0; + + + function evaluate_gate_be( + types.gate_argument_params memory gate_params, + template_gate_argument_split_gen.local_vars_type memory local_vars + ) external pure returns (uint256 gates_evaluation, uint256 theta_acc) { + gates_evaluation = local_vars.gates_evaluation; + theta_acc = local_vars.theta_acc; + uint256 terms; + assembly { + let modulus := mload(gate_params) + let theta := mload(add(gate_params, THETA_OFFSET)) + + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + + function get_witness_i_by_rotation_idx(idx, rot_idx, ptr) -> result { + result := mload( + add( + add(mload(add(add(mload(add(ptr, WITNESS_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))), 0x20), + mul(0x20, rot_idx) + ) + ) + } + + function get_constant_i(idx, ptr) -> result { + result := mload(add(add(mload(add(ptr, CONSTANT_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))) + } + + function get_selector_i(idx, ptr) -> result { + result := mload(add(add(mload(add(ptr, SELECTOR_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))) + } + + //Gate0 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fb094cf91b992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91a992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ec00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(8,0, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fb094cf91b992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91a992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ec00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(8,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(3,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(7,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(6,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(5,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(4,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(0,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate1 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffc0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffff81 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffff9 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,0, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffec51 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x330c + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffccb5 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1a71 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x142 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffe5 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffff859 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,0, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992930ecf0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecbfc00000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d2cecffffff00 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b982d30e900000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1000000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x10000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(5,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(1,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate2 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecf0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffc001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecc0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffc001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecc0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecf0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(2,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate3 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfff80001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffe0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffc01 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(3,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecbc000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffbfff0 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b892d30ecffffc000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b9928f0ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1000000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x10000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(5,0, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(3,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate4 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfe000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffff801 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffc1 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,0, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf8d2e61c5ca0a1eff23a + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ec8a24636a + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffe3470 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf71eabf7085562106e72 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b9904b112fc6609d8 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992767e469f2b8a8 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094ceb3152f48e386fe46402 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x12a4e415e1e1b36ff883d1 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x6167eb8c7252078275a1 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x9de93ece51 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(5,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(4,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate5 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffff + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffe + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xa62b942e656949441 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1e39a5057d81 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x57f6c1 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(9,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate6 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecc0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffff01 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffc001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecff000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_constant_i(0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecf0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(4,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(4,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffff89 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x112 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffff20 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x55 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffff2 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(4,0, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(6,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate7 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffff01 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecf0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffff0001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffc001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecff000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecc0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(8,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x2d0 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffff91d + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x658 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffd22 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xaf + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffec + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(3,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(7,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate8 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x10000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(8,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate9 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffc00001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffe001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d20ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfc000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffff1 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,0, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d2fecfffc0000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992cf0ecffc00000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d2cecff000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b892d30acfff00001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x1000000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x10000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(5,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate10 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(3,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(10,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate11 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fb094cf91b992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(4,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91a992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(5,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ec00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(6,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(7,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fb094cf91b992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91a992d30ed00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ec00000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(3,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(11,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate12 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(12,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate13 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000000000000000000000891a63f02533e46e64b4c3b40000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3000000000000000000000000000000019b4f2bd06f9bad4b2e1e4b1c0000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3000000000000000000000000000000019b4f2bd06f9bad4b2e1e4b1c0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000000000000000000000891a63f02533e46e64b4c3b40000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffeb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x12 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffef + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(13,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate14 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x166666666666666666666666666666667265825836748a6342696ab95999999a + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x29999999999999999999999999999999afe116a3d2d86eb856c3c633a6666667 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(14,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + + } + } +} diff --git a/deploy/contracts/gate/gate15.sol b/deploy/contracts/gate/gate15.sol new file mode 100644 index 0000000..c1f2839 --- /dev/null +++ b/deploy/contracts/gate/gate15.sol @@ -0,0 +1,285 @@ + +// SPDX-License-Identifier: Apache-2.0. +//---------------------------------------------------------------------------// +// Copyright (c) 2022 Mikhail Komarov +// Copyright (c) 2022 Ilias Khairullin +// Copyright (c) 2022 Aleksei Moskvin +// Copyright (c) 2022-2023 Elena Tatuzova +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//---------------------------------------------------------------------------// +pragma solidity >=0.8.4; + +import "../../../contracts/types.sol"; +import "./gate_argument.sol"; + +library template_gate15{ + uint256 constant MODULUS_OFFSET = 0x0; + uint256 constant THETA_OFFSET = 0x20; + + uint256 constant CONSTRAINT_EVAL_OFFSET = 0x00; + uint256 constant GATE_EVAL_OFFSET = 0x20; + uint256 constant GATES_EVALUATIONS_OFFSET = 0x40; + uint256 constant THETA_ACC_OFFSET = 0x60; + + uint256 constant WITNESS_EVALUATIONS_OFFSET = 0x80; + uint256 constant CONSTANT_EVALUATIONS_OFFSET = 0xa0; + uint256 constant SELECTOR_EVALUATIONS_OFFSET = 0xc0; + + + function evaluate_gate_be( + types.gate_argument_params memory gate_params, + template_gate_argument_split_gen.local_vars_type memory local_vars + ) external pure returns (uint256 gates_evaluation, uint256 theta_acc) { + gates_evaluation = local_vars.gates_evaluation; + theta_acc = local_vars.theta_acc; + uint256 terms; + assembly { + let modulus := mload(gate_params) + let theta := mload(add(gate_params, THETA_OFFSET)) + + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + + function get_witness_i_by_rotation_idx(idx, rot_idx, ptr) -> result { + result := mload( + add( + add(mload(add(add(mload(add(ptr, WITNESS_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))), 0x20), + mul(0x20, rot_idx) + ) + ) + } + + function get_constant_i(idx, ptr) -> result { + result := mload(add(add(mload(add(ptr, CONSTANT_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))) + } + + function get_selector_i(idx, ptr) -> result { + result := mload(add(add(mload(add(ptr, SELECTOR_EVALUATIONS_OFFSET)), 0x20), mul(0x20, idx))) + } + + //Gate15 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000000000000000000000891a63f02533e46e64b4c3b40000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3000000000000000000000000000000019b4f2bd06f9bad4b2e1e4b1c0000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3000000000000000000000000000000019b4f2bd06f9bad4b2e1e4b1c0000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x100000000000000000000000000000000891a63f02533e46e64b4c3b40000001 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,1, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffeb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x12 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(2,2, local_vars) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffef + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x6 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0xb + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,2, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(0,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,1, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffd + terms:=mulmod(terms, get_witness_i_by_rotation_idx(1,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(1,2, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(15,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + //Gate16 + mstore(add(local_vars, GATE_EVAL_OFFSET), 0) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET), 0) + terms:=0x333333333333333333333333333333334e9ee0c9a10a60e2e0f0f3f0ccccccc + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=0x3ccccccccccccccccccccccccccccccced5caaef6f3c530d6b1e21adf3333334 + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + terms:=mulmod(terms, get_witness_i_by_rotation_idx(2,0, local_vars), modulus) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + terms:=get_witness_i_by_rotation_idx(0,1, local_vars) + mstore(add(local_vars, CONSTRAINT_EVAL_OFFSET),addmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),terms,modulus)) + mstore(add(local_vars, GATE_EVAL_OFFSET),addmod(mload(add(local_vars, GATE_EVAL_OFFSET)),mulmod(mload(add(local_vars, CONSTRAINT_EVAL_OFFSET)),theta_acc,modulus),modulus)) + theta_acc := mulmod(theta_acc, theta, modulus) + mstore(add(local_vars, GATE_EVAL_OFFSET),mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)),get_selector_i(16,local_vars),modulus)) + gates_evaluation := addmod(gates_evaluation,mload(add(local_vars, GATE_EVAL_OFFSET)),modulus) + + + } + } +} diff --git a/deploy/contracts/gate/gate_argument.sol b/deploy/contracts/gate/gate_argument.sol new file mode 100644 index 0000000..8605aa8 --- /dev/null +++ b/deploy/contracts/gate/gate_argument.sol @@ -0,0 +1,103 @@ + +// SPDX-License-Identifier: Apache-2.0. +//---------------------------------------------------------------------------// +// Copyright (c) 2022 Mikhail Komarov +// Copyright (c) 2022 Aleksei Moskvin +// Copyright (c) 2023 Elena Tatuzova +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//---------------------------------------------------------------------------// +pragma solidity >=0.8.4; + +import "../../../contracts/types.sol"; +import "../../../contracts/basic_marshalling.sol"; +import "../../../contracts/commitments/batched_lpc_verifier.sol"; +import "../../../contracts/interfaces/gate_argument.sol"; + +import "./gate0.sol"; +import "./gate15.sol"; + + +contract template_gate_argument_split_gen is IGateArgument{ + uint256 constant GATES_N = 17; + + struct local_vars_type{ + // 0x0 + uint256 constraint_eval; + // 0x20 + uint256 gate_eval; + // 0x40 + uint256 gates_evaluation; + // 0x60 + uint256 theta_acc; + + //0x80 + uint256[][] witness_evaluations; + //a0 + uint256[] constant_evaluations; + //c0 + uint256[] selector_evaluations; + + } + + // TODO: columns_rotations could be hard-coded + function evaluate_gates_be( + bytes calldata blob, + uint256 eval_proof_combined_value_offset, + types.gate_argument_params memory gate_params, + types.arithmetization_params memory ar_params, + int256[][] calldata columns_rotations + ) external pure returns (uint256 gates_evaluation) { + local_vars_type memory local_vars; + + + local_vars.witness_evaluations = new uint256[][](ar_params.witness_columns); + for (uint256 i = 0; i < ar_params.witness_columns;) { + local_vars.witness_evaluations[i] = new uint256[](columns_rotations[i].length); + for (uint256 j = 0; j < columns_rotations[i].length;) { + local_vars.witness_evaluations[i][j] = batched_lpc_verifier.get_variable_values_z_i_j_from_proof_be( + blob, eval_proof_combined_value_offset, i, j + ); + unchecked{j++;} + } + unchecked{i++;} + } + + local_vars.constant_evaluations = new uint256[](ar_params.constant_columns); + for (uint256 i = 0; i < ar_params.constant_columns;) { + local_vars.constant_evaluations[i] = batched_lpc_verifier.get_fixed_values_z_i_j_from_proof_be( + blob, eval_proof_combined_value_offset, ar_params.permutation_columns + ar_params.permutation_columns + i, 0 + ); + + unchecked{i++;} + } + + local_vars.selector_evaluations = new uint256[](ar_params.selector_columns); + for (uint256 i = 0; i < ar_params.selector_columns;) { + local_vars.selector_evaluations[i] = batched_lpc_verifier.get_fixed_values_z_i_j_from_proof_be( + blob, eval_proof_combined_value_offset, ar_params.permutation_columns + ar_params.permutation_columns + ar_params.constant_columns + i, 0 + ); + unchecked{i++;} + } + + + local_vars.theta_acc = 1; + local_vars.gates_evaluation = 0; + + (local_vars.gates_evaluation, local_vars.theta_acc) = template_gate0.evaluate_gate_be(gate_params, local_vars); + (local_vars.gates_evaluation, local_vars.theta_acc) = template_gate15.evaluate_gate_be(gate_params, local_vars); + + + gates_evaluation = local_vars.gates_evaluation; + } +} diff --git a/deploy/contracts/gate/template.sol b/deploy/contracts/gate/template.sol deleted file mode 100644 index d9680fa..0000000 --- a/deploy/contracts/gate/template.sol +++ /dev/null @@ -1,220 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0. -//---------------------------------------------------------------------------// -// Copyright (c) 2023 Ilya Marozau -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//---------------------------------------------------------------------------// -pragma solidity >=0.8.4; - -import "@nilfoundation/evm-placeholder-verification/contracts/types.sol"; -import "@nilfoundation/evm-placeholder-verification/contracts/basic_marshalling.sol"; -import "@nilfoundation/evm-placeholder-verification/contracts/commitments/batched_lpc_verifier.sol"; -import "@nilfoundation/evm-placeholder-verification/contracts/interfaces/gate_argument.sol"; - -contract GateArgument is IGateArgument{ - uint256 constant GATES_N = 1; - - uint256 constant MODULUS_OFFSET = 0x0; - uint256 constant THETA_OFFSET = 0x20; - - uint256 constant CONSTRAINT_EVAL_OFFSET = 0x00; - uint256 constant GATE_EVAL_OFFSET = 0x20; - uint256 constant GATES_EVALUATIONS_OFFSET = 0x40; - uint256 constant THETA_ACC_OFFSET = 0x60; - uint256 constant WITNESS_EVALUATIONS_OFFSET = 0x80; - uint256 constant SELECTOR_EVALUATIONS_OFFSET =0xa0; - - // TODO: columns_rotations could be hard-coded - // gate argument local variables may be different for different circuits - struct local_vars_type { - // 0x0 - uint256 constraint_eval; - // 0x20 - uint256 gate_eval; - // 0x40 - uint256 gates_evaluation; - // 0x60 - uint256 theta_acc; - // 0x80 - uint256[][] witness_evaluations; - // 0xa0 - uint256[] selector_evaluations; - } - - function evaluate_gates_be( - bytes calldata blob, - uint256 eval_proof_combined_value_offset, - types.gate_argument_params memory gate_params, - types.arithmetization_params memory ar_params, - int256[][] memory columns_rotations - ) external pure returns (uint256 gates_evaluation) { - local_vars_type memory local_vars; - local_vars.witness_evaluations = new uint256[][](ar_params.witness_columns); - for (uint256 i = 0; i < ar_params.witness_columns; i++) { - local_vars.witness_evaluations[i] = new uint256[](columns_rotations[i].length); - for (uint256 j = 0; j < columns_rotations[i].length; j++) { - local_vars.witness_evaluations[i][j] = batched_lpc_verifier.get_variable_values_z_i_j_from_proof_be( - blob, eval_proof_combined_value_offset, i, j - ); - } - } - - local_vars.selector_evaluations = new uint256[](GATES_N); - for (uint256 i = 0; i < GATES_N; i++) { - local_vars.selector_evaluations[i] = batched_lpc_verifier.get_fixed_values_z_i_j_from_proof_be( - blob, - eval_proof_combined_value_offset, - i + ar_params.permutation_columns + ar_params.permutation_columns + ar_params.constant_columns, - 0 - ); - } - - uint256 t = 0; - assembly { - let modulus := mload(gate_params) - let theta := mload(add(gate_params, THETA_OFFSET)) - - let theta_acc := 1 - mstore(add(local_vars, GATE_EVAL_OFFSET), 0) - - function get_eval_i_by_rotation_idx(idx, rot_idx, ptr) -> result { - result := mload(add(add(mload(add(add(ptr, 0x20), mul(0x20, idx))), 0x20), - mul(0x20, rot_idx))) - } - - function get_selector_i(idx, ptr) -> result { - result := mload(add(add(ptr, 0x20), mul(0x20, idx))) - } - - let x1 := add(local_vars, CONSTRAINT_EVAL_OFFSET) - let x2 := add(local_vars, WITNESS_EVALUATIONS_OFFSET) - let x3 := get_eval_i_by_rotation_idx(0, 0, mload(x2)) - let x4 := get_eval_i_by_rotation_idx(2, 0, mload(x2)) - mstore(add(local_vars, GATE_EVAL_OFFSET), 0) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, get_eval_i_by_rotation_idx(3, 0, mload(x2)), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x4, mulmod(x4, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x4, get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, get_eval_i_by_rotation_idx(3, 0, mload(x2)), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x2, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffe, mulmod(x3, x3, modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x2, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ecfffffffe, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), mulmod(x3, x3, modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ecffffffff, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), mulmod(x3, x3, modulus), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(10, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, x3, modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, x4, modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(10, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, x3, modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, x4, modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(4, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x4, mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x4, get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(4, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(x3, mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(x3, get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(10, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), x3, modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), x4, modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(10, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), x3, modulus), modulus), modulus), modulus), modulus)) - - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), x4, modulus), modulus), modulus), modulus), modulus)) - // Last working string - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(4, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(4, 0, mload(x2)), get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), mulmod(x3, get_eval_i_by_rotation_idx(10, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, x4, modulus), modulus)) - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(get_eval_i_by_rotation_idx(6, 0, mload(x2)), x4, modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(6, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, get_eval_i_by_rotation_idx(3, 0, mload(x2)), modulus), modulus)) - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(get_eval_i_by_rotation_idx(6, 0, mload(x2)), get_eval_i_by_rotation_idx(3, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x3, mulmod(get_eval_i_by_rotation_idx(6, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, x3, modulus), modulus)) - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x4, mulmod(get_eval_i_by_rotation_idx(7, 0, mload(x2)), x3, modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(7, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus)) - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x4, mulmod(get_eval_i_by_rotation_idx(7, 0, mload(x2)), get_eval_i_by_rotation_idx(1, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(7, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(9, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(9, 0, mload(x2)), get_eval_i_by_rotation_idx(4, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(x1, 0) - //1st - mstore(x1, addmod(mload(x1), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus)) - mstore(x1, addmod(mload(x1), mulmod(x3, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(x4, mulmod(get_eval_i_by_rotation_idx(8, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(get_eval_i_by_rotation_idx(1, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(9, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(x1, addmod(mload(x1), mulmod(0x40000000000000000000000000000000224698fc094cf91b992d30ed00000000, mulmod(get_eval_i_by_rotation_idx(3, 0, mload(x2)), mulmod(get_eval_i_by_rotation_idx(9, 0, mload(x2)), get_eval_i_by_rotation_idx(5, 0, mload(x2)), modulus), modulus), modulus), modulus)) - mstore(add(local_vars, GATE_EVAL_OFFSET), addmod(mload(add(local_vars, GATE_EVAL_OFFSET)), mulmod(mload(x1), theta_acc, modulus), modulus)) - theta_acc := mulmod(theta_acc, theta, modulus) - mstore(add(local_vars, GATE_EVAL_OFFSET), mulmod(mload(add(local_vars, GATE_EVAL_OFFSET)), get_selector_i(0, mload(add(local_vars, SELECTOR_EVALUATIONS_OFFSET))), modulus)) - - gates_evaluation := mload(add(local_vars, GATE_EVAL_OFFSET)) - } - } -} \ No newline at end of file diff --git a/deploy/tasks/deploy.ts b/deploy/tasks/deploy.ts index 7549586..34936e9 100644 --- a/deploy/tasks/deploy.ts +++ b/deploy/tasks/deploy.ts @@ -1,16 +1,38 @@ import {task} from 'hardhat/config' +const hre = require('hardhat') import * as fs from 'fs'; task("deploy") .setAction(async (taskArgs, {ethers, run}) => { + const {deployments, getNamedAccounts} = hre; + const {deploy} = deployments; + // https://sepolia.etherscan.io/address/0x489dbc0762b3d9bd9843db11eecd2a177d84ba2b const sepoliaPlaceholderVerifierAddress = '0x489Dbc0762b3D9Bd9843Db11EECd2A177D84ba2b'; // ===================== DEPLOY GateArgument ===================== console.log("Deploy GateArgument...") - const GateArgument = await ethers.getContractFactory("GateArgument"); - const gateArgument = await GateArgument.deploy(); + let libs = [ + "template_gate0", + "template_gate15" + ]; + + let deployedLib = {} + for (let lib of libs) { + await deploy(lib, { + log: true, + }); + deployedLib[lib] = (await hre.deployments.get(lib)).address + } + + const gateArgument = await deploy('template_gate_argument_split_gen', { + libraries: deployedLib, + log: true, + }); + + // const GateArgument = await ethers.getContractFactory("template_gate_argument_split_gen"); + // const gateArgument = await GateArgument.deploy(); await gateArgument.deployed(); console.log("GateArgument at: ", gateArgument.address) diff --git a/storage-proof-app/mock_data.py b/storage-proof-app/mock_data.py index 0de2381..ba54018 100644 --- a/storage-proof-app/mock_data.py +++ b/storage-proof-app/mock_data.py @@ -28,3 +28,9 @@ def slice_into_low_high(digest): with open(args.output, 'w') as f: sys.stdout = f print(json.dumps(input, indent=4)) + + public_input = [{"root" : root.hex()}, {"leaf" : leaf.hex()}] + output_pi = "public_input_" + args.output + with open(output_pi, 'w') as f: + sys.stdout = f + print(json.dumps(public_input, indent=4))