diff --git a/.github/cache-success/restore-dist/index.js b/.github/cache-success/restore-dist/index.js index 995fc0f1a6b..4bddffd644e 100644 --- a/.github/cache-success/restore-dist/index.js +++ b/.github/cache-success/restore-dist/index.js @@ -33636,7 +33636,7 @@ class BlobClient extends StorageClient { * ONLY AVAILABLE IN NODE.JS RUNTIME. * * Downloads an Azure Blob to a local file. - * Fails if the the given file path already exits. + * Fails if the given file path already exits. * Offset and count are optional, pass 0 and undefined respectively to download the entire blob. * * @param filePath - @@ -35023,7 +35023,7 @@ class PageBlobClient extends BlobClient { * getPageRangesSegment returns a single segment of page ranges starting from the * specified Marker. Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call getPageRangesSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges * * @param offset - Starting byte position of the page ranges. @@ -35231,7 +35231,7 @@ class PageBlobClient extends BlobClient { * specified Marker for difference between previous snapshot and the target page blob. * Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call getPageRangesDiffSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges * * @param offset - Starting byte position of the page ranges. @@ -36687,7 +36687,7 @@ class ContainerClient extends StorageClient { * listBlobFlatSegment returns a single segment of blobs starting from the * specified Marker. Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call listBlobsFlatSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * * @param marker - A string value that identifies the portion of the list to be returned with the next list operation. @@ -36718,7 +36718,7 @@ class ContainerClient extends StorageClient { * listBlobHierarchySegment returns a single segment of blobs starting from * the specified Marker. Use an empty Marker to start enumeration from the * beginning. After getting a segment, process it, and then call listBlobsHierarchicalSegment - * again (passing the the previously-returned Marker) to get the next segment. + * again (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * * @param delimiter - The character or string used to define the virtual hierarchy @@ -48872,427 +48872,427 @@ module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; /***/ 4351: /***/ ((module) => { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, Symbol, Reflect, Promise, SuppressedError */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -var __addDisposableResource; -var __disposeResources; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - __addDisposableResource = function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - }; - - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - __disposeResources = function (env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - function next() { - while (env.stack.length) { - var rec = env.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - catch (e) { - fail(e); - } - } - if (env.hasError) throw env.error; - } - return next(); - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); - exporter("__addDisposableResource", __addDisposableResource); - exporter("__disposeResources", __disposeResources); -}); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); +}); /***/ }), @@ -72584,1303 +72584,1303 @@ exports.parseURL = __nccwpck_require__(2158).parseURL; /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; - -const punycode = __nccwpck_require__(5477); -const tr46 = __nccwpck_require__(4256); - -const specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; - -const failure = Symbol("failure"); - -function countSymbols(str) { - return punycode.ucs2.decode(str).length; -} - -function at(input, idx) { - const c = input[idx]; - return isNaN(c) ? undefined : String.fromCodePoint(c); -} - -function isASCIIDigit(c) { - return c >= 0x30 && c <= 0x39; -} - -function isASCIIAlpha(c) { - return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); -} - -function isASCIIAlphanumeric(c) { - return isASCIIAlpha(c) || isASCIIDigit(c); -} - -function isASCIIHex(c) { - return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); -} - -function isSingleDot(buffer) { - return buffer === "." || buffer.toLowerCase() === "%2e"; -} - -function isDoubleDot(buffer) { - buffer = buffer.toLowerCase(); - return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; -} - -function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); -} - -function isWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); -} - -function isNormalizedWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; -} - -function containsForbiddenHostCodePoint(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function containsForbiddenHostCodePointExcludingPercent(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function isSpecialScheme(scheme) { - return specialSchemes[scheme] !== undefined; -} - -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} - -function defaultPort(scheme) { - return specialSchemes[scheme]; -} - -function percentEncode(c) { - let hex = c.toString(16).toUpperCase(); - if (hex.length === 1) { - hex = "0" + hex; - } - - return "%" + hex; -} - -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; - - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); - } - - return str; -} - -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); -} - -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; -} - -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); -} - -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} - -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); - - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); - } - - return cStr; -} - -function parseIPv4Number(input) { - let R = 10; - - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } - - if (input === "") { - return 0; - } - - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { - return failure; - } - - return parseInt(input, R); -} - -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } - - if (parts.length > 4) { - return input; - } - - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; - } - const n = parseIPv4Number(part); - if (n === failure) { - return input; - } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; - } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { - return failure; - } - - let ipv4 = numbers.pop(); - let counter = 0; - - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; - } - - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; - - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); - } - - return output; -} - -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; - - input = punycode.ucs2.decode(input); - - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } - - pointer += 2; - ++pieceIndex; - compress = pieceIndex; - } - - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } - - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; - } - - let value = 0; - let length = 0; - - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } - - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } - - pointer -= length; - - if (pieceIndex > 6) { - return failure; - } - - let numbersSeen = 0; - - while (input[pointer] !== undefined) { - let ipv4Piece = null; - - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } - - if (!isASCIIDigit(input[pointer])) { - return failure; - } - - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } - - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; - - ++numbersSeen; - - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } - - if (numbersSeen !== 4) { - return failure; - } - - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { - return failure; - } - } else if (input[pointer] !== undefined) { - return failure; - } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; - } - } else if (compress === null && pieceIndex !== 8) { - return failure; - } - - return address; -} - -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; - - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } - - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; - } - - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; - } - } - - return output; -} - -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; - } - - return parseIPv6(input.substring(1, input.length - 1)); - } - - if (!isSpecialArg) { - return parseOpaqueHost(input); - } - - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } - - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } - - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; - } - - return asciiDomain; -} - -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } - - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); - } - return output; -} - -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; - - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; - } - ++currLen; - } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} - -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } - - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; - } - - return host; -} - -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} - -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} - -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; - } - - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} - -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} - -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} - -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; - - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, - - cannotBeABaseURL: false - }; - - const res = trimControlChars(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - } - - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - - this.state = stateOverride || "scheme start"; - - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; - - this.input = punycode.ucs2.decode(this.input); - - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); - - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; - } - } -} - -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } - - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } - - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } - - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); - - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; - } - - return true; -}; - -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; - } - this.atFlag = true; - - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); - - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; - } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; - } - } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; - - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } - - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } - } - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; - } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - if (host === "localhost") { - host = ""; - } - this.url.host = host; - - if (this.stateOverride) { - return false; - } - - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; - - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } - - return true; -}; - -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } - - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; - } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } - - return true; -}; - -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } - - return true; -}; - -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } - - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } - - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } - - return true; -}; - -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; - - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } - - output += serializeHost(url.host); - - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } - - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } - - if (url.query !== null) { - output += "?" + url.query; - } - - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } - - return output; -} - -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); - - if (tuple.port !== null) { - result += ":" + tuple.port; - } - - return result; -} - -module.exports.serializeURL = serializeURL; - -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; - -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } - - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } - - return usm.url; -}; - -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.serializeHost = serializeHost; - -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - -module.exports.serializeInteger = function (integer) { - return String(integer); -}; - -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } - - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; + +const punycode = __nccwpck_require__(5477); +const tr46 = __nccwpck_require__(4256); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; /***/ }), diff --git a/.github/cache-success/save-dist/index.js b/.github/cache-success/save-dist/index.js index 3c41ee6a5ce..889a4136678 100644 --- a/.github/cache-success/save-dist/index.js +++ b/.github/cache-success/save-dist/index.js @@ -33636,7 +33636,7 @@ class BlobClient extends StorageClient { * ONLY AVAILABLE IN NODE.JS RUNTIME. * * Downloads an Azure Blob to a local file. - * Fails if the the given file path already exits. + * Fails if the given file path already exits. * Offset and count are optional, pass 0 and undefined respectively to download the entire blob. * * @param filePath - @@ -35023,7 +35023,7 @@ class PageBlobClient extends BlobClient { * getPageRangesSegment returns a single segment of page ranges starting from the * specified Marker. Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call getPageRangesSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges * * @param offset - Starting byte position of the page ranges. @@ -35231,7 +35231,7 @@ class PageBlobClient extends BlobClient { * specified Marker for difference between previous snapshot and the target page blob. * Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call getPageRangesDiffSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges * * @param offset - Starting byte position of the page ranges. @@ -36687,7 +36687,7 @@ class ContainerClient extends StorageClient { * listBlobFlatSegment returns a single segment of blobs starting from the * specified Marker. Use an empty Marker to start enumeration from the beginning. * After getting a segment, process it, and then call listBlobsFlatSegment again - * (passing the the previously-returned Marker) to get the next segment. + * (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * * @param marker - A string value that identifies the portion of the list to be returned with the next list operation. @@ -36718,7 +36718,7 @@ class ContainerClient extends StorageClient { * listBlobHierarchySegment returns a single segment of blobs starting from * the specified Marker. Use an empty Marker to start enumeration from the * beginning. After getting a segment, process it, and then call listBlobsHierarchicalSegment - * again (passing the the previously-returned Marker) to get the next segment. + * again (passing the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * * @param delimiter - The character or string used to define the virtual hierarchy @@ -48872,427 +48872,427 @@ module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; /***/ 4351: /***/ ((module) => { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, Symbol, Reflect, Promise, SuppressedError */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -var __addDisposableResource; -var __disposeResources; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - __addDisposableResource = function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - }; - - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - __disposeResources = function (env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - function next() { - while (env.stack.length) { - var rec = env.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - catch (e) { - fail(e); - } - } - if (env.hasError) throw env.error; - } - return next(); - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); - exporter("__addDisposableResource", __addDisposableResource); - exporter("__disposeResources", __disposeResources); -}); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); +}); /***/ }), @@ -72584,1303 +72584,1303 @@ exports.parseURL = __nccwpck_require__(2158).parseURL; /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; - -const punycode = __nccwpck_require__(5477); -const tr46 = __nccwpck_require__(4256); - -const specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; - -const failure = Symbol("failure"); - -function countSymbols(str) { - return punycode.ucs2.decode(str).length; -} - -function at(input, idx) { - const c = input[idx]; - return isNaN(c) ? undefined : String.fromCodePoint(c); -} - -function isASCIIDigit(c) { - return c >= 0x30 && c <= 0x39; -} - -function isASCIIAlpha(c) { - return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); -} - -function isASCIIAlphanumeric(c) { - return isASCIIAlpha(c) || isASCIIDigit(c); -} - -function isASCIIHex(c) { - return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); -} - -function isSingleDot(buffer) { - return buffer === "." || buffer.toLowerCase() === "%2e"; -} - -function isDoubleDot(buffer) { - buffer = buffer.toLowerCase(); - return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; -} - -function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); -} - -function isWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); -} - -function isNormalizedWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; -} - -function containsForbiddenHostCodePoint(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function containsForbiddenHostCodePointExcludingPercent(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function isSpecialScheme(scheme) { - return specialSchemes[scheme] !== undefined; -} - -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} - -function defaultPort(scheme) { - return specialSchemes[scheme]; -} - -function percentEncode(c) { - let hex = c.toString(16).toUpperCase(); - if (hex.length === 1) { - hex = "0" + hex; - } - - return "%" + hex; -} - -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; - - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); - } - - return str; -} - -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); -} - -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; -} - -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); -} - -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} - -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); - - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); - } - - return cStr; -} - -function parseIPv4Number(input) { - let R = 10; - - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } - - if (input === "") { - return 0; - } - - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { - return failure; - } - - return parseInt(input, R); -} - -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } - - if (parts.length > 4) { - return input; - } - - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; - } - const n = parseIPv4Number(part); - if (n === failure) { - return input; - } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; - } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { - return failure; - } - - let ipv4 = numbers.pop(); - let counter = 0; - - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; - } - - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; - - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); - } - - return output; -} - -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; - - input = punycode.ucs2.decode(input); - - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } - - pointer += 2; - ++pieceIndex; - compress = pieceIndex; - } - - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } - - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; - } - - let value = 0; - let length = 0; - - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } - - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } - - pointer -= length; - - if (pieceIndex > 6) { - return failure; - } - - let numbersSeen = 0; - - while (input[pointer] !== undefined) { - let ipv4Piece = null; - - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } - - if (!isASCIIDigit(input[pointer])) { - return failure; - } - - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } - - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; - - ++numbersSeen; - - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } - - if (numbersSeen !== 4) { - return failure; - } - - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { - return failure; - } - } else if (input[pointer] !== undefined) { - return failure; - } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; - } - } else if (compress === null && pieceIndex !== 8) { - return failure; - } - - return address; -} - -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; - - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } - - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; - } - - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; - } - } - - return output; -} - -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; - } - - return parseIPv6(input.substring(1, input.length - 1)); - } - - if (!isSpecialArg) { - return parseOpaqueHost(input); - } - - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } - - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } - - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; - } - - return asciiDomain; -} - -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } - - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); - } - return output; -} - -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; - - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; - } - ++currLen; - } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} - -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } - - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; - } - - return host; -} - -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} - -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} - -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; - } - - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} - -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} - -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} - -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; - - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, - - cannotBeABaseURL: false - }; - - const res = trimControlChars(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - } - - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - - this.state = stateOverride || "scheme start"; - - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; - - this.input = punycode.ucs2.decode(this.input); - - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); - - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; - } - } -} - -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } - - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } - - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } - - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); - - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; - } - - return true; -}; - -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; - } - this.atFlag = true; - - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); - - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; - } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; - } - } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; - - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } - - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } - } - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; - } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - if (host === "localhost") { - host = ""; - } - this.url.host = host; - - if (this.stateOverride) { - return false; - } - - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; - - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } - - return true; -}; - -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } - - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; - } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } - - return true; -}; - -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } - - return true; -}; - -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } - - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } - - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } - - return true; -}; - -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; - - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } - - output += serializeHost(url.host); - - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } - - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } - - if (url.query !== null) { - output += "?" + url.query; - } - - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } - - return output; -} - -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); - - if (tuple.port !== null) { - result += ":" + tuple.port; - } - - return result; -} - -module.exports.serializeURL = serializeURL; - -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; - -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } - - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } - - return usm.url; -}; - -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.serializeHost = serializeHost; - -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - -module.exports.serializeInteger = function (integer) { - return String(integer); -}; - -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } - - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; + +const punycode = __nccwpck_require__(5477); +const tr46 = __nccwpck_require__(4256); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; /***/ }), diff --git a/.github/workflows/devnet-deploys.yml b/.github/workflows/devnet-deploys.yml index 7280857a12d..d434c49391d 100644 --- a/.github/workflows/devnet-deploys.yml +++ b/.github/workflows/devnet-deploys.yml @@ -3,7 +3,11 @@ on: # push: # branches: [devnet, provernet, alphanet] workflow_dispatch: - inputs: {} + inputs: + rebuild_images: + description: "Rebuild images" + required: false + type: boolean concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -77,7 +81,7 @@ jobs: setup: uses: ./.github/workflows/setup-runner.yml with: - username: master + username: ${{ github.actor }} runner_type: builder-x86 secrets: inherit @@ -125,7 +129,7 @@ jobs: echo "deploy_tag=provernet" >> $GITHUB_OUTPUT echo "branch_name=provernet" >> $GITHUB_OUTPUT echo "network_api_key=PROVERNET_API_KEY" >> $GITHUB_OUTPUT - echo "agents_per_prover=2" >> $GITHUB_OUTPUT + echo "agents_per_prover=4" >> $GITHUB_OUTPUT echo "bot_interval=300" >> $GITHUB_OUTPUT echo "node_tcp_range_start=40200" >> $GITHUB_OUTPUT echo "node_udp_range_start=45200" >> $GITHUB_OUTPUT @@ -190,31 +194,6 @@ jobs: earthly-ci \ --no-output --push ./iac/mainnet-fork+export-mainnet-fork --DIST_TAG=${{ env.DEPLOY_TAG }} - build-aztec-nargo: - needs: set-network - env: - BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }} - DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }} - TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }} - API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }} - TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }} - API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }} - runs-on: ${{ github.actor }}-x86 - steps: - - uses: actions/checkout@v4 - with: - ref: "${{ env.GIT_COMMIT }}" - fetch-depth: 0 - - uses: ./.github/ci-setup-action - with: - concurrency_key: build-aztec-nargo-${{ github.actor }} - dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}" - - - name: Build & push aztec nargo image - run: | - earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ env.DEPLOY_TAG }} - earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ github.sha }} - build-aztec: needs: set-network env: @@ -237,8 +216,13 @@ jobs: - name: Check if only workflow flows have changed id: check_only_workflow_changes uses: actions/github-script@v7 + env: + REBUILD_IMAGES: ${{ github.event.inputs.rebuild_images }} with: script: | + if (process.env.REBUILD_IMAGES === 'true') { + return false; + } const { execSync } = require('child_process'); const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}') .toString() @@ -268,8 +252,33 @@ jobs: docker push aztecprotocol/aztec:${{ github.sha }} + build-aztec-nargo: + needs: [set-network, build-aztec] + env: + BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }} + DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }} + TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }} + API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }} + TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }} + API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }} + runs-on: ${{ github.actor }}-x86 + steps: + - uses: actions/checkout@v4 + with: + ref: "${{ env.GIT_COMMIT }}" + fetch-depth: 0 + - uses: ./.github/ci-setup-action + with: + concurrency_key: build-aztec-nargo-${{ github.actor }} + dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}" + + - name: Build & push aztec nargo image + run: | + earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ env.DEPLOY_TAG }} + earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ github.sha }} + build-faucet: - needs: set-network + needs: [set-network, build-aztec] env: BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }} DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }} @@ -468,8 +477,8 @@ jobs: echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$(extract inboxAddress)" >>$GITHUB_ENV echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$(extract outboxAddress)" >>$GITHUB_ENV echo "TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$(extract availabilityOracleAddress)" >>$GITHUB_ENV - echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$(extract gasTokenAddress)" >>$GITHUB_ENV - echo "TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS=$(extract gasPortalAddress)" >>$GITHUB_ENV + echo "TF_VAR_FEE_JUICE_CONTRACT_ADDRESS=$(extract feeJuiceAddress)" >>$GITHUB_ENV + echo "TF_VAR_FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$(extract feeJuicePortalAddress)" >>$GITHUB_ENV - name: Apply l1-contracts Terraform working-directory: ./l1-contracts/terraform @@ -591,7 +600,7 @@ jobs: aws s3 cp ${{ env.CONTRACT_S3_BUCKET }}/${{ env.DEPLOY_TAG }}/l1_contracts.json ./l1_contracts.json aws s3 cp ${{ env.CONTRACT_S3_BUCKET }}/${{ env.DEPLOY_TAG }}/basic_contracts.json ./basic_contracts.json - echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$(jq -r '.gasTokenAddress' ./l1_contracts.json)" >>$GITHUB_ENV + echo "TF_VAR_FEE_JUICE_CONTRACT_ADDRESS=$(jq -r '.feeJuiceAddress' ./l1_contracts.json)" >>$GITHUB_ENV echo "TF_VAR_DEV_COIN_CONTRACT_ADDRESS=$(jq -r '.devCoinL1' ./basic_contracts.json)" >>$GITHUB_ENV - name: Deploy Faucet diff --git a/aztec-up/bin/.aztec-run b/aztec-up/bin/.aztec-run index 8e318fc4c63..0bbd9c561a5 100755 --- a/aztec-up/bin/.aztec-run +++ b/aztec-up/bin/.aztec-run @@ -10,6 +10,13 @@ shift DEFAULT_PORT=8080 VERSION=${VERSION:-"latest"} AZTEC_PORT=${AZTEC_PORT:-$DEFAULT_PORT} +INHERIT_USER=${INHERIT_USER:-1} + +if [[ -n "${NETWORK:-}" ]]; then + VERSION=$NETWORK + # enable proving if connecting to a network by default + export PXE_PROVER_ENABLED=${PXE_PROVER_ENABLED:-1} +fi # preserve arguments to pass to docker run declare -a preserved_args @@ -39,7 +46,7 @@ fi # If running in rootless docker, don't set uid/gid in container, as it breaks the write perms to the home mount. # Otherwise we set the uid/gid to be that of user running the container to ensure write perms to the home mount. -if [ -z "${ROOTLESS:-}" ]; then +if [[ -z "${ROOTLESS:-}" && "${INHERIT_USER:-}" == "1" ]]; then DOCKER_USER="--user $(id -u):$(id -g)" fi @@ -73,16 +80,6 @@ for i in "${!args[@]}"; do fi done -DOCKER_ENV="-e HOME=$HOME" -for env in ${ENV_VARS_TO_INJECT:-}; do - if [ -n "${!env:-}" ]; then - # First substitute any reference to localhost with our host gateway. - env=${env//localhost/host.docker.internal} - # Inject into container. - DOCKER_ENV+=" -e $env=${!env:-}" - fi -done - # Parse command-line arguments while [[ "$#" -gt 0 ]]; do case $1 in @@ -91,6 +88,14 @@ while [[ "$#" -gt 0 ]]; do preserved_args+=("$1" "$2") # Store both argument and value shift 2 # Move past argument and value ;; + --pxe.network) + VERSION="$2" # Set version to user-specified network (e.g. 'devnet') + echo "Using aztecprotocol/aztec: $VERSION" + preserved_args+=("$1" "$2") # Store both argument and value + # turn on proving if connecting to a network by default + export PXE_PROVER_ENABLED=${PXE_PROVER_ENABLED:-1} + shift 2 + ;; # Move past argument and value *) preserved_args+=("$1") # Store unrecognized/other arguments shift # Move to next argument @@ -98,17 +103,33 @@ while [[ "$#" -gt 0 ]]; do esac done +DOCKER_ENV="-e HOME=$HOME" +for env in ${ENV_VARS_TO_INJECT:-}; do + if [ -n "${!env:-}" ]; then + # First substitute any reference to localhost with our host gateway. + env=${env//localhost/host.docker.internal} + # Inject into container. + DOCKER_ENV+=" -e $env=${!env:-}" + fi +done + # Dynamic port assignment port_assignment="" if [[ -z "${SKIP_PORT_ASSIGNMENT:-}" ]]; then port_assignment="-p $AZTEC_PORT:$AZTEC_PORT" fi +ssh_agent_forwarding="" +if [ -n "${SSH_AUTH_SOCK:-}" ]; then + ssh_agent_forwarding="-v $(realpath $SSH_AUTH_SOCK):$SSH_AUTH_SOCK" +fi + docker run \ -ti \ --rm \ --workdir "$PWD" \ -v $HOME:$HOME -v cache:/cache \ + $ssh_agent_forwarding \ $port_assignment \ ${DOCKER_ENV:-} \ ${DOCKER_HOST_BINDS:-} \ diff --git a/aztec-up/bin/aztec b/aztec-up/bin/aztec index 7268142f8ae..eff925be279 100755 --- a/aztec-up/bin/aztec +++ b/aztec-up/bin/aztec @@ -1,6 +1,13 @@ #!/usr/bin/env bash set -euo pipefail +# Directory of env_var file +TS_ENV_VAR_FILE=/usr/src/yarn-project/foundation/src/config/env_var.ts +LOCAL_TS_FILE=./env_var.ts +NETWORK=${NETWORK:-} +VERSION=${VERSION:-${NETWORK:-"latest"}} +LOCAL_ENV_VAR_FILE="./.${VERSION}_aztec_cli_vars" + function get_compose { # Favour 'docker compose', falling back on docker-compose. CMD="docker compose" @@ -8,6 +15,11 @@ function get_compose { $CMD $@ } +# Function to parse the TypeScript file +function parse_ts_file { + grep -oE "\| '[^']+'" "$LOCAL_TS_FILE" | sed "s/| '//; s/'//g" >"$LOCAL_ENV_VAR_FILE" +} + CALLED_FROM=$PWD if [ "${1:-}" == "test" ]; then @@ -24,7 +36,7 @@ elif [ $# == 2 ] && [ "$1" == "start" ] && [ "$2" == "--sandbox" ]; then # Compose file to use FILE_ARG="-f $HOME/.aztec/docker-compose.sandbox.yml" - # Function to be executed when SIGINT is received. + # Function to be executed when SIGINT is received. cleanup() { get_compose $FILE_ARG down } @@ -32,9 +44,29 @@ elif [ $# == 2 ] && [ "$1" == "start" ] && [ "$2" == "--sandbox" ]; then # Set trap to catch SIGINT and call the cleanup function. trap cleanup SIGINT - get_compose -p sandbox $FILE_ARG up --force-recreate --remove-orphans + get_compose -p sandbox $FILE_ARG up --force-recreate --remove-orphans elif [ "${1:-}" == "start" ]; then - $(dirname $0)/.aztec-run aztecprotocol/aztec "$@" + # export ENV_VARS_TO_INJECT=$(<.aztec_cli_vars) + + # Grab env vars from aztec project + if [[ ! -f "$LOCAL_ENV_VAR_FILE" ]]; then + echo "No env vars file found, creating one..." + # Create temp container + temp_container_id=$(docker create aztecprotocol/aztec:$VERSION) + # Copy env vars file from container + docker cp ${temp_container_id}:$TS_ENV_VAR_FILE $LOCAL_TS_FILE &> /dev/null + # Remove temp container + docker rm $temp_container_id &> /dev/null + + # Parse the TypeScript file + parse_ts_file + rm $LOCAL_TS_FILE + fi + + # Read env vars from file + readarray -t ENV_VARS_TO_INJECT <"$LOCAL_ENV_VAR_FILE" + export ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}" + ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}" INHERIT_USER=0 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@" else SKIP_PORT_ASSIGNMENT=1 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@" fi diff --git a/aztec-up/bin/aztec-install b/aztec-up/bin/aztec-install index 4d158894149..028d798beab 100755 --- a/aztec-up/bin/aztec-install +++ b/aztec-up/bin/aztec-install @@ -2,19 +2,19 @@ set -euo pipefail # Colors -g="\033[32m" # Green -y="\033[33m" # Yellow -b="\033[34m" # Blue -p="\033[35m" # Purple -r="\033[0m" # Reset +g="\033[32m" # Green +y="\033[33m" # Yellow +b="\033[34m" # Blue +p="\033[35m" # Purple +r="\033[0m" # Reset bold="\033[1m" # Function to replace characters and add color function print_colored() { - local b=$'\033[34m' # Blue - local y=$'\033[33m' # Yellow - local r=$'\033[0m' # Reset - echo "$1" | sed -E "s/(█+)/${b}\1${y}/g" + local b=$'\033[34m' # Blue + local y=$'\033[33m' # Yellow + local r=$'\033[0m' # Reset + echo "$1" | sed -E "s/(█+)/${b}\1${y}/g" } function title() { @@ -32,11 +32,11 @@ function title() { echo if [ "$(uname -s)" == "Darwin" ]; then echo -e "${y}WARNING: For best performance we recommend adjusting your default docker settings:" - echo -e " - Under general, enable VirtioFS." - echo -e " - Under resources, set CPUs to ~80% your maximum." - echo -e " - Under resources, set Memory to ~80% your maximum." - echo -e "You may receive a warning about your home directory being mounted into a container." - echo -e "This is requested so we can read and write project files, that is all." + echo -e " - Under general, enable VirtioFS." + echo -e " - Under resources, set CPUs to ~80% your maximum." + echo -e " - Under resources, set Memory to ~80% your maximum." + echo -e "You may receive a warning about your home directory being mounted into a container." + echo -e "This is requested so we can read and write project files, that is all." echo -e "${r}" fi echo -e "This will install the following scripts and update your PATH if necessary:" @@ -126,6 +126,7 @@ install_bin aztec install_bin aztec-up install_bin aztec-nargo install_bin aztec-wallet +install_bin .aztec_cli_vars function update_path_env_var { TARGET_DIR="${1}" @@ -159,7 +160,7 @@ function update_path_env_var { fi # Add the target directory to the user's PATH in their profile. - echo "export PATH=\"\$PATH:$TARGET_DIR\"" >> "$SHELL_PROFILE" + echo "export PATH=\"\$PATH:$TARGET_DIR\"" >>"$SHELL_PROFILE" if [ -z "${NON_INTERACTIVE:-}" ]; then info "Done! Starting fresh shell..." diff --git a/aztec-up/bin/aztec-wallet b/aztec-up/bin/aztec-wallet index 59845ee5a01..675b8bfeda6 100755 --- a/aztec-up/bin/aztec-wallet +++ b/aztec-up/bin/aztec-wallet @@ -1,10 +1,9 @@ #!/usr/bin/env bash set -euo pipefail -export SKIP_NET=1 export SKIP_PORT_ASSIGNMENT=1 export WALLET_DATA_DIRECTORY=$(dirname $0)/wallet-data -export ENV_VARS_TO_INJECT=WALLET_DATA_DIRECTORY +export ENV_VARS_TO_INJECT="WALLET_DATA_DIRECTORY SSH_AUTH_SOCK" mkdir -p $WALLET_DATA_DIRECTORY diff --git a/barretenberg/.gitrepo b/barretenberg/.gitrepo index 553a8fd44fa..1a62fad0b55 100644 --- a/barretenberg/.gitrepo +++ b/barretenberg/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/AztecProtocol/barretenberg branch = master - commit = d4aee60047d9b92f44c2d7d7cc7f3d6b4453f725 - parent = 7b90699fdbebcb00a06f396e8263a9ffe156fbc2 + commit = 75f3d76d00431ee76119785f69e43a615a5bf144 + parent = 3a6021c54515205d74908b708cb43102a2b8a6f7 method = merge cmdver = 0.4.6 diff --git a/barretenberg/acir_tests/reset_acir_tests.sh b/barretenberg/acir_tests/reset_acir_tests.sh index c89731cd79c..dbb21572fe2 100755 --- a/barretenberg/acir_tests/reset_acir_tests.sh +++ b/barretenberg/acir_tests/reset_acir_tests.sh @@ -1,8 +1,12 @@ # Run from within barretenberg/acir_tests + +# clean and rebuild noir then compile the test programs cd ../../noir/noir-repo cargo clean noirup -p . cd test_programs && ./rebuild.sh +# remove and repopulate the test artifacts in bberg cd ../../../barretenberg/acir_tests rm -rf acir_tests +./clone_test_vectors.sh \ No newline at end of file diff --git a/barretenberg/cpp/format.sh b/barretenberg/cpp/format.sh index 3bbfd4b59fc..0b1deb05615 100755 --- a/barretenberg/cpp/format.sh +++ b/barretenberg/cpp/format.sh @@ -13,6 +13,12 @@ if [ "$1" == "staged" ]; then sed -i.bak 's/\r$//' $FILE && rm ${FILE}.bak git add $FILE done +elif [ "$1" == "changed" ]; then + echo Formatting barretenberg changed files... + for FILE in $(git diff-index --diff-filter=d --relative --name-only HEAD | grep -e '\.\(cpp\|hpp\|tcc\)$'); do + clang-format-16 -i $FILE + sed -i.bak 's/\r$//' $FILE && rm ${FILE}.bak + done elif [ "$1" == "check" ]; then for FILE in $(find ./src -iname *.hpp -o -iname *.cpp -o -iname *.tcc | grep -v src/msgpack-c); do clang-format-16 --dry-run --Werror $FILE diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 0f6b67549b7..654cdaf6b39 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -100,10 +100,11 @@ namespace main(256); da_out_of_gas * (1 - da_out_of_gas) = 0; // Constrain that the gas decrements correctly per instruction + // TODO: Special-case for external call. #[L2_GAS_REMAINING_DECREMENT] - sel_gas_accounting_active * (l2_gas_remaining' - l2_gas_remaining + l2_gas_op_cost) = 0; + sel_gas_accounting_active * (1 - sel_op_external_call) * (l2_gas_remaining' - l2_gas_remaining + l2_gas_op_cost) = 0; #[DA_GAS_REMAINING_DECREMENT] - sel_gas_accounting_active * (da_gas_remaining' - da_gas_remaining + da_gas_op_cost) = 0; + sel_gas_accounting_active * (1 - sel_op_external_call) * (da_gas_remaining' - da_gas_remaining + da_gas_op_cost) = 0; // Constrain that the remaining gas is unchanged otherwise (multi-line operations) #[L2_GAS_INACTIVE] @@ -479,14 +480,17 @@ namespace main(256); //===== CONTROL_FLOW_CONSISTENCY ============================================ pol INTERNAL_CALL_STACK_SELECTORS = (sel_first + sel_op_internal_call + sel_op_internal_return + sel_op_halt); + pol SEL_ALU_R_TAG = sel_op_add + sel_op_sub + sel_op_mul + sel_op_div + sel_op_not + sel_op_eq + + sel_op_lt + sel_op_lte + sel_op_shr + sel_op_shl; + pol SEL_ALU_W_TAG = sel_op_cast; + pol SEL_ALL_ALU = SEL_ALU_R_TAG + SEL_ALU_W_TAG; pol SEL_ALL_CTRL_FLOW = sel_op_jump + sel_op_jumpi + sel_op_internal_call + sel_op_internal_return; - pol SEL_ALL_LEFTGAS = sel_op_dagasleft + sel_op_l2gasleft; pol SEL_ALL_BINARY = sel_op_and + sel_op_or + sel_op_xor; pol SEL_ALL_GADGET = sel_op_radix_le + sel_op_sha256 + sel_op_poseidon2 + sel_op_keccak + sel_op_pedersen; pol SEL_ALL_MEMORY = sel_op_cmov + sel_op_mov; pol SEL_ALL_MEM_SLICE = sel_op_calldata_copy + sel_op_external_return; - pol OPCODE_SELECTORS = sel_op_fdiv + SEL_ALU_ALL + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET + pol OPCODE_SELECTORS = sel_op_fdiv + SEL_ALL_ALU + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS + SEL_ALL_MEM_SLICE; // TODO: sel_gas_accounting_active is activating gas accounting on a given row. All opcode with selectors @@ -497,11 +501,11 @@ namespace main(256); // Alternatively, we introduce a boolean selector for the three opcodes mentioned above. // Note: External call gas cost is not constrained pol commit sel_gas_accounting_active; - pol commit sel_mem_op_activate_gas; // TODO: remove this one // TODO: remove sload and sstore from here // This temporarily disables gas tracking for sload and sstore because our gas // tracking doesn't work properly for instructions that span multiple rows - sel_gas_accounting_active - OPCODE_SELECTORS - SEL_ALL_CTRL_FLOW - sel_op_sload - sel_op_sstore - sel_mem_op_activate_gas = 0; + // TODO: disabling this until PR in stack. + // sel_gas_accounting_active - OPCODE_SELECTORS - SEL_ALL_CTRL_FLOW - sel_op_sload - sel_op_sstore - sel_mem_op_activate_gas = 0; // Program counter must increment if not jumping or returning // TODO: support for muli-rows opcode in execution trace such as @@ -558,15 +562,9 @@ namespace main(256); #[MOV_MAIN_SAME_TAG] (sel_op_mov + sel_op_cmov) * (r_in_tag - w_in_tag) = 0; - //===== ALU CONSTRAINTS ===================================================== - pol SEL_ALU_R_TAG = sel_op_add + sel_op_sub + sel_op_mul + sel_op_div + sel_op_not + sel_op_eq - + sel_op_lt + sel_op_lte + sel_op_shr + sel_op_shl; - pol SEL_ALU_W_TAG = sel_op_cast; - pol SEL_ALU_ALL = SEL_ALU_R_TAG + SEL_ALU_W_TAG; - // Predicate to activate the copy of intermediate registers to ALU table. If tag_err == 1, // the operation is not copied to the ALU table. - sel_alu = SEL_ALU_ALL * (1 - tag_err) * (1 - op_err); + sel_alu = SEL_ALL_ALU * (1 - tag_err) * (1 - op_err); // Dispatch the correct in_tag for alu SEL_ALU_R_TAG * (alu_in_tag - r_in_tag) = 0; diff --git a/barretenberg/cpp/scripts/analyze_client_ivc_bench.py b/barretenberg/cpp/scripts/analyze_client_ivc_bench.py index 94c66435f46..532079f847e 100644 --- a/barretenberg/cpp/scripts/analyze_client_ivc_bench.py +++ b/barretenberg/cpp/scripts/analyze_client_ivc_bench.py @@ -1,9 +1,17 @@ import json +import argparse from pathlib import Path -PREFIX = Path("build-op-count-time") -IVC_BENCH_JSON = Path("client_ivc_bench.json") -BENCHMARK = "ClientIVCBench/Full/6" +# Define command-line arguments with defaults +parser = argparse.ArgumentParser(description="Analyze benchmark JSON data.") +parser.add_argument("--json", type=Path, default=Path("client_ivc_bench.json"), help="Benchmark JSON file name.") +parser.add_argument("--benchmark", type=str, default="ClientIVCBench/Full/6", help="Benchmark name to analyze.") +parser.add_argument("--prefix", type=Path, default=Path("build-op-count-time"), help="Prefix path for benchmark files.") +args = parser.parse_args() + +IVC_BENCH_JSON = args.json +BENCHMARK = args.benchmark +PREFIX = args.prefix # Single out an independent set of functions accounting for most of BENCHMARK's real_time to_keep = [ @@ -16,25 +24,27 @@ "TranslatorProver::construct_proof(t)", "Goblin::merge(t)" ] -with open(PREFIX/IVC_BENCH_JSON, "r") as read_file: + +with open(PREFIX / IVC_BENCH_JSON, "r") as read_file: read_result = json.load(read_file) for _bench in read_result["benchmarks"]: if _bench["name"] == BENCHMARK: bench = _bench + bench_components = dict(filter(lambda x: x[0] in to_keep, bench.items())) # For each kept time, get the proportion over all kept times. -sum_of_kept_times_ms = sum(float(time) - for _, time in bench_components.items())/1e6 +sum_of_kept_times_ms = sum(float(time) for _, time in bench_components.items()) / 1e6 + max_label_length = max(len(label) for label in to_keep) column = {"function": "function", "ms": "ms", "%": "% sum"} -print( - f"{column['function']:<{max_label_length}}{column['ms']:>8} {column['%']:>8}") +print(f"{column['function']:<{max_label_length}}{column['ms']:>8} {column['%']:>8}") + for key in to_keep: if key not in bench: time_ms = 0 else: - time_ms = bench[key]/1e6 + time_ms = bench[key] / 1e6 print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/sum_of_kept_times_ms:>8.2%}") # Validate that kept times account for most of the total measured time. @@ -70,7 +80,6 @@ total_time_ms = bench["ProtogalaxyProver::fold_instances(t)"]/1e6 print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/total_time_ms:>8.2%}") - # Extract a set of components from the benchmark data and display timings and relative percentages def print_contributions(prefix, ivc_bench_json, bench_name, components): diff --git a/barretenberg/cpp/scripts/benchmark_client_ivc.sh b/barretenberg/cpp/scripts/benchmark_client_ivc.sh index 7991ef87940..0841f4429ba 100755 --- a/barretenberg/cpp/scripts/benchmark_client_ivc.sh +++ b/barretenberg/cpp/scripts/benchmark_client_ivc.sh @@ -1,21 +1,30 @@ #!/usr/bin/env bash set -eu -TARGET="client_ivc_bench" -# Note: to run structured trace version, change "Full" to "FullStructured" here and in analyze script -FILTER="ClientIVCBench/Full/6$" -BUILD_DIR=build-op-count-time +TARGET=${1:-"client_ivc_bench"} + +if [ "$TARGET" = "client_ivc_bench" ]; then + BENCHMARK="ClientIVCBench/Full/6" +elif [ "$TARGET" = "aztec_ivc_bench" ]; then + BENCHMARK="AztecIVCBench/FullStructured/6" +else + echo "Error: Unrecognized TARGET '$TARGET'." + exit 1 +fi + +BUILD_DIR="build-op-count-time" +FILTER="${BENCHMARK}$" # '$' to ensure only specified bench is run # Move above script dir. cd $(dirname $0)/.. # Measure the benchmarks with ops time counting -./scripts/benchmark_remote.sh client_ivc_bench\ - "./client_ivc_bench --benchmark_filter=$FILTER\ - --benchmark_out=$TARGET.json\ - --benchmark_out_format=json"\ +./scripts/benchmark_remote.sh "$TARGET"\ + "./$TARGET --benchmark_filter=$FILTER\ + --benchmark_out=$TARGET.json\ + --benchmark_out_format=json"\ op-count-time\ - build-op-count-time + "$BUILD_DIR" # Retrieve output from benching instance cd $BUILD_DIR @@ -23,4 +32,4 @@ scp $BB_SSH_KEY $BB_SSH_INSTANCE:$BB_SSH_CPP_PATH/build/$TARGET.json . # Analyze the results cd ../ -python3 ./scripts/analyze_client_ivc_bench.py +python3 ./scripts/analyze_client_ivc_bench.py --json "$TARGET.json" --benchmark "$BENCHMARK" --prefix "$BUILD_DIR" diff --git a/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.cpp b/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.cpp index eda78fe0b3e..87947d8edd6 100644 --- a/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.cpp @@ -7,7 +7,7 @@ namespace bb { * @details If this is the first circuit being accumulated, initialize the prover and verifier accumulators. Otherwise, * fold the instance for the provided circuit into the accumulator. When two fold proofs have been enqueued, two * recursive folding verifications are appended to the next circuit that is accumulated, which must be a kernel. - * Similarly, if a merge proof exists, a recursive merge verifier is appended. + * Similarly, merge proofs are stored in a queue and recursively verified in kernels. * * @param circuit Circuit to be accumulated/folded * @param precomputed_vk Optional precomputed VK (otherwise will be computed herein) @@ -16,42 +16,73 @@ void AztecIVC::accumulate(ClientCircuit& circuit, const std::shared_ptr(verifier_accum->get_value()); - - // Perform databus commitment consistency checks and propagate return data commitments via the public inputs - bus_depot.execute(verifier.instances); - } - verification_queue.clear(); + // The aztec architecture dictates that every second circuit is a kernel. This check can be triggered/replaced by + // the presence of the recursive folding verify opcode once it is introduced into noir. + is_kernel = (circuit_count % 2 == 0); + + // If present circuit is a kernel, perform required recursive PG and/or merge verifications and databus checks + if (is_kernel) { + complete_kernel_circuit_logic(circuit); + } + + // Perform PG and/or merge proving + execute_accumulation_prover(circuit, precomputed_vk); +} + +/** + * @brief Append logic to complete a kernel circuit + * @details A kernel circuit may contain some combination of PG recursive verification, merge recursive verification, + * and databus commitment consistency checks. This method appends this logic to a provided kernel circuit. + * + * @param circuit + */ +void AztecIVC::complete_kernel_circuit_logic(ClientCircuit& circuit) +{ + BB_OP_COUNT_TIME_NAME("construct_circuits"); + + // The folding verification queue should be either empty or contain two fold proofs + ASSERT(verification_queue.empty() || verification_queue.size() == 2); + + for (auto& [proof, vkey] : verification_queue) { + // Perform folding recursive verification + FoldingRecursiveVerifier verifier{ &circuit, { verifier_accumulator, { vkey } } }; + auto verifier_accum = verifier.verify_folding_proof(proof); + verifier_accumulator = std::make_shared(verifier_accum->get_value()); + + // Perform databus commitment consistency checks and propagate return data commitments via public inputs + bus_depot.execute(verifier.instances); } + verification_queue.clear(); - // Construct a merge proof (and add a recursive merge verifier to the circuit if a previous merge proof exists) - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1063): update recursive merge verification to only - // occur in kernels, similar to folding recursive verification. - goblin.merge(circuit); + // Recusively verify all merge proofs in queue + for (auto& proof : merge_verification_queue) { + goblin.verify_merge(circuit, proof); + } + merge_verification_queue.clear(); +} + +/** + * @brief Execute prover work for instance accumulation + * @details Construct an instance for the provided circuit. If this is the first instance in the IVC, simply initialize + * the folding accumulator. Otherwise, execute the PG prover to fold the instance into the accumulator and produce a + * folding proof. Also execute the merge protocol to produce a merge proof. + * + * @param circuit + * @param precomputed_vk + */ +void AztecIVC::execute_accumulation_prover(ClientCircuit& circuit, + const std::shared_ptr& precomputed_vk) +{ + // Construct merge proof for the present circuit and add to merge verification queue + MergeProof merge_proof = goblin.prove_merge(circuit); + merge_verification_queue.emplace_back(merge_proof); // Construct the prover instance for circuit auto prover_instance = std::make_shared(circuit, trace_structure); // Set the instance verification key from precomputed if available, else compute it - if (precomputed_vk) { - instance_vk = precomputed_vk; - } else { - instance_vk = std::make_shared(prover_instance->proving_key); - } - - // Store whether the present circuit is a kernel (Note: the aztec architecture dictates that every second circuit - // is a kernel. This check can triggered/replaced by the presence of the recursive folding verify opcode once it is - // introduced into noir). - instance_vk->databus_propagation_data.is_kernel = (circuit_count % 2 == 0); + instance_vk = precomputed_vk ? precomputed_vk : std::make_shared(prover_instance->proving_key); + instance_vk->databus_propagation_data.is_kernel = is_kernel; // Store whether the present circuit is a kernel // If this is the first circuit simply initialize the prover and verifier accumulator instances if (circuit_count == 1) { @@ -76,10 +107,12 @@ void AztecIVC::accumulate(ClientCircuit& circuit, const std::shared_ptr; + using MergeProof = std::vector; using ProverInstance = ProverInstance_; using VerifierInstance = VerifierInstance_; using ClientCircuit = MegaCircuitBuilder; // can only be Mega @@ -80,6 +81,8 @@ class AztecIVC { // Set of pairs of {fold_proof, verification_key} to be recursively verified std::vector verification_queue; + // Set of merge proofs to be recursively verified + std::vector merge_verification_queue; // Management of linking databus commitments between circuits in the IVC DataBusDepot bus_depot; @@ -87,8 +90,15 @@ class AztecIVC { // A flag indicating whether or not to construct a structured trace in the ProverInstance TraceStructure trace_structure = TraceStructure::NONE; - // The number of circuits processed into the IVC - size_t circuit_count = 0; + size_t circuit_count = 0; // the number of circuits processed into the IVC + bool is_kernel = false; // is the present circuit a kernel + + // Complete the logic of a kernel circuit (e.g. PG/merge recursive verification, databus consistency checks) + void complete_kernel_circuit_logic(ClientCircuit& circuit); + + // Perform prover work for accumulation (e.g. PG folding, merge proving) + void execute_accumulation_prover(ClientCircuit& circuit, + const std::shared_ptr& precomputed_vk = nullptr); void accumulate(ClientCircuit& circuit, const std::shared_ptr& precomputed_vk = nullptr); diff --git a/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.test.cpp b/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.test.cpp index f3c2102931b..1f0cf11a807 100644 --- a/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/aztec_ivc/aztec_ivc.test.cpp @@ -32,8 +32,10 @@ class AztecIVCTests : public ::testing::Test { /** * @brief Construct mock circuit with arithmetic gates and goblin ops - * @details Currently default sized to 2^16 to match kernel. (Note: dummy op gates added to avoid non-zero - * polynomials will bump size to next power of 2) + * @details Defaulted to add 2^16 gates (which will bump to next power of two with the addition of dummy gates). + * The size of the baseline circuit needs to be ~2x the number of gates appended to the kernel circuits via + * recursive verifications (currently ~60k) to ensure that the circuits being folded are equal in size. (This is + * only necessary if the structured trace is not in use). * */ static Builder create_mock_circuit(AztecIVC& ivc, size_t log2_num_gates = 16) @@ -88,10 +90,8 @@ TEST_F(AztecIVCTests, Basic) /** * @brief Check that the IVC fails to verify if an intermediate fold proof is invalid - * @details When accumulating 4 circuits, there are 3 fold proofs to verify (the first two are recursively verfied - and - * the 3rd is verified as part of the IVC proof). Check that if any of one of these proofs is invalid, the IVC will - fail + * @details When accumulating 4 circuits, there are 3 fold proofs to verify (the first two are recursively verfied and + * the 3rd is verified as part of the IVC proof). Check that if any of one of these proofs is invalid, the IVC will fail * to verify. * */ @@ -193,8 +193,6 @@ TEST_F(AztecIVCTests, BasicLarge) ivc.accumulate(circuit); } - info(ivc.goblin.op_queue->get_current_size()); - EXPECT_TRUE(ivc.prove_and_verify()); }; diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 7f6c6481b5d..135bef63403 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -328,7 +328,7 @@ void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath, using TranslatorVK = TranslatorFlavor::VerificationKey; init_bn254_crs(1 << 24); - init_grumpkin_crs(1 << 14); + init_grumpkin_crs(1 << 15); auto gzippedBincodes = unpack_from_file>(bytecodePath); auto witnessMaps = unpack_from_file>(witnessPath); @@ -410,7 +410,7 @@ bool verify_client_ivc(const std::filesystem::path& proof_path, const std::filesystem::path& translator_vk_path) { init_bn254_crs(1); - init_grumpkin_crs(1 << 14); + init_grumpkin_crs(1 << 15); const auto proof = from_buffer(read_file(proof_path)); const auto accumulator = read_to_shared_ptr(accumulator_path); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt index e76758ca571..ab990b18d9f 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(basics_bench) add_subdirectory(decrypt_bench) add_subdirectory(goblin_bench) add_subdirectory(ipa_bench) +add_subdirectory(aztec_ivc_bench) add_subdirectory(client_ivc_bench) add_subdirectory(pippenger_bench) add_subdirectory(plonk_bench) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/CMakeLists.txt new file mode 100644 index 00000000000..e720a99f87e --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(aztec_ivc_bench aztec_ivc stdlib_honk_recursion stdlib_sha256 crypto_merkle_tree stdlib_primitives) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/aztec_ivc.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/aztec_ivc.bench.cpp new file mode 100644 index 00000000000..a24535ea22b --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/benchmark/aztec_ivc_bench/aztec_ivc.bench.cpp @@ -0,0 +1,153 @@ + +#include + +#include "barretenberg/aztec_ivc/aztec_ivc.hpp" +#include "barretenberg/common/op_count.hpp" +#include "barretenberg/common/op_count_google_bench.hpp" +#include "barretenberg/goblin/mock_circuits.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" +#include "barretenberg/ultra_honk/ultra_verifier.hpp" + +using namespace benchmark; +using namespace bb; + +namespace { + +/** + * @brief Benchmark suite for the aztec client PG-Goblin IVC scheme + * + */ +class AztecIVCBench : public benchmark::Fixture { + public: + using Builder = MegaCircuitBuilder; + using VerifierInstance = VerifierInstance_; + using Proof = AztecIVC::Proof; + + // Number of function circuits to accumulate(based on Zacs target numbers) + static constexpr size_t NUM_ITERATIONS_MEDIUM_COMPLEXITY = 6; + + void SetUp([[maybe_unused]] const ::benchmark::State& state) override + { + bb::srs::init_crs_factory("../srs_db/ignition"); + bb::srs::init_grumpkin_crs_factory("../srs_db/grumpkin"); + } + + /** + * @brief Verify an IVC proof + * + */ + static bool verify_ivc(Proof& proof, AztecIVC& ivc) + { + auto verifier_inst = std::make_shared(ivc.verification_queue[0].instance_vk); + bool verified = ivc.verify(proof, { ivc.verifier_accumulator, verifier_inst }); + + // This is a benchmark, not a test, so just print success or failure to the log + if (verified) { + info("IVC successfully verified!"); + } else { + info("IVC failed to verify."); + } + return verified; + } + + /** + * @brief Precompute the verification keys for the bench given the number of circuits in the IVC + * + * @param ivc + * @param num_function_circuits + * @return auto + */ + static auto precompute_verification_keys(AztecIVC& ivc, const size_t num_circuits) + { + // Produce the set of mocked circuits to be accumulated + MockCircuitMaker mock_circuit_maker; + std::vector circuits; + for (size_t circuit_idx = 0; circuit_idx < num_circuits; ++circuit_idx) { + circuits.emplace_back(mock_circuit_maker.create_next_circuit(ivc)); + } + + // Compute and return the corresponding set of verfication keys + return ivc.precompute_folding_verification_keys(circuits); + } + + /** + * @brief Manage the construction of mock app/kernel circuits + * @details Per the medium complexity benchmark spec, the first app circuit is size 2^19. Subsequent app and kernel + * circuits are size 2^17. Circuits produced are alternatingly app and kernel. + */ + class MockCircuitMaker { + size_t circuit_counter = 0; + + public: + Builder create_next_circuit(AztecIVC& ivc) + { + circuit_counter++; + + bool is_kernel = (circuit_counter % 2 == 0); // Every other circuit is a kernel, starting from the second + + Builder circuit{ ivc.goblin.op_queue }; + if (is_kernel) { // construct mock kernel + GoblinMockCircuits::construct_mock_folding_kernel(circuit); + } else { // construct mock app + bool use_large_circuit = (circuit_counter == 1); + GoblinMockCircuits::construct_mock_app_circuit(circuit, use_large_circuit); + } + return circuit; + } + }; + + /** + * @brief Perform a specified number of circuit accumulation rounds + * + * @param NUM_CIRCUITS Number of circuits to accumulate (apps + kernels) + */ + static void perform_ivc_accumulation_rounds(size_t NUM_CIRCUITS, AztecIVC& ivc, auto& precomputed_vks) + { + ASSERT(precomputed_vks.size() == NUM_CIRCUITS); // ensure presence of a precomputed VK for each circuit + + MockCircuitMaker mock_circuit_maker; + + for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) { + Builder circuit; + { + BB_OP_COUNT_TIME_NAME("construct_circuits"); + circuit = mock_circuit_maker.create_next_circuit(ivc); + } + + ivc.accumulate(circuit, precomputed_vks[circuit_idx]); + } + } +}; + +/** + * @brief Benchmark the prover work for the full PG-Goblin IVC protocol + * + */ +BENCHMARK_DEFINE_F(AztecIVCBench, FullStructured)(benchmark::State& state) +{ + AztecIVC ivc; + ivc.trace_structure = TraceStructure::AZTEC_IVC_BENCH; + + auto total_num_circuits = 2 * static_cast(state.range(0)); // 2x accounts for kernel circuits + + // Precompute the verification keys for the benchmark circuits + auto precomputed_vkeys = precompute_verification_keys(ivc, total_num_circuits); + + Proof proof; + for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); + perform_ivc_accumulation_rounds(total_num_circuits, ivc, precomputed_vkeys); + proof = ivc.prove(); + } + + // For good measure, ensure the IVC verifies + verify_ivc(proof, ivc); +} + +#define ARGS Arg(AztecIVCBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY) + +BENCHMARK_REGISTER_F(AztecIVCBench, FullStructured)->Unit(benchmark::kMillisecond)->ARGS; + +} // namespace + +BENCHMARK_MAIN(); diff --git a/barretenberg/cpp/src/barretenberg/crypto/blake3s_full/blake3s.cpp b/barretenberg/cpp/src/barretenberg/crypto/blake3s_full/blake3s.cpp index e6545f3a83e..c00419e9de6 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/blake3s_full/blake3s.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/blake3s_full/blake3s.cpp @@ -493,7 +493,7 @@ INLINE void hasher_merge_cv_stack(blake3_hasher* self, uint64_t total_len) // of the whole tree, and it would need to be ROOT finalized. We can't // compress it until we know. // 2) This 64 KiB input might complete a larger tree, whose root node is -// similarly going to be the the root of the whole tree. For example, maybe +// similarly going to be the root of the whole tree. For example, maybe // we have 196 KiB (that is, 128 + 64) hashed so far. We can't compress the // node at the root of the 256 KiB subtree until we know how to finalize it. // diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/indexed_tree/indexed_tree.hpp b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/indexed_tree/indexed_tree.hpp index b7112be5447..e87b4438508 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/indexed_tree/indexed_tree.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/indexed_tree/indexed_tree.hpp @@ -10,7 +10,7 @@ namespace bb::crypto::merkle_tree { using index_t = uint256_t; /** - * @brief Used in parallel insertions in the the IndexedTree. Workers signal to other following workes as they move up + * @brief Used in parallel insertions in the IndexedTree. Workers signal to other following workes as they move up * the level of the tree. * */ diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index 8fb66b1b522..091dd13752f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -190,6 +190,7 @@ void build_constraints(Builder& builder, } // Add block constraints + assign_calldata_ids(constraint_system.block_constraints); for (size_t i = 0; i < constraint_system.block_constraints.size(); ++i) { const auto& constraint = constraint_system.block_constraints.at(i); create_block_constraints(builder, constraint, has_valid_witness_assignments); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp index c0f889b432f..387c11e7609 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp @@ -69,6 +69,7 @@ class AcirIntegrationTest : public ::testing::Test { info("log circuit size = ", prover.instance->proving_key.log_circuit_size); #endif auto proof = prover.construct_proof(); + // Verify Honk proof auto verification_key = std::make_shared(prover.instance->proving_key); Verifier verifier{ verification_key }; @@ -430,7 +431,7 @@ INSTANTIATE_TEST_SUITE_P(AcirTests, testing::Values("fold_basic", "fold_basic_nested_call")); /** - *@brief A basic test of a circuit generated in noir that makes use of the databus + * @brief A basic test of a circuit generated in noir that makes use of the databus * */ TEST_F(AcirIntegrationTest, DISABLED_Databus) @@ -452,6 +453,59 @@ TEST_F(AcirIntegrationTest, DISABLED_Databus) EXPECT_TRUE(prove_and_verify_honk(builder)); } +/** + * @brief Test a program that uses two databus calldata columns + * @details In addition to checking that a proof of the resulting circuit verfies, check that the specific structure of + * the calldata/return data interaction in the noir program is reflected in the bberg circuit + */ +TEST_F(AcirIntegrationTest, DISABLED_DatabusTwoCalldata) +{ + using Flavor = MegaFlavor; + using Builder = Flavor::CircuitBuilder; + + std::string test_name = "databus_two_calldata"; + info("Test: ", test_name); + acir_format::AcirProgram acir_program = get_program_data_from_test_file(test_name); + + // Construct a bberg circuit from the acir representation + Builder builder = acir_format::create_circuit(acir_program.constraints, 0, acir_program.witness); + + // Check that the databus columns in the builder have been populated as expected + const auto& calldata = builder.get_calldata(); + const auto& secondary_calldata = builder.get_secondary_calldata(); + const auto& return_data = builder.get_return_data(); + + ASSERT(calldata.size() == 4); + ASSERT(secondary_calldata.size() == 3); + ASSERT(return_data.size() == 4); + + // Check that return data was computed from the two calldata inputs as expected + ASSERT_EQ(builder.get_variable(calldata[0]) + builder.get_variable(secondary_calldata[0]), + builder.get_variable(return_data[0])); + ASSERT_EQ(builder.get_variable(calldata[1]) + builder.get_variable(secondary_calldata[1]), + builder.get_variable(return_data[1])); + ASSERT_EQ(builder.get_variable(calldata[2]) + builder.get_variable(secondary_calldata[2]), + builder.get_variable(return_data[2])); + ASSERT_EQ(builder.get_variable(calldata[3]), builder.get_variable(return_data[3])); + + // Ensure that every index of each bus column was read once as expected + for (size_t idx = 0; idx < calldata.size(); ++idx) { + ASSERT_EQ(calldata.get_read_count(idx), 1); + } + for (size_t idx = 0; idx < secondary_calldata.size(); ++idx) { + ASSERT_EQ(secondary_calldata.get_read_count(idx), 1); + } + for (size_t idx = 0; idx < return_data.size(); ++idx) { + ASSERT_EQ(return_data.get_read_count(idx), 1); + } + + // This prints a summary of the types of gates in the circuit + builder.blocks.summarize(); + + // Construct and verify Honk proof + EXPECT_TRUE(prove_and_verify_honk(builder)); +} + /** * @brief Ensure that adding gates post-facto to a circuit generated from acir still results in a valid circuit * @details This is a pattern required by e.g. ClientIvc which appends recursive verifiers to acir-generated circuits diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp index 1ba27ff530d..f31501bdfda 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp @@ -163,20 +163,34 @@ void process_call_data_operations(Builder& builder, using databus_ct = stdlib::databus; databus_ct databus; - // Populate the calldata in the databus - databus.calldata.set_values(init); - for (const auto& op : constraint.trace) { - ASSERT(op.access_type == 0); - field_ct value = poly_to_field_ct(op.value, builder); - field_ct index = poly_to_field_ct(op.index, builder); - fr w_value = 0; - if (has_valid_witness_assignments) { - // If witness are assigned, we use the correct value for w - w_value = index.get_value(); + + // Method for processing operations on a generic databus calldata array + auto process_calldata = [&](auto& calldata_array) { + calldata_array.set_values(init); // Initialize the data in the bus array + + for (const auto& op : constraint.trace) { + ASSERT(op.access_type == 0); + field_ct value = poly_to_field_ct(op.value, builder); + field_ct index = poly_to_field_ct(op.index, builder); + fr w_value = 0; + if (has_valid_witness_assignments) { + // If witness are assigned, we use the correct value for w + w_value = index.get_value(); + } + field_ct w = field_ct::from_witness(&builder, w_value); + value.assert_equal(calldata_array[w]); + w.assert_equal(index); } - field_ct w = field_ct::from_witness(&builder, w_value); - value.assert_equal(databus.calldata[w]); - w.assert_equal(index); + }; + + // Process primary or secondary calldata based on calldata_id + if (constraint.calldata_id == 0) { + process_calldata(databus.calldata); + } else if (constraint.calldata_id == 1) { + process_calldata(databus.secondary_calldata); + } else { + info("Databus only supports two calldata arrays."); + ASSERT(false); } } @@ -199,4 +213,20 @@ void process_return_data_operations(const BlockConstraint& constraint, std::vect ASSERT(constraint.trace.size() == 0); } +// Do nothing for Ultra since it does not support Databus +template <> void assign_calldata_ids([[maybe_unused]] std::vector& constraints) {} + +template <> void assign_calldata_ids(std::vector& constraints) +{ + // Assign unique ID to each calldata block constraint + uint32_t calldata_id = 0; + for (auto& constraint : constraints) { + if (constraint.type == BlockType::CallData) { + constraint.calldata_id = calldata_id++; + } + } + // The backend only supports 2 calldata columns + ASSERT(calldata_id <= 2); +} + } // namespace acir_format \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp index 8a0da27058b..4fccf1d9998 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp @@ -22,6 +22,7 @@ struct BlockConstraint { std::vector init; std::vector trace; BlockType type; + uint32_t calldata_id{ 0 }; }; template @@ -47,6 +48,16 @@ void process_call_data_operations(Builder& builder, template void process_return_data_operations(const BlockConstraint& constraint, std::vector>& init); +/** + * @brief Assign a unique ID to each calldata block constraint based on the order in which it was recieved + * TODO(https://github.com/AztecProtocol/barretenberg/issues/1070): this is a workaround to allow calldata inputs to be + * distinguished by the backend since no identifiers are received from noir. + * + * @tparam Builder + * @param constraints + */ +template void assign_calldata_ids(std::vector& constraints); + template inline void read(B& buf, MemOp& mem_op) { using serialize::read; diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp index 7f3754c7e17..883f8bcb017 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp @@ -1,4 +1,5 @@ #pragma once + #include "barretenberg/common/serialize.hpp" #include "barretenberg/ecc/curves/bn254/fq2.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" @@ -63,6 +64,8 @@ template class alignas(64) affine_ constexpr affine_element operator+(const affine_element& other) const noexcept; + constexpr affine_element operator*(const Fr& exponent) const noexcept; + template > 255) == uint256_t(0), void>> [[nodiscard]] constexpr uint256_t compress() const noexcept; diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp index f58e6f5b7bd..1c1df91b819 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp @@ -68,6 +68,12 @@ constexpr affine_element affine_element::operator+( return affine_element(element(*this) + element(other)); } +template +constexpr affine_element affine_element::operator*(const Fr& exponent) const noexcept +{ + return bb::group_elements::element(*this) * exponent; +} + template template diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp index cb7946beb0f..4203bfdf4dd 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp @@ -153,17 +153,3 @@ template std::ostream& operator<<(std::ostrea } // namespace bb::group_elements #include "./element_impl.hpp" - -template -bb::group_elements::affine_element operator*( - const bb::group_elements::affine_element& base, const Fr& exponent) noexcept -{ - return bb::group_elements::affine_element(bb::group_elements::element(base) * exponent); -} - -template -bb::group_elements::affine_element operator*(const bb::group_elements::element& base, - const Fr& exponent) noexcept -{ - return (bb::group_elements::element(base) * exponent); -} diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp index bdb969415cb..b57873289f4 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp @@ -652,7 +652,7 @@ class ECCVMFlavor { }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to diff --git a/barretenberg/cpp/src/barretenberg/eccvm_recursion/eccvm_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/eccvm_recursion/eccvm_recursive_flavor.hpp index 131c5fcb686..e2aacc1d532 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm_recursion/eccvm_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm_recursion/eccvm_recursive_flavor.hpp @@ -77,7 +77,7 @@ template class ECCVMRecursiveFlavor_ { using VerifierCommitmentKey = bb::VerifierCommitmentKey; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witness) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witness) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp index 1fa923c620f..e9a073d559e 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp @@ -40,8 +40,10 @@ class GoblinProver { using TranslatorProver = bb::TranslatorProver; using TranslatorProvingKey = bb::TranslatorFlavor::ProvingKey; using RecursiveMergeVerifier = bb::stdlib::recursion::goblin::MergeRecursiveVerifier_; + using PairingPoints = RecursiveMergeVerifier::PairingPoints; using MergeProver = bb::MergeProver_; using VerificationKey = MegaFlavor::VerificationKey; + using MergeProof = std::vector; /** * @brief Output of goblin::accumulate; an Ultra proof and the corresponding verification key * @@ -49,7 +51,7 @@ class GoblinProver { std::shared_ptr op_queue = std::make_shared(); - HonkProof merge_proof; + MergeProof merge_proof; GoblinProof goblin_proof; // on the first call to accumulate there is no merge proof to verify @@ -115,13 +117,36 @@ class GoblinProver { */ void merge(MegaCircuitBuilder& circuit_builder) { - BB_OP_COUNT_TIME_NAME("Goblin::merge"); - // Complete the circuit logic by recursively verifying previous merge proof if it exists + // Append a recursive merge verification of the merge proof if (merge_proof_exists) { - RecursiveMergeVerifier merge_verifier{ &circuit_builder }; - [[maybe_unused]] auto pairing_points = merge_verifier.verify_proof(merge_proof); + [[maybe_unused]] auto pairing_points = verify_merge(circuit_builder, merge_proof); } + // Construct a merge proof for the present circuit + merge_proof = prove_merge(circuit_builder); + }; + + /** + * @brief Append recursive verification of a merge proof to a provided circuit + * + * @param circuit_builder + * @return PairingPoints + */ + PairingPoints verify_merge(MegaCircuitBuilder& circuit_builder, MergeProof& proof) const + { + BB_OP_COUNT_TIME_NAME("Goblin::merge"); + RecursiveMergeVerifier merge_verifier{ &circuit_builder }; + return merge_verifier.verify_proof(proof); + }; + + /** + * @brief Construct a merge proof for the goblin ECC ops in the provided circuit + * + * @param circuit_builder + */ + MergeProof prove_merge(MegaCircuitBuilder& circuit_builder) + { + BB_OP_COUNT_TIME_NAME("Goblin::merge"); // TODO(https://github.com/AztecProtocol/barretenberg/issues/993): Some circuits (particularly on the first call // to accumulate) may not have any goblin ecc ops prior to the call to merge(), so the commitment to the new // contribution (C_t_shift) in the merge prover will be the point at infinity. (Note: Some dummy ops are added @@ -131,13 +156,12 @@ class GoblinProver { MockCircuits::construct_goblin_ecc_op_circuit(circuit_builder); // Add some arbitrary goblin ECC ops } - // Construct and store the merge proof to be recursively verified on the next call to accumulate - MergeProver merge_prover{ circuit_builder.op_queue }; - merge_proof = merge_prover.construct_proof(); - if (!merge_proof_exists) { merge_proof_exists = true; } + + MergeProver merge_prover{ circuit_builder.op_queue }; + return merge_prover.construct_proof(); }; /** @@ -171,9 +195,9 @@ class GoblinProver { * * @return Proof */ - GoblinProof prove() + GoblinProof prove(MergeProof merge_proof_in = {}) { - goblin_proof.merge_proof = std::move(merge_proof); + goblin_proof.merge_proof = merge_proof_in.empty() ? std::move(merge_proof) : std::move(merge_proof_in); prove_eccvm(); prove_translator(); return goblin_proof; diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp index 9e696ae3580..e64847a7a0e 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp @@ -41,6 +41,35 @@ class GoblinMockCircuits { std::shared_ptr verification_key; }; + /** + * @brief Populate a builder with some arbitrary but nontrivial constraints + * @details Although the details of the circuit constructed here are arbitrary, the intent is to mock something a + * bit more realistic than a circuit comprised entirely of arithmetic gates. E.g. the circuit should respond + * realistically to efforts to parallelize circuit construction. + * + * @param builder + * @param large If true, construct a "large" circuit (2^19), else a medium circuit (2^17) + */ + static void construct_mock_app_circuit(MegaBuilder& builder, bool large = false) + { + if (large) { // Results in circuit size 2^19 + stdlib::generate_sha256_test_circuit(builder, 12); + stdlib::generate_ecdsa_verification_test_circuit(builder, 11); + stdlib::generate_merkle_membership_test_circuit(builder, 12); + } else { // Results in circuit size 2^17 + stdlib::generate_sha256_test_circuit(builder, 9); + stdlib::generate_ecdsa_verification_test_circuit(builder, 2); + stdlib::generate_merkle_membership_test_circuit(builder, 10); + } + + // TODO(https://github.com/AztecProtocol/barretenberg/issues/911): We require goblin ops to be added to the + // function circuit because we cannot support zero commtiments. While the builder handles this at + // ProverInstance creation stage via the add_gates_to_ensure_all_polys_are_non_zero function for other MegaHonk + // circuits (where we don't explicitly need to add goblin ops), in IVC merge proving happens prior to folding + // where the absense of goblin ecc ops will result in zero commitments. + MockCircuits::construct_goblin_ecc_op_circuit(builder); + } + /** * @brief Populate a builder with some arbitrary but nontrivial constraints * @details Although the details of the circuit constructed here are arbitrary, the intent is to mock something a diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp index b37cdd16206..38c14d4b5cb 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp @@ -32,4 +32,21 @@ TEST_F(MegaMockCircuitsPinning, FunctionSizes) }; run_test(true); run_test(false); +} + +TEST_F(MegaMockCircuitsPinning, AppCircuitSizes) +{ + const auto run_test = [](bool large) { + GoblinProver goblin; + MegaCircuitBuilder app_circuit{ goblin.op_queue }; + GoblinMockCircuits::construct_mock_app_circuit(app_circuit, large); + auto instance = std::make_shared(app_circuit); + if (large) { + EXPECT_EQ(instance->proving_key.log_circuit_size, 19); + } else { + EXPECT_EQ(instance->proving_key.log_circuit_size, 17); + }; + }; + run_test(true); + run_test(false); } \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp index a32d7d83f09..14789bfa263 100644 --- a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp @@ -28,7 +28,7 @@ struct StackTraces { // A set of fixed block size conigurations to be used with the structured execution trace. The actual block sizes // corresponding to these settings are defined in the corresponding arithmetization classes (Ultra/Mega). For efficiency // it is best to use the smallest possible block sizes to accommodate a given situation. -enum class TraceStructure { NONE, SMALL_TEST, CLIENT_IVC_BENCH, E2E_FULL_TEST }; +enum class TraceStructure { NONE, SMALL_TEST, CLIENT_IVC_BENCH, AZTEC_IVC_BENCH, E2E_FULL_TEST }; /** * @brief Basic structure for storing gate data in a builder diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp index c27a53e8deb..8f0e9e35721 100644 --- a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp @@ -56,7 +56,7 @@ template class MegaArith { this->lookup = FIXED_SIZE; this->busread = FIXED_SIZE; this->poseidon_external = FIXED_SIZE; - this->poseidon_internal = FIXED_SIZE; + this->poseidon_internal = 1 << 15; } }; @@ -77,6 +77,23 @@ template class MegaArith { } }; + // A minimal structuring specifically tailored to the medium complexity transaction for the AztecIvc benchmark + struct AztecIvcBenchStructuredBlockSizes : public MegaTraceBlocks { + AztecIvcBenchStructuredBlockSizes() + { + this->ecc_op = 1 << 10; + this->pub_inputs = 1 << 7; + this->arithmetic = 187000; + this->delta_range = 90000; + this->elliptic = 9000; + this->aux = 137000; + this->lookup = 72000; + this->busread = 1 << 7; + this->poseidon_external = 3000; + this->poseidon_internal = 17000; + } + }; + // Structuring tailored to the full e2e TS test (TO BE UPDATED ACCORDINGLY) struct E2eStructuredBlockSizes : public MegaTraceBlocks { E2eStructuredBlockSizes() @@ -178,6 +195,9 @@ template class MegaArith { case TraceStructure::CLIENT_IVC_BENCH: fixed_block_sizes = ClientIvcBenchStructuredBlockSizes(); break; + case TraceStructure::AZTEC_IVC_BENCH: + fixed_block_sizes = AztecIvcBenchStructuredBlockSizes(); + break; case TraceStructure::E2E_FULL_TEST: fixed_block_sizes = E2eStructuredBlockSizes(); break; diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/ultra_arithmetization.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/ultra_arithmetization.hpp index 402ce07f9e0..38d3028300d 100644 --- a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/ultra_arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/ultra_arithmetization.hpp @@ -90,6 +90,7 @@ template class UltraArith { // We don't use Ultra in ClientIvc so no need for anything other than sizing for simple unit tests case TraceStructure::SMALL_TEST: case TraceStructure::CLIENT_IVC_BENCH: + case TraceStructure::AZTEC_IVC_BENCH: case TraceStructure::E2E_FULL_TEST: fixed_block_sizes = SmallTestStructuredBlockSizes(); break; diff --git a/barretenberg/cpp/src/barretenberg/polynomials/univariate.hpp b/barretenberg/cpp/src/barretenberg/polynomials/univariate.hpp index 2a64416f21e..5165b19fd6c 100644 --- a/barretenberg/cpp/src/barretenberg/polynomials/univariate.hpp +++ b/barretenberg/cpp/src/barretenberg/polynomials/univariate.hpp @@ -459,7 +459,7 @@ template const& univari write(it, univariate.evaluations); } +template +Univariate operator+( + const Fr& ff, const Univariate& uv) +{ + return uv + ff; +} + +template +Univariate operator-( + const Fr& ff, const Univariate& uv) +{ + return -uv + ff; +} + +template +Univariate operator*( + const Fr& ff, const Univariate& uv) +{ + return uv * ff; +} + template class UnivariateView { public: static constexpr size_t LENGTH = domain_end - domain_start; diff --git a/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp index 7e39ebc7df8..038e6cd326c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp @@ -32,11 +32,11 @@ template class LogDerivLookupRelationImpl { 3, // log derivative lookup argument sub-relation }; - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1036): Scrutinize these adjustment factors. Counting - // degrees suggests the first subrelation should require an adjustment of 2. + // Note: the required correction for the second sub-relation is technically +1 but the two corrections must agree + // due to the way the relation algebra is written so both are set to +2. static constexpr std::array TOTAL_LENGTH_ADJUSTMENTS{ - 1, // inverse construction sub-relation - 1 // log derivative lookup argument sub-relation + 2, // inverse construction sub-relation + 2 // log derivative lookup argument sub-relation }; static constexpr std::array SUBRELATION_LINEARLY_INDEPENDENT = { true, false }; diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/README.md b/barretenberg/cpp/src/barretenberg/smt_verification/README.md index 2db78c3853b..680c974e469 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/README.md +++ b/barretenberg/cpp/src/barretenberg/smt_verification/README.md @@ -119,7 +119,7 @@ To store it on the disk just do the following - ```smt_circuit::StandardCircuit circuit(CircuitSchema c_info, Solver* s, TermType type, str tag="", bool optimizations=true)``` - ```smt_circuit::UltraCircuit circuit(CircuitSchema c_info, Solver* s, TermType type, str tag="", bool optimizations=true)``` - It will generate all the symbolic values of the circuit wires, add all the gate constrains, create a map `term_name->STerm` and the inverse of it. Where `term_name` is the the name you provided earlier. + It will generate all the symbolic values of the circuit wires, add all the gate constrains, create a map `term_name->STerm` and the inverse of it. Where `term_name` is the name you provided earlier. In case you want to create two similar circuits with the same `solver` and `schema`, then you should specify the `tag`(name) of a circuit. @@ -209,7 +209,7 @@ Another one is - `pair StandardCircuit::unique_witness_ext(CircuitSchema circuit_info, Solver* s, TermType type, vector equal_variables, vector nequal_variables, vector at_least_one_equal_variable, vector at_least_one_nequal_variable)` that does the same but provides you with more flexible settings. - Same in `UltraCircuit` -The return circuits can be useful, if you want to define some additional constraints, that are not covered by the the above functions. +The return circuits can be useful, if you want to define some additional constraints, that are not covered by the above functions. You can call `s.check`, `s.model`, `smt_timer` or `default_model` further. ## 5. smt_util.hpp diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp index a40ba91f45d..02c69d8f770 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp @@ -38,7 +38,7 @@ bool_t ecdsa_verify_signature(const stdlib::byte_array& messag * It is used to recover signing public key from an ecdsa signature. In practice, the value * of v is offset by 27 following the convention from the original bitcoin whitepaper. * - * The value of v depends on the the point R = (x, y) s.t. r = x % |Fr| + * The value of v depends on the point R = (x, y) s.t. r = x % |Fr| * 0: y is even && x < |Fr| (x = r) * 1: y is odd && x < |Fr| (x = r) * 2: y is even && |Fr| <= x < |Fq| (x = r + |Fr|) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp index 744fafa2d4b..3b939e5f042 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp @@ -40,7 +40,7 @@ enum blake2s_constant { * h: A 64-byte chain value denoted decomposed as (h_0, h_1, ..., h_7), each h_i is a 32-bit number. * It form the first two rows on the internal state matrix v of the compression function G. * - * t: It is a counter (t_0 lsb and t_1 msb) used in the the initialization of the internal state v. + * t: It is a counter (t_0 lsb and t_1 msb) used in the initialization of the internal state v. * * f: f_0 and f_1 are finalization flags used in the initialization of the internal state v. * / 0xfff...ff if the block processed is the last diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp index b77a4358518..be51db0b7bb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp @@ -1223,7 +1223,7 @@ void bigfield::perform_reductions_for_mult_madd(std::vector::unsafe_evaluate_multiple_multiply_add(const std::vect ctx->decompose_into_default_range(carry_lo.witness_index, static_cast(carry_lo_msb)); ctx->decompose_into_default_range(carry_hi.witness_index, static_cast(carry_hi_msb)); } - was removed from the the `else` block below. See the conversation at + was removed from the `else` block below. See the conversation at https://github.com/AztecProtocol/aztec2-internal/pull/1023 We should make sure that no constraint like this is needed but missing (e.g., an equivalent constraint was just imposed?). */ diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp index 5d96a94293e..9c36c59a809 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp @@ -257,7 +257,7 @@ TEST(stdlib_plookup, blake2s_xor_rotate_16) } /* - * The following out coefficients are the the ones multiplied for computing the cumulative intermediate terms + * The following out coefficients are the ones multiplied for computing the cumulative intermediate terms * in the expected output. If the column_3_coefficients for this table are (a0, a1, ..., a5), then the * out_coefficients must be (a5/a4, a4/a3, a3/a2, a2/a1, a1/a0). Note that these are stored in reverse orde * for simplicity. diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp index 08ec8b849a2..6a0c281f05d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp @@ -1705,7 +1705,7 @@ template class stdlib_uint : public testing::Test { } /** - * @brief Test the the function uint_ct::at used to extract bits. + * @brief Test the function uint_ct::at used to extract bits. */ static void test_at() { diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp index 64409b23361..ec085459272 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp @@ -455,7 +455,7 @@ class MegaFlavor { }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to resolve diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp index fde032f061e..d0beed7bed2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp @@ -88,7 +88,7 @@ template class MegaRecursiveFlavor_ { using Base::Base; }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to resolve diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp index 2797c1b8fcf..42e24195960 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp @@ -457,7 +457,7 @@ void UltraCircuitBuilder_::create_poly_gate(const poly_triple_< * * @details x and y are defined over scalar field. * - * @param in Elliptic curve point addition gate parameters, including the the affine coordinates of the two points being + * @param in Elliptic curve point addition gate parameters, including the affine coordinates of the two points being * added, the resulting point coordinates and the selector values that describe whether the second point is negated. */ template diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp index 7d501ae0fdf..dfda4a2a24e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp @@ -351,7 +351,7 @@ class UltraFlavor { }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to resolve diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak.hpp index 9b8d8dd6070..30db8636251 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak.hpp @@ -352,7 +352,7 @@ class UltraKeccakFlavor { }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to resolve diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp index f46d4d60f47..b0228d4748b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp @@ -95,7 +95,7 @@ template class UltraRecursiveFlavor_ { public: /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to resolve diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp index 2d8af1288aa..aa89a13a2b9 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp @@ -12,8 +12,8 @@ namespace bb { */ template size_t ProverInstance_::compute_dyadic_size(Circuit& circuit) { - // minimum circuit size due to lookup argument - const size_t min_size_due_to_lookups = circuit.get_tables_size() + circuit.get_lookups_size(); + // for the lookup argument the circuit size must be at least as large as the sum of all tables used + const size_t min_size_due_to_lookups = circuit.get_tables_size(); // minimum size of execution trace due to everything else size_t min_size_of_execution_trace = circuit.public_inputs.size() + circuit.num_gates; diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp index a8d4d709100..6abd04d0661 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp @@ -843,7 +843,7 @@ class TranslatorFlavor { }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to diff --git a/barretenberg/cpp/src/barretenberg/translator_vm_recursion/translator_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/translator_vm_recursion/translator_recursive_flavor.hpp index d922e941bfd..054874779ef 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm_recursion/translator_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm_recursion/translator_recursive_flavor.hpp @@ -110,7 +110,7 @@ template class TranslatorRecursiveFlavor_ { using Base::Base; }; /** - * @brief The verification key is responsible for storing the the commitments to the precomputed (non-witnessk) + * @brief The verification key is responsible for storing the commitments to the precomputed (non-witnessk) * polynomials used by the verifier. * * @note Note the discrepancy with what sort of data is stored here vs in the proving key. We may want to diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index f2cb4c04cc8..58a8a8079d2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -206,7 +206,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; polys.main_sel_last[i] = rows[i].main_sel_last; polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; - polys.main_sel_mem_op_activate_gas[i] = rows[i].main_sel_mem_op_activate_gas; polys.main_sel_mem_op_b[i] = rows[i].main_sel_mem_op_b; polys.main_sel_mem_op_c[i] = rows[i].main_sel_mem_op_c; polys.main_sel_mem_op_d[i] = rows[i].main_sel_mem_op_d; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp index 0f5cf53fb5d..3e196511ba2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp @@ -20,8 +20,6 @@ class AvmCircuitBuilder { using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; - static constexpr size_t num_fixed_columns = 704; - static constexpr size_t num_polys = 704 + 74; std::vector rows; void set_trace(std::vector&& trace) { rows = std::move(trace); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 481de9fb1b2..9387efd4525 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -187,602 +187,601 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , main_sel_gas_accounting_active(il[179]) , main_sel_last(il[180]) , main_sel_mem_op_a(il[181]) - , main_sel_mem_op_activate_gas(il[182]) - , main_sel_mem_op_b(il[183]) - , main_sel_mem_op_c(il[184]) - , main_sel_mem_op_d(il[185]) - , main_sel_mov_ia_to_ic(il[186]) - , main_sel_mov_ib_to_ic(il[187]) - , main_sel_op_add(il[188]) - , main_sel_op_address(il[189]) - , main_sel_op_and(il[190]) - , main_sel_op_block_number(il[191]) - , main_sel_op_calldata_copy(il[192]) - , main_sel_op_cast(il[193]) - , main_sel_op_chain_id(il[194]) - , main_sel_op_cmov(il[195]) - , main_sel_op_coinbase(il[196]) - , main_sel_op_dagasleft(il[197]) - , main_sel_op_div(il[198]) - , main_sel_op_emit_l2_to_l1_msg(il[199]) - , main_sel_op_emit_note_hash(il[200]) - , main_sel_op_emit_nullifier(il[201]) - , main_sel_op_emit_unencrypted_log(il[202]) - , main_sel_op_eq(il[203]) - , main_sel_op_external_call(il[204]) - , main_sel_op_external_return(il[205]) - , main_sel_op_fdiv(il[206]) - , main_sel_op_fee_per_da_gas(il[207]) - , main_sel_op_fee_per_l2_gas(il[208]) - , main_sel_op_function_selector(il[209]) - , main_sel_op_get_contract_instance(il[210]) - , main_sel_op_halt(il[211]) - , main_sel_op_internal_call(il[212]) - , main_sel_op_internal_return(il[213]) - , main_sel_op_jump(il[214]) - , main_sel_op_jumpi(il[215]) - , main_sel_op_keccak(il[216]) - , main_sel_op_l1_to_l2_msg_exists(il[217]) - , main_sel_op_l2gasleft(il[218]) - , main_sel_op_lt(il[219]) - , main_sel_op_lte(il[220]) - , main_sel_op_mov(il[221]) - , main_sel_op_mul(il[222]) - , main_sel_op_not(il[223]) - , main_sel_op_note_hash_exists(il[224]) - , main_sel_op_nullifier_exists(il[225]) - , main_sel_op_or(il[226]) - , main_sel_op_pedersen(il[227]) - , main_sel_op_poseidon2(il[228]) - , main_sel_op_radix_le(il[229]) - , main_sel_op_sender(il[230]) - , main_sel_op_sha256(il[231]) - , main_sel_op_shl(il[232]) - , main_sel_op_shr(il[233]) - , main_sel_op_sload(il[234]) - , main_sel_op_sstore(il[235]) - , main_sel_op_storage_address(il[236]) - , main_sel_op_sub(il[237]) - , main_sel_op_timestamp(il[238]) - , main_sel_op_transaction_fee(il[239]) - , main_sel_op_version(il[240]) - , main_sel_op_xor(il[241]) - , main_sel_q_kernel_lookup(il[242]) - , main_sel_q_kernel_output_lookup(il[243]) - , main_sel_resolve_ind_addr_a(il[244]) - , main_sel_resolve_ind_addr_b(il[245]) - , main_sel_resolve_ind_addr_c(il[246]) - , main_sel_resolve_ind_addr_d(il[247]) - , main_sel_returndata(il[248]) - , main_sel_rng_16(il[249]) - , main_sel_rng_8(il[250]) - , main_sel_slice_gadget(il[251]) - , main_space_id(il[252]) - , main_tag_err(il[253]) - , main_w_in_tag(il[254]) - , mem_addr(il[255]) - , mem_clk(il[256]) - , mem_diff_hi(il[257]) - , mem_diff_lo(il[258]) - , mem_diff_mid(il[259]) - , mem_glob_addr(il[260]) - , mem_last(il[261]) - , mem_lastAccess(il[262]) - , mem_one_min_inv(il[263]) - , mem_r_in_tag(il[264]) - , mem_rw(il[265]) - , mem_sel_mem(il[266]) - , mem_sel_mov_ia_to_ic(il[267]) - , mem_sel_mov_ib_to_ic(il[268]) - , mem_sel_op_a(il[269]) - , mem_sel_op_b(il[270]) - , mem_sel_op_c(il[271]) - , mem_sel_op_cmov(il[272]) - , mem_sel_op_d(il[273]) - , mem_sel_op_poseidon_read_a(il[274]) - , mem_sel_op_poseidon_read_b(il[275]) - , mem_sel_op_poseidon_read_c(il[276]) - , mem_sel_op_poseidon_read_d(il[277]) - , mem_sel_op_poseidon_write_a(il[278]) - , mem_sel_op_poseidon_write_b(il[279]) - , mem_sel_op_poseidon_write_c(il[280]) - , mem_sel_op_poseidon_write_d(il[281]) - , mem_sel_op_slice(il[282]) - , mem_sel_resolve_ind_addr_a(il[283]) - , mem_sel_resolve_ind_addr_b(il[284]) - , mem_sel_resolve_ind_addr_c(il[285]) - , mem_sel_resolve_ind_addr_d(il[286]) - , mem_sel_rng_chk(il[287]) - , mem_skip_check_tag(il[288]) - , mem_space_id(il[289]) - , mem_tag(il[290]) - , mem_tag_err(il[291]) - , mem_tsp(il[292]) - , mem_val(il[293]) - , mem_w_in_tag(il[294]) - , pedersen_clk(il[295]) - , pedersen_input(il[296]) - , pedersen_output(il[297]) - , pedersen_sel_pedersen(il[298]) - , poseidon2_B_10_0(il[299]) - , poseidon2_B_10_1(il[300]) - , poseidon2_B_10_2(il[301]) - , poseidon2_B_10_3(il[302]) - , poseidon2_B_11_0(il[303]) - , poseidon2_B_11_1(il[304]) - , poseidon2_B_11_2(il[305]) - , poseidon2_B_11_3(il[306]) - , poseidon2_B_12_0(il[307]) - , poseidon2_B_12_1(il[308]) - , poseidon2_B_12_2(il[309]) - , poseidon2_B_12_3(il[310]) - , poseidon2_B_13_0(il[311]) - , poseidon2_B_13_1(il[312]) - , poseidon2_B_13_2(il[313]) - , poseidon2_B_13_3(il[314]) - , poseidon2_B_14_0(il[315]) - , poseidon2_B_14_1(il[316]) - , poseidon2_B_14_2(il[317]) - , poseidon2_B_14_3(il[318]) - , poseidon2_B_15_0(il[319]) - , poseidon2_B_15_1(il[320]) - , poseidon2_B_15_2(il[321]) - , poseidon2_B_15_3(il[322]) - , poseidon2_B_16_0(il[323]) - , poseidon2_B_16_1(il[324]) - , poseidon2_B_16_2(il[325]) - , poseidon2_B_16_3(il[326]) - , poseidon2_B_17_0(il[327]) - , poseidon2_B_17_1(il[328]) - , poseidon2_B_17_2(il[329]) - , poseidon2_B_17_3(il[330]) - , poseidon2_B_18_0(il[331]) - , poseidon2_B_18_1(il[332]) - , poseidon2_B_18_2(il[333]) - , poseidon2_B_18_3(il[334]) - , poseidon2_B_19_0(il[335]) - , poseidon2_B_19_1(il[336]) - , poseidon2_B_19_2(il[337]) - , poseidon2_B_19_3(il[338]) - , poseidon2_B_20_0(il[339]) - , poseidon2_B_20_1(il[340]) - , poseidon2_B_20_2(il[341]) - , poseidon2_B_20_3(il[342]) - , poseidon2_B_21_0(il[343]) - , poseidon2_B_21_1(il[344]) - , poseidon2_B_21_2(il[345]) - , poseidon2_B_21_3(il[346]) - , poseidon2_B_22_0(il[347]) - , poseidon2_B_22_1(il[348]) - , poseidon2_B_22_2(il[349]) - , poseidon2_B_22_3(il[350]) - , poseidon2_B_23_0(il[351]) - , poseidon2_B_23_1(il[352]) - , poseidon2_B_23_2(il[353]) - , poseidon2_B_23_3(il[354]) - , poseidon2_B_24_0(il[355]) - , poseidon2_B_24_1(il[356]) - , poseidon2_B_24_2(il[357]) - , poseidon2_B_24_3(il[358]) - , poseidon2_B_25_0(il[359]) - , poseidon2_B_25_1(il[360]) - , poseidon2_B_25_2(il[361]) - , poseidon2_B_25_3(il[362]) - , poseidon2_B_26_0(il[363]) - , poseidon2_B_26_1(il[364]) - , poseidon2_B_26_2(il[365]) - , poseidon2_B_26_3(il[366]) - , poseidon2_B_27_0(il[367]) - , poseidon2_B_27_1(il[368]) - , poseidon2_B_27_2(il[369]) - , poseidon2_B_27_3(il[370]) - , poseidon2_B_28_0(il[371]) - , poseidon2_B_28_1(il[372]) - , poseidon2_B_28_2(il[373]) - , poseidon2_B_28_3(il[374]) - , poseidon2_B_29_0(il[375]) - , poseidon2_B_29_1(il[376]) - , poseidon2_B_29_2(il[377]) - , poseidon2_B_29_3(il[378]) - , poseidon2_B_30_0(il[379]) - , poseidon2_B_30_1(il[380]) - , poseidon2_B_30_2(il[381]) - , poseidon2_B_30_3(il[382]) - , poseidon2_B_31_0(il[383]) - , poseidon2_B_31_1(il[384]) - , poseidon2_B_31_2(il[385]) - , poseidon2_B_31_3(il[386]) - , poseidon2_B_32_0(il[387]) - , poseidon2_B_32_1(il[388]) - , poseidon2_B_32_2(il[389]) - , poseidon2_B_32_3(il[390]) - , poseidon2_B_33_0(il[391]) - , poseidon2_B_33_1(il[392]) - , poseidon2_B_33_2(il[393]) - , poseidon2_B_33_3(il[394]) - , poseidon2_B_34_0(il[395]) - , poseidon2_B_34_1(il[396]) - , poseidon2_B_34_2(il[397]) - , poseidon2_B_34_3(il[398]) - , poseidon2_B_35_0(il[399]) - , poseidon2_B_35_1(il[400]) - , poseidon2_B_35_2(il[401]) - , poseidon2_B_35_3(il[402]) - , poseidon2_B_36_0(il[403]) - , poseidon2_B_36_1(il[404]) - , poseidon2_B_36_2(il[405]) - , poseidon2_B_36_3(il[406]) - , poseidon2_B_37_0(il[407]) - , poseidon2_B_37_1(il[408]) - , poseidon2_B_37_2(il[409]) - , poseidon2_B_37_3(il[410]) - , poseidon2_B_38_0(il[411]) - , poseidon2_B_38_1(il[412]) - , poseidon2_B_38_2(il[413]) - , poseidon2_B_38_3(il[414]) - , poseidon2_B_39_0(il[415]) - , poseidon2_B_39_1(il[416]) - , poseidon2_B_39_2(il[417]) - , poseidon2_B_39_3(il[418]) - , poseidon2_B_40_0(il[419]) - , poseidon2_B_40_1(il[420]) - , poseidon2_B_40_2(il[421]) - , poseidon2_B_40_3(il[422]) - , poseidon2_B_41_0(il[423]) - , poseidon2_B_41_1(il[424]) - , poseidon2_B_41_2(il[425]) - , poseidon2_B_41_3(il[426]) - , poseidon2_B_42_0(il[427]) - , poseidon2_B_42_1(il[428]) - , poseidon2_B_42_2(il[429]) - , poseidon2_B_42_3(il[430]) - , poseidon2_B_43_0(il[431]) - , poseidon2_B_43_1(il[432]) - , poseidon2_B_43_2(il[433]) - , poseidon2_B_43_3(il[434]) - , poseidon2_B_44_0(il[435]) - , poseidon2_B_44_1(il[436]) - , poseidon2_B_44_2(il[437]) - , poseidon2_B_44_3(il[438]) - , poseidon2_B_45_0(il[439]) - , poseidon2_B_45_1(il[440]) - , poseidon2_B_45_2(il[441]) - , poseidon2_B_45_3(il[442]) - , poseidon2_B_46_0(il[443]) - , poseidon2_B_46_1(il[444]) - , poseidon2_B_46_2(il[445]) - , poseidon2_B_46_3(il[446]) - , poseidon2_B_47_0(il[447]) - , poseidon2_B_47_1(il[448]) - , poseidon2_B_47_2(il[449]) - , poseidon2_B_47_3(il[450]) - , poseidon2_B_48_0(il[451]) - , poseidon2_B_48_1(il[452]) - , poseidon2_B_48_2(il[453]) - , poseidon2_B_48_3(il[454]) - , poseidon2_B_49_0(il[455]) - , poseidon2_B_49_1(il[456]) - , poseidon2_B_49_2(il[457]) - , poseidon2_B_49_3(il[458]) - , poseidon2_B_4_0(il[459]) - , poseidon2_B_4_1(il[460]) - , poseidon2_B_4_2(il[461]) - , poseidon2_B_4_3(il[462]) - , poseidon2_B_50_0(il[463]) - , poseidon2_B_50_1(il[464]) - , poseidon2_B_50_2(il[465]) - , poseidon2_B_50_3(il[466]) - , poseidon2_B_51_0(il[467]) - , poseidon2_B_51_1(il[468]) - , poseidon2_B_51_2(il[469]) - , poseidon2_B_51_3(il[470]) - , poseidon2_B_52_0(il[471]) - , poseidon2_B_52_1(il[472]) - , poseidon2_B_52_2(il[473]) - , poseidon2_B_52_3(il[474]) - , poseidon2_B_53_0(il[475]) - , poseidon2_B_53_1(il[476]) - , poseidon2_B_53_2(il[477]) - , poseidon2_B_53_3(il[478]) - , poseidon2_B_54_0(il[479]) - , poseidon2_B_54_1(il[480]) - , poseidon2_B_54_2(il[481]) - , poseidon2_B_54_3(il[482]) - , poseidon2_B_55_0(il[483]) - , poseidon2_B_55_1(il[484]) - , poseidon2_B_55_2(il[485]) - , poseidon2_B_55_3(il[486]) - , poseidon2_B_56_0(il[487]) - , poseidon2_B_56_1(il[488]) - , poseidon2_B_56_2(il[489]) - , poseidon2_B_56_3(il[490]) - , poseidon2_B_57_0(il[491]) - , poseidon2_B_57_1(il[492]) - , poseidon2_B_57_2(il[493]) - , poseidon2_B_57_3(il[494]) - , poseidon2_B_58_0(il[495]) - , poseidon2_B_58_1(il[496]) - , poseidon2_B_58_2(il[497]) - , poseidon2_B_58_3(il[498]) - , poseidon2_B_59_0(il[499]) - , poseidon2_B_59_1(il[500]) - , poseidon2_B_59_2(il[501]) - , poseidon2_B_59_3(il[502]) - , poseidon2_B_5_0(il[503]) - , poseidon2_B_5_1(il[504]) - , poseidon2_B_5_2(il[505]) - , poseidon2_B_5_3(il[506]) - , poseidon2_B_6_0(il[507]) - , poseidon2_B_6_1(il[508]) - , poseidon2_B_6_2(il[509]) - , poseidon2_B_6_3(il[510]) - , poseidon2_B_7_0(il[511]) - , poseidon2_B_7_1(il[512]) - , poseidon2_B_7_2(il[513]) - , poseidon2_B_7_3(il[514]) - , poseidon2_B_8_0(il[515]) - , poseidon2_B_8_1(il[516]) - , poseidon2_B_8_2(il[517]) - , poseidon2_B_8_3(il[518]) - , poseidon2_B_9_0(il[519]) - , poseidon2_B_9_1(il[520]) - , poseidon2_B_9_2(il[521]) - , poseidon2_B_9_3(il[522]) - , poseidon2_EXT_LAYER_4(il[523]) - , poseidon2_EXT_LAYER_5(il[524]) - , poseidon2_EXT_LAYER_6(il[525]) - , poseidon2_EXT_LAYER_7(il[526]) - , poseidon2_T_0_4(il[527]) - , poseidon2_T_0_5(il[528]) - , poseidon2_T_0_6(il[529]) - , poseidon2_T_0_7(il[530]) - , poseidon2_T_1_4(il[531]) - , poseidon2_T_1_5(il[532]) - , poseidon2_T_1_6(il[533]) - , poseidon2_T_1_7(il[534]) - , poseidon2_T_2_4(il[535]) - , poseidon2_T_2_5(il[536]) - , poseidon2_T_2_6(il[537]) - , poseidon2_T_2_7(il[538]) - , poseidon2_T_3_4(il[539]) - , poseidon2_T_3_5(il[540]) - , poseidon2_T_3_6(il[541]) - , poseidon2_T_3_7(il[542]) - , poseidon2_T_60_4(il[543]) - , poseidon2_T_60_5(il[544]) - , poseidon2_T_60_6(il[545]) - , poseidon2_T_60_7(il[546]) - , poseidon2_T_61_4(il[547]) - , poseidon2_T_61_5(il[548]) - , poseidon2_T_61_6(il[549]) - , poseidon2_T_61_7(il[550]) - , poseidon2_T_62_4(il[551]) - , poseidon2_T_62_5(il[552]) - , poseidon2_T_62_6(il[553]) - , poseidon2_T_62_7(il[554]) - , poseidon2_T_63_4(il[555]) - , poseidon2_T_63_5(il[556]) - , poseidon2_T_63_6(il[557]) - , poseidon2_T_63_7(il[558]) - , poseidon2_a_0(il[559]) - , poseidon2_a_1(il[560]) - , poseidon2_a_2(il[561]) - , poseidon2_a_3(il[562]) - , poseidon2_b_0(il[563]) - , poseidon2_b_1(il[564]) - , poseidon2_b_2(il[565]) - , poseidon2_b_3(il[566]) - , poseidon2_clk(il[567]) - , poseidon2_input_addr(il[568]) - , poseidon2_mem_addr_read_a(il[569]) - , poseidon2_mem_addr_read_b(il[570]) - , poseidon2_mem_addr_read_c(il[571]) - , poseidon2_mem_addr_read_d(il[572]) - , poseidon2_mem_addr_write_a(il[573]) - , poseidon2_mem_addr_write_b(il[574]) - , poseidon2_mem_addr_write_c(il[575]) - , poseidon2_mem_addr_write_d(il[576]) - , poseidon2_output_addr(il[577]) - , poseidon2_sel_poseidon_perm(il[578]) - , sha256_clk(il[579]) - , sha256_input(il[580]) - , sha256_output(il[581]) - , sha256_sel_sha256_compression(il[582]) - , sha256_state(il[583]) - , slice_addr(il[584]) - , slice_clk(il[585]) - , slice_cnt(il[586]) - , slice_col_offset(il[587]) - , slice_one_min_inv(il[588]) - , slice_sel_cd_cpy(il[589]) - , slice_sel_mem_active(il[590]) - , slice_sel_return(il[591]) - , slice_sel_start(il[592]) - , slice_space_id(il[593]) - , slice_val(il[594]) - , lookup_byte_lengths_counts(il[595]) - , lookup_byte_operations_counts(il[596]) - , lookup_cd_value_counts(il[597]) - , lookup_ret_value_counts(il[598]) - , lookup_opcode_gas_counts(il[599]) - , range_check_l2_gas_hi_counts(il[600]) - , range_check_l2_gas_lo_counts(il[601]) - , range_check_da_gas_hi_counts(il[602]) - , range_check_da_gas_lo_counts(il[603]) - , kernel_output_lookup_counts(il[604]) - , lookup_into_kernel_counts(il[605]) - , incl_main_tag_err_counts(il[606]) - , incl_mem_tag_err_counts(il[607]) - , lookup_mem_rng_chk_lo_counts(il[608]) - , lookup_mem_rng_chk_mid_counts(il[609]) - , lookup_mem_rng_chk_hi_counts(il[610]) - , lookup_pow_2_0_counts(il[611]) - , lookup_pow_2_1_counts(il[612]) - , lookup_u8_0_counts(il[613]) - , lookup_u8_1_counts(il[614]) - , lookup_u16_0_counts(il[615]) - , lookup_u16_1_counts(il[616]) - , lookup_u16_2_counts(il[617]) - , lookup_u16_3_counts(il[618]) - , lookup_u16_4_counts(il[619]) - , lookup_u16_5_counts(il[620]) - , lookup_u16_6_counts(il[621]) - , lookup_u16_7_counts(il[622]) - , lookup_u16_8_counts(il[623]) - , lookup_u16_9_counts(il[624]) - , lookup_u16_10_counts(il[625]) - , lookup_u16_11_counts(il[626]) - , lookup_u16_12_counts(il[627]) - , lookup_u16_13_counts(il[628]) - , lookup_u16_14_counts(il[629]) - , lookup_div_u16_0_counts(il[630]) - , lookup_div_u16_1_counts(il[631]) - , lookup_div_u16_2_counts(il[632]) - , lookup_div_u16_3_counts(il[633]) - , lookup_div_u16_4_counts(il[634]) - , lookup_div_u16_5_counts(il[635]) - , lookup_div_u16_6_counts(il[636]) - , lookup_div_u16_7_counts(il[637]) - , perm_pos_mem_read_a(il[638]) - , perm_pos_mem_read_b(il[639]) - , perm_pos_mem_read_c(il[640]) - , perm_pos_mem_read_d(il[641]) - , perm_pos_mem_write_a(il[642]) - , perm_pos_mem_write_b(il[643]) - , perm_pos_mem_write_c(il[644]) - , perm_pos_mem_write_d(il[645]) - , perm_slice_mem(il[646]) - , perm_main_alu(il[647]) - , perm_main_bin(il[648]) - , perm_main_conv(il[649]) - , perm_main_pos2_perm(il[650]) - , perm_main_pedersen(il[651]) - , perm_main_slice(il[652]) - , perm_main_mem_a(il[653]) - , perm_main_mem_b(il[654]) - , perm_main_mem_c(il[655]) - , perm_main_mem_d(il[656]) - , perm_main_mem_ind_addr_a(il[657]) - , perm_main_mem_ind_addr_b(il[658]) - , perm_main_mem_ind_addr_c(il[659]) - , perm_main_mem_ind_addr_d(il[660]) - , lookup_byte_lengths(il[661]) - , lookup_byte_operations(il[662]) - , lookup_cd_value(il[663]) - , lookup_ret_value(il[664]) - , lookup_opcode_gas(il[665]) - , range_check_l2_gas_hi(il[666]) - , range_check_l2_gas_lo(il[667]) - , range_check_da_gas_hi(il[668]) - , range_check_da_gas_lo(il[669]) - , kernel_output_lookup(il[670]) - , lookup_into_kernel(il[671]) - , incl_main_tag_err(il[672]) - , incl_mem_tag_err(il[673]) - , lookup_mem_rng_chk_lo(il[674]) - , lookup_mem_rng_chk_mid(il[675]) - , lookup_mem_rng_chk_hi(il[676]) - , lookup_pow_2_0(il[677]) - , lookup_pow_2_1(il[678]) - , lookup_u8_0(il[679]) - , lookup_u8_1(il[680]) - , lookup_u16_0(il[681]) - , lookup_u16_1(il[682]) - , lookup_u16_2(il[683]) - , lookup_u16_3(il[684]) - , lookup_u16_4(il[685]) - , lookup_u16_5(il[686]) - , lookup_u16_6(il[687]) - , lookup_u16_7(il[688]) - , lookup_u16_8(il[689]) - , lookup_u16_9(il[690]) - , lookup_u16_10(il[691]) - , lookup_u16_11(il[692]) - , lookup_u16_12(il[693]) - , lookup_u16_13(il[694]) - , lookup_u16_14(il[695]) - , lookup_div_u16_0(il[696]) - , lookup_div_u16_1(il[697]) - , lookup_div_u16_2(il[698]) - , lookup_div_u16_3(il[699]) - , lookup_div_u16_4(il[700]) - , lookup_div_u16_5(il[701]) - , lookup_div_u16_6(il[702]) - , lookup_div_u16_7(il[703]) - , alu_a_hi_shift(il[704]) - , alu_a_lo_shift(il[705]) - , alu_b_hi_shift(il[706]) - , alu_b_lo_shift(il[707]) - , alu_cmp_rng_ctr_shift(il[708]) - , alu_div_u16_r0_shift(il[709]) - , alu_div_u16_r1_shift(il[710]) - , alu_div_u16_r2_shift(il[711]) - , alu_div_u16_r3_shift(il[712]) - , alu_div_u16_r4_shift(il[713]) - , alu_div_u16_r5_shift(il[714]) - , alu_div_u16_r6_shift(il[715]) - , alu_div_u16_r7_shift(il[716]) - , alu_op_add_shift(il[717]) - , alu_op_cast_prev_shift(il[718]) - , alu_op_cast_shift(il[719]) - , alu_op_div_shift(il[720]) - , alu_op_mul_shift(il[721]) - , alu_op_shl_shift(il[722]) - , alu_op_shr_shift(il[723]) - , alu_op_sub_shift(il[724]) - , alu_p_sub_a_hi_shift(il[725]) - , alu_p_sub_a_lo_shift(il[726]) - , alu_p_sub_b_hi_shift(il[727]) - , alu_p_sub_b_lo_shift(il[728]) - , alu_sel_alu_shift(il[729]) - , alu_sel_cmp_shift(il[730]) - , alu_sel_div_rng_chk_shift(il[731]) - , alu_sel_rng_chk_lookup_shift(il[732]) - , alu_sel_rng_chk_shift(il[733]) - , alu_u16_r0_shift(il[734]) - , alu_u16_r1_shift(il[735]) - , alu_u16_r2_shift(il[736]) - , alu_u16_r3_shift(il[737]) - , alu_u16_r4_shift(il[738]) - , alu_u16_r5_shift(il[739]) - , alu_u16_r6_shift(il[740]) - , alu_u8_r0_shift(il[741]) - , alu_u8_r1_shift(il[742]) - , binary_acc_ia_shift(il[743]) - , binary_acc_ib_shift(il[744]) - , binary_acc_ic_shift(il[745]) - , binary_mem_tag_ctr_shift(il[746]) - , binary_op_id_shift(il[747]) - , kernel_emit_l2_to_l1_msg_write_offset_shift(il[748]) - , kernel_emit_note_hash_write_offset_shift(il[749]) - , kernel_emit_nullifier_write_offset_shift(il[750]) - , kernel_emit_unencrypted_log_write_offset_shift(il[751]) - , kernel_l1_to_l2_msg_exists_write_offset_shift(il[752]) - , kernel_note_hash_exist_write_offset_shift(il[753]) - , kernel_nullifier_exists_write_offset_shift(il[754]) - , kernel_nullifier_non_exists_write_offset_shift(il[755]) - , kernel_side_effect_counter_shift(il[756]) - , kernel_sload_write_offset_shift(il[757]) - , kernel_sstore_write_offset_shift(il[758]) - , main_da_gas_remaining_shift(il[759]) - , main_internal_return_ptr_shift(il[760]) - , main_l2_gas_remaining_shift(il[761]) - , main_pc_shift(il[762]) - , mem_glob_addr_shift(il[763]) - , mem_rw_shift(il[764]) - , mem_sel_mem_shift(il[765]) - , mem_tag_shift(il[766]) - , mem_tsp_shift(il[767]) - , mem_val_shift(il[768]) - , slice_addr_shift(il[769]) - , slice_clk_shift(il[770]) - , slice_cnt_shift(il[771]) - , slice_col_offset_shift(il[772]) - , slice_sel_cd_cpy_shift(il[773]) - , slice_sel_mem_active_shift(il[774]) - , slice_sel_return_shift(il[775]) - , slice_sel_start_shift(il[776]) - , slice_space_id_shift(il[777]) + , main_sel_mem_op_b(il[182]) + , main_sel_mem_op_c(il[183]) + , main_sel_mem_op_d(il[184]) + , main_sel_mov_ia_to_ic(il[185]) + , main_sel_mov_ib_to_ic(il[186]) + , main_sel_op_add(il[187]) + , main_sel_op_address(il[188]) + , main_sel_op_and(il[189]) + , main_sel_op_block_number(il[190]) + , main_sel_op_calldata_copy(il[191]) + , main_sel_op_cast(il[192]) + , main_sel_op_chain_id(il[193]) + , main_sel_op_cmov(il[194]) + , main_sel_op_coinbase(il[195]) + , main_sel_op_dagasleft(il[196]) + , main_sel_op_div(il[197]) + , main_sel_op_emit_l2_to_l1_msg(il[198]) + , main_sel_op_emit_note_hash(il[199]) + , main_sel_op_emit_nullifier(il[200]) + , main_sel_op_emit_unencrypted_log(il[201]) + , main_sel_op_eq(il[202]) + , main_sel_op_external_call(il[203]) + , main_sel_op_external_return(il[204]) + , main_sel_op_fdiv(il[205]) + , main_sel_op_fee_per_da_gas(il[206]) + , main_sel_op_fee_per_l2_gas(il[207]) + , main_sel_op_function_selector(il[208]) + , main_sel_op_get_contract_instance(il[209]) + , main_sel_op_halt(il[210]) + , main_sel_op_internal_call(il[211]) + , main_sel_op_internal_return(il[212]) + , main_sel_op_jump(il[213]) + , main_sel_op_jumpi(il[214]) + , main_sel_op_keccak(il[215]) + , main_sel_op_l1_to_l2_msg_exists(il[216]) + , main_sel_op_l2gasleft(il[217]) + , main_sel_op_lt(il[218]) + , main_sel_op_lte(il[219]) + , main_sel_op_mov(il[220]) + , main_sel_op_mul(il[221]) + , main_sel_op_not(il[222]) + , main_sel_op_note_hash_exists(il[223]) + , main_sel_op_nullifier_exists(il[224]) + , main_sel_op_or(il[225]) + , main_sel_op_pedersen(il[226]) + , main_sel_op_poseidon2(il[227]) + , main_sel_op_radix_le(il[228]) + , main_sel_op_sender(il[229]) + , main_sel_op_sha256(il[230]) + , main_sel_op_shl(il[231]) + , main_sel_op_shr(il[232]) + , main_sel_op_sload(il[233]) + , main_sel_op_sstore(il[234]) + , main_sel_op_storage_address(il[235]) + , main_sel_op_sub(il[236]) + , main_sel_op_timestamp(il[237]) + , main_sel_op_transaction_fee(il[238]) + , main_sel_op_version(il[239]) + , main_sel_op_xor(il[240]) + , main_sel_q_kernel_lookup(il[241]) + , main_sel_q_kernel_output_lookup(il[242]) + , main_sel_resolve_ind_addr_a(il[243]) + , main_sel_resolve_ind_addr_b(il[244]) + , main_sel_resolve_ind_addr_c(il[245]) + , main_sel_resolve_ind_addr_d(il[246]) + , main_sel_returndata(il[247]) + , main_sel_rng_16(il[248]) + , main_sel_rng_8(il[249]) + , main_sel_slice_gadget(il[250]) + , main_space_id(il[251]) + , main_tag_err(il[252]) + , main_w_in_tag(il[253]) + , mem_addr(il[254]) + , mem_clk(il[255]) + , mem_diff_hi(il[256]) + , mem_diff_lo(il[257]) + , mem_diff_mid(il[258]) + , mem_glob_addr(il[259]) + , mem_last(il[260]) + , mem_lastAccess(il[261]) + , mem_one_min_inv(il[262]) + , mem_r_in_tag(il[263]) + , mem_rw(il[264]) + , mem_sel_mem(il[265]) + , mem_sel_mov_ia_to_ic(il[266]) + , mem_sel_mov_ib_to_ic(il[267]) + , mem_sel_op_a(il[268]) + , mem_sel_op_b(il[269]) + , mem_sel_op_c(il[270]) + , mem_sel_op_cmov(il[271]) + , mem_sel_op_d(il[272]) + , mem_sel_op_poseidon_read_a(il[273]) + , mem_sel_op_poseidon_read_b(il[274]) + , mem_sel_op_poseidon_read_c(il[275]) + , mem_sel_op_poseidon_read_d(il[276]) + , mem_sel_op_poseidon_write_a(il[277]) + , mem_sel_op_poseidon_write_b(il[278]) + , mem_sel_op_poseidon_write_c(il[279]) + , mem_sel_op_poseidon_write_d(il[280]) + , mem_sel_op_slice(il[281]) + , mem_sel_resolve_ind_addr_a(il[282]) + , mem_sel_resolve_ind_addr_b(il[283]) + , mem_sel_resolve_ind_addr_c(il[284]) + , mem_sel_resolve_ind_addr_d(il[285]) + , mem_sel_rng_chk(il[286]) + , mem_skip_check_tag(il[287]) + , mem_space_id(il[288]) + , mem_tag(il[289]) + , mem_tag_err(il[290]) + , mem_tsp(il[291]) + , mem_val(il[292]) + , mem_w_in_tag(il[293]) + , pedersen_clk(il[294]) + , pedersen_input(il[295]) + , pedersen_output(il[296]) + , pedersen_sel_pedersen(il[297]) + , poseidon2_B_10_0(il[298]) + , poseidon2_B_10_1(il[299]) + , poseidon2_B_10_2(il[300]) + , poseidon2_B_10_3(il[301]) + , poseidon2_B_11_0(il[302]) + , poseidon2_B_11_1(il[303]) + , poseidon2_B_11_2(il[304]) + , poseidon2_B_11_3(il[305]) + , poseidon2_B_12_0(il[306]) + , poseidon2_B_12_1(il[307]) + , poseidon2_B_12_2(il[308]) + , poseidon2_B_12_3(il[309]) + , poseidon2_B_13_0(il[310]) + , poseidon2_B_13_1(il[311]) + , poseidon2_B_13_2(il[312]) + , poseidon2_B_13_3(il[313]) + , poseidon2_B_14_0(il[314]) + , poseidon2_B_14_1(il[315]) + , poseidon2_B_14_2(il[316]) + , poseidon2_B_14_3(il[317]) + , poseidon2_B_15_0(il[318]) + , poseidon2_B_15_1(il[319]) + , poseidon2_B_15_2(il[320]) + , poseidon2_B_15_3(il[321]) + , poseidon2_B_16_0(il[322]) + , poseidon2_B_16_1(il[323]) + , poseidon2_B_16_2(il[324]) + , poseidon2_B_16_3(il[325]) + , poseidon2_B_17_0(il[326]) + , poseidon2_B_17_1(il[327]) + , poseidon2_B_17_2(il[328]) + , poseidon2_B_17_3(il[329]) + , poseidon2_B_18_0(il[330]) + , poseidon2_B_18_1(il[331]) + , poseidon2_B_18_2(il[332]) + , poseidon2_B_18_3(il[333]) + , poseidon2_B_19_0(il[334]) + , poseidon2_B_19_1(il[335]) + , poseidon2_B_19_2(il[336]) + , poseidon2_B_19_3(il[337]) + , poseidon2_B_20_0(il[338]) + , poseidon2_B_20_1(il[339]) + , poseidon2_B_20_2(il[340]) + , poseidon2_B_20_3(il[341]) + , poseidon2_B_21_0(il[342]) + , poseidon2_B_21_1(il[343]) + , poseidon2_B_21_2(il[344]) + , poseidon2_B_21_3(il[345]) + , poseidon2_B_22_0(il[346]) + , poseidon2_B_22_1(il[347]) + , poseidon2_B_22_2(il[348]) + , poseidon2_B_22_3(il[349]) + , poseidon2_B_23_0(il[350]) + , poseidon2_B_23_1(il[351]) + , poseidon2_B_23_2(il[352]) + , poseidon2_B_23_3(il[353]) + , poseidon2_B_24_0(il[354]) + , poseidon2_B_24_1(il[355]) + , poseidon2_B_24_2(il[356]) + , poseidon2_B_24_3(il[357]) + , poseidon2_B_25_0(il[358]) + , poseidon2_B_25_1(il[359]) + , poseidon2_B_25_2(il[360]) + , poseidon2_B_25_3(il[361]) + , poseidon2_B_26_0(il[362]) + , poseidon2_B_26_1(il[363]) + , poseidon2_B_26_2(il[364]) + , poseidon2_B_26_3(il[365]) + , poseidon2_B_27_0(il[366]) + , poseidon2_B_27_1(il[367]) + , poseidon2_B_27_2(il[368]) + , poseidon2_B_27_3(il[369]) + , poseidon2_B_28_0(il[370]) + , poseidon2_B_28_1(il[371]) + , poseidon2_B_28_2(il[372]) + , poseidon2_B_28_3(il[373]) + , poseidon2_B_29_0(il[374]) + , poseidon2_B_29_1(il[375]) + , poseidon2_B_29_2(il[376]) + , poseidon2_B_29_3(il[377]) + , poseidon2_B_30_0(il[378]) + , poseidon2_B_30_1(il[379]) + , poseidon2_B_30_2(il[380]) + , poseidon2_B_30_3(il[381]) + , poseidon2_B_31_0(il[382]) + , poseidon2_B_31_1(il[383]) + , poseidon2_B_31_2(il[384]) + , poseidon2_B_31_3(il[385]) + , poseidon2_B_32_0(il[386]) + , poseidon2_B_32_1(il[387]) + , poseidon2_B_32_2(il[388]) + , poseidon2_B_32_3(il[389]) + , poseidon2_B_33_0(il[390]) + , poseidon2_B_33_1(il[391]) + , poseidon2_B_33_2(il[392]) + , poseidon2_B_33_3(il[393]) + , poseidon2_B_34_0(il[394]) + , poseidon2_B_34_1(il[395]) + , poseidon2_B_34_2(il[396]) + , poseidon2_B_34_3(il[397]) + , poseidon2_B_35_0(il[398]) + , poseidon2_B_35_1(il[399]) + , poseidon2_B_35_2(il[400]) + , poseidon2_B_35_3(il[401]) + , poseidon2_B_36_0(il[402]) + , poseidon2_B_36_1(il[403]) + , poseidon2_B_36_2(il[404]) + , poseidon2_B_36_3(il[405]) + , poseidon2_B_37_0(il[406]) + , poseidon2_B_37_1(il[407]) + , poseidon2_B_37_2(il[408]) + , poseidon2_B_37_3(il[409]) + , poseidon2_B_38_0(il[410]) + , poseidon2_B_38_1(il[411]) + , poseidon2_B_38_2(il[412]) + , poseidon2_B_38_3(il[413]) + , poseidon2_B_39_0(il[414]) + , poseidon2_B_39_1(il[415]) + , poseidon2_B_39_2(il[416]) + , poseidon2_B_39_3(il[417]) + , poseidon2_B_40_0(il[418]) + , poseidon2_B_40_1(il[419]) + , poseidon2_B_40_2(il[420]) + , poseidon2_B_40_3(il[421]) + , poseidon2_B_41_0(il[422]) + , poseidon2_B_41_1(il[423]) + , poseidon2_B_41_2(il[424]) + , poseidon2_B_41_3(il[425]) + , poseidon2_B_42_0(il[426]) + , poseidon2_B_42_1(il[427]) + , poseidon2_B_42_2(il[428]) + , poseidon2_B_42_3(il[429]) + , poseidon2_B_43_0(il[430]) + , poseidon2_B_43_1(il[431]) + , poseidon2_B_43_2(il[432]) + , poseidon2_B_43_3(il[433]) + , poseidon2_B_44_0(il[434]) + , poseidon2_B_44_1(il[435]) + , poseidon2_B_44_2(il[436]) + , poseidon2_B_44_3(il[437]) + , poseidon2_B_45_0(il[438]) + , poseidon2_B_45_1(il[439]) + , poseidon2_B_45_2(il[440]) + , poseidon2_B_45_3(il[441]) + , poseidon2_B_46_0(il[442]) + , poseidon2_B_46_1(il[443]) + , poseidon2_B_46_2(il[444]) + , poseidon2_B_46_3(il[445]) + , poseidon2_B_47_0(il[446]) + , poseidon2_B_47_1(il[447]) + , poseidon2_B_47_2(il[448]) + , poseidon2_B_47_3(il[449]) + , poseidon2_B_48_0(il[450]) + , poseidon2_B_48_1(il[451]) + , poseidon2_B_48_2(il[452]) + , poseidon2_B_48_3(il[453]) + , poseidon2_B_49_0(il[454]) + , poseidon2_B_49_1(il[455]) + , poseidon2_B_49_2(il[456]) + , poseidon2_B_49_3(il[457]) + , poseidon2_B_4_0(il[458]) + , poseidon2_B_4_1(il[459]) + , poseidon2_B_4_2(il[460]) + , poseidon2_B_4_3(il[461]) + , poseidon2_B_50_0(il[462]) + , poseidon2_B_50_1(il[463]) + , poseidon2_B_50_2(il[464]) + , poseidon2_B_50_3(il[465]) + , poseidon2_B_51_0(il[466]) + , poseidon2_B_51_1(il[467]) + , poseidon2_B_51_2(il[468]) + , poseidon2_B_51_3(il[469]) + , poseidon2_B_52_0(il[470]) + , poseidon2_B_52_1(il[471]) + , poseidon2_B_52_2(il[472]) + , poseidon2_B_52_3(il[473]) + , poseidon2_B_53_0(il[474]) + , poseidon2_B_53_1(il[475]) + , poseidon2_B_53_2(il[476]) + , poseidon2_B_53_3(il[477]) + , poseidon2_B_54_0(il[478]) + , poseidon2_B_54_1(il[479]) + , poseidon2_B_54_2(il[480]) + , poseidon2_B_54_3(il[481]) + , poseidon2_B_55_0(il[482]) + , poseidon2_B_55_1(il[483]) + , poseidon2_B_55_2(il[484]) + , poseidon2_B_55_3(il[485]) + , poseidon2_B_56_0(il[486]) + , poseidon2_B_56_1(il[487]) + , poseidon2_B_56_2(il[488]) + , poseidon2_B_56_3(il[489]) + , poseidon2_B_57_0(il[490]) + , poseidon2_B_57_1(il[491]) + , poseidon2_B_57_2(il[492]) + , poseidon2_B_57_3(il[493]) + , poseidon2_B_58_0(il[494]) + , poseidon2_B_58_1(il[495]) + , poseidon2_B_58_2(il[496]) + , poseidon2_B_58_3(il[497]) + , poseidon2_B_59_0(il[498]) + , poseidon2_B_59_1(il[499]) + , poseidon2_B_59_2(il[500]) + , poseidon2_B_59_3(il[501]) + , poseidon2_B_5_0(il[502]) + , poseidon2_B_5_1(il[503]) + , poseidon2_B_5_2(il[504]) + , poseidon2_B_5_3(il[505]) + , poseidon2_B_6_0(il[506]) + , poseidon2_B_6_1(il[507]) + , poseidon2_B_6_2(il[508]) + , poseidon2_B_6_3(il[509]) + , poseidon2_B_7_0(il[510]) + , poseidon2_B_7_1(il[511]) + , poseidon2_B_7_2(il[512]) + , poseidon2_B_7_3(il[513]) + , poseidon2_B_8_0(il[514]) + , poseidon2_B_8_1(il[515]) + , poseidon2_B_8_2(il[516]) + , poseidon2_B_8_3(il[517]) + , poseidon2_B_9_0(il[518]) + , poseidon2_B_9_1(il[519]) + , poseidon2_B_9_2(il[520]) + , poseidon2_B_9_3(il[521]) + , poseidon2_EXT_LAYER_4(il[522]) + , poseidon2_EXT_LAYER_5(il[523]) + , poseidon2_EXT_LAYER_6(il[524]) + , poseidon2_EXT_LAYER_7(il[525]) + , poseidon2_T_0_4(il[526]) + , poseidon2_T_0_5(il[527]) + , poseidon2_T_0_6(il[528]) + , poseidon2_T_0_7(il[529]) + , poseidon2_T_1_4(il[530]) + , poseidon2_T_1_5(il[531]) + , poseidon2_T_1_6(il[532]) + , poseidon2_T_1_7(il[533]) + , poseidon2_T_2_4(il[534]) + , poseidon2_T_2_5(il[535]) + , poseidon2_T_2_6(il[536]) + , poseidon2_T_2_7(il[537]) + , poseidon2_T_3_4(il[538]) + , poseidon2_T_3_5(il[539]) + , poseidon2_T_3_6(il[540]) + , poseidon2_T_3_7(il[541]) + , poseidon2_T_60_4(il[542]) + , poseidon2_T_60_5(il[543]) + , poseidon2_T_60_6(il[544]) + , poseidon2_T_60_7(il[545]) + , poseidon2_T_61_4(il[546]) + , poseidon2_T_61_5(il[547]) + , poseidon2_T_61_6(il[548]) + , poseidon2_T_61_7(il[549]) + , poseidon2_T_62_4(il[550]) + , poseidon2_T_62_5(il[551]) + , poseidon2_T_62_6(il[552]) + , poseidon2_T_62_7(il[553]) + , poseidon2_T_63_4(il[554]) + , poseidon2_T_63_5(il[555]) + , poseidon2_T_63_6(il[556]) + , poseidon2_T_63_7(il[557]) + , poseidon2_a_0(il[558]) + , poseidon2_a_1(il[559]) + , poseidon2_a_2(il[560]) + , poseidon2_a_3(il[561]) + , poseidon2_b_0(il[562]) + , poseidon2_b_1(il[563]) + , poseidon2_b_2(il[564]) + , poseidon2_b_3(il[565]) + , poseidon2_clk(il[566]) + , poseidon2_input_addr(il[567]) + , poseidon2_mem_addr_read_a(il[568]) + , poseidon2_mem_addr_read_b(il[569]) + , poseidon2_mem_addr_read_c(il[570]) + , poseidon2_mem_addr_read_d(il[571]) + , poseidon2_mem_addr_write_a(il[572]) + , poseidon2_mem_addr_write_b(il[573]) + , poseidon2_mem_addr_write_c(il[574]) + , poseidon2_mem_addr_write_d(il[575]) + , poseidon2_output_addr(il[576]) + , poseidon2_sel_poseidon_perm(il[577]) + , sha256_clk(il[578]) + , sha256_input(il[579]) + , sha256_output(il[580]) + , sha256_sel_sha256_compression(il[581]) + , sha256_state(il[582]) + , slice_addr(il[583]) + , slice_clk(il[584]) + , slice_cnt(il[585]) + , slice_col_offset(il[586]) + , slice_one_min_inv(il[587]) + , slice_sel_cd_cpy(il[588]) + , slice_sel_mem_active(il[589]) + , slice_sel_return(il[590]) + , slice_sel_start(il[591]) + , slice_space_id(il[592]) + , slice_val(il[593]) + , lookup_byte_lengths_counts(il[594]) + , lookup_byte_operations_counts(il[595]) + , lookup_cd_value_counts(il[596]) + , lookup_ret_value_counts(il[597]) + , lookup_opcode_gas_counts(il[598]) + , range_check_l2_gas_hi_counts(il[599]) + , range_check_l2_gas_lo_counts(il[600]) + , range_check_da_gas_hi_counts(il[601]) + , range_check_da_gas_lo_counts(il[602]) + , kernel_output_lookup_counts(il[603]) + , lookup_into_kernel_counts(il[604]) + , incl_main_tag_err_counts(il[605]) + , incl_mem_tag_err_counts(il[606]) + , lookup_mem_rng_chk_lo_counts(il[607]) + , lookup_mem_rng_chk_mid_counts(il[608]) + , lookup_mem_rng_chk_hi_counts(il[609]) + , lookup_pow_2_0_counts(il[610]) + , lookup_pow_2_1_counts(il[611]) + , lookup_u8_0_counts(il[612]) + , lookup_u8_1_counts(il[613]) + , lookup_u16_0_counts(il[614]) + , lookup_u16_1_counts(il[615]) + , lookup_u16_2_counts(il[616]) + , lookup_u16_3_counts(il[617]) + , lookup_u16_4_counts(il[618]) + , lookup_u16_5_counts(il[619]) + , lookup_u16_6_counts(il[620]) + , lookup_u16_7_counts(il[621]) + , lookup_u16_8_counts(il[622]) + , lookup_u16_9_counts(il[623]) + , lookup_u16_10_counts(il[624]) + , lookup_u16_11_counts(il[625]) + , lookup_u16_12_counts(il[626]) + , lookup_u16_13_counts(il[627]) + , lookup_u16_14_counts(il[628]) + , lookup_div_u16_0_counts(il[629]) + , lookup_div_u16_1_counts(il[630]) + , lookup_div_u16_2_counts(il[631]) + , lookup_div_u16_3_counts(il[632]) + , lookup_div_u16_4_counts(il[633]) + , lookup_div_u16_5_counts(il[634]) + , lookup_div_u16_6_counts(il[635]) + , lookup_div_u16_7_counts(il[636]) + , perm_pos_mem_read_a_inv(il[637]) + , perm_pos_mem_read_b_inv(il[638]) + , perm_pos_mem_read_c_inv(il[639]) + , perm_pos_mem_read_d_inv(il[640]) + , perm_pos_mem_write_a_inv(il[641]) + , perm_pos_mem_write_b_inv(il[642]) + , perm_pos_mem_write_c_inv(il[643]) + , perm_pos_mem_write_d_inv(il[644]) + , perm_slice_mem_inv(il[645]) + , perm_main_alu_inv(il[646]) + , perm_main_bin_inv(il[647]) + , perm_main_conv_inv(il[648]) + , perm_main_pos2_perm_inv(il[649]) + , perm_main_pedersen_inv(il[650]) + , perm_main_slice_inv(il[651]) + , perm_main_mem_a_inv(il[652]) + , perm_main_mem_b_inv(il[653]) + , perm_main_mem_c_inv(il[654]) + , perm_main_mem_d_inv(il[655]) + , perm_main_mem_ind_addr_a_inv(il[656]) + , perm_main_mem_ind_addr_b_inv(il[657]) + , perm_main_mem_ind_addr_c_inv(il[658]) + , perm_main_mem_ind_addr_d_inv(il[659]) + , lookup_byte_lengths_inv(il[660]) + , lookup_byte_operations_inv(il[661]) + , lookup_cd_value_inv(il[662]) + , lookup_ret_value_inv(il[663]) + , lookup_opcode_gas_inv(il[664]) + , range_check_l2_gas_hi_inv(il[665]) + , range_check_l2_gas_lo_inv(il[666]) + , range_check_da_gas_hi_inv(il[667]) + , range_check_da_gas_lo_inv(il[668]) + , kernel_output_lookup_inv(il[669]) + , lookup_into_kernel_inv(il[670]) + , incl_main_tag_err_inv(il[671]) + , incl_mem_tag_err_inv(il[672]) + , lookup_mem_rng_chk_lo_inv(il[673]) + , lookup_mem_rng_chk_mid_inv(il[674]) + , lookup_mem_rng_chk_hi_inv(il[675]) + , lookup_pow_2_0_inv(il[676]) + , lookup_pow_2_1_inv(il[677]) + , lookup_u8_0_inv(il[678]) + , lookup_u8_1_inv(il[679]) + , lookup_u16_0_inv(il[680]) + , lookup_u16_1_inv(il[681]) + , lookup_u16_2_inv(il[682]) + , lookup_u16_3_inv(il[683]) + , lookup_u16_4_inv(il[684]) + , lookup_u16_5_inv(il[685]) + , lookup_u16_6_inv(il[686]) + , lookup_u16_7_inv(il[687]) + , lookup_u16_8_inv(il[688]) + , lookup_u16_9_inv(il[689]) + , lookup_u16_10_inv(il[690]) + , lookup_u16_11_inv(il[691]) + , lookup_u16_12_inv(il[692]) + , lookup_u16_13_inv(il[693]) + , lookup_u16_14_inv(il[694]) + , lookup_div_u16_0_inv(il[695]) + , lookup_div_u16_1_inv(il[696]) + , lookup_div_u16_2_inv(il[697]) + , lookup_div_u16_3_inv(il[698]) + , lookup_div_u16_4_inv(il[699]) + , lookup_div_u16_5_inv(il[700]) + , lookup_div_u16_6_inv(il[701]) + , lookup_div_u16_7_inv(il[702]) + , alu_op_div_shift(il[703]) + , alu_cmp_rng_ctr_shift(il[704]) + , mem_val_shift(il[705]) + , binary_acc_ia_shift(il[706]) + , alu_op_shr_shift(il[707]) + , alu_u16_r2_shift(il[708]) + , alu_sel_rng_chk_shift(il[709]) + , kernel_l1_to_l2_msg_exists_write_offset_shift(il[710]) + , slice_addr_shift(il[711]) + , alu_div_u16_r7_shift(il[712]) + , mem_glob_addr_shift(il[713]) + , slice_space_id_shift(il[714]) + , alu_div_u16_r1_shift(il[715]) + , kernel_note_hash_exist_write_offset_shift(il[716]) + , alu_u16_r4_shift(il[717]) + , mem_sel_mem_shift(il[718]) + , alu_p_sub_a_hi_shift(il[719]) + , kernel_nullifier_exists_write_offset_shift(il[720]) + , alu_div_u16_r3_shift(il[721]) + , alu_op_add_shift(il[722]) + , alu_p_sub_a_lo_shift(il[723]) + , slice_col_offset_shift(il[724]) + , alu_sel_rng_chk_lookup_shift(il[725]) + , binary_op_id_shift(il[726]) + , kernel_sload_write_offset_shift(il[727]) + , alu_div_u16_r2_shift(il[728]) + , kernel_emit_unencrypted_log_write_offset_shift(il[729]) + , alu_b_lo_shift(il[730]) + , mem_tsp_shift(il[731]) + , main_da_gas_remaining_shift(il[732]) + , alu_op_sub_shift(il[733]) + , slice_sel_start_shift(il[734]) + , alu_sel_alu_shift(il[735]) + , kernel_nullifier_non_exists_write_offset_shift(il[736]) + , alu_b_hi_shift(il[737]) + , slice_cnt_shift(il[738]) + , alu_u16_r6_shift(il[739]) + , slice_sel_cd_cpy_shift(il[740]) + , alu_u8_r1_shift(il[741]) + , alu_div_u16_r0_shift(il[742]) + , alu_u8_r0_shift(il[743]) + , alu_op_cast_shift(il[744]) + , kernel_emit_l2_to_l1_msg_write_offset_shift(il[745]) + , alu_div_u16_r6_shift(il[746]) + , alu_div_u16_r4_shift(il[747]) + , slice_sel_mem_active_shift(il[748]) + , main_l2_gas_remaining_shift(il[749]) + , alu_op_mul_shift(il[750]) + , alu_u16_r5_shift(il[751]) + , binary_acc_ib_shift(il[752]) + , alu_p_sub_b_hi_shift(il[753]) + , alu_sel_div_rng_chk_shift(il[754]) + , alu_a_lo_shift(il[755]) + , alu_u16_r1_shift(il[756]) + , slice_clk_shift(il[757]) + , mem_tag_shift(il[758]) + , alu_op_cast_prev_shift(il[759]) + , alu_div_u16_r5_shift(il[760]) + , slice_sel_return_shift(il[761]) + , alu_u16_r3_shift(il[762]) + , alu_u16_r0_shift(il[763]) + , binary_mem_tag_ctr_shift(il[764]) + , alu_sel_cmp_shift(il[765]) + , kernel_emit_note_hash_write_offset_shift(il[766]) + , kernel_emit_nullifier_write_offset_shift(il[767]) + , alu_a_hi_shift(il[768]) + , kernel_sstore_write_offset_shift(il[769]) + , alu_op_shl_shift(il[770]) + , mem_rw_shift(il[771]) + , main_pc_shift(il[772]) + , main_internal_return_ptr_shift(il[773]) + , binary_acc_ic_shift(il[774]) + , kernel_side_effect_counter_shift(il[775]) + , alu_p_sub_b_lo_shift(il[776]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -799,784 +798,783 @@ AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_idx) const { - return AllConstRefValues(RefArray{ byte_lookup_sel_bin[row_idx], - byte_lookup_table_byte_lengths[row_idx], - byte_lookup_table_in_tags[row_idx], - byte_lookup_table_input_a[row_idx], - byte_lookup_table_input_b[row_idx], - byte_lookup_table_op_id[row_idx], - byte_lookup_table_output[row_idx], - gas_da_gas_fixed_table[row_idx], - gas_l2_gas_fixed_table[row_idx], - gas_sel_gas_cost[row_idx], - main_clk[row_idx], - main_sel_first[row_idx], - main_zeroes[row_idx], - powers_power_of_2[row_idx], - kernel_kernel_inputs[row_idx], - kernel_kernel_value_out[row_idx], - kernel_kernel_side_effect_out[row_idx], - kernel_kernel_metadata_out[row_idx], - main_calldata[row_idx], - main_returndata[row_idx], - alu_a_hi[row_idx], - alu_a_lo[row_idx], - alu_b_hi[row_idx], - alu_b_lo[row_idx], - alu_borrow[row_idx], - alu_cf[row_idx], - alu_clk[row_idx], - alu_cmp_rng_ctr[row_idx], - alu_div_u16_r0[row_idx], - alu_div_u16_r1[row_idx], - alu_div_u16_r2[row_idx], - alu_div_u16_r3[row_idx], - alu_div_u16_r4[row_idx], - alu_div_u16_r5[row_idx], - alu_div_u16_r6[row_idx], - alu_div_u16_r7[row_idx], - alu_divisor_hi[row_idx], - alu_divisor_lo[row_idx], - alu_ff_tag[row_idx], - alu_ia[row_idx], - alu_ib[row_idx], - alu_ic[row_idx], - alu_in_tag[row_idx], - alu_op_add[row_idx], - alu_op_cast[row_idx], - alu_op_cast_prev[row_idx], - alu_op_div[row_idx], - alu_op_div_a_lt_b[row_idx], - alu_op_div_std[row_idx], - alu_op_eq[row_idx], - alu_op_eq_diff_inv[row_idx], - alu_op_lt[row_idx], - alu_op_lte[row_idx], - alu_op_mul[row_idx], - alu_op_not[row_idx], - alu_op_shl[row_idx], - alu_op_shr[row_idx], - alu_op_sub[row_idx], - alu_p_a_borrow[row_idx], - alu_p_b_borrow[row_idx], - alu_p_sub_a_hi[row_idx], - alu_p_sub_a_lo[row_idx], - alu_p_sub_b_hi[row_idx], - alu_p_sub_b_lo[row_idx], - alu_partial_prod_hi[row_idx], - alu_partial_prod_lo[row_idx], - alu_quotient_hi[row_idx], - alu_quotient_lo[row_idx], - alu_remainder[row_idx], - alu_res_hi[row_idx], - alu_res_lo[row_idx], - alu_sel_alu[row_idx], - alu_sel_cmp[row_idx], - alu_sel_div_rng_chk[row_idx], - alu_sel_rng_chk[row_idx], - alu_sel_rng_chk_lookup[row_idx], - alu_sel_shift_which[row_idx], - alu_shift_lt_bit_len[row_idx], - alu_t_sub_s_bits[row_idx], - alu_two_pow_s[row_idx], - alu_two_pow_t_sub_s[row_idx], - alu_u128_tag[row_idx], - alu_u16_r0[row_idx], - alu_u16_r1[row_idx], - alu_u16_r10[row_idx], - alu_u16_r11[row_idx], - alu_u16_r12[row_idx], - alu_u16_r13[row_idx], - alu_u16_r14[row_idx], - alu_u16_r2[row_idx], - alu_u16_r3[row_idx], - alu_u16_r4[row_idx], - alu_u16_r5[row_idx], - alu_u16_r6[row_idx], - alu_u16_r7[row_idx], - alu_u16_r8[row_idx], - alu_u16_r9[row_idx], - alu_u16_tag[row_idx], - alu_u32_tag[row_idx], - alu_u64_tag[row_idx], - alu_u8_r0[row_idx], - alu_u8_r1[row_idx], - alu_u8_tag[row_idx], - binary_acc_ia[row_idx], - binary_acc_ib[row_idx], - binary_acc_ic[row_idx], - binary_clk[row_idx], - binary_ia_bytes[row_idx], - binary_ib_bytes[row_idx], - binary_ic_bytes[row_idx], - binary_in_tag[row_idx], - binary_mem_tag_ctr[row_idx], - binary_mem_tag_ctr_inv[row_idx], - binary_op_id[row_idx], - binary_sel_bin[row_idx], - binary_start[row_idx], - conversion_clk[row_idx], - conversion_input[row_idx], - conversion_num_limbs[row_idx], - conversion_radix[row_idx], - conversion_sel_to_radix_le[row_idx], - keccakf1600_clk[row_idx], - keccakf1600_input[row_idx], - keccakf1600_output[row_idx], - keccakf1600_sel_keccakf1600[row_idx], - kernel_emit_l2_to_l1_msg_write_offset[row_idx], - kernel_emit_note_hash_write_offset[row_idx], - kernel_emit_nullifier_write_offset[row_idx], - kernel_emit_unencrypted_log_write_offset[row_idx], - kernel_kernel_in_offset[row_idx], - kernel_kernel_out_offset[row_idx], - kernel_l1_to_l2_msg_exists_write_offset[row_idx], - kernel_note_hash_exist_write_offset[row_idx], - kernel_nullifier_exists_write_offset[row_idx], - kernel_nullifier_non_exists_write_offset[row_idx], - kernel_q_public_input_kernel_add_to_table[row_idx], - kernel_q_public_input_kernel_out_add_to_table[row_idx], - kernel_side_effect_counter[row_idx], - kernel_sload_write_offset[row_idx], - kernel_sstore_write_offset[row_idx], - main_abs_da_rem_gas_hi[row_idx], - main_abs_da_rem_gas_lo[row_idx], - main_abs_l2_rem_gas_hi[row_idx], - main_abs_l2_rem_gas_lo[row_idx], - main_alu_in_tag[row_idx], - main_bin_op_id[row_idx], - main_call_ptr[row_idx], - main_da_gas_op_cost[row_idx], - main_da_gas_remaining[row_idx], - main_da_out_of_gas[row_idx], - main_ia[row_idx], - main_ib[row_idx], - main_ic[row_idx], - main_id[row_idx], - main_id_zero[row_idx], - main_ind_addr_a[row_idx], - main_ind_addr_b[row_idx], - main_ind_addr_c[row_idx], - main_ind_addr_d[row_idx], - main_internal_return_ptr[row_idx], - main_inv[row_idx], - main_l2_gas_op_cost[row_idx], - main_l2_gas_remaining[row_idx], - main_l2_out_of_gas[row_idx], - main_mem_addr_a[row_idx], - main_mem_addr_b[row_idx], - main_mem_addr_c[row_idx], - main_mem_addr_d[row_idx], - main_op_err[row_idx], - main_opcode_val[row_idx], - main_pc[row_idx], - main_r_in_tag[row_idx], - main_rwa[row_idx], - main_rwb[row_idx], - main_rwc[row_idx], - main_rwd[row_idx], - main_sel_alu[row_idx], - main_sel_bin[row_idx], - main_sel_calldata[row_idx], - main_sel_gas_accounting_active[row_idx], - main_sel_last[row_idx], - main_sel_mem_op_a[row_idx], - main_sel_mem_op_activate_gas[row_idx], - main_sel_mem_op_b[row_idx], - main_sel_mem_op_c[row_idx], - main_sel_mem_op_d[row_idx], - main_sel_mov_ia_to_ic[row_idx], - main_sel_mov_ib_to_ic[row_idx], - main_sel_op_add[row_idx], - main_sel_op_address[row_idx], - main_sel_op_and[row_idx], - main_sel_op_block_number[row_idx], - main_sel_op_calldata_copy[row_idx], - main_sel_op_cast[row_idx], - main_sel_op_chain_id[row_idx], - main_sel_op_cmov[row_idx], - main_sel_op_coinbase[row_idx], - main_sel_op_dagasleft[row_idx], - main_sel_op_div[row_idx], - main_sel_op_emit_l2_to_l1_msg[row_idx], - main_sel_op_emit_note_hash[row_idx], - main_sel_op_emit_nullifier[row_idx], - main_sel_op_emit_unencrypted_log[row_idx], - main_sel_op_eq[row_idx], - main_sel_op_external_call[row_idx], - main_sel_op_external_return[row_idx], - main_sel_op_fdiv[row_idx], - main_sel_op_fee_per_da_gas[row_idx], - main_sel_op_fee_per_l2_gas[row_idx], - main_sel_op_function_selector[row_idx], - main_sel_op_get_contract_instance[row_idx], - main_sel_op_halt[row_idx], - main_sel_op_internal_call[row_idx], - main_sel_op_internal_return[row_idx], - main_sel_op_jump[row_idx], - main_sel_op_jumpi[row_idx], - main_sel_op_keccak[row_idx], - main_sel_op_l1_to_l2_msg_exists[row_idx], - main_sel_op_l2gasleft[row_idx], - main_sel_op_lt[row_idx], - main_sel_op_lte[row_idx], - main_sel_op_mov[row_idx], - main_sel_op_mul[row_idx], - main_sel_op_not[row_idx], - main_sel_op_note_hash_exists[row_idx], - main_sel_op_nullifier_exists[row_idx], - main_sel_op_or[row_idx], - main_sel_op_pedersen[row_idx], - main_sel_op_poseidon2[row_idx], - main_sel_op_radix_le[row_idx], - main_sel_op_sender[row_idx], - main_sel_op_sha256[row_idx], - main_sel_op_shl[row_idx], - main_sel_op_shr[row_idx], - main_sel_op_sload[row_idx], - main_sel_op_sstore[row_idx], - main_sel_op_storage_address[row_idx], - main_sel_op_sub[row_idx], - main_sel_op_timestamp[row_idx], - main_sel_op_transaction_fee[row_idx], - main_sel_op_version[row_idx], - main_sel_op_xor[row_idx], - main_sel_q_kernel_lookup[row_idx], - main_sel_q_kernel_output_lookup[row_idx], - main_sel_resolve_ind_addr_a[row_idx], - main_sel_resolve_ind_addr_b[row_idx], - main_sel_resolve_ind_addr_c[row_idx], - main_sel_resolve_ind_addr_d[row_idx], - main_sel_returndata[row_idx], - main_sel_rng_16[row_idx], - main_sel_rng_8[row_idx], - main_sel_slice_gadget[row_idx], - main_space_id[row_idx], - main_tag_err[row_idx], - main_w_in_tag[row_idx], - mem_addr[row_idx], - mem_clk[row_idx], - mem_diff_hi[row_idx], - mem_diff_lo[row_idx], - mem_diff_mid[row_idx], - mem_glob_addr[row_idx], - mem_last[row_idx], - mem_lastAccess[row_idx], - mem_one_min_inv[row_idx], - mem_r_in_tag[row_idx], - mem_rw[row_idx], - mem_sel_mem[row_idx], - mem_sel_mov_ia_to_ic[row_idx], - mem_sel_mov_ib_to_ic[row_idx], - mem_sel_op_a[row_idx], - mem_sel_op_b[row_idx], - mem_sel_op_c[row_idx], - mem_sel_op_cmov[row_idx], - mem_sel_op_d[row_idx], - mem_sel_op_poseidon_read_a[row_idx], - mem_sel_op_poseidon_read_b[row_idx], - mem_sel_op_poseidon_read_c[row_idx], - mem_sel_op_poseidon_read_d[row_idx], - mem_sel_op_poseidon_write_a[row_idx], - mem_sel_op_poseidon_write_b[row_idx], - mem_sel_op_poseidon_write_c[row_idx], - mem_sel_op_poseidon_write_d[row_idx], - mem_sel_op_slice[row_idx], - mem_sel_resolve_ind_addr_a[row_idx], - mem_sel_resolve_ind_addr_b[row_idx], - mem_sel_resolve_ind_addr_c[row_idx], - mem_sel_resolve_ind_addr_d[row_idx], - mem_sel_rng_chk[row_idx], - mem_skip_check_tag[row_idx], - mem_space_id[row_idx], - mem_tag[row_idx], - mem_tag_err[row_idx], - mem_tsp[row_idx], - mem_val[row_idx], - mem_w_in_tag[row_idx], - pedersen_clk[row_idx], - pedersen_input[row_idx], - pedersen_output[row_idx], - pedersen_sel_pedersen[row_idx], - poseidon2_B_10_0[row_idx], - poseidon2_B_10_1[row_idx], - poseidon2_B_10_2[row_idx], - poseidon2_B_10_3[row_idx], - poseidon2_B_11_0[row_idx], - poseidon2_B_11_1[row_idx], - poseidon2_B_11_2[row_idx], - poseidon2_B_11_3[row_idx], - poseidon2_B_12_0[row_idx], - poseidon2_B_12_1[row_idx], - poseidon2_B_12_2[row_idx], - poseidon2_B_12_3[row_idx], - poseidon2_B_13_0[row_idx], - poseidon2_B_13_1[row_idx], - poseidon2_B_13_2[row_idx], - poseidon2_B_13_3[row_idx], - poseidon2_B_14_0[row_idx], - poseidon2_B_14_1[row_idx], - poseidon2_B_14_2[row_idx], - poseidon2_B_14_3[row_idx], - poseidon2_B_15_0[row_idx], - poseidon2_B_15_1[row_idx], - poseidon2_B_15_2[row_idx], - poseidon2_B_15_3[row_idx], - poseidon2_B_16_0[row_idx], - poseidon2_B_16_1[row_idx], - poseidon2_B_16_2[row_idx], - poseidon2_B_16_3[row_idx], - poseidon2_B_17_0[row_idx], - poseidon2_B_17_1[row_idx], - poseidon2_B_17_2[row_idx], - poseidon2_B_17_3[row_idx], - poseidon2_B_18_0[row_idx], - poseidon2_B_18_1[row_idx], - poseidon2_B_18_2[row_idx], - poseidon2_B_18_3[row_idx], - poseidon2_B_19_0[row_idx], - poseidon2_B_19_1[row_idx], - poseidon2_B_19_2[row_idx], - poseidon2_B_19_3[row_idx], - poseidon2_B_20_0[row_idx], - poseidon2_B_20_1[row_idx], - poseidon2_B_20_2[row_idx], - poseidon2_B_20_3[row_idx], - poseidon2_B_21_0[row_idx], - poseidon2_B_21_1[row_idx], - poseidon2_B_21_2[row_idx], - poseidon2_B_21_3[row_idx], - poseidon2_B_22_0[row_idx], - poseidon2_B_22_1[row_idx], - poseidon2_B_22_2[row_idx], - poseidon2_B_22_3[row_idx], - poseidon2_B_23_0[row_idx], - poseidon2_B_23_1[row_idx], - poseidon2_B_23_2[row_idx], - poseidon2_B_23_3[row_idx], - poseidon2_B_24_0[row_idx], - poseidon2_B_24_1[row_idx], - poseidon2_B_24_2[row_idx], - poseidon2_B_24_3[row_idx], - poseidon2_B_25_0[row_idx], - poseidon2_B_25_1[row_idx], - poseidon2_B_25_2[row_idx], - poseidon2_B_25_3[row_idx], - poseidon2_B_26_0[row_idx], - poseidon2_B_26_1[row_idx], - poseidon2_B_26_2[row_idx], - poseidon2_B_26_3[row_idx], - poseidon2_B_27_0[row_idx], - poseidon2_B_27_1[row_idx], - poseidon2_B_27_2[row_idx], - poseidon2_B_27_3[row_idx], - poseidon2_B_28_0[row_idx], - poseidon2_B_28_1[row_idx], - poseidon2_B_28_2[row_idx], - poseidon2_B_28_3[row_idx], - poseidon2_B_29_0[row_idx], - poseidon2_B_29_1[row_idx], - poseidon2_B_29_2[row_idx], - poseidon2_B_29_3[row_idx], - poseidon2_B_30_0[row_idx], - poseidon2_B_30_1[row_idx], - poseidon2_B_30_2[row_idx], - poseidon2_B_30_3[row_idx], - poseidon2_B_31_0[row_idx], - poseidon2_B_31_1[row_idx], - poseidon2_B_31_2[row_idx], - poseidon2_B_31_3[row_idx], - poseidon2_B_32_0[row_idx], - poseidon2_B_32_1[row_idx], - poseidon2_B_32_2[row_idx], - poseidon2_B_32_3[row_idx], - poseidon2_B_33_0[row_idx], - poseidon2_B_33_1[row_idx], - poseidon2_B_33_2[row_idx], - poseidon2_B_33_3[row_idx], - poseidon2_B_34_0[row_idx], - poseidon2_B_34_1[row_idx], - poseidon2_B_34_2[row_idx], - poseidon2_B_34_3[row_idx], - poseidon2_B_35_0[row_idx], - poseidon2_B_35_1[row_idx], - poseidon2_B_35_2[row_idx], - poseidon2_B_35_3[row_idx], - poseidon2_B_36_0[row_idx], - poseidon2_B_36_1[row_idx], - poseidon2_B_36_2[row_idx], - poseidon2_B_36_3[row_idx], - poseidon2_B_37_0[row_idx], - poseidon2_B_37_1[row_idx], - poseidon2_B_37_2[row_idx], - poseidon2_B_37_3[row_idx], - poseidon2_B_38_0[row_idx], - poseidon2_B_38_1[row_idx], - poseidon2_B_38_2[row_idx], - poseidon2_B_38_3[row_idx], - poseidon2_B_39_0[row_idx], - poseidon2_B_39_1[row_idx], - poseidon2_B_39_2[row_idx], - poseidon2_B_39_3[row_idx], - poseidon2_B_40_0[row_idx], - poseidon2_B_40_1[row_idx], - poseidon2_B_40_2[row_idx], - poseidon2_B_40_3[row_idx], - poseidon2_B_41_0[row_idx], - poseidon2_B_41_1[row_idx], - poseidon2_B_41_2[row_idx], - poseidon2_B_41_3[row_idx], - poseidon2_B_42_0[row_idx], - poseidon2_B_42_1[row_idx], - poseidon2_B_42_2[row_idx], - poseidon2_B_42_3[row_idx], - poseidon2_B_43_0[row_idx], - poseidon2_B_43_1[row_idx], - poseidon2_B_43_2[row_idx], - poseidon2_B_43_3[row_idx], - poseidon2_B_44_0[row_idx], - poseidon2_B_44_1[row_idx], - poseidon2_B_44_2[row_idx], - poseidon2_B_44_3[row_idx], - poseidon2_B_45_0[row_idx], - poseidon2_B_45_1[row_idx], - poseidon2_B_45_2[row_idx], - poseidon2_B_45_3[row_idx], - poseidon2_B_46_0[row_idx], - poseidon2_B_46_1[row_idx], - poseidon2_B_46_2[row_idx], - poseidon2_B_46_3[row_idx], - poseidon2_B_47_0[row_idx], - poseidon2_B_47_1[row_idx], - poseidon2_B_47_2[row_idx], - poseidon2_B_47_3[row_idx], - poseidon2_B_48_0[row_idx], - poseidon2_B_48_1[row_idx], - poseidon2_B_48_2[row_idx], - poseidon2_B_48_3[row_idx], - poseidon2_B_49_0[row_idx], - poseidon2_B_49_1[row_idx], - poseidon2_B_49_2[row_idx], - poseidon2_B_49_3[row_idx], - poseidon2_B_4_0[row_idx], - poseidon2_B_4_1[row_idx], - poseidon2_B_4_2[row_idx], - poseidon2_B_4_3[row_idx], - poseidon2_B_50_0[row_idx], - poseidon2_B_50_1[row_idx], - poseidon2_B_50_2[row_idx], - poseidon2_B_50_3[row_idx], - poseidon2_B_51_0[row_idx], - poseidon2_B_51_1[row_idx], - poseidon2_B_51_2[row_idx], - poseidon2_B_51_3[row_idx], - poseidon2_B_52_0[row_idx], - poseidon2_B_52_1[row_idx], - poseidon2_B_52_2[row_idx], - poseidon2_B_52_3[row_idx], - poseidon2_B_53_0[row_idx], - poseidon2_B_53_1[row_idx], - poseidon2_B_53_2[row_idx], - poseidon2_B_53_3[row_idx], - poseidon2_B_54_0[row_idx], - poseidon2_B_54_1[row_idx], - poseidon2_B_54_2[row_idx], - poseidon2_B_54_3[row_idx], - poseidon2_B_55_0[row_idx], - poseidon2_B_55_1[row_idx], - poseidon2_B_55_2[row_idx], - poseidon2_B_55_3[row_idx], - poseidon2_B_56_0[row_idx], - poseidon2_B_56_1[row_idx], - poseidon2_B_56_2[row_idx], - poseidon2_B_56_3[row_idx], - poseidon2_B_57_0[row_idx], - poseidon2_B_57_1[row_idx], - poseidon2_B_57_2[row_idx], - poseidon2_B_57_3[row_idx], - poseidon2_B_58_0[row_idx], - poseidon2_B_58_1[row_idx], - poseidon2_B_58_2[row_idx], - poseidon2_B_58_3[row_idx], - poseidon2_B_59_0[row_idx], - poseidon2_B_59_1[row_idx], - poseidon2_B_59_2[row_idx], - poseidon2_B_59_3[row_idx], - poseidon2_B_5_0[row_idx], - poseidon2_B_5_1[row_idx], - poseidon2_B_5_2[row_idx], - poseidon2_B_5_3[row_idx], - poseidon2_B_6_0[row_idx], - poseidon2_B_6_1[row_idx], - poseidon2_B_6_2[row_idx], - poseidon2_B_6_3[row_idx], - poseidon2_B_7_0[row_idx], - poseidon2_B_7_1[row_idx], - poseidon2_B_7_2[row_idx], - poseidon2_B_7_3[row_idx], - poseidon2_B_8_0[row_idx], - poseidon2_B_8_1[row_idx], - poseidon2_B_8_2[row_idx], - poseidon2_B_8_3[row_idx], - poseidon2_B_9_0[row_idx], - poseidon2_B_9_1[row_idx], - poseidon2_B_9_2[row_idx], - poseidon2_B_9_3[row_idx], - poseidon2_EXT_LAYER_4[row_idx], - poseidon2_EXT_LAYER_5[row_idx], - poseidon2_EXT_LAYER_6[row_idx], - poseidon2_EXT_LAYER_7[row_idx], - poseidon2_T_0_4[row_idx], - poseidon2_T_0_5[row_idx], - poseidon2_T_0_6[row_idx], - poseidon2_T_0_7[row_idx], - poseidon2_T_1_4[row_idx], - poseidon2_T_1_5[row_idx], - poseidon2_T_1_6[row_idx], - poseidon2_T_1_7[row_idx], - poseidon2_T_2_4[row_idx], - poseidon2_T_2_5[row_idx], - poseidon2_T_2_6[row_idx], - poseidon2_T_2_7[row_idx], - poseidon2_T_3_4[row_idx], - poseidon2_T_3_5[row_idx], - poseidon2_T_3_6[row_idx], - poseidon2_T_3_7[row_idx], - poseidon2_T_60_4[row_idx], - poseidon2_T_60_5[row_idx], - poseidon2_T_60_6[row_idx], - poseidon2_T_60_7[row_idx], - poseidon2_T_61_4[row_idx], - poseidon2_T_61_5[row_idx], - poseidon2_T_61_6[row_idx], - poseidon2_T_61_7[row_idx], - poseidon2_T_62_4[row_idx], - poseidon2_T_62_5[row_idx], - poseidon2_T_62_6[row_idx], - poseidon2_T_62_7[row_idx], - poseidon2_T_63_4[row_idx], - poseidon2_T_63_5[row_idx], - poseidon2_T_63_6[row_idx], - poseidon2_T_63_7[row_idx], - poseidon2_a_0[row_idx], - poseidon2_a_1[row_idx], - poseidon2_a_2[row_idx], - poseidon2_a_3[row_idx], - poseidon2_b_0[row_idx], - poseidon2_b_1[row_idx], - poseidon2_b_2[row_idx], - poseidon2_b_3[row_idx], - poseidon2_clk[row_idx], - poseidon2_input_addr[row_idx], - poseidon2_mem_addr_read_a[row_idx], - poseidon2_mem_addr_read_b[row_idx], - poseidon2_mem_addr_read_c[row_idx], - poseidon2_mem_addr_read_d[row_idx], - poseidon2_mem_addr_write_a[row_idx], - poseidon2_mem_addr_write_b[row_idx], - poseidon2_mem_addr_write_c[row_idx], - poseidon2_mem_addr_write_d[row_idx], - poseidon2_output_addr[row_idx], - poseidon2_sel_poseidon_perm[row_idx], - sha256_clk[row_idx], - sha256_input[row_idx], - sha256_output[row_idx], - sha256_sel_sha256_compression[row_idx], - sha256_state[row_idx], - slice_addr[row_idx], - slice_clk[row_idx], - slice_cnt[row_idx], - slice_col_offset[row_idx], - slice_one_min_inv[row_idx], - slice_sel_cd_cpy[row_idx], - slice_sel_mem_active[row_idx], - slice_sel_return[row_idx], - slice_sel_start[row_idx], - slice_space_id[row_idx], - slice_val[row_idx], - lookup_byte_lengths_counts[row_idx], - lookup_byte_operations_counts[row_idx], - lookup_cd_value_counts[row_idx], - lookup_ret_value_counts[row_idx], - lookup_opcode_gas_counts[row_idx], - range_check_l2_gas_hi_counts[row_idx], - range_check_l2_gas_lo_counts[row_idx], - range_check_da_gas_hi_counts[row_idx], - range_check_da_gas_lo_counts[row_idx], - kernel_output_lookup_counts[row_idx], - lookup_into_kernel_counts[row_idx], - incl_main_tag_err_counts[row_idx], - incl_mem_tag_err_counts[row_idx], - lookup_mem_rng_chk_lo_counts[row_idx], - lookup_mem_rng_chk_mid_counts[row_idx], - lookup_mem_rng_chk_hi_counts[row_idx], - lookup_pow_2_0_counts[row_idx], - lookup_pow_2_1_counts[row_idx], - lookup_u8_0_counts[row_idx], - lookup_u8_1_counts[row_idx], - lookup_u16_0_counts[row_idx], - lookup_u16_1_counts[row_idx], - lookup_u16_2_counts[row_idx], - lookup_u16_3_counts[row_idx], - lookup_u16_4_counts[row_idx], - lookup_u16_5_counts[row_idx], - lookup_u16_6_counts[row_idx], - lookup_u16_7_counts[row_idx], - lookup_u16_8_counts[row_idx], - lookup_u16_9_counts[row_idx], - lookup_u16_10_counts[row_idx], - lookup_u16_11_counts[row_idx], - lookup_u16_12_counts[row_idx], - lookup_u16_13_counts[row_idx], - lookup_u16_14_counts[row_idx], - lookup_div_u16_0_counts[row_idx], - lookup_div_u16_1_counts[row_idx], - lookup_div_u16_2_counts[row_idx], - lookup_div_u16_3_counts[row_idx], - lookup_div_u16_4_counts[row_idx], - lookup_div_u16_5_counts[row_idx], - lookup_div_u16_6_counts[row_idx], - lookup_div_u16_7_counts[row_idx], - perm_pos_mem_read_a[row_idx], - perm_pos_mem_read_b[row_idx], - perm_pos_mem_read_c[row_idx], - perm_pos_mem_read_d[row_idx], - perm_pos_mem_write_a[row_idx], - perm_pos_mem_write_b[row_idx], - perm_pos_mem_write_c[row_idx], - perm_pos_mem_write_d[row_idx], - perm_slice_mem[row_idx], - perm_main_alu[row_idx], - perm_main_bin[row_idx], - perm_main_conv[row_idx], - perm_main_pos2_perm[row_idx], - perm_main_pedersen[row_idx], - perm_main_slice[row_idx], - perm_main_mem_a[row_idx], - perm_main_mem_b[row_idx], - perm_main_mem_c[row_idx], - perm_main_mem_d[row_idx], - perm_main_mem_ind_addr_a[row_idx], - perm_main_mem_ind_addr_b[row_idx], - perm_main_mem_ind_addr_c[row_idx], - perm_main_mem_ind_addr_d[row_idx], - lookup_byte_lengths[row_idx], - lookup_byte_operations[row_idx], - lookup_cd_value[row_idx], - lookup_ret_value[row_idx], - lookup_opcode_gas[row_idx], - range_check_l2_gas_hi[row_idx], - range_check_l2_gas_lo[row_idx], - range_check_da_gas_hi[row_idx], - range_check_da_gas_lo[row_idx], - kernel_output_lookup[row_idx], - lookup_into_kernel[row_idx], - incl_main_tag_err[row_idx], - incl_mem_tag_err[row_idx], - lookup_mem_rng_chk_lo[row_idx], - lookup_mem_rng_chk_mid[row_idx], - lookup_mem_rng_chk_hi[row_idx], - lookup_pow_2_0[row_idx], - lookup_pow_2_1[row_idx], - lookup_u8_0[row_idx], - lookup_u8_1[row_idx], - lookup_u16_0[row_idx], - lookup_u16_1[row_idx], - lookup_u16_2[row_idx], - lookup_u16_3[row_idx], - lookup_u16_4[row_idx], - lookup_u16_5[row_idx], - lookup_u16_6[row_idx], - lookup_u16_7[row_idx], - lookup_u16_8[row_idx], - lookup_u16_9[row_idx], - lookup_u16_10[row_idx], - lookup_u16_11[row_idx], - lookup_u16_12[row_idx], - lookup_u16_13[row_idx], - lookup_u16_14[row_idx], - lookup_div_u16_0[row_idx], - lookup_div_u16_1[row_idx], - lookup_div_u16_2[row_idx], - lookup_div_u16_3[row_idx], - lookup_div_u16_4[row_idx], - lookup_div_u16_5[row_idx], - lookup_div_u16_6[row_idx], - lookup_div_u16_7[row_idx], - alu_a_hi_shift[row_idx], - alu_a_lo_shift[row_idx], - alu_b_hi_shift[row_idx], - alu_b_lo_shift[row_idx], - alu_cmp_rng_ctr_shift[row_idx], - alu_div_u16_r0_shift[row_idx], - alu_div_u16_r1_shift[row_idx], - alu_div_u16_r2_shift[row_idx], - alu_div_u16_r3_shift[row_idx], - alu_div_u16_r4_shift[row_idx], - alu_div_u16_r5_shift[row_idx], - alu_div_u16_r6_shift[row_idx], - alu_div_u16_r7_shift[row_idx], - alu_op_add_shift[row_idx], - alu_op_cast_prev_shift[row_idx], - alu_op_cast_shift[row_idx], - alu_op_div_shift[row_idx], - alu_op_mul_shift[row_idx], - alu_op_shl_shift[row_idx], - alu_op_shr_shift[row_idx], - alu_op_sub_shift[row_idx], - alu_p_sub_a_hi_shift[row_idx], - alu_p_sub_a_lo_shift[row_idx], - alu_p_sub_b_hi_shift[row_idx], - alu_p_sub_b_lo_shift[row_idx], - alu_sel_alu_shift[row_idx], - alu_sel_cmp_shift[row_idx], - alu_sel_div_rng_chk_shift[row_idx], - alu_sel_rng_chk_lookup_shift[row_idx], - alu_sel_rng_chk_shift[row_idx], - alu_u16_r0_shift[row_idx], - alu_u16_r1_shift[row_idx], - alu_u16_r2_shift[row_idx], - alu_u16_r3_shift[row_idx], - alu_u16_r4_shift[row_idx], - alu_u16_r5_shift[row_idx], - alu_u16_r6_shift[row_idx], - alu_u8_r0_shift[row_idx], - alu_u8_r1_shift[row_idx], - binary_acc_ia_shift[row_idx], - binary_acc_ib_shift[row_idx], - binary_acc_ic_shift[row_idx], - binary_mem_tag_ctr_shift[row_idx], - binary_op_id_shift[row_idx], - kernel_emit_l2_to_l1_msg_write_offset_shift[row_idx], - kernel_emit_note_hash_write_offset_shift[row_idx], - kernel_emit_nullifier_write_offset_shift[row_idx], - kernel_emit_unencrypted_log_write_offset_shift[row_idx], - kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], - kernel_note_hash_exist_write_offset_shift[row_idx], - kernel_nullifier_exists_write_offset_shift[row_idx], - kernel_nullifier_non_exists_write_offset_shift[row_idx], - kernel_side_effect_counter_shift[row_idx], - kernel_sload_write_offset_shift[row_idx], - kernel_sstore_write_offset_shift[row_idx], - main_da_gas_remaining_shift[row_idx], - main_internal_return_ptr_shift[row_idx], - main_l2_gas_remaining_shift[row_idx], - main_pc_shift[row_idx], - mem_glob_addr_shift[row_idx], - mem_rw_shift[row_idx], - mem_sel_mem_shift[row_idx], - mem_tag_shift[row_idx], - mem_tsp_shift[row_idx], - mem_val_shift[row_idx], - slice_addr_shift[row_idx], - slice_clk_shift[row_idx], - slice_cnt_shift[row_idx], - slice_col_offset_shift[row_idx], - slice_sel_cd_cpy_shift[row_idx], - slice_sel_mem_active_shift[row_idx], - slice_sel_return_shift[row_idx], - slice_sel_start_shift[row_idx], - slice_space_id_shift[row_idx] }); + return RefArray{ byte_lookup_sel_bin[row_idx], + byte_lookup_table_byte_lengths[row_idx], + byte_lookup_table_in_tags[row_idx], + byte_lookup_table_input_a[row_idx], + byte_lookup_table_input_b[row_idx], + byte_lookup_table_op_id[row_idx], + byte_lookup_table_output[row_idx], + gas_da_gas_fixed_table[row_idx], + gas_l2_gas_fixed_table[row_idx], + gas_sel_gas_cost[row_idx], + main_clk[row_idx], + main_sel_first[row_idx], + main_zeroes[row_idx], + powers_power_of_2[row_idx], + kernel_kernel_inputs[row_idx], + kernel_kernel_value_out[row_idx], + kernel_kernel_side_effect_out[row_idx], + kernel_kernel_metadata_out[row_idx], + main_calldata[row_idx], + main_returndata[row_idx], + alu_a_hi[row_idx], + alu_a_lo[row_idx], + alu_b_hi[row_idx], + alu_b_lo[row_idx], + alu_borrow[row_idx], + alu_cf[row_idx], + alu_clk[row_idx], + alu_cmp_rng_ctr[row_idx], + alu_div_u16_r0[row_idx], + alu_div_u16_r1[row_idx], + alu_div_u16_r2[row_idx], + alu_div_u16_r3[row_idx], + alu_div_u16_r4[row_idx], + alu_div_u16_r5[row_idx], + alu_div_u16_r6[row_idx], + alu_div_u16_r7[row_idx], + alu_divisor_hi[row_idx], + alu_divisor_lo[row_idx], + alu_ff_tag[row_idx], + alu_ia[row_idx], + alu_ib[row_idx], + alu_ic[row_idx], + alu_in_tag[row_idx], + alu_op_add[row_idx], + alu_op_cast[row_idx], + alu_op_cast_prev[row_idx], + alu_op_div[row_idx], + alu_op_div_a_lt_b[row_idx], + alu_op_div_std[row_idx], + alu_op_eq[row_idx], + alu_op_eq_diff_inv[row_idx], + alu_op_lt[row_idx], + alu_op_lte[row_idx], + alu_op_mul[row_idx], + alu_op_not[row_idx], + alu_op_shl[row_idx], + alu_op_shr[row_idx], + alu_op_sub[row_idx], + alu_p_a_borrow[row_idx], + alu_p_b_borrow[row_idx], + alu_p_sub_a_hi[row_idx], + alu_p_sub_a_lo[row_idx], + alu_p_sub_b_hi[row_idx], + alu_p_sub_b_lo[row_idx], + alu_partial_prod_hi[row_idx], + alu_partial_prod_lo[row_idx], + alu_quotient_hi[row_idx], + alu_quotient_lo[row_idx], + alu_remainder[row_idx], + alu_res_hi[row_idx], + alu_res_lo[row_idx], + alu_sel_alu[row_idx], + alu_sel_cmp[row_idx], + alu_sel_div_rng_chk[row_idx], + alu_sel_rng_chk[row_idx], + alu_sel_rng_chk_lookup[row_idx], + alu_sel_shift_which[row_idx], + alu_shift_lt_bit_len[row_idx], + alu_t_sub_s_bits[row_idx], + alu_two_pow_s[row_idx], + alu_two_pow_t_sub_s[row_idx], + alu_u128_tag[row_idx], + alu_u16_r0[row_idx], + alu_u16_r1[row_idx], + alu_u16_r10[row_idx], + alu_u16_r11[row_idx], + alu_u16_r12[row_idx], + alu_u16_r13[row_idx], + alu_u16_r14[row_idx], + alu_u16_r2[row_idx], + alu_u16_r3[row_idx], + alu_u16_r4[row_idx], + alu_u16_r5[row_idx], + alu_u16_r6[row_idx], + alu_u16_r7[row_idx], + alu_u16_r8[row_idx], + alu_u16_r9[row_idx], + alu_u16_tag[row_idx], + alu_u32_tag[row_idx], + alu_u64_tag[row_idx], + alu_u8_r0[row_idx], + alu_u8_r1[row_idx], + alu_u8_tag[row_idx], + binary_acc_ia[row_idx], + binary_acc_ib[row_idx], + binary_acc_ic[row_idx], + binary_clk[row_idx], + binary_ia_bytes[row_idx], + binary_ib_bytes[row_idx], + binary_ic_bytes[row_idx], + binary_in_tag[row_idx], + binary_mem_tag_ctr[row_idx], + binary_mem_tag_ctr_inv[row_idx], + binary_op_id[row_idx], + binary_sel_bin[row_idx], + binary_start[row_idx], + conversion_clk[row_idx], + conversion_input[row_idx], + conversion_num_limbs[row_idx], + conversion_radix[row_idx], + conversion_sel_to_radix_le[row_idx], + keccakf1600_clk[row_idx], + keccakf1600_input[row_idx], + keccakf1600_output[row_idx], + keccakf1600_sel_keccakf1600[row_idx], + kernel_emit_l2_to_l1_msg_write_offset[row_idx], + kernel_emit_note_hash_write_offset[row_idx], + kernel_emit_nullifier_write_offset[row_idx], + kernel_emit_unencrypted_log_write_offset[row_idx], + kernel_kernel_in_offset[row_idx], + kernel_kernel_out_offset[row_idx], + kernel_l1_to_l2_msg_exists_write_offset[row_idx], + kernel_note_hash_exist_write_offset[row_idx], + kernel_nullifier_exists_write_offset[row_idx], + kernel_nullifier_non_exists_write_offset[row_idx], + kernel_q_public_input_kernel_add_to_table[row_idx], + kernel_q_public_input_kernel_out_add_to_table[row_idx], + kernel_side_effect_counter[row_idx], + kernel_sload_write_offset[row_idx], + kernel_sstore_write_offset[row_idx], + main_abs_da_rem_gas_hi[row_idx], + main_abs_da_rem_gas_lo[row_idx], + main_abs_l2_rem_gas_hi[row_idx], + main_abs_l2_rem_gas_lo[row_idx], + main_alu_in_tag[row_idx], + main_bin_op_id[row_idx], + main_call_ptr[row_idx], + main_da_gas_op_cost[row_idx], + main_da_gas_remaining[row_idx], + main_da_out_of_gas[row_idx], + main_ia[row_idx], + main_ib[row_idx], + main_ic[row_idx], + main_id[row_idx], + main_id_zero[row_idx], + main_ind_addr_a[row_idx], + main_ind_addr_b[row_idx], + main_ind_addr_c[row_idx], + main_ind_addr_d[row_idx], + main_internal_return_ptr[row_idx], + main_inv[row_idx], + main_l2_gas_op_cost[row_idx], + main_l2_gas_remaining[row_idx], + main_l2_out_of_gas[row_idx], + main_mem_addr_a[row_idx], + main_mem_addr_b[row_idx], + main_mem_addr_c[row_idx], + main_mem_addr_d[row_idx], + main_op_err[row_idx], + main_opcode_val[row_idx], + main_pc[row_idx], + main_r_in_tag[row_idx], + main_rwa[row_idx], + main_rwb[row_idx], + main_rwc[row_idx], + main_rwd[row_idx], + main_sel_alu[row_idx], + main_sel_bin[row_idx], + main_sel_calldata[row_idx], + main_sel_gas_accounting_active[row_idx], + main_sel_last[row_idx], + main_sel_mem_op_a[row_idx], + main_sel_mem_op_b[row_idx], + main_sel_mem_op_c[row_idx], + main_sel_mem_op_d[row_idx], + main_sel_mov_ia_to_ic[row_idx], + main_sel_mov_ib_to_ic[row_idx], + main_sel_op_add[row_idx], + main_sel_op_address[row_idx], + main_sel_op_and[row_idx], + main_sel_op_block_number[row_idx], + main_sel_op_calldata_copy[row_idx], + main_sel_op_cast[row_idx], + main_sel_op_chain_id[row_idx], + main_sel_op_cmov[row_idx], + main_sel_op_coinbase[row_idx], + main_sel_op_dagasleft[row_idx], + main_sel_op_div[row_idx], + main_sel_op_emit_l2_to_l1_msg[row_idx], + main_sel_op_emit_note_hash[row_idx], + main_sel_op_emit_nullifier[row_idx], + main_sel_op_emit_unencrypted_log[row_idx], + main_sel_op_eq[row_idx], + main_sel_op_external_call[row_idx], + main_sel_op_external_return[row_idx], + main_sel_op_fdiv[row_idx], + main_sel_op_fee_per_da_gas[row_idx], + main_sel_op_fee_per_l2_gas[row_idx], + main_sel_op_function_selector[row_idx], + main_sel_op_get_contract_instance[row_idx], + main_sel_op_halt[row_idx], + main_sel_op_internal_call[row_idx], + main_sel_op_internal_return[row_idx], + main_sel_op_jump[row_idx], + main_sel_op_jumpi[row_idx], + main_sel_op_keccak[row_idx], + main_sel_op_l1_to_l2_msg_exists[row_idx], + main_sel_op_l2gasleft[row_idx], + main_sel_op_lt[row_idx], + main_sel_op_lte[row_idx], + main_sel_op_mov[row_idx], + main_sel_op_mul[row_idx], + main_sel_op_not[row_idx], + main_sel_op_note_hash_exists[row_idx], + main_sel_op_nullifier_exists[row_idx], + main_sel_op_or[row_idx], + main_sel_op_pedersen[row_idx], + main_sel_op_poseidon2[row_idx], + main_sel_op_radix_le[row_idx], + main_sel_op_sender[row_idx], + main_sel_op_sha256[row_idx], + main_sel_op_shl[row_idx], + main_sel_op_shr[row_idx], + main_sel_op_sload[row_idx], + main_sel_op_sstore[row_idx], + main_sel_op_storage_address[row_idx], + main_sel_op_sub[row_idx], + main_sel_op_timestamp[row_idx], + main_sel_op_transaction_fee[row_idx], + main_sel_op_version[row_idx], + main_sel_op_xor[row_idx], + main_sel_q_kernel_lookup[row_idx], + main_sel_q_kernel_output_lookup[row_idx], + main_sel_resolve_ind_addr_a[row_idx], + main_sel_resolve_ind_addr_b[row_idx], + main_sel_resolve_ind_addr_c[row_idx], + main_sel_resolve_ind_addr_d[row_idx], + main_sel_returndata[row_idx], + main_sel_rng_16[row_idx], + main_sel_rng_8[row_idx], + main_sel_slice_gadget[row_idx], + main_space_id[row_idx], + main_tag_err[row_idx], + main_w_in_tag[row_idx], + mem_addr[row_idx], + mem_clk[row_idx], + mem_diff_hi[row_idx], + mem_diff_lo[row_idx], + mem_diff_mid[row_idx], + mem_glob_addr[row_idx], + mem_last[row_idx], + mem_lastAccess[row_idx], + mem_one_min_inv[row_idx], + mem_r_in_tag[row_idx], + mem_rw[row_idx], + mem_sel_mem[row_idx], + mem_sel_mov_ia_to_ic[row_idx], + mem_sel_mov_ib_to_ic[row_idx], + mem_sel_op_a[row_idx], + mem_sel_op_b[row_idx], + mem_sel_op_c[row_idx], + mem_sel_op_cmov[row_idx], + mem_sel_op_d[row_idx], + mem_sel_op_poseidon_read_a[row_idx], + mem_sel_op_poseidon_read_b[row_idx], + mem_sel_op_poseidon_read_c[row_idx], + mem_sel_op_poseidon_read_d[row_idx], + mem_sel_op_poseidon_write_a[row_idx], + mem_sel_op_poseidon_write_b[row_idx], + mem_sel_op_poseidon_write_c[row_idx], + mem_sel_op_poseidon_write_d[row_idx], + mem_sel_op_slice[row_idx], + mem_sel_resolve_ind_addr_a[row_idx], + mem_sel_resolve_ind_addr_b[row_idx], + mem_sel_resolve_ind_addr_c[row_idx], + mem_sel_resolve_ind_addr_d[row_idx], + mem_sel_rng_chk[row_idx], + mem_skip_check_tag[row_idx], + mem_space_id[row_idx], + mem_tag[row_idx], + mem_tag_err[row_idx], + mem_tsp[row_idx], + mem_val[row_idx], + mem_w_in_tag[row_idx], + pedersen_clk[row_idx], + pedersen_input[row_idx], + pedersen_output[row_idx], + pedersen_sel_pedersen[row_idx], + poseidon2_B_10_0[row_idx], + poseidon2_B_10_1[row_idx], + poseidon2_B_10_2[row_idx], + poseidon2_B_10_3[row_idx], + poseidon2_B_11_0[row_idx], + poseidon2_B_11_1[row_idx], + poseidon2_B_11_2[row_idx], + poseidon2_B_11_3[row_idx], + poseidon2_B_12_0[row_idx], + poseidon2_B_12_1[row_idx], + poseidon2_B_12_2[row_idx], + poseidon2_B_12_3[row_idx], + poseidon2_B_13_0[row_idx], + poseidon2_B_13_1[row_idx], + poseidon2_B_13_2[row_idx], + poseidon2_B_13_3[row_idx], + poseidon2_B_14_0[row_idx], + poseidon2_B_14_1[row_idx], + poseidon2_B_14_2[row_idx], + poseidon2_B_14_3[row_idx], + poseidon2_B_15_0[row_idx], + poseidon2_B_15_1[row_idx], + poseidon2_B_15_2[row_idx], + poseidon2_B_15_3[row_idx], + poseidon2_B_16_0[row_idx], + poseidon2_B_16_1[row_idx], + poseidon2_B_16_2[row_idx], + poseidon2_B_16_3[row_idx], + poseidon2_B_17_0[row_idx], + poseidon2_B_17_1[row_idx], + poseidon2_B_17_2[row_idx], + poseidon2_B_17_3[row_idx], + poseidon2_B_18_0[row_idx], + poseidon2_B_18_1[row_idx], + poseidon2_B_18_2[row_idx], + poseidon2_B_18_3[row_idx], + poseidon2_B_19_0[row_idx], + poseidon2_B_19_1[row_idx], + poseidon2_B_19_2[row_idx], + poseidon2_B_19_3[row_idx], + poseidon2_B_20_0[row_idx], + poseidon2_B_20_1[row_idx], + poseidon2_B_20_2[row_idx], + poseidon2_B_20_3[row_idx], + poseidon2_B_21_0[row_idx], + poseidon2_B_21_1[row_idx], + poseidon2_B_21_2[row_idx], + poseidon2_B_21_3[row_idx], + poseidon2_B_22_0[row_idx], + poseidon2_B_22_1[row_idx], + poseidon2_B_22_2[row_idx], + poseidon2_B_22_3[row_idx], + poseidon2_B_23_0[row_idx], + poseidon2_B_23_1[row_idx], + poseidon2_B_23_2[row_idx], + poseidon2_B_23_3[row_idx], + poseidon2_B_24_0[row_idx], + poseidon2_B_24_1[row_idx], + poseidon2_B_24_2[row_idx], + poseidon2_B_24_3[row_idx], + poseidon2_B_25_0[row_idx], + poseidon2_B_25_1[row_idx], + poseidon2_B_25_2[row_idx], + poseidon2_B_25_3[row_idx], + poseidon2_B_26_0[row_idx], + poseidon2_B_26_1[row_idx], + poseidon2_B_26_2[row_idx], + poseidon2_B_26_3[row_idx], + poseidon2_B_27_0[row_idx], + poseidon2_B_27_1[row_idx], + poseidon2_B_27_2[row_idx], + poseidon2_B_27_3[row_idx], + poseidon2_B_28_0[row_idx], + poseidon2_B_28_1[row_idx], + poseidon2_B_28_2[row_idx], + poseidon2_B_28_3[row_idx], + poseidon2_B_29_0[row_idx], + poseidon2_B_29_1[row_idx], + poseidon2_B_29_2[row_idx], + poseidon2_B_29_3[row_idx], + poseidon2_B_30_0[row_idx], + poseidon2_B_30_1[row_idx], + poseidon2_B_30_2[row_idx], + poseidon2_B_30_3[row_idx], + poseidon2_B_31_0[row_idx], + poseidon2_B_31_1[row_idx], + poseidon2_B_31_2[row_idx], + poseidon2_B_31_3[row_idx], + poseidon2_B_32_0[row_idx], + poseidon2_B_32_1[row_idx], + poseidon2_B_32_2[row_idx], + poseidon2_B_32_3[row_idx], + poseidon2_B_33_0[row_idx], + poseidon2_B_33_1[row_idx], + poseidon2_B_33_2[row_idx], + poseidon2_B_33_3[row_idx], + poseidon2_B_34_0[row_idx], + poseidon2_B_34_1[row_idx], + poseidon2_B_34_2[row_idx], + poseidon2_B_34_3[row_idx], + poseidon2_B_35_0[row_idx], + poseidon2_B_35_1[row_idx], + poseidon2_B_35_2[row_idx], + poseidon2_B_35_3[row_idx], + poseidon2_B_36_0[row_idx], + poseidon2_B_36_1[row_idx], + poseidon2_B_36_2[row_idx], + poseidon2_B_36_3[row_idx], + poseidon2_B_37_0[row_idx], + poseidon2_B_37_1[row_idx], + poseidon2_B_37_2[row_idx], + poseidon2_B_37_3[row_idx], + poseidon2_B_38_0[row_idx], + poseidon2_B_38_1[row_idx], + poseidon2_B_38_2[row_idx], + poseidon2_B_38_3[row_idx], + poseidon2_B_39_0[row_idx], + poseidon2_B_39_1[row_idx], + poseidon2_B_39_2[row_idx], + poseidon2_B_39_3[row_idx], + poseidon2_B_40_0[row_idx], + poseidon2_B_40_1[row_idx], + poseidon2_B_40_2[row_idx], + poseidon2_B_40_3[row_idx], + poseidon2_B_41_0[row_idx], + poseidon2_B_41_1[row_idx], + poseidon2_B_41_2[row_idx], + poseidon2_B_41_3[row_idx], + poseidon2_B_42_0[row_idx], + poseidon2_B_42_1[row_idx], + poseidon2_B_42_2[row_idx], + poseidon2_B_42_3[row_idx], + poseidon2_B_43_0[row_idx], + poseidon2_B_43_1[row_idx], + poseidon2_B_43_2[row_idx], + poseidon2_B_43_3[row_idx], + poseidon2_B_44_0[row_idx], + poseidon2_B_44_1[row_idx], + poseidon2_B_44_2[row_idx], + poseidon2_B_44_3[row_idx], + poseidon2_B_45_0[row_idx], + poseidon2_B_45_1[row_idx], + poseidon2_B_45_2[row_idx], + poseidon2_B_45_3[row_idx], + poseidon2_B_46_0[row_idx], + poseidon2_B_46_1[row_idx], + poseidon2_B_46_2[row_idx], + poseidon2_B_46_3[row_idx], + poseidon2_B_47_0[row_idx], + poseidon2_B_47_1[row_idx], + poseidon2_B_47_2[row_idx], + poseidon2_B_47_3[row_idx], + poseidon2_B_48_0[row_idx], + poseidon2_B_48_1[row_idx], + poseidon2_B_48_2[row_idx], + poseidon2_B_48_3[row_idx], + poseidon2_B_49_0[row_idx], + poseidon2_B_49_1[row_idx], + poseidon2_B_49_2[row_idx], + poseidon2_B_49_3[row_idx], + poseidon2_B_4_0[row_idx], + poseidon2_B_4_1[row_idx], + poseidon2_B_4_2[row_idx], + poseidon2_B_4_3[row_idx], + poseidon2_B_50_0[row_idx], + poseidon2_B_50_1[row_idx], + poseidon2_B_50_2[row_idx], + poseidon2_B_50_3[row_idx], + poseidon2_B_51_0[row_idx], + poseidon2_B_51_1[row_idx], + poseidon2_B_51_2[row_idx], + poseidon2_B_51_3[row_idx], + poseidon2_B_52_0[row_idx], + poseidon2_B_52_1[row_idx], + poseidon2_B_52_2[row_idx], + poseidon2_B_52_3[row_idx], + poseidon2_B_53_0[row_idx], + poseidon2_B_53_1[row_idx], + poseidon2_B_53_2[row_idx], + poseidon2_B_53_3[row_idx], + poseidon2_B_54_0[row_idx], + poseidon2_B_54_1[row_idx], + poseidon2_B_54_2[row_idx], + poseidon2_B_54_3[row_idx], + poseidon2_B_55_0[row_idx], + poseidon2_B_55_1[row_idx], + poseidon2_B_55_2[row_idx], + poseidon2_B_55_3[row_idx], + poseidon2_B_56_0[row_idx], + poseidon2_B_56_1[row_idx], + poseidon2_B_56_2[row_idx], + poseidon2_B_56_3[row_idx], + poseidon2_B_57_0[row_idx], + poseidon2_B_57_1[row_idx], + poseidon2_B_57_2[row_idx], + poseidon2_B_57_3[row_idx], + poseidon2_B_58_0[row_idx], + poseidon2_B_58_1[row_idx], + poseidon2_B_58_2[row_idx], + poseidon2_B_58_3[row_idx], + poseidon2_B_59_0[row_idx], + poseidon2_B_59_1[row_idx], + poseidon2_B_59_2[row_idx], + poseidon2_B_59_3[row_idx], + poseidon2_B_5_0[row_idx], + poseidon2_B_5_1[row_idx], + poseidon2_B_5_2[row_idx], + poseidon2_B_5_3[row_idx], + poseidon2_B_6_0[row_idx], + poseidon2_B_6_1[row_idx], + poseidon2_B_6_2[row_idx], + poseidon2_B_6_3[row_idx], + poseidon2_B_7_0[row_idx], + poseidon2_B_7_1[row_idx], + poseidon2_B_7_2[row_idx], + poseidon2_B_7_3[row_idx], + poseidon2_B_8_0[row_idx], + poseidon2_B_8_1[row_idx], + poseidon2_B_8_2[row_idx], + poseidon2_B_8_3[row_idx], + poseidon2_B_9_0[row_idx], + poseidon2_B_9_1[row_idx], + poseidon2_B_9_2[row_idx], + poseidon2_B_9_3[row_idx], + poseidon2_EXT_LAYER_4[row_idx], + poseidon2_EXT_LAYER_5[row_idx], + poseidon2_EXT_LAYER_6[row_idx], + poseidon2_EXT_LAYER_7[row_idx], + poseidon2_T_0_4[row_idx], + poseidon2_T_0_5[row_idx], + poseidon2_T_0_6[row_idx], + poseidon2_T_0_7[row_idx], + poseidon2_T_1_4[row_idx], + poseidon2_T_1_5[row_idx], + poseidon2_T_1_6[row_idx], + poseidon2_T_1_7[row_idx], + poseidon2_T_2_4[row_idx], + poseidon2_T_2_5[row_idx], + poseidon2_T_2_6[row_idx], + poseidon2_T_2_7[row_idx], + poseidon2_T_3_4[row_idx], + poseidon2_T_3_5[row_idx], + poseidon2_T_3_6[row_idx], + poseidon2_T_3_7[row_idx], + poseidon2_T_60_4[row_idx], + poseidon2_T_60_5[row_idx], + poseidon2_T_60_6[row_idx], + poseidon2_T_60_7[row_idx], + poseidon2_T_61_4[row_idx], + poseidon2_T_61_5[row_idx], + poseidon2_T_61_6[row_idx], + poseidon2_T_61_7[row_idx], + poseidon2_T_62_4[row_idx], + poseidon2_T_62_5[row_idx], + poseidon2_T_62_6[row_idx], + poseidon2_T_62_7[row_idx], + poseidon2_T_63_4[row_idx], + poseidon2_T_63_5[row_idx], + poseidon2_T_63_6[row_idx], + poseidon2_T_63_7[row_idx], + poseidon2_a_0[row_idx], + poseidon2_a_1[row_idx], + poseidon2_a_2[row_idx], + poseidon2_a_3[row_idx], + poseidon2_b_0[row_idx], + poseidon2_b_1[row_idx], + poseidon2_b_2[row_idx], + poseidon2_b_3[row_idx], + poseidon2_clk[row_idx], + poseidon2_input_addr[row_idx], + poseidon2_mem_addr_read_a[row_idx], + poseidon2_mem_addr_read_b[row_idx], + poseidon2_mem_addr_read_c[row_idx], + poseidon2_mem_addr_read_d[row_idx], + poseidon2_mem_addr_write_a[row_idx], + poseidon2_mem_addr_write_b[row_idx], + poseidon2_mem_addr_write_c[row_idx], + poseidon2_mem_addr_write_d[row_idx], + poseidon2_output_addr[row_idx], + poseidon2_sel_poseidon_perm[row_idx], + sha256_clk[row_idx], + sha256_input[row_idx], + sha256_output[row_idx], + sha256_sel_sha256_compression[row_idx], + sha256_state[row_idx], + slice_addr[row_idx], + slice_clk[row_idx], + slice_cnt[row_idx], + slice_col_offset[row_idx], + slice_one_min_inv[row_idx], + slice_sel_cd_cpy[row_idx], + slice_sel_mem_active[row_idx], + slice_sel_return[row_idx], + slice_sel_start[row_idx], + slice_space_id[row_idx], + slice_val[row_idx], + lookup_byte_lengths_counts[row_idx], + lookup_byte_operations_counts[row_idx], + lookup_cd_value_counts[row_idx], + lookup_ret_value_counts[row_idx], + lookup_opcode_gas_counts[row_idx], + range_check_l2_gas_hi_counts[row_idx], + range_check_l2_gas_lo_counts[row_idx], + range_check_da_gas_hi_counts[row_idx], + range_check_da_gas_lo_counts[row_idx], + kernel_output_lookup_counts[row_idx], + lookup_into_kernel_counts[row_idx], + incl_main_tag_err_counts[row_idx], + incl_mem_tag_err_counts[row_idx], + lookup_mem_rng_chk_lo_counts[row_idx], + lookup_mem_rng_chk_mid_counts[row_idx], + lookup_mem_rng_chk_hi_counts[row_idx], + lookup_pow_2_0_counts[row_idx], + lookup_pow_2_1_counts[row_idx], + lookup_u8_0_counts[row_idx], + lookup_u8_1_counts[row_idx], + lookup_u16_0_counts[row_idx], + lookup_u16_1_counts[row_idx], + lookup_u16_2_counts[row_idx], + lookup_u16_3_counts[row_idx], + lookup_u16_4_counts[row_idx], + lookup_u16_5_counts[row_idx], + lookup_u16_6_counts[row_idx], + lookup_u16_7_counts[row_idx], + lookup_u16_8_counts[row_idx], + lookup_u16_9_counts[row_idx], + lookup_u16_10_counts[row_idx], + lookup_u16_11_counts[row_idx], + lookup_u16_12_counts[row_idx], + lookup_u16_13_counts[row_idx], + lookup_u16_14_counts[row_idx], + lookup_div_u16_0_counts[row_idx], + lookup_div_u16_1_counts[row_idx], + lookup_div_u16_2_counts[row_idx], + lookup_div_u16_3_counts[row_idx], + lookup_div_u16_4_counts[row_idx], + lookup_div_u16_5_counts[row_idx], + lookup_div_u16_6_counts[row_idx], + lookup_div_u16_7_counts[row_idx], + perm_pos_mem_read_a_inv[row_idx], + perm_pos_mem_read_b_inv[row_idx], + perm_pos_mem_read_c_inv[row_idx], + perm_pos_mem_read_d_inv[row_idx], + perm_pos_mem_write_a_inv[row_idx], + perm_pos_mem_write_b_inv[row_idx], + perm_pos_mem_write_c_inv[row_idx], + perm_pos_mem_write_d_inv[row_idx], + perm_slice_mem_inv[row_idx], + perm_main_alu_inv[row_idx], + perm_main_bin_inv[row_idx], + perm_main_conv_inv[row_idx], + perm_main_pos2_perm_inv[row_idx], + perm_main_pedersen_inv[row_idx], + perm_main_slice_inv[row_idx], + perm_main_mem_a_inv[row_idx], + perm_main_mem_b_inv[row_idx], + perm_main_mem_c_inv[row_idx], + perm_main_mem_d_inv[row_idx], + perm_main_mem_ind_addr_a_inv[row_idx], + perm_main_mem_ind_addr_b_inv[row_idx], + perm_main_mem_ind_addr_c_inv[row_idx], + perm_main_mem_ind_addr_d_inv[row_idx], + lookup_byte_lengths_inv[row_idx], + lookup_byte_operations_inv[row_idx], + lookup_cd_value_inv[row_idx], + lookup_ret_value_inv[row_idx], + lookup_opcode_gas_inv[row_idx], + range_check_l2_gas_hi_inv[row_idx], + range_check_l2_gas_lo_inv[row_idx], + range_check_da_gas_hi_inv[row_idx], + range_check_da_gas_lo_inv[row_idx], + kernel_output_lookup_inv[row_idx], + lookup_into_kernel_inv[row_idx], + incl_main_tag_err_inv[row_idx], + incl_mem_tag_err_inv[row_idx], + lookup_mem_rng_chk_lo_inv[row_idx], + lookup_mem_rng_chk_mid_inv[row_idx], + lookup_mem_rng_chk_hi_inv[row_idx], + lookup_pow_2_0_inv[row_idx], + lookup_pow_2_1_inv[row_idx], + lookup_u8_0_inv[row_idx], + lookup_u8_1_inv[row_idx], + lookup_u16_0_inv[row_idx], + lookup_u16_1_inv[row_idx], + lookup_u16_2_inv[row_idx], + lookup_u16_3_inv[row_idx], + lookup_u16_4_inv[row_idx], + lookup_u16_5_inv[row_idx], + lookup_u16_6_inv[row_idx], + lookup_u16_7_inv[row_idx], + lookup_u16_8_inv[row_idx], + lookup_u16_9_inv[row_idx], + lookup_u16_10_inv[row_idx], + lookup_u16_11_inv[row_idx], + lookup_u16_12_inv[row_idx], + lookup_u16_13_inv[row_idx], + lookup_u16_14_inv[row_idx], + lookup_div_u16_0_inv[row_idx], + lookup_div_u16_1_inv[row_idx], + lookup_div_u16_2_inv[row_idx], + lookup_div_u16_3_inv[row_idx], + lookup_div_u16_4_inv[row_idx], + lookup_div_u16_5_inv[row_idx], + lookup_div_u16_6_inv[row_idx], + lookup_div_u16_7_inv[row_idx], + alu_op_div_shift[row_idx], + alu_cmp_rng_ctr_shift[row_idx], + mem_val_shift[row_idx], + binary_acc_ia_shift[row_idx], + alu_op_shr_shift[row_idx], + alu_u16_r2_shift[row_idx], + alu_sel_rng_chk_shift[row_idx], + kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], + slice_addr_shift[row_idx], + alu_div_u16_r7_shift[row_idx], + mem_glob_addr_shift[row_idx], + slice_space_id_shift[row_idx], + alu_div_u16_r1_shift[row_idx], + kernel_note_hash_exist_write_offset_shift[row_idx], + alu_u16_r4_shift[row_idx], + mem_sel_mem_shift[row_idx], + alu_p_sub_a_hi_shift[row_idx], + kernel_nullifier_exists_write_offset_shift[row_idx], + alu_div_u16_r3_shift[row_idx], + alu_op_add_shift[row_idx], + alu_p_sub_a_lo_shift[row_idx], + slice_col_offset_shift[row_idx], + alu_sel_rng_chk_lookup_shift[row_idx], + binary_op_id_shift[row_idx], + kernel_sload_write_offset_shift[row_idx], + alu_div_u16_r2_shift[row_idx], + kernel_emit_unencrypted_log_write_offset_shift[row_idx], + alu_b_lo_shift[row_idx], + mem_tsp_shift[row_idx], + main_da_gas_remaining_shift[row_idx], + alu_op_sub_shift[row_idx], + slice_sel_start_shift[row_idx], + alu_sel_alu_shift[row_idx], + kernel_nullifier_non_exists_write_offset_shift[row_idx], + alu_b_hi_shift[row_idx], + slice_cnt_shift[row_idx], + alu_u16_r6_shift[row_idx], + slice_sel_cd_cpy_shift[row_idx], + alu_u8_r1_shift[row_idx], + alu_div_u16_r0_shift[row_idx], + alu_u8_r0_shift[row_idx], + alu_op_cast_shift[row_idx], + kernel_emit_l2_to_l1_msg_write_offset_shift[row_idx], + alu_div_u16_r6_shift[row_idx], + alu_div_u16_r4_shift[row_idx], + slice_sel_mem_active_shift[row_idx], + main_l2_gas_remaining_shift[row_idx], + alu_op_mul_shift[row_idx], + alu_u16_r5_shift[row_idx], + binary_acc_ib_shift[row_idx], + alu_p_sub_b_hi_shift[row_idx], + alu_sel_div_rng_chk_shift[row_idx], + alu_a_lo_shift[row_idx], + alu_u16_r1_shift[row_idx], + slice_clk_shift[row_idx], + mem_tag_shift[row_idx], + alu_op_cast_prev_shift[row_idx], + alu_div_u16_r5_shift[row_idx], + slice_sel_return_shift[row_idx], + alu_u16_r3_shift[row_idx], + alu_u16_r0_shift[row_idx], + binary_mem_tag_ctr_shift[row_idx], + alu_sel_cmp_shift[row_idx], + kernel_emit_note_hash_write_offset_shift[row_idx], + kernel_emit_nullifier_write_offset_shift[row_idx], + alu_a_hi_shift[row_idx], + kernel_sstore_write_offset_shift[row_idx], + alu_op_shl_shift[row_idx], + mem_rw_shift[row_idx], + main_pc_shift[row_idx], + main_internal_return_ptr_shift[row_idx], + binary_acc_ic_shift[row_idx], + kernel_side_effect_counter_shift[row_idx], + alu_p_sub_b_lo_shift[row_idx] }; } AvmFlavor::CommitmentLabels::CommitmentLabels() @@ -1763,7 +1761,6 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; Base::main_sel_last = "MAIN_SEL_LAST"; Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; - Base::main_sel_mem_op_activate_gas = "MAIN_SEL_MEM_OP_ACTIVATE_GAS"; Base::main_sel_mem_op_b = "MAIN_SEL_MEM_OP_B"; Base::main_sel_mem_op_c = "MAIN_SEL_MEM_OP_C"; Base::main_sel_mem_op_d = "MAIN_SEL_MEM_OP_D"; @@ -2176,72 +2173,72 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::slice_sel_start = "SLICE_SEL_START"; Base::slice_space_id = "SLICE_SPACE_ID"; Base::slice_val = "SLICE_VAL"; - Base::perm_pos_mem_read_a = "PERM_POS_MEM_READ_A"; - Base::perm_pos_mem_read_b = "PERM_POS_MEM_READ_B"; - Base::perm_pos_mem_read_c = "PERM_POS_MEM_READ_C"; - Base::perm_pos_mem_read_d = "PERM_POS_MEM_READ_D"; - Base::perm_pos_mem_write_a = "PERM_POS_MEM_WRITE_A"; - Base::perm_pos_mem_write_b = "PERM_POS_MEM_WRITE_B"; - Base::perm_pos_mem_write_c = "PERM_POS_MEM_WRITE_C"; - Base::perm_pos_mem_write_d = "PERM_POS_MEM_WRITE_D"; - Base::perm_slice_mem = "PERM_SLICE_MEM"; - Base::perm_main_alu = "PERM_MAIN_ALU"; - Base::perm_main_bin = "PERM_MAIN_BIN"; - Base::perm_main_conv = "PERM_MAIN_CONV"; - Base::perm_main_pos2_perm = "PERM_MAIN_POS2_PERM"; - Base::perm_main_pedersen = "PERM_MAIN_PEDERSEN"; - Base::perm_main_slice = "PERM_MAIN_SLICE"; - Base::perm_main_mem_a = "PERM_MAIN_MEM_A"; - Base::perm_main_mem_b = "PERM_MAIN_MEM_B"; - Base::perm_main_mem_c = "PERM_MAIN_MEM_C"; - Base::perm_main_mem_d = "PERM_MAIN_MEM_D"; - Base::perm_main_mem_ind_addr_a = "PERM_MAIN_MEM_IND_ADDR_A"; - Base::perm_main_mem_ind_addr_b = "PERM_MAIN_MEM_IND_ADDR_B"; - Base::perm_main_mem_ind_addr_c = "PERM_MAIN_MEM_IND_ADDR_C"; - Base::perm_main_mem_ind_addr_d = "PERM_MAIN_MEM_IND_ADDR_D"; - Base::lookup_byte_lengths = "LOOKUP_BYTE_LENGTHS"; - Base::lookup_byte_operations = "LOOKUP_BYTE_OPERATIONS"; - Base::lookup_cd_value = "LOOKUP_CD_VALUE"; - Base::lookup_ret_value = "LOOKUP_RET_VALUE"; - Base::lookup_opcode_gas = "LOOKUP_OPCODE_GAS"; - Base::range_check_l2_gas_hi = "RANGE_CHECK_L2_GAS_HI"; - Base::range_check_l2_gas_lo = "RANGE_CHECK_L2_GAS_LO"; - Base::range_check_da_gas_hi = "RANGE_CHECK_DA_GAS_HI"; - Base::range_check_da_gas_lo = "RANGE_CHECK_DA_GAS_LO"; - Base::kernel_output_lookup = "KERNEL_OUTPUT_LOOKUP"; - Base::lookup_into_kernel = "LOOKUP_INTO_KERNEL"; - Base::incl_main_tag_err = "INCL_MAIN_TAG_ERR"; - Base::incl_mem_tag_err = "INCL_MEM_TAG_ERR"; - Base::lookup_mem_rng_chk_lo = "LOOKUP_MEM_RNG_CHK_LO"; - Base::lookup_mem_rng_chk_mid = "LOOKUP_MEM_RNG_CHK_MID"; - Base::lookup_mem_rng_chk_hi = "LOOKUP_MEM_RNG_CHK_HI"; - Base::lookup_pow_2_0 = "LOOKUP_POW_2_0"; - Base::lookup_pow_2_1 = "LOOKUP_POW_2_1"; - Base::lookup_u8_0 = "LOOKUP_U8_0"; - Base::lookup_u8_1 = "LOOKUP_U8_1"; - Base::lookup_u16_0 = "LOOKUP_U16_0"; - Base::lookup_u16_1 = "LOOKUP_U16_1"; - Base::lookup_u16_2 = "LOOKUP_U16_2"; - Base::lookup_u16_3 = "LOOKUP_U16_3"; - Base::lookup_u16_4 = "LOOKUP_U16_4"; - Base::lookup_u16_5 = "LOOKUP_U16_5"; - Base::lookup_u16_6 = "LOOKUP_U16_6"; - Base::lookup_u16_7 = "LOOKUP_U16_7"; - Base::lookup_u16_8 = "LOOKUP_U16_8"; - Base::lookup_u16_9 = "LOOKUP_U16_9"; - Base::lookup_u16_10 = "LOOKUP_U16_10"; - Base::lookup_u16_11 = "LOOKUP_U16_11"; - Base::lookup_u16_12 = "LOOKUP_U16_12"; - Base::lookup_u16_13 = "LOOKUP_U16_13"; - Base::lookup_u16_14 = "LOOKUP_U16_14"; - Base::lookup_div_u16_0 = "LOOKUP_DIV_U16_0"; - Base::lookup_div_u16_1 = "LOOKUP_DIV_U16_1"; - Base::lookup_div_u16_2 = "LOOKUP_DIV_U16_2"; - Base::lookup_div_u16_3 = "LOOKUP_DIV_U16_3"; - Base::lookup_div_u16_4 = "LOOKUP_DIV_U16_4"; - Base::lookup_div_u16_5 = "LOOKUP_DIV_U16_5"; - Base::lookup_div_u16_6 = "LOOKUP_DIV_U16_6"; - Base::lookup_div_u16_7 = "LOOKUP_DIV_U16_7"; + Base::perm_pos_mem_read_a_inv = "PERM_POS_MEM_READ_A_INV"; + Base::perm_pos_mem_read_b_inv = "PERM_POS_MEM_READ_B_INV"; + Base::perm_pos_mem_read_c_inv = "PERM_POS_MEM_READ_C_INV"; + Base::perm_pos_mem_read_d_inv = "PERM_POS_MEM_READ_D_INV"; + Base::perm_pos_mem_write_a_inv = "PERM_POS_MEM_WRITE_A_INV"; + Base::perm_pos_mem_write_b_inv = "PERM_POS_MEM_WRITE_B_INV"; + Base::perm_pos_mem_write_c_inv = "PERM_POS_MEM_WRITE_C_INV"; + Base::perm_pos_mem_write_d_inv = "PERM_POS_MEM_WRITE_D_INV"; + Base::perm_slice_mem_inv = "PERM_SLICE_MEM_INV"; + Base::perm_main_alu_inv = "PERM_MAIN_ALU_INV"; + Base::perm_main_bin_inv = "PERM_MAIN_BIN_INV"; + Base::perm_main_conv_inv = "PERM_MAIN_CONV_INV"; + Base::perm_main_pos2_perm_inv = "PERM_MAIN_POS2_PERM_INV"; + Base::perm_main_pedersen_inv = "PERM_MAIN_PEDERSEN_INV"; + Base::perm_main_slice_inv = "PERM_MAIN_SLICE_INV"; + Base::perm_main_mem_a_inv = "PERM_MAIN_MEM_A_INV"; + Base::perm_main_mem_b_inv = "PERM_MAIN_MEM_B_INV"; + Base::perm_main_mem_c_inv = "PERM_MAIN_MEM_C_INV"; + Base::perm_main_mem_d_inv = "PERM_MAIN_MEM_D_INV"; + Base::perm_main_mem_ind_addr_a_inv = "PERM_MAIN_MEM_IND_ADDR_A_INV"; + Base::perm_main_mem_ind_addr_b_inv = "PERM_MAIN_MEM_IND_ADDR_B_INV"; + Base::perm_main_mem_ind_addr_c_inv = "PERM_MAIN_MEM_IND_ADDR_C_INV"; + Base::perm_main_mem_ind_addr_d_inv = "PERM_MAIN_MEM_IND_ADDR_D_INV"; + Base::lookup_byte_lengths_inv = "LOOKUP_BYTE_LENGTHS_INV"; + Base::lookup_byte_operations_inv = "LOOKUP_BYTE_OPERATIONS_INV"; + Base::lookup_cd_value_inv = "LOOKUP_CD_VALUE_INV"; + Base::lookup_ret_value_inv = "LOOKUP_RET_VALUE_INV"; + Base::lookup_opcode_gas_inv = "LOOKUP_OPCODE_GAS_INV"; + Base::range_check_l2_gas_hi_inv = "RANGE_CHECK_L2_GAS_HI_INV"; + Base::range_check_l2_gas_lo_inv = "RANGE_CHECK_L2_GAS_LO_INV"; + Base::range_check_da_gas_hi_inv = "RANGE_CHECK_DA_GAS_HI_INV"; + Base::range_check_da_gas_lo_inv = "RANGE_CHECK_DA_GAS_LO_INV"; + Base::kernel_output_lookup_inv = "KERNEL_OUTPUT_LOOKUP_INV"; + Base::lookup_into_kernel_inv = "LOOKUP_INTO_KERNEL_INV"; + Base::incl_main_tag_err_inv = "INCL_MAIN_TAG_ERR_INV"; + Base::incl_mem_tag_err_inv = "INCL_MEM_TAG_ERR_INV"; + Base::lookup_mem_rng_chk_lo_inv = "LOOKUP_MEM_RNG_CHK_LO_INV"; + Base::lookup_mem_rng_chk_mid_inv = "LOOKUP_MEM_RNG_CHK_MID_INV"; + Base::lookup_mem_rng_chk_hi_inv = "LOOKUP_MEM_RNG_CHK_HI_INV"; + Base::lookup_pow_2_0_inv = "LOOKUP_POW_2_0_INV"; + Base::lookup_pow_2_1_inv = "LOOKUP_POW_2_1_INV"; + Base::lookup_u8_0_inv = "LOOKUP_U8_0_INV"; + Base::lookup_u8_1_inv = "LOOKUP_U8_1_INV"; + Base::lookup_u16_0_inv = "LOOKUP_U16_0_INV"; + Base::lookup_u16_1_inv = "LOOKUP_U16_1_INV"; + Base::lookup_u16_2_inv = "LOOKUP_U16_2_INV"; + Base::lookup_u16_3_inv = "LOOKUP_U16_3_INV"; + Base::lookup_u16_4_inv = "LOOKUP_U16_4_INV"; + Base::lookup_u16_5_inv = "LOOKUP_U16_5_INV"; + Base::lookup_u16_6_inv = "LOOKUP_U16_6_INV"; + Base::lookup_u16_7_inv = "LOOKUP_U16_7_INV"; + Base::lookup_u16_8_inv = "LOOKUP_U16_8_INV"; + Base::lookup_u16_9_inv = "LOOKUP_U16_9_INV"; + Base::lookup_u16_10_inv = "LOOKUP_U16_10_INV"; + Base::lookup_u16_11_inv = "LOOKUP_U16_11_INV"; + Base::lookup_u16_12_inv = "LOOKUP_U16_12_INV"; + Base::lookup_u16_13_inv = "LOOKUP_U16_13_INV"; + Base::lookup_u16_14_inv = "LOOKUP_U16_14_INV"; + Base::lookup_div_u16_0_inv = "LOOKUP_DIV_U16_0_INV"; + Base::lookup_div_u16_1_inv = "LOOKUP_DIV_U16_1_INV"; + Base::lookup_div_u16_2_inv = "LOOKUP_DIV_U16_2_INV"; + Base::lookup_div_u16_3_inv = "LOOKUP_DIV_U16_3_INV"; + Base::lookup_div_u16_4_inv = "LOOKUP_DIV_U16_4_INV"; + Base::lookup_div_u16_5_inv = "LOOKUP_DIV_U16_5_INV"; + Base::lookup_div_u16_6_inv = "LOOKUP_DIV_U16_6_INV"; + Base::lookup_div_u16_7_inv = "LOOKUP_DIV_U16_7_INV"; Base::lookup_byte_lengths_counts = "LOOKUP_BYTE_LENGTHS_COUNTS"; Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index da7999d51b3..ae21d760e78 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -102,10 +102,10 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // The entities that will be used in the flavor. // clang-format off #define PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_da_gas_fixed_table, gas_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_first, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES kernel_kernel_inputs, kernel_kernel_value_out, kernel_kernel_side_effect_out, kernel_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_borrow, alu_cf, alu_clk, alu_cmp_rng_ctr, alu_div_u16_r0, alu_div_u16_r1, alu_div_u16_r2, alu_div_u16_r3, alu_div_u16_r4, alu_div_u16_r5, alu_div_u16_r6, alu_div_u16_r7, alu_divisor_hi, alu_divisor_lo, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_op_add, alu_op_cast, alu_op_cast_prev, alu_op_div, alu_op_div_a_lt_b, alu_op_div_std, alu_op_eq, alu_op_eq_diff_inv, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_p_a_borrow, alu_p_b_borrow, alu_p_sub_a_hi, alu_p_sub_a_lo, alu_p_sub_b_hi, alu_p_sub_b_lo, alu_partial_prod_hi, alu_partial_prod_lo, alu_quotient_hi, alu_quotient_lo, alu_remainder, alu_res_hi, alu_res_lo, alu_sel_alu, alu_sel_cmp, alu_sel_div_rng_chk, alu_sel_rng_chk, alu_sel_rng_chk_lookup, alu_sel_shift_which, alu_shift_lt_bit_len, alu_t_sub_s_bits, alu_two_pow_s, alu_two_pow_t_sub_s, alu_u128_tag, alu_u16_r0, alu_u16_r1, alu_u16_r10, alu_u16_r11, alu_u16_r12, alu_u16_r13, alu_u16_r14, alu_u16_r2, alu_u16_r3, alu_u16_r4, alu_u16_r5, alu_u16_r6, alu_u16_r7, alu_u16_r8, alu_u16_r9, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_r0, alu_u8_r1, alu_u8_tag, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, kernel_emit_l2_to_l1_msg_write_offset, kernel_emit_note_hash_write_offset, kernel_emit_nullifier_write_offset, kernel_emit_unencrypted_log_write_offset, kernel_kernel_in_offset, kernel_kernel_out_offset, kernel_l1_to_l2_msg_exists_write_offset, kernel_note_hash_exist_write_offset, kernel_nullifier_exists_write_offset, kernel_nullifier_non_exists_write_offset, kernel_q_public_input_kernel_add_to_table, kernel_q_public_input_kernel_out_add_to_table, kernel_side_effect_counter, kernel_sload_write_offset, kernel_sstore_write_offset, main_abs_da_rem_gas_hi, main_abs_da_rem_gas_lo, main_abs_l2_rem_gas_hi, main_abs_l2_rem_gas_lo, main_alu_in_tag, main_bin_op_id, main_call_ptr, main_da_gas_op_cost, main_da_gas_remaining, main_da_out_of_gas, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_l2_gas_op_cost, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_gas_accounting_active, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_activate_gas, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_halt, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff_hi, mem_diff_lo, mem_diff_mid, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_cd_value_counts, lookup_ret_value_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, range_check_da_gas_hi_counts, range_check_da_gas_lo_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, lookup_mem_rng_chk_lo_counts, lookup_mem_rng_chk_mid_counts, lookup_mem_rng_chk_hi_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, lookup_u16_1_counts, lookup_u16_2_counts, lookup_u16_3_counts, lookup_u16_4_counts, lookup_u16_5_counts, lookup_u16_6_counts, lookup_u16_7_counts, lookup_u16_8_counts, lookup_u16_9_counts, lookup_u16_10_counts, lookup_u16_11_counts, lookup_u16_12_counts, lookup_u16_13_counts, lookup_u16_14_counts, lookup_div_u16_0_counts, lookup_div_u16_1_counts, lookup_div_u16_2_counts, lookup_div_u16_3_counts, lookup_div_u16_4_counts, lookup_div_u16_5_counts, lookup_div_u16_6_counts, lookup_div_u16_7_counts -#define DERIVED_WITNESS_ENTITIES perm_pos_mem_read_a, perm_pos_mem_read_b, perm_pos_mem_read_c, perm_pos_mem_read_d, perm_pos_mem_write_a, perm_pos_mem_write_b, perm_pos_mem_write_c, perm_pos_mem_write_d, perm_slice_mem, perm_main_alu, perm_main_bin, perm_main_conv, perm_main_pos2_perm, perm_main_pedersen, perm_main_slice, perm_main_mem_a, perm_main_mem_b, perm_main_mem_c, perm_main_mem_d, perm_main_mem_ind_addr_a, perm_main_mem_ind_addr_b, perm_main_mem_ind_addr_c, perm_main_mem_ind_addr_d, lookup_byte_lengths, lookup_byte_operations, lookup_cd_value, lookup_ret_value, lookup_opcode_gas, range_check_l2_gas_hi, range_check_l2_gas_lo, range_check_da_gas_hi, range_check_da_gas_lo, kernel_output_lookup, lookup_into_kernel, incl_main_tag_err, incl_mem_tag_err, lookup_mem_rng_chk_lo, lookup_mem_rng_chk_mid, lookup_mem_rng_chk_hi, lookup_pow_2_0, lookup_pow_2_1, lookup_u8_0, lookup_u8_1, lookup_u16_0, lookup_u16_1, lookup_u16_2, lookup_u16_3, lookup_u16_4, lookup_u16_5, lookup_u16_6, lookup_u16_7, lookup_u16_8, lookup_u16_9, lookup_u16_10, lookup_u16_11, lookup_u16_12, lookup_u16_13, lookup_u16_14, lookup_div_u16_0, lookup_div_u16_1, lookup_div_u16_2, lookup_div_u16_3, lookup_div_u16_4, lookup_div_u16_5, lookup_div_u16_6, lookup_div_u16_7 -#define SHIFTED_ENTITIES alu_a_hi_shift, alu_a_lo_shift, alu_b_hi_shift, alu_b_lo_shift, alu_cmp_rng_ctr_shift, alu_div_u16_r0_shift, alu_div_u16_r1_shift, alu_div_u16_r2_shift, alu_div_u16_r3_shift, alu_div_u16_r4_shift, alu_div_u16_r5_shift, alu_div_u16_r6_shift, alu_div_u16_r7_shift, alu_op_add_shift, alu_op_cast_prev_shift, alu_op_cast_shift, alu_op_div_shift, alu_op_mul_shift, alu_op_shl_shift, alu_op_shr_shift, alu_op_sub_shift, alu_p_sub_a_hi_shift, alu_p_sub_a_lo_shift, alu_p_sub_b_hi_shift, alu_p_sub_b_lo_shift, alu_sel_alu_shift, alu_sel_cmp_shift, alu_sel_div_rng_chk_shift, alu_sel_rng_chk_lookup_shift, alu_sel_rng_chk_shift, alu_u16_r0_shift, alu_u16_r1_shift, alu_u16_r2_shift, alu_u16_r3_shift, alu_u16_r4_shift, alu_u16_r5_shift, alu_u16_r6_shift, alu_u8_r0_shift, alu_u8_r1_shift, binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, kernel_emit_l2_to_l1_msg_write_offset_shift, kernel_emit_note_hash_write_offset_shift, kernel_emit_nullifier_write_offset_shift, kernel_emit_unencrypted_log_write_offset_shift, kernel_l1_to_l2_msg_exists_write_offset_shift, kernel_note_hash_exist_write_offset_shift, kernel_nullifier_exists_write_offset_shift, kernel_nullifier_non_exists_write_offset_shift, kernel_side_effect_counter_shift, kernel_sload_write_offset_shift, kernel_sstore_write_offset_shift, main_da_gas_remaining_shift, main_internal_return_ptr_shift, main_l2_gas_remaining_shift, main_pc_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift -#define TO_BE_SHIFTED(e) e.alu_a_hi, e.alu_a_lo, e.alu_b_hi, e.alu_b_lo, e.alu_cmp_rng_ctr, e.alu_div_u16_r0, e.alu_div_u16_r1, e.alu_div_u16_r2, e.alu_div_u16_r3, e.alu_div_u16_r4, e.alu_div_u16_r5, e.alu_div_u16_r6, e.alu_div_u16_r7, e.alu_op_add, e.alu_op_cast_prev, e.alu_op_cast, e.alu_op_div, e.alu_op_mul, e.alu_op_shl, e.alu_op_shr, e.alu_op_sub, e.alu_p_sub_a_hi, e.alu_p_sub_a_lo, e.alu_p_sub_b_hi, e.alu_p_sub_b_lo, e.alu_sel_alu, e.alu_sel_cmp, e.alu_sel_div_rng_chk, e.alu_sel_rng_chk_lookup, e.alu_sel_rng_chk, e.alu_u16_r0, e.alu_u16_r1, e.alu_u16_r2, e.alu_u16_r3, e.alu_u16_r4, e.alu_u16_r5, e.alu_u16_r6, e.alu_u8_r0, e.alu_u8_r1, e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.kernel_emit_l2_to_l1_msg_write_offset, e.kernel_emit_note_hash_write_offset, e.kernel_emit_nullifier_write_offset, e.kernel_emit_unencrypted_log_write_offset, e.kernel_l1_to_l2_msg_exists_write_offset, e.kernel_note_hash_exist_write_offset, e.kernel_nullifier_exists_write_offset, e.kernel_nullifier_non_exists_write_offset, e.kernel_side_effect_counter, e.kernel_sload_write_offset, e.kernel_sstore_write_offset, e.main_da_gas_remaining, e.main_internal_return_ptr, e.main_l2_gas_remaining, e.main_pc, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id +#define WIRE_ENTITIES kernel_kernel_inputs, kernel_kernel_value_out, kernel_kernel_side_effect_out, kernel_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_borrow, alu_cf, alu_clk, alu_cmp_rng_ctr, alu_div_u16_r0, alu_div_u16_r1, alu_div_u16_r2, alu_div_u16_r3, alu_div_u16_r4, alu_div_u16_r5, alu_div_u16_r6, alu_div_u16_r7, alu_divisor_hi, alu_divisor_lo, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_op_add, alu_op_cast, alu_op_cast_prev, alu_op_div, alu_op_div_a_lt_b, alu_op_div_std, alu_op_eq, alu_op_eq_diff_inv, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_p_a_borrow, alu_p_b_borrow, alu_p_sub_a_hi, alu_p_sub_a_lo, alu_p_sub_b_hi, alu_p_sub_b_lo, alu_partial_prod_hi, alu_partial_prod_lo, alu_quotient_hi, alu_quotient_lo, alu_remainder, alu_res_hi, alu_res_lo, alu_sel_alu, alu_sel_cmp, alu_sel_div_rng_chk, alu_sel_rng_chk, alu_sel_rng_chk_lookup, alu_sel_shift_which, alu_shift_lt_bit_len, alu_t_sub_s_bits, alu_two_pow_s, alu_two_pow_t_sub_s, alu_u128_tag, alu_u16_r0, alu_u16_r1, alu_u16_r10, alu_u16_r11, alu_u16_r12, alu_u16_r13, alu_u16_r14, alu_u16_r2, alu_u16_r3, alu_u16_r4, alu_u16_r5, alu_u16_r6, alu_u16_r7, alu_u16_r8, alu_u16_r9, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_r0, alu_u8_r1, alu_u8_tag, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, kernel_emit_l2_to_l1_msg_write_offset, kernel_emit_note_hash_write_offset, kernel_emit_nullifier_write_offset, kernel_emit_unencrypted_log_write_offset, kernel_kernel_in_offset, kernel_kernel_out_offset, kernel_l1_to_l2_msg_exists_write_offset, kernel_note_hash_exist_write_offset, kernel_nullifier_exists_write_offset, kernel_nullifier_non_exists_write_offset, kernel_q_public_input_kernel_add_to_table, kernel_q_public_input_kernel_out_add_to_table, kernel_side_effect_counter, kernel_sload_write_offset, kernel_sstore_write_offset, main_abs_da_rem_gas_hi, main_abs_da_rem_gas_lo, main_abs_l2_rem_gas_hi, main_abs_l2_rem_gas_lo, main_alu_in_tag, main_bin_op_id, main_call_ptr, main_da_gas_op_cost, main_da_gas_remaining, main_da_out_of_gas, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_l2_gas_op_cost, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_gas_accounting_active, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_halt, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff_hi, mem_diff_lo, mem_diff_mid, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_cd_value_counts, lookup_ret_value_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, range_check_da_gas_hi_counts, range_check_da_gas_lo_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, lookup_mem_rng_chk_lo_counts, lookup_mem_rng_chk_mid_counts, lookup_mem_rng_chk_hi_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, lookup_u16_1_counts, lookup_u16_2_counts, lookup_u16_3_counts, lookup_u16_4_counts, lookup_u16_5_counts, lookup_u16_6_counts, lookup_u16_7_counts, lookup_u16_8_counts, lookup_u16_9_counts, lookup_u16_10_counts, lookup_u16_11_counts, lookup_u16_12_counts, lookup_u16_13_counts, lookup_u16_14_counts, lookup_div_u16_0_counts, lookup_div_u16_1_counts, lookup_div_u16_2_counts, lookup_div_u16_3_counts, lookup_div_u16_4_counts, lookup_div_u16_5_counts, lookup_div_u16_6_counts, lookup_div_u16_7_counts +#define DERIVED_WITNESS_ENTITIES perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_cd_value_inv, lookup_ret_value_inv, lookup_opcode_gas_inv, range_check_l2_gas_hi_inv, range_check_l2_gas_lo_inv, range_check_da_gas_hi_inv, range_check_da_gas_lo_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv, lookup_mem_rng_chk_lo_inv, lookup_mem_rng_chk_mid_inv, lookup_mem_rng_chk_hi_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_u8_0_inv, lookup_u8_1_inv, lookup_u16_0_inv, lookup_u16_1_inv, lookup_u16_2_inv, lookup_u16_3_inv, lookup_u16_4_inv, lookup_u16_5_inv, lookup_u16_6_inv, lookup_u16_7_inv, lookup_u16_8_inv, lookup_u16_9_inv, lookup_u16_10_inv, lookup_u16_11_inv, lookup_u16_12_inv, lookup_u16_13_inv, lookup_u16_14_inv, lookup_div_u16_0_inv, lookup_div_u16_1_inv, lookup_div_u16_2_inv, lookup_div_u16_3_inv, lookup_div_u16_4_inv, lookup_div_u16_5_inv, lookup_div_u16_6_inv, lookup_div_u16_7_inv +#define SHIFTED_ENTITIES alu_op_div_shift, alu_cmp_rng_ctr_shift, mem_val_shift, binary_acc_ia_shift, alu_op_shr_shift, alu_u16_r2_shift, alu_sel_rng_chk_shift, kernel_l1_to_l2_msg_exists_write_offset_shift, slice_addr_shift, alu_div_u16_r7_shift, mem_glob_addr_shift, slice_space_id_shift, alu_div_u16_r1_shift, kernel_note_hash_exist_write_offset_shift, alu_u16_r4_shift, mem_sel_mem_shift, alu_p_sub_a_hi_shift, kernel_nullifier_exists_write_offset_shift, alu_div_u16_r3_shift, alu_op_add_shift, alu_p_sub_a_lo_shift, slice_col_offset_shift, alu_sel_rng_chk_lookup_shift, binary_op_id_shift, kernel_sload_write_offset_shift, alu_div_u16_r2_shift, kernel_emit_unencrypted_log_write_offset_shift, alu_b_lo_shift, mem_tsp_shift, main_da_gas_remaining_shift, alu_op_sub_shift, slice_sel_start_shift, alu_sel_alu_shift, kernel_nullifier_non_exists_write_offset_shift, alu_b_hi_shift, slice_cnt_shift, alu_u16_r6_shift, slice_sel_cd_cpy_shift, alu_u8_r1_shift, alu_div_u16_r0_shift, alu_u8_r0_shift, alu_op_cast_shift, kernel_emit_l2_to_l1_msg_write_offset_shift, alu_div_u16_r6_shift, alu_div_u16_r4_shift, slice_sel_mem_active_shift, main_l2_gas_remaining_shift, alu_op_mul_shift, alu_u16_r5_shift, binary_acc_ib_shift, alu_p_sub_b_hi_shift, alu_sel_div_rng_chk_shift, alu_a_lo_shift, alu_u16_r1_shift, slice_clk_shift, mem_tag_shift, alu_op_cast_prev_shift, alu_div_u16_r5_shift, slice_sel_return_shift, alu_u16_r3_shift, alu_u16_r0_shift, binary_mem_tag_ctr_shift, alu_sel_cmp_shift, kernel_emit_note_hash_write_offset_shift, kernel_emit_nullifier_write_offset_shift, alu_a_hi_shift, kernel_sstore_write_offset_shift, alu_op_shl_shift, mem_rw_shift, main_pc_shift, main_internal_return_ptr_shift, binary_acc_ic_shift, kernel_side_effect_counter_shift, alu_p_sub_b_lo_shift +#define TO_BE_SHIFTED(e) e.alu_op_div, e.alu_cmp_rng_ctr, e.mem_val, e.binary_acc_ia, e.alu_op_shr, e.alu_u16_r2, e.alu_sel_rng_chk, e.kernel_l1_to_l2_msg_exists_write_offset, e.slice_addr, e.alu_div_u16_r7, e.mem_glob_addr, e.slice_space_id, e.alu_div_u16_r1, e.kernel_note_hash_exist_write_offset, e.alu_u16_r4, e.mem_sel_mem, e.alu_p_sub_a_hi, e.kernel_nullifier_exists_write_offset, e.alu_div_u16_r3, e.alu_op_add, e.alu_p_sub_a_lo, e.slice_col_offset, e.alu_sel_rng_chk_lookup, e.binary_op_id, e.kernel_sload_write_offset, e.alu_div_u16_r2, e.kernel_emit_unencrypted_log_write_offset, e.alu_b_lo, e.mem_tsp, e.main_da_gas_remaining, e.alu_op_sub, e.slice_sel_start, e.alu_sel_alu, e.kernel_nullifier_non_exists_write_offset, e.alu_b_hi, e.slice_cnt, e.alu_u16_r6, e.slice_sel_cd_cpy, e.alu_u8_r1, e.alu_div_u16_r0, e.alu_u8_r0, e.alu_op_cast, e.kernel_emit_l2_to_l1_msg_write_offset, e.alu_div_u16_r6, e.alu_div_u16_r4, e.slice_sel_mem_active, e.main_l2_gas_remaining, e.alu_op_mul, e.alu_u16_r5, e.binary_acc_ib, e.alu_p_sub_b_hi, e.alu_sel_div_rng_chk, e.alu_a_lo, e.alu_u16_r1, e.slice_clk, e.mem_tag, e.alu_op_cast_prev, e.alu_div_u16_r5, e.slice_sel_return, e.alu_u16_r3, e.alu_u16_r0, e.binary_mem_tag_ctr, e.alu_sel_cmp, e.kernel_emit_note_hash_write_offset, e.kernel_emit_nullifier_write_offset, e.alu_a_hi, e.kernel_sstore_write_offset, e.alu_op_shl, e.mem_rw, e.main_pc, e.main_internal_return_ptr, e.binary_acc_ic, e.kernel_side_effect_counter, e.alu_p_sub_b_lo #define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES // clang-format on @@ -128,11 +128,12 @@ class AvmFlavor { using RelationSeparator = AvmFlavorSettings::RelationSeparator; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 14; - static constexpr size_t NUM_WITNESS_ENTITIES = 690; + static constexpr size_t NUM_WITNESS_ENTITIES = 689; + static constexpr size_t NUM_SHIFTED_ENTITIES = 74; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 778; + static constexpr size_t NUM_ALL_ENTITIES = 777; using MainRelations = std::tuple< // Relations @@ -150,51 +151,35 @@ class AvmFlavor { using LookupRelations = std::tuple< // Lookups - perm_pos_mem_read_a_relation, - perm_pos_mem_read_b_relation, - perm_pos_mem_read_c_relation, - perm_pos_mem_read_d_relation, - perm_pos_mem_write_a_relation, - perm_pos_mem_write_b_relation, - perm_pos_mem_write_c_relation, - perm_pos_mem_write_d_relation, - perm_slice_mem_relation, - perm_main_alu_relation, - perm_main_bin_relation, - perm_main_conv_relation, - perm_main_pos2_perm_relation, - perm_main_pedersen_relation, - perm_main_slice_relation, - perm_main_mem_a_relation, - perm_main_mem_b_relation, - perm_main_mem_c_relation, - perm_main_mem_d_relation, - perm_main_mem_ind_addr_a_relation, - perm_main_mem_ind_addr_b_relation, - perm_main_mem_ind_addr_c_relation, - perm_main_mem_ind_addr_d_relation, + incl_main_tag_err_relation, + incl_mem_tag_err_relation, + kernel_output_lookup_relation, lookup_byte_lengths_relation, lookup_byte_operations_relation, lookup_cd_value_relation, - lookup_ret_value_relation, - lookup_opcode_gas_relation, - range_check_l2_gas_hi_relation, - range_check_l2_gas_lo_relation, - range_check_da_gas_hi_relation, - range_check_da_gas_lo_relation, - kernel_output_lookup_relation, + lookup_div_u16_0_relation, + lookup_div_u16_1_relation, + lookup_div_u16_2_relation, + lookup_div_u16_3_relation, + lookup_div_u16_4_relation, + lookup_div_u16_5_relation, + lookup_div_u16_6_relation, + lookup_div_u16_7_relation, lookup_into_kernel_relation, - incl_main_tag_err_relation, - incl_mem_tag_err_relation, + lookup_mem_rng_chk_hi_relation, lookup_mem_rng_chk_lo_relation, lookup_mem_rng_chk_mid_relation, - lookup_mem_rng_chk_hi_relation, + lookup_opcode_gas_relation, lookup_pow_2_0_relation, lookup_pow_2_1_relation, - lookup_u8_0_relation, - lookup_u8_1_relation, + lookup_ret_value_relation, lookup_u16_0_relation, lookup_u16_1_relation, + lookup_u16_10_relation, + lookup_u16_11_relation, + lookup_u16_12_relation, + lookup_u16_13_relation, + lookup_u16_14_relation, lookup_u16_2_relation, lookup_u16_3_relation, lookup_u16_4_relation, @@ -203,19 +188,35 @@ class AvmFlavor { lookup_u16_7_relation, lookup_u16_8_relation, lookup_u16_9_relation, - lookup_u16_10_relation, - lookup_u16_11_relation, - lookup_u16_12_relation, - lookup_u16_13_relation, - lookup_u16_14_relation, - lookup_div_u16_0_relation, - lookup_div_u16_1_relation, - lookup_div_u16_2_relation, - lookup_div_u16_3_relation, - lookup_div_u16_4_relation, - lookup_div_u16_5_relation, - lookup_div_u16_6_relation, - lookup_div_u16_7_relation>; + lookup_u8_0_relation, + lookup_u8_1_relation, + perm_main_alu_relation, + perm_main_bin_relation, + perm_main_conv_relation, + perm_main_mem_a_relation, + perm_main_mem_b_relation, + perm_main_mem_c_relation, + perm_main_mem_d_relation, + perm_main_mem_ind_addr_a_relation, + perm_main_mem_ind_addr_b_relation, + perm_main_mem_ind_addr_c_relation, + perm_main_mem_ind_addr_d_relation, + perm_main_pedersen_relation, + perm_main_pos2_perm_relation, + perm_main_slice_relation, + perm_pos_mem_read_a_relation, + perm_pos_mem_read_b_relation, + perm_pos_mem_read_c_relation, + perm_pos_mem_read_d_relation, + perm_pos_mem_write_a_relation, + perm_pos_mem_write_b_relation, + perm_pos_mem_write_c_relation, + perm_pos_mem_write_d_relation, + perm_slice_mem_relation, + range_check_da_gas_hi_relation, + range_check_da_gas_lo_relation, + range_check_l2_gas_hi_relation, + range_check_l2_gas_lo_relation>; using Relations = tuple_cat_t; @@ -263,9 +264,7 @@ class AvmFlavor { template static auto get_to_be_shifted([[maybe_unused]] PrecomputedAndWitnessEntitiesSuperset& entities) { - return RefArray::value>{ - TO_BE_SHIFTED(entities) - }; + return RefArray{ TO_BE_SHIFTED(entities) }; } template diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index eb57c0bd310..98cad5f73f6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -201,7 +201,6 @@ template std::vector AvmFullRow::names() "main_sel_gas_accounting_active", "main_sel_last", "main_sel_mem_op_a", - "main_sel_mem_op_activate_gas", "main_sel_mem_op_b", "main_sel_mem_op_c", "main_sel_mem_op_d", @@ -614,72 +613,72 @@ template std::vector AvmFullRow::names() "slice_sel_start", "slice_space_id", "slice_val", - "perm_pos_mem_read_a", - "perm_pos_mem_read_b", - "perm_pos_mem_read_c", - "perm_pos_mem_read_d", - "perm_pos_mem_write_a", - "perm_pos_mem_write_b", - "perm_pos_mem_write_c", - "perm_pos_mem_write_d", - "perm_slice_mem", - "perm_main_alu", - "perm_main_bin", - "perm_main_conv", - "perm_main_pos2_perm", - "perm_main_pedersen", - "perm_main_slice", - "perm_main_mem_a", - "perm_main_mem_b", - "perm_main_mem_c", - "perm_main_mem_d", - "perm_main_mem_ind_addr_a", - "perm_main_mem_ind_addr_b", - "perm_main_mem_ind_addr_c", - "perm_main_mem_ind_addr_d", - "lookup_byte_lengths", - "lookup_byte_operations", - "lookup_cd_value", - "lookup_ret_value", - "lookup_opcode_gas", - "range_check_l2_gas_hi", - "range_check_l2_gas_lo", - "range_check_da_gas_hi", - "range_check_da_gas_lo", - "kernel_output_lookup", - "lookup_into_kernel", - "incl_main_tag_err", - "incl_mem_tag_err", - "lookup_mem_rng_chk_lo", - "lookup_mem_rng_chk_mid", - "lookup_mem_rng_chk_hi", - "lookup_pow_2_0", - "lookup_pow_2_1", - "lookup_u8_0", - "lookup_u8_1", - "lookup_u16_0", - "lookup_u16_1", - "lookup_u16_2", - "lookup_u16_3", - "lookup_u16_4", - "lookup_u16_5", - "lookup_u16_6", - "lookup_u16_7", - "lookup_u16_8", - "lookup_u16_9", - "lookup_u16_10", - "lookup_u16_11", - "lookup_u16_12", - "lookup_u16_13", - "lookup_u16_14", - "lookup_div_u16_0", - "lookup_div_u16_1", - "lookup_div_u16_2", - "lookup_div_u16_3", - "lookup_div_u16_4", - "lookup_div_u16_5", - "lookup_div_u16_6", - "lookup_div_u16_7", + "perm_pos_mem_read_a_inv", + "perm_pos_mem_read_b_inv", + "perm_pos_mem_read_c_inv", + "perm_pos_mem_read_d_inv", + "perm_pos_mem_write_a_inv", + "perm_pos_mem_write_b_inv", + "perm_pos_mem_write_c_inv", + "perm_pos_mem_write_d_inv", + "perm_slice_mem_inv", + "perm_main_alu_inv", + "perm_main_bin_inv", + "perm_main_conv_inv", + "perm_main_pos2_perm_inv", + "perm_main_pedersen_inv", + "perm_main_slice_inv", + "perm_main_mem_a_inv", + "perm_main_mem_b_inv", + "perm_main_mem_c_inv", + "perm_main_mem_d_inv", + "perm_main_mem_ind_addr_a_inv", + "perm_main_mem_ind_addr_b_inv", + "perm_main_mem_ind_addr_c_inv", + "perm_main_mem_ind_addr_d_inv", + "lookup_byte_lengths_inv", + "lookup_byte_operations_inv", + "lookup_cd_value_inv", + "lookup_ret_value_inv", + "lookup_opcode_gas_inv", + "range_check_l2_gas_hi_inv", + "range_check_l2_gas_lo_inv", + "range_check_da_gas_hi_inv", + "range_check_da_gas_lo_inv", + "kernel_output_lookup_inv", + "lookup_into_kernel_inv", + "incl_main_tag_err_inv", + "incl_mem_tag_err_inv", + "lookup_mem_rng_chk_lo_inv", + "lookup_mem_rng_chk_mid_inv", + "lookup_mem_rng_chk_hi_inv", + "lookup_pow_2_0_inv", + "lookup_pow_2_1_inv", + "lookup_u8_0_inv", + "lookup_u8_1_inv", + "lookup_u16_0_inv", + "lookup_u16_1_inv", + "lookup_u16_2_inv", + "lookup_u16_3_inv", + "lookup_u16_4_inv", + "lookup_u16_5_inv", + "lookup_u16_6_inv", + "lookup_u16_7_inv", + "lookup_u16_8_inv", + "lookup_u16_9_inv", + "lookup_u16_10_inv", + "lookup_u16_11_inv", + "lookup_u16_12_inv", + "lookup_u16_13_inv", + "lookup_u16_14_inv", + "lookup_div_u16_0_inv", + "lookup_div_u16_1_inv", + "lookup_div_u16_2_inv", + "lookup_div_u16_3_inv", + "lookup_div_u16_4_inv", + "lookup_div_u16_5_inv", + "lookup_div_u16_6_inv", + "lookup_div_u16_7_inv", "lookup_byte_lengths_counts", "lookup_byte_operations_counts", "lookup_cd_value_counts", @@ -910,7 +909,6 @@ template RefVector AvmFullRow::as_vector() const main_sel_gas_accounting_active, main_sel_last, main_sel_mem_op_a, - main_sel_mem_op_activate_gas, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, @@ -1323,72 +1321,72 @@ template RefVector AvmFullRow::as_vector() const slice_sel_start, slice_space_id, slice_val, - perm_pos_mem_read_a, - perm_pos_mem_read_b, - perm_pos_mem_read_c, - perm_pos_mem_read_d, - perm_pos_mem_write_a, - perm_pos_mem_write_b, - perm_pos_mem_write_c, - perm_pos_mem_write_d, - perm_slice_mem, - perm_main_alu, - perm_main_bin, - perm_main_conv, - perm_main_pos2_perm, - perm_main_pedersen, - perm_main_slice, - perm_main_mem_a, - perm_main_mem_b, - perm_main_mem_c, - perm_main_mem_d, - perm_main_mem_ind_addr_a, - perm_main_mem_ind_addr_b, - perm_main_mem_ind_addr_c, - perm_main_mem_ind_addr_d, - lookup_byte_lengths, - lookup_byte_operations, - lookup_cd_value, - lookup_ret_value, - lookup_opcode_gas, - range_check_l2_gas_hi, - range_check_l2_gas_lo, - range_check_da_gas_hi, - range_check_da_gas_lo, - kernel_output_lookup, - lookup_into_kernel, - incl_main_tag_err, - incl_mem_tag_err, - lookup_mem_rng_chk_lo, - lookup_mem_rng_chk_mid, - lookup_mem_rng_chk_hi, - lookup_pow_2_0, - lookup_pow_2_1, - lookup_u8_0, - lookup_u8_1, - lookup_u16_0, - lookup_u16_1, - lookup_u16_2, - lookup_u16_3, - lookup_u16_4, - lookup_u16_5, - lookup_u16_6, - lookup_u16_7, - lookup_u16_8, - lookup_u16_9, - lookup_u16_10, - lookup_u16_11, - lookup_u16_12, - lookup_u16_13, - lookup_u16_14, - lookup_div_u16_0, - lookup_div_u16_1, - lookup_div_u16_2, - lookup_div_u16_3, - lookup_div_u16_4, - lookup_div_u16_5, - lookup_div_u16_6, - lookup_div_u16_7, + perm_pos_mem_read_a_inv, + perm_pos_mem_read_b_inv, + perm_pos_mem_read_c_inv, + perm_pos_mem_read_d_inv, + perm_pos_mem_write_a_inv, + perm_pos_mem_write_b_inv, + perm_pos_mem_write_c_inv, + perm_pos_mem_write_d_inv, + perm_slice_mem_inv, + perm_main_alu_inv, + perm_main_bin_inv, + perm_main_conv_inv, + perm_main_pos2_perm_inv, + perm_main_pedersen_inv, + perm_main_slice_inv, + perm_main_mem_a_inv, + perm_main_mem_b_inv, + perm_main_mem_c_inv, + perm_main_mem_d_inv, + perm_main_mem_ind_addr_a_inv, + perm_main_mem_ind_addr_b_inv, + perm_main_mem_ind_addr_c_inv, + perm_main_mem_ind_addr_d_inv, + lookup_byte_lengths_inv, + lookup_byte_operations_inv, + lookup_cd_value_inv, + lookup_ret_value_inv, + lookup_opcode_gas_inv, + range_check_l2_gas_hi_inv, + range_check_l2_gas_lo_inv, + range_check_da_gas_hi_inv, + range_check_da_gas_lo_inv, + kernel_output_lookup_inv, + lookup_into_kernel_inv, + incl_main_tag_err_inv, + incl_mem_tag_err_inv, + lookup_mem_rng_chk_lo_inv, + lookup_mem_rng_chk_mid_inv, + lookup_mem_rng_chk_hi_inv, + lookup_pow_2_0_inv, + lookup_pow_2_1_inv, + lookup_u8_0_inv, + lookup_u8_1_inv, + lookup_u16_0_inv, + lookup_u16_1_inv, + lookup_u16_2_inv, + lookup_u16_3_inv, + lookup_u16_4_inv, + lookup_u16_5_inv, + lookup_u16_6_inv, + lookup_u16_7_inv, + lookup_u16_8_inv, + lookup_u16_9_inv, + lookup_u16_10_inv, + lookup_u16_11_inv, + lookup_u16_12_inv, + lookup_u16_13_inv, + lookup_u16_14_inv, + lookup_div_u16_0_inv, + lookup_div_u16_1_inv, + lookup_div_u16_2_inv, + lookup_div_u16_3_inv, + lookup_div_u16_4_inv, + lookup_div_u16_5_inv, + lookup_div_u16_6_inv, + lookup_div_u16_7_inv, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_cd_value_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index 278ce258c3c..6251815e527 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -192,7 +192,6 @@ template struct AvmFullRow { FF main_sel_gas_accounting_active{}; FF main_sel_last{}; FF main_sel_mem_op_a{}; - FF main_sel_mem_op_activate_gas{}; FF main_sel_mem_op_b{}; FF main_sel_mem_op_c{}; FF main_sel_mem_op_d{}; @@ -605,72 +604,72 @@ template struct AvmFullRow { FF slice_sel_start{}; FF slice_space_id{}; FF slice_val{}; - FF perm_pos_mem_read_a{}; - FF perm_pos_mem_read_b{}; - FF perm_pos_mem_read_c{}; - FF perm_pos_mem_read_d{}; - FF perm_pos_mem_write_a{}; - FF perm_pos_mem_write_b{}; - FF perm_pos_mem_write_c{}; - FF perm_pos_mem_write_d{}; - FF perm_slice_mem{}; - FF perm_main_alu{}; - FF perm_main_bin{}; - FF perm_main_conv{}; - FF perm_main_pos2_perm{}; - FF perm_main_pedersen{}; - FF perm_main_slice{}; - FF perm_main_mem_a{}; - FF perm_main_mem_b{}; - FF perm_main_mem_c{}; - FF perm_main_mem_d{}; - FF perm_main_mem_ind_addr_a{}; - FF perm_main_mem_ind_addr_b{}; - FF perm_main_mem_ind_addr_c{}; - FF perm_main_mem_ind_addr_d{}; - FF lookup_byte_lengths{}; - FF lookup_byte_operations{}; - FF lookup_cd_value{}; - FF lookup_ret_value{}; - FF lookup_opcode_gas{}; - FF range_check_l2_gas_hi{}; - FF range_check_l2_gas_lo{}; - FF range_check_da_gas_hi{}; - FF range_check_da_gas_lo{}; - FF kernel_output_lookup{}; - FF lookup_into_kernel{}; - FF incl_main_tag_err{}; - FF incl_mem_tag_err{}; - FF lookup_mem_rng_chk_lo{}; - FF lookup_mem_rng_chk_mid{}; - FF lookup_mem_rng_chk_hi{}; - FF lookup_pow_2_0{}; - FF lookup_pow_2_1{}; - FF lookup_u8_0{}; - FF lookup_u8_1{}; - FF lookup_u16_0{}; - FF lookup_u16_1{}; - FF lookup_u16_2{}; - FF lookup_u16_3{}; - FF lookup_u16_4{}; - FF lookup_u16_5{}; - FF lookup_u16_6{}; - FF lookup_u16_7{}; - FF lookup_u16_8{}; - FF lookup_u16_9{}; - FF lookup_u16_10{}; - FF lookup_u16_11{}; - FF lookup_u16_12{}; - FF lookup_u16_13{}; - FF lookup_u16_14{}; - FF lookup_div_u16_0{}; - FF lookup_div_u16_1{}; - FF lookup_div_u16_2{}; - FF lookup_div_u16_3{}; - FF lookup_div_u16_4{}; - FF lookup_div_u16_5{}; - FF lookup_div_u16_6{}; - FF lookup_div_u16_7{}; + FF perm_pos_mem_read_a_inv{}; + FF perm_pos_mem_read_b_inv{}; + FF perm_pos_mem_read_c_inv{}; + FF perm_pos_mem_read_d_inv{}; + FF perm_pos_mem_write_a_inv{}; + FF perm_pos_mem_write_b_inv{}; + FF perm_pos_mem_write_c_inv{}; + FF perm_pos_mem_write_d_inv{}; + FF perm_slice_mem_inv{}; + FF perm_main_alu_inv{}; + FF perm_main_bin_inv{}; + FF perm_main_conv_inv{}; + FF perm_main_pos2_perm_inv{}; + FF perm_main_pedersen_inv{}; + FF perm_main_slice_inv{}; + FF perm_main_mem_a_inv{}; + FF perm_main_mem_b_inv{}; + FF perm_main_mem_c_inv{}; + FF perm_main_mem_d_inv{}; + FF perm_main_mem_ind_addr_a_inv{}; + FF perm_main_mem_ind_addr_b_inv{}; + FF perm_main_mem_ind_addr_c_inv{}; + FF perm_main_mem_ind_addr_d_inv{}; + FF lookup_byte_lengths_inv{}; + FF lookup_byte_operations_inv{}; + FF lookup_cd_value_inv{}; + FF lookup_ret_value_inv{}; + FF lookup_opcode_gas_inv{}; + FF range_check_l2_gas_hi_inv{}; + FF range_check_l2_gas_lo_inv{}; + FF range_check_da_gas_hi_inv{}; + FF range_check_da_gas_lo_inv{}; + FF kernel_output_lookup_inv{}; + FF lookup_into_kernel_inv{}; + FF incl_main_tag_err_inv{}; + FF incl_mem_tag_err_inv{}; + FF lookup_mem_rng_chk_lo_inv{}; + FF lookup_mem_rng_chk_mid_inv{}; + FF lookup_mem_rng_chk_hi_inv{}; + FF lookup_pow_2_0_inv{}; + FF lookup_pow_2_1_inv{}; + FF lookup_u8_0_inv{}; + FF lookup_u8_1_inv{}; + FF lookup_u16_0_inv{}; + FF lookup_u16_1_inv{}; + FF lookup_u16_2_inv{}; + FF lookup_u16_3_inv{}; + FF lookup_u16_4_inv{}; + FF lookup_u16_5_inv{}; + FF lookup_u16_6_inv{}; + FF lookup_u16_7_inv{}; + FF lookup_u16_8_inv{}; + FF lookup_u16_9_inv{}; + FF lookup_u16_10_inv{}; + FF lookup_u16_11_inv{}; + FF lookup_u16_12_inv{}; + FF lookup_u16_13_inv{}; + FF lookup_u16_14_inv{}; + FF lookup_div_u16_0_inv{}; + FF lookup_div_u16_1_inv{}; + FF lookup_div_u16_2_inv{}; + FF lookup_div_u16_3_inv{}; + FF lookup_div_u16_4_inv{}; + FF lookup_div_u16_5_inv{}; + FF lookup_div_u16_6_inv{}; + FF lookup_div_u16_7_inv{}; FF lookup_byte_lengths_counts{}; FF lookup_byte_operations_counts{}; FF lookup_cd_value_counts{}; @@ -718,7 +717,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 704; + static constexpr size_t SIZE = 703; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp index be6b7555425..355085b61e8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp @@ -6,137 +6,14 @@ namespace bb::Avm_vm { -template struct AluRow { - FF alu_a_hi{}; - FF alu_a_hi_shift{}; - FF alu_a_lo{}; - FF alu_a_lo_shift{}; - FF alu_b_hi{}; - FF alu_b_hi_shift{}; - FF alu_b_lo{}; - FF alu_b_lo_shift{}; - FF alu_borrow{}; - FF alu_cf{}; - FF alu_cmp_rng_ctr{}; - FF alu_cmp_rng_ctr_shift{}; - FF alu_div_u16_r0{}; - FF alu_div_u16_r0_shift{}; - FF alu_div_u16_r1{}; - FF alu_div_u16_r1_shift{}; - FF alu_div_u16_r2{}; - FF alu_div_u16_r2_shift{}; - FF alu_div_u16_r3{}; - FF alu_div_u16_r3_shift{}; - FF alu_div_u16_r4{}; - FF alu_div_u16_r4_shift{}; - FF alu_div_u16_r5{}; - FF alu_div_u16_r5_shift{}; - FF alu_div_u16_r6{}; - FF alu_div_u16_r6_shift{}; - FF alu_div_u16_r7{}; - FF alu_div_u16_r7_shift{}; - FF alu_divisor_hi{}; - FF alu_divisor_lo{}; - FF alu_ff_tag{}; - FF alu_ia{}; - FF alu_ib{}; - FF alu_ic{}; - FF alu_in_tag{}; - FF alu_op_add{}; - FF alu_op_add_shift{}; - FF alu_op_cast{}; - FF alu_op_cast_prev{}; - FF alu_op_cast_prev_shift{}; - FF alu_op_cast_shift{}; - FF alu_op_div{}; - FF alu_op_div_a_lt_b{}; - FF alu_op_div_shift{}; - FF alu_op_div_std{}; - FF alu_op_eq{}; - FF alu_op_eq_diff_inv{}; - FF alu_op_lt{}; - FF alu_op_lte{}; - FF alu_op_mul{}; - FF alu_op_mul_shift{}; - FF alu_op_not{}; - FF alu_op_shl{}; - FF alu_op_shl_shift{}; - FF alu_op_shr{}; - FF alu_op_shr_shift{}; - FF alu_op_sub{}; - FF alu_op_sub_shift{}; - FF alu_p_a_borrow{}; - FF alu_p_b_borrow{}; - FF alu_p_sub_a_hi{}; - FF alu_p_sub_a_hi_shift{}; - FF alu_p_sub_a_lo{}; - FF alu_p_sub_a_lo_shift{}; - FF alu_p_sub_b_hi{}; - FF alu_p_sub_b_hi_shift{}; - FF alu_p_sub_b_lo{}; - FF alu_p_sub_b_lo_shift{}; - FF alu_partial_prod_hi{}; - FF alu_partial_prod_lo{}; - FF alu_quotient_hi{}; - FF alu_quotient_lo{}; - FF alu_remainder{}; - FF alu_res_hi{}; - FF alu_res_lo{}; - FF alu_sel_alu{}; - FF alu_sel_alu_shift{}; - FF alu_sel_cmp{}; - FF alu_sel_cmp_shift{}; - FF alu_sel_div_rng_chk{}; - FF alu_sel_div_rng_chk_shift{}; - FF alu_sel_rng_chk{}; - FF alu_sel_rng_chk_lookup_shift{}; - FF alu_sel_rng_chk_shift{}; - FF alu_sel_shift_which{}; - FF alu_shift_lt_bit_len{}; - FF alu_t_sub_s_bits{}; - FF alu_two_pow_s{}; - FF alu_two_pow_t_sub_s{}; - FF alu_u128_tag{}; - FF alu_u16_r0{}; - FF alu_u16_r0_shift{}; - FF alu_u16_r1{}; - FF alu_u16_r10{}; - FF alu_u16_r11{}; - FF alu_u16_r12{}; - FF alu_u16_r13{}; - FF alu_u16_r14{}; - FF alu_u16_r1_shift{}; - FF alu_u16_r2{}; - FF alu_u16_r2_shift{}; - FF alu_u16_r3{}; - FF alu_u16_r3_shift{}; - FF alu_u16_r4{}; - FF alu_u16_r4_shift{}; - FF alu_u16_r5{}; - FF alu_u16_r5_shift{}; - FF alu_u16_r6{}; - FF alu_u16_r6_shift{}; - FF alu_u16_r7{}; - FF alu_u16_r8{}; - FF alu_u16_r9{}; - FF alu_u16_tag{}; - FF alu_u32_tag{}; - FF alu_u64_tag{}; - FF alu_u8_r0{}; - FF alu_u8_r0_shift{}; - FF alu_u8_r1{}; - FF alu_u8_r1_shift{}; - FF alu_u8_tag{}; -}; - template class aluImpl { public: using FF = FF_; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 8, 3, 4, 4, 5, 4, 4, 3, 4, 3, - 3, 4, 3, 6, 5, 3, 3, 3, 3, 4, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 4, 4, 4, 4, - 4, 3, 5, 5, 4, 5, 5, 2, 3, 3, 3, 3, 3, 4, 4, 3, 5, 3, 3, 3, 5, 3, 3, 4, 4, 4, 4, 4, 4 + 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 4, 5, 5, 4, 4, 4, 5, 3, 3, 4, 5, 3, 3, 3, 3, 3, + 3, 3, 3, 5, 5, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, + 4, 3, 4, 5, 4, 5, 5, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3 }; template @@ -145,6 +22,74 @@ template class aluImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto alu_SUM_8 = new_term.alu_u8_r0; + const auto alu_SUM_16 = (alu_SUM_8 + (new_term.alu_u8_r1 * FF(256))); + const auto alu_SUM_32 = (alu_SUM_16 + (new_term.alu_u16_r0 * FF(65536))); + const auto alu_SUM_64 = + ((alu_SUM_32 + (new_term.alu_u16_r1 * FF(4294967296UL))) + (new_term.alu_u16_r2 * FF(281474976710656UL))); + const auto alu_SUM_96 = ((alu_SUM_64 + (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + + (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))); + const auto alu_SUM_128 = ((alu_SUM_96 + (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + + (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))); + const auto alu_SUM_TAG = (((((new_term.alu_u8_tag * alu_SUM_8) + (new_term.alu_u16_tag * alu_SUM_16)) + + (new_term.alu_u32_tag * alu_SUM_32)) + + (new_term.alu_u64_tag * alu_SUM_64)) + + (new_term.alu_u128_tag * alu_SUM_128)); + const auto alu_SUM_TAG_NO_128 = ((((new_term.alu_u8_tag * alu_SUM_8) + (new_term.alu_u16_tag * alu_SUM_16)) + + (new_term.alu_u32_tag * alu_SUM_32)) + + (new_term.alu_u64_tag * alu_SUM_64)); + const auto alu_SUM_HIGH_64 = + (((new_term.alu_u16_r3 + (new_term.alu_u16_r4 * FF(65536))) + (new_term.alu_u16_r5 * FF(4294967296UL))) + + (new_term.alu_u16_r6 * FF(281474976710656UL))); + const auto alu_SUM_LOW_SHIFTED_64 = ((((new_term.alu_u8_r0_shift + (new_term.alu_u8_r1_shift * FF(256))) + + (new_term.alu_u16_r0_shift * FF(65536))) + + (new_term.alu_u16_r1_shift * FF(4294967296UL))) + + (new_term.alu_u16_r2_shift * FF(281474976710656UL))); + const auto alu_SUM_HIGH_SHIFTED_64 = (((new_term.alu_u16_r3_shift + (new_term.alu_u16_r4_shift * FF(65536))) + + (new_term.alu_u16_r5_shift * FF(4294967296UL))) + + (new_term.alu_u16_r6_shift * FF(281474976710656UL))); + const auto alu_R_64 = + (((new_term.alu_u16_r7 + (new_term.alu_u16_r8 * FF(65536))) + (new_term.alu_u16_r9 * FF(4294967296UL))) + + (new_term.alu_u16_r10 * FF(281474976710656UL))); + const auto alu_SEL_BITWISE = new_term.alu_op_not; + const auto alu_UINT_MAX = ((((((new_term.alu_u8_tag * FF(256)) + (new_term.alu_u16_tag * FF(65536))) + + (new_term.alu_u32_tag * FF(4294967296UL))) + + (new_term.alu_u64_tag * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + + (new_term.alu_u128_tag * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - + FF(1)); + const auto alu_DIFF = (new_term.alu_ia - new_term.alu_ib); + const auto alu_INPUT_IA = + ((new_term.alu_op_lt * new_term.alu_ib) + ((new_term.alu_op_lte + new_term.alu_op_cast) * new_term.alu_ia)); + const auto alu_INPUT_IB = ((new_term.alu_op_lt * new_term.alu_ia) + (new_term.alu_op_lte * new_term.alu_ib)); + const auto alu_A_SUB_B_LO = (((new_term.alu_a_lo - new_term.alu_b_lo) - FF(1)) + + (new_term.alu_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))); + const auto alu_A_SUB_B_HI = ((new_term.alu_a_hi - new_term.alu_b_hi) - new_term.alu_borrow); + const auto alu_B_SUB_A_LO = + ((new_term.alu_b_lo - new_term.alu_a_lo) + (new_term.alu_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))); + const auto alu_B_SUB_A_HI = ((new_term.alu_b_hi - new_term.alu_a_hi) - new_term.alu_borrow); + const auto alu_IS_GT = + ((new_term.alu_op_lt * new_term.alu_ic) + ((FF(1) - new_term.alu_ic) * new_term.alu_op_lte)); + const auto alu_RNG_CHK_OP = + (((((new_term.alu_sel_rng_chk + new_term.alu_sel_cmp) + new_term.alu_op_cast) + new_term.alu_op_cast_prev) + + new_term.alu_shift_lt_bit_len) + + new_term.alu_op_div); + const auto alu_MAX_BITS = + (((((new_term.alu_u8_tag * FF(8)) + (new_term.alu_u16_tag * FF(16))) + (new_term.alu_u32_tag * FF(32))) + + (new_term.alu_u64_tag * FF(64))) + + (new_term.alu_u128_tag * FF(128))); + const auto alu_PRODUCT = + (((new_term.alu_divisor_lo * new_term.alu_quotient_lo) + + (FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }) * new_term.alu_partial_prod_lo)) + + (FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }) * + (new_term.alu_partial_prod_hi + (new_term.alu_divisor_hi * new_term.alu_quotient_hi)))); + const auto alu_NEXT_SUM_64_LO = ((((new_term.alu_u8_r0_shift + (new_term.alu_u8_r1_shift * FF(256))) + + (new_term.alu_u16_r0_shift * FF(65536))) + + (new_term.alu_u16_r1_shift * FF(4294967296UL))) + + (new_term.alu_u16_r2_shift * FF(281474976710656UL))); + const auto alu_NEXT_SUM_128_HI = (((new_term.alu_u16_r3_shift + (new_term.alu_u16_r4_shift * FF(65536))) + + (new_term.alu_u16_r5_shift * FF(4294967296UL))) + + (new_term.alu_u16_r6_shift * FF(281474976710656UL))); + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; auto tmp = @@ -174,43 +119,43 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = (new_term.alu_cf * (-new_term.alu_cf + FF(1))); + auto tmp = (new_term.alu_cf * (FF(1) - new_term.alu_cf)); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = (new_term.alu_ff_tag * (-new_term.alu_ff_tag + FF(1))); + auto tmp = (new_term.alu_ff_tag * (FF(1) - new_term.alu_ff_tag)); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = (new_term.alu_u8_tag * (-new_term.alu_u8_tag + FF(1))); + auto tmp = (new_term.alu_u8_tag * (FF(1) - new_term.alu_u8_tag)); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = (new_term.alu_u16_tag * (-new_term.alu_u16_tag + FF(1))); + auto tmp = (new_term.alu_u16_tag * (FF(1) - new_term.alu_u16_tag)); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = (new_term.alu_u32_tag * (-new_term.alu_u32_tag + FF(1))); + auto tmp = (new_term.alu_u32_tag * (FF(1) - new_term.alu_u32_tag)); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = (new_term.alu_u64_tag * (-new_term.alu_u64_tag + FF(1))); + auto tmp = (new_term.alu_u64_tag * (FF(1) - new_term.alu_u64_tag)); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = (new_term.alu_u128_tag * (-new_term.alu_u128_tag + FF(1))); + auto tmp = (new_term.alu_u128_tag * (FF(1) - new_term.alu_u128_tag)); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } @@ -228,55 +173,27 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; auto tmp = (new_term.alu_in_tag - - (((((new_term.alu_u8_tag + (new_term.alu_u16_tag * FF(2))) + (new_term.alu_u32_tag * FF(3))) + - (new_term.alu_u64_tag * FF(4))) + - (new_term.alu_u128_tag * FF(5))) + - (new_term.alu_ff_tag * FF(6)))); + (((((new_term.alu_u8_tag + (FF(2) * new_term.alu_u16_tag)) + (FF(3) * new_term.alu_u32_tag)) + + (FF(4) * new_term.alu_u64_tag)) + + (FF(5) * new_term.alu_u128_tag)) + + (FF(6) * new_term.alu_ff_tag))); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = - (((new_term.alu_op_add + new_term.alu_op_sub) * - ((((((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + - (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + - (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))) - - new_term.alu_ia) + - (new_term.alu_ff_tag * new_term.alu_ic))) + - ((new_term.alu_op_add - new_term.alu_op_sub) * - ((new_term.alu_cf * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL })) - new_term.alu_ib))); + auto tmp = (((new_term.alu_op_add + new_term.alu_op_sub) * + ((alu_SUM_128 - new_term.alu_ia) + (new_term.alu_ff_tag * new_term.alu_ic))) + + ((new_term.alu_op_add - new_term.alu_op_sub) * + ((new_term.alu_cf * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL })) - new_term.alu_ib))); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = - (((new_term.alu_op_add + new_term.alu_op_sub) * - (((((((new_term.alu_u8_tag * new_term.alu_u8_r0) + - (new_term.alu_u16_tag * (new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))))) + - (new_term.alu_u32_tag * - ((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))))) + - (new_term.alu_u64_tag * - ((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))))) + - (new_term.alu_u128_tag * - ((((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + - (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + - (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + - (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))))) + - (new_term.alu_ff_tag * new_term.alu_ia)) - - new_term.alu_ic)) + - ((new_term.alu_ff_tag * (new_term.alu_op_add - new_term.alu_op_sub)) * new_term.alu_ib)); + auto tmp = (((new_term.alu_op_add + new_term.alu_op_sub) * + ((alu_SUM_TAG + (new_term.alu_ff_tag * new_term.alu_ia)) - new_term.alu_ic)) + + ((new_term.alu_ff_tag * (new_term.alu_op_add - new_term.alu_op_sub)) * new_term.alu_ib)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } @@ -289,16 +206,8 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = - ((((-new_term.alu_ff_tag + FF(1)) - new_term.alu_u128_tag) * new_term.alu_op_mul) * - (((((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + - (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + - (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))) - - (new_term.alu_ia * new_term.alu_ib))); + auto tmp = ((((FF(1) - new_term.alu_ff_tag) - new_term.alu_u128_tag) * new_term.alu_op_mul) * + (alu_SUM_128 - (new_term.alu_ia * new_term.alu_ib))); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } @@ -306,126 +215,82 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; auto tmp = (new_term.alu_op_mul * - (((((new_term.alu_u8_tag * new_term.alu_u8_r0) + - (new_term.alu_u16_tag * (new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))))) + - (new_term.alu_u32_tag * - ((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))))) + - (new_term.alu_u64_tag * - ((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))))) - - (((-new_term.alu_ff_tag + FF(1)) - new_term.alu_u128_tag) * new_term.alu_ic))); + (alu_SUM_TAG_NO_128 - (((FF(1) - new_term.alu_ff_tag) - new_term.alu_u128_tag) * new_term.alu_ic))); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = - ((new_term.alu_u128_tag * new_term.alu_op_mul) * - ((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - ((((new_term.alu_u16_r3 + (new_term.alu_u16_r4 * FF(65536))) + - (new_term.alu_u16_r5 * FF(4294967296UL))) + - (new_term.alu_u16_r6 * FF(281474976710656UL))) * - FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - - new_term.alu_ia)); + auto tmp = ((new_term.alu_u128_tag * new_term.alu_op_mul) * + ((alu_SUM_64 + (alu_SUM_HIGH_64 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - new_term.alu_ia)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; auto tmp = ((new_term.alu_u128_tag * new_term.alu_op_mul) * - ((((((new_term.alu_u8_r0_shift + (new_term.alu_u8_r1_shift * FF(256))) + - (new_term.alu_u16_r0_shift * FF(65536))) + - (new_term.alu_u16_r1_shift * FF(4294967296UL))) + - (new_term.alu_u16_r2_shift * FF(281474976710656UL))) + - ((((new_term.alu_u16_r3_shift + (new_term.alu_u16_r4_shift * FF(65536))) + - (new_term.alu_u16_r5_shift * FF(4294967296UL))) + - (new_term.alu_u16_r6_shift * FF(281474976710656UL))) * - FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - + ((alu_SUM_LOW_SHIFTED_64 + (alu_SUM_HIGH_SHIFTED_64 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - new_term.alu_ib)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = - ((new_term.alu_u128_tag * new_term.alu_op_mul) * - ((((new_term.alu_ia * ((((new_term.alu_u8_r0_shift + (new_term.alu_u8_r1_shift * FF(256))) + - (new_term.alu_u16_r0_shift * FF(65536))) + - (new_term.alu_u16_r1_shift * FF(4294967296UL))) + - (new_term.alu_u16_r2_shift * FF(281474976710656UL)))) + - ((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) * - (((new_term.alu_u16_r3_shift + (new_term.alu_u16_r4_shift * FF(65536))) + - (new_term.alu_u16_r5_shift * FF(4294967296UL))) + - (new_term.alu_u16_r6_shift * FF(281474976710656UL)))) * - FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - - (((new_term.alu_cf * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL })) + - (((new_term.alu_u16_r7 + (new_term.alu_u16_r8 * FF(65536))) + - (new_term.alu_u16_r9 * FF(4294967296UL))) + - (new_term.alu_u16_r10 * FF(281474976710656UL)))) * - FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - - new_term.alu_ic)); + auto tmp = ((new_term.alu_u128_tag * new_term.alu_op_mul) * + ((((new_term.alu_ia * alu_SUM_LOW_SHIFTED_64) + + ((alu_SUM_64 * alu_SUM_HIGH_SHIFTED_64) * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) - + (((new_term.alu_cf * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL })) + alu_R_64) * + FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - + new_term.alu_ic)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_not * new_term.alu_ff_tag); + auto tmp = (alu_SEL_BITWISE * new_term.alu_ff_tag); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = - (new_term.alu_op_not * ((new_term.alu_ia + new_term.alu_ic) - - ((((((new_term.alu_u8_tag * FF(256)) + (new_term.alu_u16_tag * FF(65536))) + - (new_term.alu_u32_tag * FF(4294967296UL))) + - (new_term.alu_u64_tag * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u128_tag * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - - FF(1)))); + auto tmp = (new_term.alu_op_not * ((new_term.alu_ia + new_term.alu_ic) - alu_UINT_MAX)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = ((new_term.alu_sel_cmp + new_term.alu_op_eq) * (new_term.alu_ic * (-new_term.alu_ic + FF(1)))); + auto tmp = ((new_term.alu_sel_cmp + new_term.alu_op_eq) * (new_term.alu_ic * (FF(1) - new_term.alu_ic))); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_eq * - ((((new_term.alu_ia - new_term.alu_ib) * - ((new_term.alu_ic * (-new_term.alu_op_eq_diff_inv + FF(1))) + new_term.alu_op_eq_diff_inv)) - - FF(1)) + - new_term.alu_ic)); + auto tmp = (new_term.alu_op_eq * (((alu_DIFF * ((new_term.alu_ic * (FF(1) - new_term.alu_op_eq_diff_inv)) + + new_term.alu_op_eq_diff_inv)) - + FF(1)) + + new_term.alu_ic)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (((new_term.alu_op_lt * new_term.alu_ib) + - ((new_term.alu_op_lte + new_term.alu_op_cast) * new_term.alu_ia)) - - ((new_term.alu_a_lo + (new_term.alu_a_hi * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) * - (new_term.alu_sel_cmp + new_term.alu_op_cast))); + auto tmp = + (alu_INPUT_IA - ((new_term.alu_a_lo + (FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }) * new_term.alu_a_hi)) * + (new_term.alu_sel_cmp + new_term.alu_op_cast))); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (((new_term.alu_op_lt * new_term.alu_ia) + (new_term.alu_op_lte * new_term.alu_ib)) - - ((new_term.alu_b_lo + (new_term.alu_b_hi * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) * - new_term.alu_sel_cmp)); + auto tmp = + (alu_INPUT_IB - ((new_term.alu_b_lo + (FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }) * new_term.alu_b_hi)) * + new_term.alu_sel_cmp)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = (new_term.alu_p_a_borrow * (-new_term.alu_p_a_borrow + FF(1))); + auto tmp = (new_term.alu_p_a_borrow * (FF(1) - new_term.alu_p_a_borrow)); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } @@ -433,7 +298,7 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; auto tmp = ((new_term.alu_p_sub_a_lo - - ((-new_term.alu_a_lo + FF(uint256_t{ 4891460686036598784UL, 2896914383306846353UL, 0UL, 0UL })) + + ((FF(uint256_t{ 4891460686036598784UL, 2896914383306846353UL, 0UL, 0UL }) - new_term.alu_a_lo) + (new_term.alu_p_a_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL })))) * ((new_term.alu_sel_cmp + new_term.alu_op_cast) + new_term.alu_op_div_std)); tmp *= scaling_factor; @@ -443,7 +308,7 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; auto tmp = ((new_term.alu_p_sub_a_hi - - ((-new_term.alu_a_hi + FF(uint256_t{ 13281191951274694749UL, 3486998266802970665UL, 0UL, 0UL })) - + ((FF(uint256_t{ 13281191951274694749UL, 3486998266802970665UL, 0UL, 0UL }) - new_term.alu_a_hi) - new_term.alu_p_a_borrow)) * ((new_term.alu_sel_cmp + new_term.alu_op_cast) + new_term.alu_op_div_std)); tmp *= scaling_factor; @@ -451,7 +316,7 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = (new_term.alu_p_b_borrow * (-new_term.alu_p_b_borrow + FF(1))); + auto tmp = (new_term.alu_p_b_borrow * (FF(1) - new_term.alu_p_b_borrow)); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } @@ -459,7 +324,7 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; auto tmp = ((new_term.alu_p_sub_b_lo - - ((-new_term.alu_b_lo + FF(uint256_t{ 4891460686036598784UL, 2896914383306846353UL, 0UL, 0UL })) + + ((FF(uint256_t{ 4891460686036598784UL, 2896914383306846353UL, 0UL, 0UL }) - new_term.alu_b_lo) + (new_term.alu_p_b_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL })))) * new_term.alu_sel_cmp); tmp *= scaling_factor; @@ -469,7 +334,7 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; auto tmp = ((new_term.alu_p_sub_b_hi - - ((-new_term.alu_b_hi + FF(uint256_t{ 13281191951274694749UL, 3486998266802970665UL, 0UL, 0UL })) - + ((FF(uint256_t{ 13281191951274694749UL, 3486998266802970665UL, 0UL, 0UL }) - new_term.alu_b_hi) - new_term.alu_p_b_borrow)) * new_term.alu_sel_cmp); tmp *= scaling_factor; @@ -478,14 +343,7 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; auto tmp = - ((new_term.alu_res_lo - - (((((new_term.alu_a_lo - new_term.alu_b_lo) - FF(1)) + - (new_term.alu_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) * - ((new_term.alu_op_lt * new_term.alu_ic) + ((-new_term.alu_ic + FF(1)) * new_term.alu_op_lte))) + - (((new_term.alu_b_lo - new_term.alu_a_lo) + - (new_term.alu_borrow * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) * - (-((new_term.alu_op_lt * new_term.alu_ic) + ((-new_term.alu_ic + FF(1)) * new_term.alu_op_lte)) + - FF(1))))) * + ((new_term.alu_res_lo - ((alu_A_SUB_B_LO * alu_IS_GT) + (alu_B_SUB_A_LO * (FF(1) - alu_IS_GT)))) * new_term.alu_sel_cmp); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); @@ -493,12 +351,7 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; auto tmp = - ((new_term.alu_res_hi - - ((((new_term.alu_a_hi - new_term.alu_b_hi) - new_term.alu_borrow) * - ((new_term.alu_op_lt * new_term.alu_ic) + ((-new_term.alu_ic + FF(1)) * new_term.alu_op_lte))) + - (((new_term.alu_b_hi - new_term.alu_a_hi) - new_term.alu_borrow) * - (-((new_term.alu_op_lt * new_term.alu_ic) + ((-new_term.alu_ic + FF(1)) * new_term.alu_op_lte)) + - FF(1))))) * + ((new_term.alu_res_hi - ((alu_A_SUB_B_HI * alu_IS_GT) + (alu_B_SUB_A_HI * (FF(1) - alu_IS_GT)))) * new_term.alu_sel_cmp); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); @@ -518,7 +371,7 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = (new_term.alu_sel_rng_chk * (-new_term.alu_sel_rng_chk + FF(1))); + auto tmp = (new_term.alu_sel_rng_chk * (FF(1) - new_term.alu_sel_rng_chk)); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } @@ -531,7 +384,7 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; auto tmp = ((new_term.alu_cmp_rng_ctr * - (((-new_term.alu_sel_rng_chk + FF(1)) * (-new_term.alu_op_eq_diff_inv + FF(1))) + + (((FF(1) - new_term.alu_sel_rng_chk) * (FF(1) - new_term.alu_op_eq_diff_inv)) + new_term.alu_op_eq_diff_inv)) - new_term.alu_sel_rng_chk); tmp *= scaling_factor; @@ -555,19 +408,7 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = - (new_term.alu_a_lo - - (((((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + - (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + - (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))) * - (((((new_term.alu_sel_rng_chk + new_term.alu_sel_cmp) + new_term.alu_op_cast) + - new_term.alu_op_cast_prev) + - new_term.alu_shift_lt_bit_len) + - new_term.alu_op_div))); + auto tmp = (new_term.alu_a_lo - (alu_SUM_128 * alu_RNG_CHK_OP)); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } @@ -581,10 +422,7 @@ template class aluImpl { (new_term.alu_u16_r12 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + (new_term.alu_u16_r13 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + (new_term.alu_u16_r14 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))) * - (((((new_term.alu_sel_rng_chk + new_term.alu_sel_cmp) + new_term.alu_op_cast) + - new_term.alu_op_cast_prev) + - new_term.alu_shift_lt_bit_len) + - new_term.alu_op_div))); + alu_RNG_CHK_OP)); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } @@ -645,25 +483,7 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; auto tmp = - (new_term.alu_op_cast * - (((((((new_term.alu_u8_tag * new_term.alu_u8_r0) + - (new_term.alu_u16_tag * (new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))))) + - (new_term.alu_u32_tag * - ((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))))) + - (new_term.alu_u64_tag * - ((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))))) + - (new_term.alu_u128_tag * - ((((((((new_term.alu_u8_r0 + (new_term.alu_u8_r1 * FF(256))) + (new_term.alu_u16_r0 * FF(65536))) + - (new_term.alu_u16_r1 * FF(4294967296UL))) + - (new_term.alu_u16_r2 * FF(281474976710656UL))) + - (new_term.alu_u16_r3 * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - (new_term.alu_u16_r4 * FF(uint256_t{ 0UL, 65536UL, 0UL, 0UL }))) + - (new_term.alu_u16_r5 * FF(uint256_t{ 0UL, 4294967296UL, 0UL, 0UL }))) + - (new_term.alu_u16_r6 * FF(uint256_t{ 0UL, 281474976710656UL, 0UL, 0UL }))))) + - (new_term.alu_ff_tag * new_term.alu_ia)) - - new_term.alu_ic)); + (new_term.alu_op_cast * ((alu_SUM_TAG + (new_term.alu_ff_tag * new_term.alu_ia)) - new_term.alu_ic)); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } @@ -716,7 +536,7 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.alu_shift_lt_bit_len * (-new_term.alu_shift_lt_bit_len + FF(1))); + auto tmp = (new_term.alu_shift_lt_bit_len * (FF(1) - new_term.alu_shift_lt_bit_len)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } @@ -724,17 +544,8 @@ template class aluImpl { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; auto tmp = (new_term.alu_t_sub_s_bits - (new_term.alu_sel_shift_which * - ((new_term.alu_shift_lt_bit_len * - ((((((new_term.alu_u8_tag * FF(8)) + (new_term.alu_u16_tag * FF(16))) + - (new_term.alu_u32_tag * FF(32))) + - (new_term.alu_u64_tag * FF(64))) + - (new_term.alu_u128_tag * FF(128))) - - new_term.alu_ib)) + - ((-new_term.alu_shift_lt_bit_len + FF(1)) * - (new_term.alu_ib - (((((new_term.alu_u8_tag * FF(8)) + (new_term.alu_u16_tag * FF(16))) + - (new_term.alu_u32_tag * FF(32))) + - (new_term.alu_u64_tag * FF(64))) + - (new_term.alu_u128_tag * FF(128)))))))); + ((new_term.alu_shift_lt_bit_len * (alu_MAX_BITS - new_term.alu_ib)) + + ((FF(1) - new_term.alu_shift_lt_bit_len) * (new_term.alu_ib - alu_MAX_BITS))))); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } @@ -774,7 +585,7 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_div_a_lt_b * (-new_term.alu_op_div_a_lt_b + FF(1))); + auto tmp = (new_term.alu_op_div_a_lt_b * (FF(1) - new_term.alu_op_div_a_lt_b)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } @@ -799,21 +610,21 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_div_std * (-new_term.alu_op_div_std + FF(1))); + auto tmp = (new_term.alu_op_div_std * (FF(1) - new_term.alu_op_div_std)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; auto tmp = (new_term.alu_op_div_std * ((new_term.alu_ib - new_term.alu_divisor_lo) - - (new_term.alu_divisor_hi * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL })))); + (FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }) * new_term.alu_divisor_hi))); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; auto tmp = (new_term.alu_op_div_std * ((new_term.alu_ic - new_term.alu_quotient_lo) - - (new_term.alu_quotient_hi * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL })))); + (FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }) * new_term.alu_quotient_hi))); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } @@ -822,18 +633,15 @@ template class aluImpl { auto tmp = (((new_term.alu_divisor_hi * new_term.alu_quotient_lo) + (new_term.alu_divisor_lo * new_term.alu_quotient_hi)) - - (new_term.alu_partial_prod_lo + (new_term.alu_partial_prod_hi * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL })))); + (new_term.alu_partial_prod_lo + (FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }) * new_term.alu_partial_prod_hi))); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_div_std * - ((((new_term.alu_divisor_lo * new_term.alu_quotient_lo) + - (new_term.alu_partial_prod_lo * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - ((new_term.alu_partial_prod_hi + (new_term.alu_divisor_hi * new_term.alu_quotient_hi)) * - FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - - (new_term.alu_a_lo + (new_term.alu_a_hi * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))))); + auto tmp = + (new_term.alu_op_div_std * + (alu_PRODUCT - (new_term.alu_a_lo + (FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }) * new_term.alu_a_hi)))); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } @@ -858,18 +666,13 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = (new_term.alu_op_div_std * - ((((new_term.alu_divisor_lo * new_term.alu_quotient_lo) + - (new_term.alu_partial_prod_lo * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + - ((new_term.alu_partial_prod_hi + (new_term.alu_divisor_hi * new_term.alu_quotient_hi)) * - FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - - (new_term.alu_ia - new_term.alu_remainder))); + auto tmp = (new_term.alu_op_div_std * (alu_PRODUCT - (new_term.alu_ia - new_term.alu_remainder))); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = (new_term.alu_sel_div_rng_chk * (-new_term.alu_sel_div_rng_chk + FF(1))); + auto tmp = (new_term.alu_sel_div_rng_chk * (FF(1) - new_term.alu_sel_div_rng_chk)); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } @@ -919,22 +722,13 @@ template class aluImpl { } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = - (new_term.alu_partial_prod_lo - - (new_term.alu_op_div_std * ((((new_term.alu_u8_r0_shift + (new_term.alu_u8_r1_shift * FF(256))) + - (new_term.alu_u16_r0_shift * FF(65536))) + - (new_term.alu_u16_r1_shift * FF(4294967296UL))) + - (new_term.alu_u16_r2_shift * FF(281474976710656UL))))); + auto tmp = (new_term.alu_partial_prod_lo - (new_term.alu_op_div_std * alu_NEXT_SUM_64_LO)); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = - (new_term.alu_partial_prod_hi - - (new_term.alu_op_div_std * (((new_term.alu_u16_r3_shift + (new_term.alu_u16_r4_shift * FF(65536))) + - (new_term.alu_u16_r5_shift * FF(4294967296UL))) + - (new_term.alu_u16_r6_shift * FF(281474976710656UL))))); + auto tmp = (new_term.alu_partial_prod_hi - (new_term.alu_op_div_std * alu_NEXT_SUM_128_HI)); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp index 585b3e02ad3..11d51a5a226 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp @@ -6,29 +6,11 @@ namespace bb::Avm_vm { -template struct BinaryRow { - FF binary_acc_ia{}; - FF binary_acc_ia_shift{}; - FF binary_acc_ib{}; - FF binary_acc_ib_shift{}; - FF binary_acc_ic{}; - FF binary_acc_ic_shift{}; - FF binary_ia_bytes{}; - FF binary_ib_bytes{}; - FF binary_ic_bytes{}; - FF binary_mem_tag_ctr{}; - FF binary_mem_tag_ctr_inv{}; - FF binary_mem_tag_ctr_shift{}; - FF binary_op_id{}; - FF binary_op_id_shift{}; - FF binary_sel_bin{}; -}; - template class binaryImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 4, 3, 3, 3, 4, 4, 4 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 4, 3, 3, 3, 3, 3, 3 }; template void static accumulate(ContainerOverSubrelations& evals, @@ -36,9 +18,10 @@ template class binaryImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.binary_sel_bin * (-new_term.binary_sel_bin + FF(1))); + auto tmp = (new_term.binary_sel_bin * (FF(1) - new_term.binary_sel_bin)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } @@ -58,7 +41,7 @@ template class binaryImpl { { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; auto tmp = ((new_term.binary_mem_tag_ctr * - (((-new_term.binary_sel_bin + FF(1)) * (-new_term.binary_mem_tag_ctr_inv + FF(1))) + + (((FF(1) - new_term.binary_sel_bin) * (FF(1) - new_term.binary_mem_tag_ctr_inv)) + new_term.binary_mem_tag_ctr_inv)) - new_term.binary_sel_bin); tmp *= scaling_factor; @@ -66,26 +49,26 @@ template class binaryImpl { } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ia); + auto tmp = ((FF(1) - new_term.binary_sel_bin) * new_term.binary_acc_ia); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ib); + auto tmp = ((FF(1) - new_term.binary_sel_bin) * new_term.binary_acc_ib); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ic); + auto tmp = ((FF(1) - new_term.binary_sel_bin) * new_term.binary_acc_ic); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; auto tmp = - (((new_term.binary_acc_ia - new_term.binary_ia_bytes) - (new_term.binary_acc_ia_shift * FF(256))) * + (((new_term.binary_acc_ia - new_term.binary_ia_bytes) - (FF(256) * new_term.binary_acc_ia_shift)) * new_term.binary_mem_tag_ctr); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); @@ -93,7 +76,7 @@ template class binaryImpl { { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; auto tmp = - (((new_term.binary_acc_ib - new_term.binary_ib_bytes) - (new_term.binary_acc_ib_shift * FF(256))) * + (((new_term.binary_acc_ib - new_term.binary_ib_bytes) - (FF(256) * new_term.binary_acc_ib_shift)) * new_term.binary_mem_tag_ctr); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); @@ -101,7 +84,7 @@ template class binaryImpl { { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; auto tmp = - (((new_term.binary_acc_ic - new_term.binary_ic_bytes) - (new_term.binary_acc_ic_shift * FF(256))) * + (((new_term.binary_acc_ic - new_term.binary_ic_bytes) - (FF(256) * new_term.binary_acc_ic_shift)) * new_term.binary_mem_tag_ctr); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/conversion.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/conversion.hpp index 76108aeeb0b..ec82a7624ae 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/conversion.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/conversion.hpp @@ -6,10 +6,6 @@ namespace bb::Avm_vm { -template struct ConversionRow { - FF conversion_sel_to_radix_le{}; -}; - template class conversionImpl { public: using FF = FF_; @@ -22,9 +18,10 @@ template class conversionImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.conversion_sel_to_radix_le * (-new_term.conversion_sel_to_radix_le + FF(1))); + auto tmp = (new_term.conversion_sel_to_radix_le * (FF(1) - new_term.conversion_sel_to_radix_le)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp index cd157ae28c9..d57d5895aba 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp @@ -35,7 +35,7 @@ class incl_main_tag_err_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.incl_main_tag_err, + return std::forward_as_tuple(in.incl_main_tag_err_inv, in.incl_main_tag_err_counts, in.mem_tag_err, in.main_tag_err, @@ -45,7 +45,7 @@ class incl_main_tag_err_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.incl_main_tag_err, + return std::forward_as_tuple(in.incl_main_tag_err_inv, in.incl_main_tag_err_counts, in.mem_tag_err, in.main_tag_err, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp index 8ea3c0be818..8d3b91b0db1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp @@ -35,14 +35,22 @@ class incl_mem_tag_err_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple( - in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); + return std::forward_as_tuple(in.incl_mem_tag_err_inv, + in.incl_mem_tag_err_counts, + in.main_tag_err, + in.mem_tag_err, + in.main_clk, + in.mem_clk); } template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple( - in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); + return std::forward_as_tuple(in.incl_mem_tag_err_inv, + in.incl_mem_tag_err_counts, + in.main_tag_err, + in.mem_tag_err, + in.main_clk, + in.mem_clk); } }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/keccakf1600.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/keccakf1600.hpp index 0da7033cb6d..fe4e4c44610 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/keccakf1600.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/keccakf1600.hpp @@ -6,10 +6,6 @@ namespace bb::Avm_vm { -template struct Keccakf1600Row { - FF keccakf1600_sel_keccakf1600{}; -}; - template class keccakf1600Impl { public: using FF = FF_; @@ -22,9 +18,10 @@ template class keccakf1600Impl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.keccakf1600_sel_keccakf1600 * (-new_term.keccakf1600_sel_keccakf1600 + FF(1))); + auto tmp = (new_term.keccakf1600_sel_keccakf1600 * (FF(1) - new_term.keccakf1600_sel_keccakf1600)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp index 37716d25a87..b75bec675d7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp @@ -6,40 +6,6 @@ namespace bb::Avm_vm { -template struct KernelRow { - FF kernel_emit_l2_to_l1_msg_write_offset{}; - FF kernel_emit_l2_to_l1_msg_write_offset_shift{}; - FF kernel_emit_note_hash_write_offset{}; - FF kernel_emit_note_hash_write_offset_shift{}; - FF kernel_emit_nullifier_write_offset{}; - FF kernel_emit_nullifier_write_offset_shift{}; - FF kernel_emit_unencrypted_log_write_offset{}; - FF kernel_emit_unencrypted_log_write_offset_shift{}; - FF kernel_l1_to_l2_msg_exists_write_offset{}; - FF kernel_l1_to_l2_msg_exists_write_offset_shift{}; - FF kernel_note_hash_exist_write_offset{}; - FF kernel_note_hash_exist_write_offset_shift{}; - FF kernel_nullifier_exists_write_offset{}; - FF kernel_nullifier_exists_write_offset_shift{}; - FF kernel_nullifier_non_exists_write_offset{}; - FF kernel_nullifier_non_exists_write_offset_shift{}; - FF kernel_sload_write_offset{}; - FF kernel_sload_write_offset_shift{}; - FF kernel_sstore_write_offset{}; - FF kernel_sstore_write_offset_shift{}; - FF main_ib{}; - FF main_sel_last{}; - FF main_sel_op_emit_l2_to_l1_msg{}; - FF main_sel_op_emit_note_hash{}; - FF main_sel_op_emit_nullifier{}; - FF main_sel_op_emit_unencrypted_log{}; - FF main_sel_op_l1_to_l2_msg_exists{}; - FF main_sel_op_note_hash_exists{}; - FF main_sel_op_nullifier_exists{}; - FF main_sel_op_sload{}; - FF main_sel_op_sstore{}; -}; - template class kernelImpl { public: using FF = FF_; @@ -52,9 +18,11 @@ template class kernelImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto kernel_NOT_LAST = (FF(1) - new_term.main_sel_last); + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * + auto tmp = (kernel_NOT_LAST * (new_term.kernel_note_hash_exist_write_offset_shift - (new_term.kernel_note_hash_exist_write_offset + new_term.main_sel_op_note_hash_exists))); tmp *= scaling_factor; @@ -62,7 +30,7 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * + auto tmp = (kernel_NOT_LAST * (new_term.kernel_emit_note_hash_write_offset_shift - (new_term.kernel_emit_note_hash_write_offset + new_term.main_sel_op_emit_note_hash))); tmp *= scaling_factor; @@ -70,25 +38,23 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = - ((-new_term.main_sel_last + FF(1)) * (new_term.kernel_nullifier_exists_write_offset_shift - - (new_term.kernel_nullifier_exists_write_offset + - (new_term.main_sel_op_nullifier_exists * new_term.main_ib)))); + auto tmp = (kernel_NOT_LAST * (new_term.kernel_nullifier_exists_write_offset_shift - + (new_term.kernel_nullifier_exists_write_offset + + (new_term.main_sel_op_nullifier_exists * new_term.main_ib)))); tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * - (new_term.kernel_nullifier_non_exists_write_offset_shift - - (new_term.kernel_nullifier_non_exists_write_offset + - (new_term.main_sel_op_nullifier_exists * (-new_term.main_ib + FF(1)))))); + auto tmp = (kernel_NOT_LAST * (new_term.kernel_nullifier_non_exists_write_offset_shift - + (new_term.kernel_nullifier_non_exists_write_offset + + (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_ib))))); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * + auto tmp = (kernel_NOT_LAST * (new_term.kernel_emit_nullifier_write_offset_shift - (new_term.kernel_emit_nullifier_write_offset + new_term.main_sel_op_emit_nullifier))); tmp *= scaling_factor; @@ -97,7 +63,7 @@ template class kernelImpl { { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; auto tmp = - ((-new_term.main_sel_last + FF(1)) * + (kernel_NOT_LAST * (new_term.kernel_l1_to_l2_msg_exists_write_offset_shift - (new_term.kernel_l1_to_l2_msg_exists_write_offset + new_term.main_sel_op_l1_to_l2_msg_exists))); tmp *= scaling_factor; @@ -106,7 +72,7 @@ template class kernelImpl { { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; auto tmp = - ((-new_term.main_sel_last + FF(1)) * + (kernel_NOT_LAST * (new_term.kernel_emit_unencrypted_log_write_offset_shift - (new_term.kernel_emit_unencrypted_log_write_offset + new_term.main_sel_op_emit_unencrypted_log))); tmp *= scaling_factor; @@ -114,7 +80,7 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * + auto tmp = (kernel_NOT_LAST * (new_term.kernel_emit_l2_to_l1_msg_write_offset_shift - (new_term.kernel_emit_l2_to_l1_msg_write_offset + new_term.main_sel_op_emit_l2_to_l1_msg))); tmp *= scaling_factor; @@ -122,17 +88,15 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * - (new_term.kernel_sload_write_offset_shift - - (new_term.kernel_sload_write_offset + new_term.main_sel_op_sload))); + auto tmp = (kernel_NOT_LAST * (new_term.kernel_sload_write_offset_shift - + (new_term.kernel_sload_write_offset + new_term.main_sel_op_sload))); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_last + FF(1)) * - (new_term.kernel_sstore_write_offset_shift - - (new_term.kernel_sstore_write_offset + new_term.main_sel_op_sstore))); + auto tmp = (kernel_NOT_LAST * (new_term.kernel_sstore_write_offset_shift - + (new_term.kernel_sstore_write_offset + new_term.main_sel_op_sstore))); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel_output_lookup.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel_output_lookup.hpp index 27a4f3b034d..e64c3dbb75b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel_output_lookup.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel_output_lookup.hpp @@ -35,7 +35,7 @@ class kernel_output_lookup_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.kernel_output_lookup, + return std::forward_as_tuple(in.kernel_output_lookup_inv, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, in.kernel_q_public_input_kernel_out_add_to_table, @@ -51,7 +51,7 @@ class kernel_output_lookup_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.kernel_output_lookup, + return std::forward_as_tuple(in.kernel_output_lookup_inv, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, in.kernel_q_public_input_kernel_out_add_to_table, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp index 48306c678ff..1c7d960b140 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp @@ -35,7 +35,7 @@ class lookup_byte_lengths_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_lengths, + return std::forward_as_tuple(in.lookup_byte_lengths_inv, in.lookup_byte_lengths_counts, in.binary_start, in.byte_lookup_sel_bin, @@ -47,7 +47,7 @@ class lookup_byte_lengths_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_lengths, + return std::forward_as_tuple(in.lookup_byte_lengths_inv, in.lookup_byte_lengths_counts, in.binary_start, in.byte_lookup_sel_bin, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp index 990e68f8694..142e0969b6f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp @@ -35,7 +35,7 @@ class lookup_byte_operations_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_operations, + return std::forward_as_tuple(in.lookup_byte_operations_inv, in.lookup_byte_operations_counts, in.binary_sel_bin, in.byte_lookup_sel_bin, @@ -51,7 +51,7 @@ class lookup_byte_operations_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_operations, + return std::forward_as_tuple(in.lookup_byte_operations_inv, in.lookup_byte_operations_counts, in.binary_sel_bin, in.byte_lookup_sel_bin, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp index d79010b79e8..6de998f1207 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp @@ -35,7 +35,7 @@ class lookup_cd_value_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_cd_value, + return std::forward_as_tuple(in.lookup_cd_value_inv, in.lookup_cd_value_counts, in.slice_sel_cd_cpy, in.main_sel_calldata, @@ -47,7 +47,7 @@ class lookup_cd_value_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_cd_value, + return std::forward_as_tuple(in.lookup_cd_value_inv, in.lookup_cd_value_counts, in.slice_sel_cd_cpy, in.main_sel_calldata, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_0.hpp index 6d5eb914bf1..d08bd6d1e2f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_0.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_0, + return std::forward_as_tuple(in.lookup_div_u16_0_inv, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_0_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_0, + return std::forward_as_tuple(in.lookup_div_u16_0_inv, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_1.hpp index 10b95f3109a..1ba12371043 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_1.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_1, + return std::forward_as_tuple(in.lookup_div_u16_1_inv, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_1_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_1, + return std::forward_as_tuple(in.lookup_div_u16_1_inv, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_2.hpp index 980139dca14..d1df011a9d6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_2.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_2_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_2, + return std::forward_as_tuple(in.lookup_div_u16_2_inv, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_2_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_2, + return std::forward_as_tuple(in.lookup_div_u16_2_inv, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_3.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_3.hpp index 78f146e20fc..2a2637506ba 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_3.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_3_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_3, + return std::forward_as_tuple(in.lookup_div_u16_3_inv, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_3_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_3, + return std::forward_as_tuple(in.lookup_div_u16_3_inv, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_4.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_4.hpp index 286c1c2f375..fcc48246857 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_4.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_4_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_4, + return std::forward_as_tuple(in.lookup_div_u16_4_inv, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_4_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_4, + return std::forward_as_tuple(in.lookup_div_u16_4_inv, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_5.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_5.hpp index ca7d2337de3..c2347b83860 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_5.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_5_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_5, + return std::forward_as_tuple(in.lookup_div_u16_5_inv, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_5_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_5, + return std::forward_as_tuple(in.lookup_div_u16_5_inv, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_6.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_6.hpp index 2c90e085116..fc75f890e30 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_6.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_6_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_6, + return std::forward_as_tuple(in.lookup_div_u16_6_inv, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_6_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_6, + return std::forward_as_tuple(in.lookup_div_u16_6_inv, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_7.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_7.hpp index 2cfd36db9ba..0446a0dd95d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_div_u16_7.hpp @@ -35,7 +35,7 @@ class lookup_div_u16_7_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_7, + return std::forward_as_tuple(in.lookup_div_u16_7_inv, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_div_u16_7_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_7, + return std::forward_as_tuple(in.lookup_div_u16_7_inv, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_into_kernel.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_into_kernel.hpp index b4f60e4a2bf..a2d199b598f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_into_kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_into_kernel.hpp @@ -35,7 +35,7 @@ class lookup_into_kernel_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_into_kernel, + return std::forward_as_tuple(in.lookup_into_kernel_inv, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, in.kernel_q_public_input_kernel_add_to_table, @@ -47,7 +47,7 @@ class lookup_into_kernel_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_into_kernel, + return std::forward_as_tuple(in.lookup_into_kernel_inv, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, in.kernel_q_public_input_kernel_add_to_table, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_hi.hpp index 5c8aaa6fc3b..a177b8d19ae 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_hi.hpp @@ -35,7 +35,7 @@ class lookup_mem_rng_chk_hi_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi_inv, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, in.main_sel_rng_8, @@ -45,7 +45,7 @@ class lookup_mem_rng_chk_hi_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi_inv, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, in.main_sel_rng_8, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_lo.hpp index 0703aedb9b1..4004365ad05 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_lo.hpp @@ -35,7 +35,7 @@ class lookup_mem_rng_chk_lo_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo_inv, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_mem_rng_chk_lo_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo_inv, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_mid.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_mid.hpp index c94810b17a4..87a499f1ed8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_mid.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_mid.hpp @@ -35,7 +35,7 @@ class lookup_mem_rng_chk_mid_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, + return std::forward_as_tuple(in.lookup_mem_rng_chk_mid_inv, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_mem_rng_chk_mid_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, + return std::forward_as_tuple(in.lookup_mem_rng_chk_mid_inv, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp index e5710c1fba5..e08ed613089 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp @@ -35,7 +35,7 @@ class lookup_opcode_gas_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_opcode_gas, + return std::forward_as_tuple(in.lookup_opcode_gas_inv, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, in.gas_sel_gas_cost, @@ -49,7 +49,7 @@ class lookup_opcode_gas_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_opcode_gas, + return std::forward_as_tuple(in.lookup_opcode_gas_inv, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, in.gas_sel_gas_cost, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp index 863fcfeac24..6c3eaca3787 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp @@ -35,7 +35,7 @@ class lookup_pow_2_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_0, + return std::forward_as_tuple(in.lookup_pow_2_0_inv, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, in.main_sel_rng_8, @@ -47,7 +47,7 @@ class lookup_pow_2_0_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_0, + return std::forward_as_tuple(in.lookup_pow_2_0_inv, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, in.main_sel_rng_8, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp index 051051f5ac4..444061a8da6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp @@ -35,7 +35,7 @@ class lookup_pow_2_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_1, + return std::forward_as_tuple(in.lookup_pow_2_1_inv, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, in.main_sel_rng_8, @@ -47,7 +47,7 @@ class lookup_pow_2_1_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_1, + return std::forward_as_tuple(in.lookup_pow_2_1_inv, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, in.main_sel_rng_8, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp index ebdda1877a3..a0cc928991f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp @@ -35,7 +35,7 @@ class lookup_ret_value_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_ret_value, + return std::forward_as_tuple(in.lookup_ret_value_inv, in.lookup_ret_value_counts, in.slice_sel_return, in.main_sel_returndata, @@ -47,7 +47,7 @@ class lookup_ret_value_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_ret_value, + return std::forward_as_tuple(in.lookup_ret_value_inv, in.lookup_ret_value_counts, in.slice_sel_return, in.main_sel_returndata, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_0.hpp index df8468fa309..8dd0abc45b0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_0.hpp @@ -35,7 +35,7 @@ class lookup_u16_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_0, + return std::forward_as_tuple(in.lookup_u16_0_inv, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_0_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_0, + return std::forward_as_tuple(in.lookup_u16_0_inv, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_1.hpp index b32bf947096..fe442c41f2c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_1.hpp @@ -35,7 +35,7 @@ class lookup_u16_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_1, + return std::forward_as_tuple(in.lookup_u16_1_inv, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_1_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_1, + return std::forward_as_tuple(in.lookup_u16_1_inv, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_10.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_10.hpp index cbc6159e660..139263c36f6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_10.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_10.hpp @@ -35,7 +35,7 @@ class lookup_u16_10_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_10, + return std::forward_as_tuple(in.lookup_u16_10_inv, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_10_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_10, + return std::forward_as_tuple(in.lookup_u16_10_inv, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_11.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_11.hpp index c851e3174e7..e623912ebdb 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_11.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_11.hpp @@ -35,7 +35,7 @@ class lookup_u16_11_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_11, + return std::forward_as_tuple(in.lookup_u16_11_inv, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_11_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_11, + return std::forward_as_tuple(in.lookup_u16_11_inv, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_12.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_12.hpp index 897d9aa182b..597f1f31979 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_12.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_12.hpp @@ -35,7 +35,7 @@ class lookup_u16_12_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_12, + return std::forward_as_tuple(in.lookup_u16_12_inv, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_12_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_12, + return std::forward_as_tuple(in.lookup_u16_12_inv, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_13.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_13.hpp index adcb2988599..660b420b058 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_13.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_13.hpp @@ -35,7 +35,7 @@ class lookup_u16_13_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_13, + return std::forward_as_tuple(in.lookup_u16_13_inv, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_13_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_13, + return std::forward_as_tuple(in.lookup_u16_13_inv, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_14.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_14.hpp index b9fb986d084..4e65b530a8a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_14.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_14.hpp @@ -35,7 +35,7 @@ class lookup_u16_14_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_14, + return std::forward_as_tuple(in.lookup_u16_14_inv, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_14_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_14, + return std::forward_as_tuple(in.lookup_u16_14_inv, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_2.hpp index 765f529a0f7..6ea468a9d8a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_2.hpp @@ -35,7 +35,7 @@ class lookup_u16_2_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_2, + return std::forward_as_tuple(in.lookup_u16_2_inv, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_2_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_2, + return std::forward_as_tuple(in.lookup_u16_2_inv, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_3.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_3.hpp index 9ea811735f7..db05d23c038 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_3.hpp @@ -35,7 +35,7 @@ class lookup_u16_3_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_3, + return std::forward_as_tuple(in.lookup_u16_3_inv, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_3_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_3, + return std::forward_as_tuple(in.lookup_u16_3_inv, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_4.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_4.hpp index 5dcfff11f66..cf0232bde8b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_4.hpp @@ -35,7 +35,7 @@ class lookup_u16_4_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_4, + return std::forward_as_tuple(in.lookup_u16_4_inv, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_4_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_4, + return std::forward_as_tuple(in.lookup_u16_4_inv, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_5.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_5.hpp index 43cc658542f..b8778b9d7f9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_5.hpp @@ -35,7 +35,7 @@ class lookup_u16_5_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_5, + return std::forward_as_tuple(in.lookup_u16_5_inv, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_5_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_5, + return std::forward_as_tuple(in.lookup_u16_5_inv, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_6.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_6.hpp index 46d4b80a693..eafeb4e194d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_6.hpp @@ -35,7 +35,7 @@ class lookup_u16_6_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_6, + return std::forward_as_tuple(in.lookup_u16_6_inv, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_6_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_6, + return std::forward_as_tuple(in.lookup_u16_6_inv, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_7.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_7.hpp index 576cc99c002..364baa38108 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_7.hpp @@ -35,7 +35,7 @@ class lookup_u16_7_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_7, + return std::forward_as_tuple(in.lookup_u16_7_inv, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_7_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_7, + return std::forward_as_tuple(in.lookup_u16_7_inv, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_8.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_8.hpp index 866e349c377..708918abde8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_8.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_8.hpp @@ -35,7 +35,7 @@ class lookup_u16_8_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_8, + return std::forward_as_tuple(in.lookup_u16_8_inv, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_8_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_8, + return std::forward_as_tuple(in.lookup_u16_8_inv, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_9.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_9.hpp index 0e3716af788..02254738d4b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_9.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u16_9.hpp @@ -35,7 +35,7 @@ class lookup_u16_9_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_9, + return std::forward_as_tuple(in.lookup_u16_9_inv, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class lookup_u16_9_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_9, + return std::forward_as_tuple(in.lookup_u16_9_inv, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_0.hpp index 17d5956c9e2..3f1847af2db 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_0.hpp @@ -35,7 +35,7 @@ class lookup_u8_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_0, + return std::forward_as_tuple(in.lookup_u8_0_inv, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_8, @@ -45,7 +45,7 @@ class lookup_u8_0_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_0, + return std::forward_as_tuple(in.lookup_u8_0_inv, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_8, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_1.hpp index 5c194db8b1a..f86ed91dfe3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_u8_1.hpp @@ -35,7 +35,7 @@ class lookup_u8_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_1, + return std::forward_as_tuple(in.lookup_u8_1_inv, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_8, @@ -45,7 +45,7 @@ class lookup_u8_1_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_1, + return std::forward_as_tuple(in.lookup_u8_1_inv, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, in.main_sel_rng_8, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index a1e07822a12..517d556e3bb 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -6,141 +6,16 @@ namespace bb::Avm_vm { -template struct MainRow { - FF kernel_emit_l2_to_l1_msg_write_offset{}; - FF kernel_emit_note_hash_write_offset{}; - FF kernel_emit_nullifier_write_offset{}; - FF kernel_emit_unencrypted_log_write_offset{}; - FF kernel_kernel_in_offset{}; - FF kernel_kernel_out_offset{}; - FF kernel_l1_to_l2_msg_exists_write_offset{}; - FF kernel_note_hash_exist_write_offset{}; - FF kernel_nullifier_exists_write_offset{}; - FF kernel_nullifier_non_exists_write_offset{}; - FF kernel_side_effect_counter{}; - FF kernel_side_effect_counter_shift{}; - FF kernel_sload_write_offset{}; - FF kernel_sstore_write_offset{}; - FF main_abs_da_rem_gas_hi{}; - FF main_abs_da_rem_gas_lo{}; - FF main_abs_l2_rem_gas_hi{}; - FF main_abs_l2_rem_gas_lo{}; - FF main_alu_in_tag{}; - FF main_bin_op_id{}; - FF main_call_ptr{}; - FF main_da_gas_op_cost{}; - FF main_da_gas_remaining{}; - FF main_da_gas_remaining_shift{}; - FF main_da_out_of_gas{}; - FF main_ia{}; - FF main_ib{}; - FF main_ic{}; - FF main_id{}; - FF main_id_zero{}; - FF main_internal_return_ptr{}; - FF main_internal_return_ptr_shift{}; - FF main_inv{}; - FF main_l2_gas_op_cost{}; - FF main_l2_gas_remaining{}; - FF main_l2_gas_remaining_shift{}; - FF main_l2_out_of_gas{}; - FF main_mem_addr_a{}; - FF main_mem_addr_b{}; - FF main_op_err{}; - FF main_pc{}; - FF main_pc_shift{}; - FF main_r_in_tag{}; - FF main_rwa{}; - FF main_rwb{}; - FF main_rwc{}; - FF main_rwd{}; - FF main_sel_alu{}; - FF main_sel_bin{}; - FF main_sel_first{}; - FF main_sel_gas_accounting_active{}; - FF main_sel_mem_op_a{}; - FF main_sel_mem_op_activate_gas{}; - FF main_sel_mem_op_b{}; - FF main_sel_mem_op_c{}; - FF main_sel_mem_op_d{}; - FF main_sel_mov_ia_to_ic{}; - FF main_sel_mov_ib_to_ic{}; - FF main_sel_op_add{}; - FF main_sel_op_address{}; - FF main_sel_op_and{}; - FF main_sel_op_block_number{}; - FF main_sel_op_calldata_copy{}; - FF main_sel_op_cast{}; - FF main_sel_op_chain_id{}; - FF main_sel_op_cmov{}; - FF main_sel_op_coinbase{}; - FF main_sel_op_dagasleft{}; - FF main_sel_op_div{}; - FF main_sel_op_emit_l2_to_l1_msg{}; - FF main_sel_op_emit_note_hash{}; - FF main_sel_op_emit_nullifier{}; - FF main_sel_op_emit_unencrypted_log{}; - FF main_sel_op_eq{}; - FF main_sel_op_external_call{}; - FF main_sel_op_external_return{}; - FF main_sel_op_fdiv{}; - FF main_sel_op_fee_per_da_gas{}; - FF main_sel_op_fee_per_l2_gas{}; - FF main_sel_op_function_selector{}; - FF main_sel_op_get_contract_instance{}; - FF main_sel_op_halt{}; - FF main_sel_op_internal_call{}; - FF main_sel_op_internal_return{}; - FF main_sel_op_jump{}; - FF main_sel_op_jumpi{}; - FF main_sel_op_keccak{}; - FF main_sel_op_l1_to_l2_msg_exists{}; - FF main_sel_op_l2gasleft{}; - FF main_sel_op_lt{}; - FF main_sel_op_lte{}; - FF main_sel_op_mov{}; - FF main_sel_op_mul{}; - FF main_sel_op_not{}; - FF main_sel_op_note_hash_exists{}; - FF main_sel_op_nullifier_exists{}; - FF main_sel_op_or{}; - FF main_sel_op_pedersen{}; - FF main_sel_op_poseidon2{}; - FF main_sel_op_radix_le{}; - FF main_sel_op_sender{}; - FF main_sel_op_sha256{}; - FF main_sel_op_shl{}; - FF main_sel_op_shr{}; - FF main_sel_op_sload{}; - FF main_sel_op_sstore{}; - FF main_sel_op_storage_address{}; - FF main_sel_op_sub{}; - FF main_sel_op_timestamp{}; - FF main_sel_op_transaction_fee{}; - FF main_sel_op_version{}; - FF main_sel_op_xor{}; - FF main_sel_q_kernel_lookup{}; - FF main_sel_q_kernel_output_lookup{}; - FF main_sel_resolve_ind_addr_a{}; - FF main_sel_resolve_ind_addr_b{}; - FF main_sel_resolve_ind_addr_c{}; - FF main_sel_resolve_ind_addr_d{}; - FF main_sel_slice_gadget{}; - FF main_space_id{}; - FF main_tag_err{}; - FF main_w_in_tag{}; -}; - template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2 }; template @@ -149,21 +24,94 @@ template class mainImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto constants_SENDER_SELECTOR = FF(0); + const auto constants_ADDRESS_SELECTOR = FF(1); + const auto constants_STORAGE_ADDRESS_SELECTOR = FF(1); + const auto constants_FUNCTION_SELECTOR_SELECTOR = FF(2); + const auto constants_CHAIN_ID_SELECTOR = FF(29); + const auto constants_VERSION_SELECTOR = FF(30); + const auto constants_BLOCK_NUMBER_SELECTOR = FF(31); + const auto constants_TIMESTAMP_SELECTOR = FF(33); + const auto constants_COINBASE_SELECTOR = FF(34); + const auto constants_FEE_PER_DA_GAS_SELECTOR = FF(36); + const auto constants_FEE_PER_L2_GAS_SELECTOR = FF(37); + const auto constants_TRANSACTION_FEE_SELECTOR = FF(41); + const auto constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET = FF(0); + const auto constants_START_NULLIFIER_EXISTS_OFFSET = FF(16); + const auto constants_START_NULLIFIER_NON_EXISTS_OFFSET = FF(32); + const auto constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET = FF(48); + const auto constants_START_SSTORE_WRITE_OFFSET = FF(64); + const auto constants_START_SLOAD_WRITE_OFFSET = FF(96); + const auto constants_START_EMIT_NOTE_HASH_WRITE_OFFSET = FF(128); + const auto constants_START_EMIT_NULLIFIER_WRITE_OFFSET = FF(144); + const auto constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET = FF(160); + const auto constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET = FF(162); + const auto constants_misc_INTERNAL_CALL_SPACE_ID = FF(255); + const auto main_KERNEL_INPUT_SELECTORS = + (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + + new_term.main_sel_op_sender) + + new_term.main_sel_op_function_selector) + + new_term.main_sel_op_transaction_fee) + + new_term.main_sel_op_chain_id) + + new_term.main_sel_op_version) + + new_term.main_sel_op_block_number) + + new_term.main_sel_op_coinbase) + + new_term.main_sel_op_timestamp) + + new_term.main_sel_op_fee_per_l2_gas) + + new_term.main_sel_op_fee_per_da_gas); + const auto main_KERNEL_OUTPUT_SELECTORS = + ((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + + new_term.main_sel_op_nullifier_exists) + + new_term.main_sel_op_emit_nullifier) + + new_term.main_sel_op_l1_to_l2_msg_exists) + + new_term.main_sel_op_emit_unencrypted_log) + + new_term.main_sel_op_emit_l2_to_l1_msg); + const auto main_INTERNAL_CALL_STACK_SELECTORS = + (((new_term.main_sel_first + new_term.main_sel_op_internal_call) + new_term.main_sel_op_internal_return) + + new_term.main_sel_op_halt); + const auto main_SEL_ALU_R_TAG = + (((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + + new_term.main_sel_op_div) + + new_term.main_sel_op_not) + + new_term.main_sel_op_eq) + + new_term.main_sel_op_lt) + + new_term.main_sel_op_lte) + + new_term.main_sel_op_shr) + + new_term.main_sel_op_shl); + const auto main_SEL_ALU_W_TAG = new_term.main_sel_op_cast; + const auto main_SEL_ALL_ALU = (main_SEL_ALU_R_TAG + main_SEL_ALU_W_TAG); + const auto main_SEL_ALL_LEFTGAS = (new_term.main_sel_op_dagasleft + new_term.main_sel_op_l2gasleft); + const auto main_SEL_ALL_BINARY = + ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor); + const auto main_SEL_ALL_GADGET = + ((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + new_term.main_sel_op_poseidon2) + + new_term.main_sel_op_keccak) + + new_term.main_sel_op_pedersen); + const auto main_SEL_ALL_MEMORY = (new_term.main_sel_op_cmov + new_term.main_sel_op_mov); + const auto main_SEL_ALL_MEM_SLICE = (new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return); + const auto main_OPCODE_SELECTORS = + ((((((((new_term.main_sel_op_fdiv + main_SEL_ALL_ALU) + main_SEL_ALL_BINARY) + main_SEL_ALL_MEMORY) + + main_SEL_ALL_GADGET) + + main_KERNEL_INPUT_SELECTORS) + + main_KERNEL_OUTPUT_SELECTORS) + + main_SEL_ALL_LEFTGAS) + + main_SEL_ALL_MEM_SLICE); + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.main_l2_out_of_gas * (-new_term.main_l2_out_of_gas + FF(1))); + auto tmp = (new_term.main_l2_out_of_gas * (FF(1) - new_term.main_l2_out_of_gas)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = (new_term.main_da_out_of_gas * (-new_term.main_da_out_of_gas + FF(1))); + auto tmp = (new_term.main_da_out_of_gas * (FF(1) - new_term.main_da_out_of_gas)); tmp *= scaling_factor; std::get<1>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_gas_accounting_active * + auto tmp = ((new_term.main_sel_gas_accounting_active * (FF(1) - new_term.main_sel_op_external_call)) * ((new_term.main_l2_gas_remaining_shift - new_term.main_l2_gas_remaining) + new_term.main_l2_gas_op_cost)); tmp *= scaling_factor; @@ -171,7 +119,7 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_gas_accounting_active * + auto tmp = ((new_term.main_sel_gas_accounting_active * (FF(1) - new_term.main_sel_op_external_call)) * ((new_term.main_da_gas_remaining_shift - new_term.main_da_gas_remaining) + new_term.main_da_gas_op_cost)); tmp *= scaling_factor; @@ -179,21 +127,21 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_gas_accounting_active + FF(1)) * new_term.main_l2_gas_op_cost); + auto tmp = ((FF(1) - new_term.main_sel_gas_accounting_active) * new_term.main_l2_gas_op_cost); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = ((-new_term.main_sel_gas_accounting_active + FF(1)) * new_term.main_da_gas_op_cost); + auto tmp = ((FF(1) - new_term.main_sel_gas_accounting_active) * new_term.main_da_gas_op_cost); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_gas_accounting_active * - ((((-(new_term.main_l2_out_of_gas * FF(2)) + FF(1)) * new_term.main_l2_gas_remaining_shift) - - (new_term.main_abs_l2_rem_gas_hi * FF(65536))) - + ((((FF(1) - (FF(2) * new_term.main_l2_out_of_gas)) * new_term.main_l2_gas_remaining_shift) - + (FF(65536) * new_term.main_abs_l2_rem_gas_hi)) - new_term.main_abs_l2_rem_gas_lo)); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); @@ -201,425 +149,425 @@ template class mainImpl { { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_gas_accounting_active * - ((((-(new_term.main_da_out_of_gas * FF(2)) + FF(1)) * new_term.main_da_gas_remaining_shift) - - (new_term.main_abs_da_rem_gas_hi * FF(65536))) - + ((((FF(1) - (FF(2) * new_term.main_da_out_of_gas)) * new_term.main_da_gas_remaining_shift) - + (FF(65536) * new_term.main_abs_da_rem_gas_hi)) - new_term.main_abs_da_rem_gas_lo)); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_address * (-new_term.main_sel_op_address + FF(1))); + auto tmp = (new_term.main_sel_op_address * (FF(1) - new_term.main_sel_op_address)); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * (-new_term.main_sel_op_storage_address + FF(1))); + auto tmp = (new_term.main_sel_op_storage_address * (FF(1) - new_term.main_sel_op_storage_address)); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * (-new_term.main_sel_op_sender + FF(1))); + auto tmp = (new_term.main_sel_op_sender * (FF(1) - new_term.main_sel_op_sender)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * (-new_term.main_sel_op_function_selector + FF(1))); + auto tmp = (new_term.main_sel_op_function_selector * (FF(1) - new_term.main_sel_op_function_selector)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * (-new_term.main_sel_op_transaction_fee + FF(1))); + auto tmp = (new_term.main_sel_op_transaction_fee * (FF(1) - new_term.main_sel_op_transaction_fee)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_chain_id * (-new_term.main_sel_op_chain_id + FF(1))); + auto tmp = (new_term.main_sel_op_chain_id * (FF(1) - new_term.main_sel_op_chain_id)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (-new_term.main_sel_op_version + FF(1))); + auto tmp = (new_term.main_sel_op_version * (FF(1) - new_term.main_sel_op_version)); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * (-new_term.main_sel_op_block_number + FF(1))); + auto tmp = (new_term.main_sel_op_block_number * (FF(1) - new_term.main_sel_op_block_number)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (-new_term.main_sel_op_coinbase + FF(1))); + auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_timestamp * (-new_term.main_sel_op_timestamp + FF(1))); + auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (-new_term.main_sel_op_fee_per_l2_gas + FF(1))); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * (-new_term.main_sel_op_fee_per_da_gas + FF(1))); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (-new_term.main_sel_op_l2gasleft + FF(1))); + auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (-new_term.main_sel_op_dagasleft + FF(1))); + auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * (-new_term.main_sel_op_note_hash_exists + FF(1))); + auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * (-new_term.main_sel_op_emit_note_hash + FF(1))); + auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_nullifier_exists * (-new_term.main_sel_op_nullifier_exists + FF(1))); + auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * (-new_term.main_sel_op_emit_nullifier + FF(1))); + auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (-new_term.main_sel_op_l1_to_l2_msg_exists + FF(1))); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; auto tmp = - (new_term.main_sel_op_emit_unencrypted_log * (-new_term.main_sel_op_emit_unencrypted_log + FF(1))); + (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (-new_term.main_sel_op_emit_l2_to_l1_msg + FF(1))); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; auto tmp = - (new_term.main_sel_op_get_contract_instance * (-new_term.main_sel_op_get_contract_instance + FF(1))); + (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * (-new_term.main_sel_op_sload + FF(1))); + auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * (-new_term.main_sel_op_sstore + FF(1))); + auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_radix_le * (-new_term.main_sel_op_radix_le + FF(1))); + auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sha256 * (-new_term.main_sel_op_sha256 + FF(1))); + auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_poseidon2 * (-new_term.main_sel_op_poseidon2 + FF(1))); + auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_keccak * (-new_term.main_sel_op_keccak + FF(1))); + auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen * (-new_term.main_sel_op_pedersen + FF(1))); + auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_add * (-new_term.main_sel_op_add + FF(1))); + auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sub * (-new_term.main_sel_op_sub + FF(1))); + auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mul * (-new_term.main_sel_op_mul + FF(1))); + auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_div * (-new_term.main_sel_op_div + FF(1))); + auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (-new_term.main_sel_op_fdiv + FF(1))); + auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_not * (-new_term.main_sel_op_not + FF(1))); + auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_eq * (-new_term.main_sel_op_eq + FF(1))); + auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_and * (-new_term.main_sel_op_and + FF(1))); + auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_or * (-new_term.main_sel_op_or + FF(1))); + auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_xor * (-new_term.main_sel_op_xor + FF(1))); + auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cast * (-new_term.main_sel_op_cast + FF(1))); + auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lt * (-new_term.main_sel_op_lt + FF(1))); + auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lte * (-new_term.main_sel_op_lte + FF(1))); + auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shl * (-new_term.main_sel_op_shl + FF(1))); + auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); tmp *= scaling_factor; std::get<50>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shr * (-new_term.main_sel_op_shr + FF(1))); + auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (-new_term.main_sel_op_internal_call + FF(1))); + auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); tmp *= scaling_factor; std::get<52>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (-new_term.main_sel_op_internal_return + FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); tmp *= scaling_factor; std::get<53>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (-new_term.main_sel_op_jump + FF(1))); + auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * (-new_term.main_sel_op_jumpi + FF(1))); + auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_halt * (-new_term.main_sel_op_halt + FF(1))); + auto tmp = (new_term.main_sel_op_halt * (FF(1) - new_term.main_sel_op_halt)); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_call * (-new_term.main_sel_op_external_call + FF(1))); + auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_calldata_copy * (-new_term.main_sel_op_calldata_copy + FF(1))); + auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_return * (-new_term.main_sel_op_external_return + FF(1))); + auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (-new_term.main_sel_op_mov + FF(1))); + auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cmov * (-new_term.main_sel_op_cmov + FF(1))); + auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (-new_term.main_op_err + FF(1))); + auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.main_tag_err * (-new_term.main_tag_err + FF(1))); + auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.main_id_zero * (-new_term.main_id_zero + FF(1))); + auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_a * (-new_term.main_sel_mem_op_a + FF(1))); + auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_b * (-new_term.main_sel_mem_op_b + FF(1))); + auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_c * (-new_term.main_sel_mem_op_c + FF(1))); + auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_d * (-new_term.main_sel_mem_op_d + FF(1))); + auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwa * (-new_term.main_rwa + FF(1))); + auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwb * (-new_term.main_rwb + FF(1))); + auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwc * (-new_term.main_rwc + FF(1))); + auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwd * (-new_term.main_rwd + FF(1))); + auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_a * (-new_term.main_sel_resolve_ind_addr_a + FF(1))); + auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_b * (-new_term.main_sel_resolve_ind_addr_b + FF(1))); + auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_c * (-new_term.main_sel_resolve_ind_addr_c + FF(1))); + auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_d * (-new_term.main_sel_resolve_ind_addr_d + FF(1))); + auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } @@ -632,7 +580,7 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv * (-new_term.main_op_err + FF(1))) * + auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); @@ -647,7 +595,7 @@ template class mainImpl { { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * - (-new_term.main_inv + FF(1))); + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } @@ -671,30 +619,13 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = ((((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas) * - (-new_term.main_sel_q_kernel_lookup + FF(1))); + auto tmp = (main_KERNEL_INPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_lookup)); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = (((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg) * - (-new_term.main_sel_q_kernel_output_lookup + FF(1))); + auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_output_lookup)); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } @@ -707,7 +638,7 @@ template class mainImpl { { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_jumpi * - (((-new_term.main_id_zero + FF(1)) * (new_term.main_pc_shift - new_term.main_ia)) + + (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); @@ -785,481 +716,351 @@ template class mainImpl { { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; auto tmp = - (((((new_term.main_sel_gas_accounting_active - - ((((((((new_term.main_sel_op_fdiv + - ((((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + - new_term.main_sel_op_mul) + - new_term.main_sel_op_div) + - new_term.main_sel_op_not) + - new_term.main_sel_op_eq) + - new_term.main_sel_op_lt) + - new_term.main_sel_op_lte) + - new_term.main_sel_op_shr) + - new_term.main_sel_op_shl) + - new_term.main_sel_op_cast)) + - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)) + - (new_term.main_sel_op_cmov + new_term.main_sel_op_mov)) + - ((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + - new_term.main_sel_op_poseidon2) + - new_term.main_sel_op_keccak) + - new_term.main_sel_op_pedersen)) + - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas)) + - ((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg)) + - (new_term.main_sel_op_dagasleft + new_term.main_sel_op_l2gasleft)) + - (new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return))) - - (((new_term.main_sel_op_jump + new_term.main_sel_op_jumpi) + new_term.main_sel_op_internal_call) + - new_term.main_sel_op_internal_return)) - - new_term.main_sel_op_sload) - - new_term.main_sel_op_sstore) - - new_term.main_sel_mem_op_activate_gas); + ((((FF(1) - new_term.main_sel_first) * (FF(1) - new_term.main_sel_op_halt)) * main_OPCODE_SELECTORS) * + (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = - ((((-new_term.main_sel_first + FF(1)) * (-new_term.main_sel_op_halt + FF(1))) * - ((((((((new_term.main_sel_op_fdiv + - ((((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + - new_term.main_sel_op_div) + - new_term.main_sel_op_not) + - new_term.main_sel_op_eq) + - new_term.main_sel_op_lt) + - new_term.main_sel_op_lte) + - new_term.main_sel_op_shr) + - new_term.main_sel_op_shl) + - new_term.main_sel_op_cast)) + - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)) + - (new_term.main_sel_op_cmov + new_term.main_sel_op_mov)) + - ((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + - new_term.main_sel_op_poseidon2) + - new_term.main_sel_op_keccak) + - new_term.main_sel_op_pedersen)) + - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas)) + - ((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg)) + - (new_term.main_sel_op_dagasleft + new_term.main_sel_op_l2gasleft)) + - (new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return))) * - (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); + auto tmp = ((FF(1) - main_INTERNAL_CALL_STACK_SELECTORS) * + (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = ((-(((new_term.main_sel_first + new_term.main_sel_op_internal_call) + - new_term.main_sel_op_internal_return) + - new_term.main_sel_op_halt) + - FF(1)) * - (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); + auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * + (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * - (new_term.main_space_id - FF(255))); + auto tmp = (main_OPCODE_SELECTORS * (new_term.main_call_ptr - new_term.main_space_id)); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = - (((((((((new_term.main_sel_op_fdiv + - ((((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + - new_term.main_sel_op_div) + - new_term.main_sel_op_not) + - new_term.main_sel_op_eq) + - new_term.main_sel_op_lt) + - new_term.main_sel_op_lte) + - new_term.main_sel_op_shr) + - new_term.main_sel_op_shl) + - new_term.main_sel_op_cast)) + - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)) + - (new_term.main_sel_op_cmov + new_term.main_sel_op_mov)) + - ((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + - new_term.main_sel_op_poseidon2) + - new_term.main_sel_op_keccak) + - new_term.main_sel_op_pedersen)) + - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + - new_term.main_sel_op_timestamp) + - new_term.main_sel_op_fee_per_l2_gas) + - new_term.main_sel_op_fee_per_da_gas)) + - ((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg)) + - (new_term.main_sel_op_dagasleft + new_term.main_sel_op_l2gasleft)) + - (new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return)) * - (new_term.main_call_ptr - new_term.main_space_id)); + auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * + (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * - (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); + auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * - (-new_term.main_inv + FF(1))); + auto tmp = (new_term.main_sel_mov_ia_to_ic - + (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic - - (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (-new_term.main_id_zero + FF(1))))); + auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); + auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); + auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * + (new_term.main_r_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * - (new_term.main_r_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_alu - + ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); tmp *= scaling_factor; std::get<110>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_alu - - ((((((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + - new_term.main_sel_op_div) + - new_term.main_sel_op_not) + - new_term.main_sel_op_eq) + - new_term.main_sel_op_lt) + - new_term.main_sel_op_lte) + - new_term.main_sel_op_shr) + - new_term.main_sel_op_shl) + - new_term.main_sel_op_cast) * - (-new_term.main_tag_err + FF(1))) * - (-new_term.main_op_err + FF(1)))); + auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); tmp *= scaling_factor; std::get<111>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; - auto tmp = ((((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + - new_term.main_sel_op_div) + - new_term.main_sel_op_not) + - new_term.main_sel_op_eq) + - new_term.main_sel_op_lt) + - new_term.main_sel_op_lte) + - new_term.main_sel_op_shr) + - new_term.main_sel_op_shl) * - (new_term.main_alu_in_tag - new_term.main_r_in_tag)); + auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<112>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<113, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cast * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<113>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<114, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<114>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<115, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_address * (new_term.kernel_kernel_in_offset - constants_ADDRESS_SELECTOR)); tmp *= scaling_factor; std::get<115>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<116, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_address * (new_term.kernel_kernel_in_offset - FF(1))); + auto tmp = (new_term.main_sel_op_storage_address * + (new_term.kernel_kernel_in_offset - constants_STORAGE_ADDRESS_SELECTOR)); tmp *= scaling_factor; std::get<116>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<117, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * (new_term.kernel_kernel_in_offset - FF(1))); + auto tmp = (new_term.main_sel_op_sender * (new_term.kernel_kernel_in_offset - constants_SENDER_SELECTOR)); tmp *= scaling_factor; std::get<117>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<118, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * new_term.kernel_kernel_in_offset); + auto tmp = (new_term.main_sel_op_function_selector * + (new_term.kernel_kernel_in_offset - constants_FUNCTION_SELECTOR_SELECTOR)); tmp *= scaling_factor; std::get<118>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<119, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * (new_term.kernel_kernel_in_offset - FF(2))); + auto tmp = (new_term.main_sel_op_transaction_fee * + (new_term.kernel_kernel_in_offset - constants_TRANSACTION_FEE_SELECTOR)); tmp *= scaling_factor; std::get<119>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<120, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * (new_term.kernel_kernel_in_offset - FF(41))); + auto tmp = + (new_term.main_sel_op_chain_id * (new_term.kernel_kernel_in_offset - constants_CHAIN_ID_SELECTOR)); tmp *= scaling_factor; std::get<120>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<121, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_chain_id * (new_term.kernel_kernel_in_offset - FF(29))); + auto tmp = (new_term.main_sel_op_version * (new_term.kernel_kernel_in_offset - constants_VERSION_SELECTOR)); tmp *= scaling_factor; std::get<121>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<122, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (new_term.kernel_kernel_in_offset - FF(30))); + auto tmp = (new_term.main_sel_op_block_number * + (new_term.kernel_kernel_in_offset - constants_BLOCK_NUMBER_SELECTOR)); tmp *= scaling_factor; std::get<122>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<123, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * (new_term.kernel_kernel_in_offset - FF(31))); + auto tmp = + (new_term.main_sel_op_timestamp * (new_term.kernel_kernel_in_offset - constants_TIMESTAMP_SELECTOR)); tmp *= scaling_factor; std::get<123>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<124, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_timestamp * (new_term.kernel_kernel_in_offset - FF(33))); + auto tmp = + (new_term.main_sel_op_coinbase * (new_term.kernel_kernel_in_offset - constants_COINBASE_SELECTOR)); tmp *= scaling_factor; std::get<124>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<125, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (new_term.kernel_kernel_in_offset - FF(34))); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * + (new_term.kernel_kernel_in_offset - constants_FEE_PER_DA_GAS_SELECTOR)); tmp *= scaling_factor; std::get<125>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<126, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * (new_term.kernel_kernel_in_offset - FF(36))); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * + (new_term.kernel_kernel_in_offset - constants_FEE_PER_L2_GAS_SELECTOR)); tmp *= scaling_factor; std::get<126>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<127, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (new_term.kernel_kernel_in_offset - FF(37))); + auto tmp = (new_term.main_sel_op_note_hash_exists * + (new_term.kernel_kernel_out_offset - (constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET + + new_term.kernel_note_hash_exist_write_offset))); tmp *= scaling_factor; std::get<127>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<128, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * - (new_term.kernel_kernel_out_offset - (new_term.kernel_note_hash_exist_write_offset + FF(0)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_note_hash_exist_write_offset); tmp *= scaling_factor; std::get<128>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<129, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_note_hash_exist_write_offset); + auto tmp = (new_term.main_sel_op_emit_note_hash * + (new_term.kernel_kernel_out_offset - + (constants_START_EMIT_NOTE_HASH_WRITE_OFFSET + new_term.kernel_emit_note_hash_write_offset))); tmp *= scaling_factor; std::get<129>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<130, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * - (new_term.kernel_kernel_out_offset - (new_term.kernel_emit_note_hash_write_offset + FF(128)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_note_hash_write_offset); tmp *= scaling_factor; std::get<130>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<131, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_note_hash_write_offset); + auto tmp = (new_term.main_sel_op_nullifier_exists * + (new_term.kernel_kernel_out_offset - + ((new_term.main_ib * + (constants_START_NULLIFIER_EXISTS_OFFSET + new_term.kernel_nullifier_exists_write_offset)) + + ((FF(1) - new_term.main_ib) * (constants_START_NULLIFIER_NON_EXISTS_OFFSET + + new_term.kernel_nullifier_non_exists_write_offset))))); tmp *= scaling_factor; std::get<131>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<132, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_nullifier_exists * - (new_term.kernel_kernel_out_offset - - ((new_term.main_ib * (new_term.kernel_nullifier_exists_write_offset + FF(16))) + - ((-new_term.main_ib + FF(1)) * (new_term.kernel_nullifier_non_exists_write_offset + FF(32)))))); + auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_exists_write_offset); tmp *= scaling_factor; std::get<132>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<133, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_exists_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_non_exists_write_offset); tmp *= scaling_factor; std::get<133>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<134, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_non_exists_write_offset); + auto tmp = (new_term.main_sel_op_emit_nullifier * + (new_term.kernel_kernel_out_offset - + (constants_START_EMIT_NULLIFIER_WRITE_OFFSET + new_term.kernel_emit_nullifier_write_offset))); tmp *= scaling_factor; std::get<134>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<135, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * - (new_term.kernel_kernel_out_offset - (new_term.kernel_emit_nullifier_write_offset + FF(144)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_nullifier_write_offset); tmp *= scaling_factor; std::get<135>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<136, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_nullifier_write_offset); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * + (new_term.kernel_kernel_out_offset - (constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + + new_term.kernel_l1_to_l2_msg_exists_write_offset))); tmp *= scaling_factor; std::get<136>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<137, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_l1_to_l2_msg_exists * - (new_term.kernel_kernel_out_offset - (new_term.kernel_l1_to_l2_msg_exists_write_offset + FF(48)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_l1_to_l2_msg_exists_write_offset); tmp *= scaling_factor; std::get<137>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<138, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_l1_to_l2_msg_exists_write_offset); + auto tmp = (new_term.main_sel_op_emit_unencrypted_log * + (new_term.kernel_kernel_out_offset - (constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET + + new_term.kernel_emit_unencrypted_log_write_offset))); tmp *= scaling_factor; std::get<138>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<139, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_emit_unencrypted_log * - (new_term.kernel_kernel_out_offset - (new_term.kernel_emit_unencrypted_log_write_offset + FF(162)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_unencrypted_log_write_offset); tmp *= scaling_factor; std::get<139>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<140, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_unencrypted_log_write_offset); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * + (new_term.kernel_kernel_out_offset - (constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + + new_term.kernel_emit_l2_to_l1_msg_write_offset))); tmp *= scaling_factor; std::get<140>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<141, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_emit_l2_to_l1_msg * - (new_term.kernel_kernel_out_offset - (new_term.kernel_emit_l2_to_l1_msg_write_offset + FF(160)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_l2_to_l1_msg_write_offset); tmp *= scaling_factor; std::get<141>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<142, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_l2_to_l1_msg_write_offset); + auto tmp = (new_term.main_sel_op_sload * + (new_term.kernel_kernel_out_offset - + (constants_START_SLOAD_WRITE_OFFSET + new_term.kernel_sload_write_offset))); tmp *= scaling_factor; std::get<142>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<143, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * - (new_term.kernel_kernel_out_offset - (new_term.kernel_sload_write_offset + FF(96)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_sload_write_offset); tmp *= scaling_factor; std::get<143>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<144, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_sload_write_offset); + auto tmp = (new_term.main_sel_op_sstore * + (new_term.kernel_kernel_out_offset - + (constants_START_SSTORE_WRITE_OFFSET + new_term.kernel_sstore_write_offset))); tmp *= scaling_factor; std::get<144>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<145, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * - (new_term.kernel_kernel_out_offset - (new_term.kernel_sstore_write_offset + FF(64)))); + auto tmp = (new_term.main_sel_first * new_term.kernel_sstore_write_offset); tmp *= scaling_factor; std::get<145>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<146, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_sstore_write_offset); + auto tmp = (main_KERNEL_OUTPUT_SELECTORS * + (new_term.kernel_side_effect_counter_shift - (new_term.kernel_side_effect_counter + FF(1)))); tmp *= scaling_factor; std::get<146>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<147, ContainerOverSubrelations>; - auto tmp = (((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg) * - (new_term.kernel_side_effect_counter_shift - (new_term.kernel_side_effect_counter + FF(1)))); + auto tmp = (new_term.main_sel_slice_gadget - + ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) * + (FF(1) - new_term.main_tag_err))); tmp *= scaling_factor; std::get<147>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<148, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_slice_gadget - - ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) * - (-new_term.main_tag_err + FF(1)))); + auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); tmp *= scaling_factor; std::get<148>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<149, ContainerOverSubrelations>; - auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (new_term.main_sel_op_xor * FF(2)))); - tmp *= scaling_factor; - std::get<149>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<150, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_bin - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)); tmp *= scaling_factor; - std::get<150>(evals) += typename Accumulator::View(tmp); + std::get<149>(evals) += typename Accumulator::View(tmp); } } }; @@ -1305,73 +1106,73 @@ template class main : public Relation> { return "RETURN_POINTER_INCREMENT"; case 94: return "RETURN_POINTER_DECREMENT"; - case 100: + case 99: return "PC_INCREMENT"; - case 101: + case 100: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 102: + case 101: return "SPACE_ID_INTERNAL"; - case 103: + case 102: return "SPACE_ID_STANDARD_OPCODES"; - case 104: + case 103: return "CMOV_CONDITION_RES_1"; - case 105: + case 104: return "CMOV_CONDITION_RES_2"; - case 108: + case 107: return "MOV_SAME_VALUE_A"; - case 109: + case 108: return "MOV_SAME_VALUE_B"; - case 110: + case 109: return "MOV_MAIN_SAME_TAG"; - case 114: + case 113: return "L2GASLEFT"; - case 115: + case 114: return "DAGASLEFT"; - case 116: + case 115: return "ADDRESS_KERNEL"; - case 117: + case 116: return "STORAGE_ADDRESS_KERNEL"; - case 118: + case 117: return "SENDER_KERNEL"; - case 119: + case 118: return "FUNCTION_SELECTOR_KERNEL"; - case 120: + case 119: return "FEE_TRANSACTION_FEE_KERNEL"; - case 121: + case 120: return "CHAIN_ID_KERNEL"; - case 122: + case 121: return "VERSION_KERNEL"; - case 123: + case 122: return "BLOCK_NUMBER_KERNEL"; - case 124: + case 123: return "TIMESTAMP_KERNEL"; - case 125: + case 124: return "COINBASE_KERNEL"; - case 126: + case 125: return "FEE_DA_GAS_KERNEL"; - case 127: + case 126: return "FEE_L2_GAS_KERNEL"; - case 128: + case 127: return "NOTE_HASH_KERNEL_OUTPUT"; - case 130: + case 129: return "EMIT_NOTE_HASH_KERNEL_OUTPUT"; - case 132: + case 131: return "NULLIFIER_EXISTS_KERNEL_OUTPUT"; - case 135: + case 134: return "EMIT_NULLIFIER_KERNEL_OUTPUT"; - case 137: + case 136: return "L1_TO_L2_MSG_EXISTS_KERNEL_OUTPUT"; - case 139: + case 138: return "EMIT_UNENCRYPTED_LOG_KERNEL_OUTPUT"; - case 141: + case 140: return "EMIT_L2_TO_L1_MSGS_KERNEL_OUTPUT"; - case 143: + case 142: return "SLOAD_KERNEL_OUTPUT"; - case 145: + case 144: return "SSTORE_KERNEL_OUTPUT"; - case 149: + case 148: return "BIN_SEL_1"; - case 150: + case 149: return "BIN_SEL_2"; } return std::to_string(index); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp index 6265b06c87b..68a6095ccad 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp @@ -6,62 +6,12 @@ namespace bb::Avm_vm { -template struct MemRow { - FF main_sel_first{}; - FF mem_addr{}; - FF mem_clk{}; - FF mem_diff_hi{}; - FF mem_diff_lo{}; - FF mem_diff_mid{}; - FF mem_glob_addr{}; - FF mem_glob_addr_shift{}; - FF mem_last{}; - FF mem_lastAccess{}; - FF mem_one_min_inv{}; - FF mem_r_in_tag{}; - FF mem_rw{}; - FF mem_rw_shift{}; - FF mem_sel_mem{}; - FF mem_sel_mem_shift{}; - FF mem_sel_mov_ia_to_ic{}; - FF mem_sel_mov_ib_to_ic{}; - FF mem_sel_op_a{}; - FF mem_sel_op_b{}; - FF mem_sel_op_c{}; - FF mem_sel_op_cmov{}; - FF mem_sel_op_d{}; - FF mem_sel_op_poseidon_read_a{}; - FF mem_sel_op_poseidon_read_b{}; - FF mem_sel_op_poseidon_read_c{}; - FF mem_sel_op_poseidon_read_d{}; - FF mem_sel_op_poseidon_write_a{}; - FF mem_sel_op_poseidon_write_b{}; - FF mem_sel_op_poseidon_write_c{}; - FF mem_sel_op_poseidon_write_d{}; - FF mem_sel_op_slice{}; - FF mem_sel_resolve_ind_addr_a{}; - FF mem_sel_resolve_ind_addr_b{}; - FF mem_sel_resolve_ind_addr_c{}; - FF mem_sel_resolve_ind_addr_d{}; - FF mem_sel_rng_chk{}; - FF mem_skip_check_tag{}; - FF mem_space_id{}; - FF mem_tag{}; - FF mem_tag_err{}; - FF mem_tag_shift{}; - FF mem_tsp{}; - FF mem_tsp_shift{}; - FF mem_val{}; - FF mem_val_shift{}; - FF mem_w_in_tag{}; -}; - template class memImpl { public: using FF = FF_; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 4, 3, 4, 3, 4, 3, 3, 3, 4, 4, 4, + 2, 3, 4, 3, 4, 3, 3, 2, 3, 3, 4, 4, 4, 4, 4, 6, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; @@ -71,99 +21,114 @@ template class memImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto mem_SEL_DIRECT_MEM_OP_A = + ((new_term.mem_sel_op_a + new_term.mem_sel_op_poseidon_read_a) + new_term.mem_sel_op_poseidon_write_a); + const auto mem_SEL_DIRECT_MEM_OP_B = + ((new_term.mem_sel_op_b + new_term.mem_sel_op_poseidon_read_b) + new_term.mem_sel_op_poseidon_write_b); + const auto mem_SEL_DIRECT_MEM_OP_C = + ((new_term.mem_sel_op_c + new_term.mem_sel_op_poseidon_read_c) + new_term.mem_sel_op_poseidon_write_c); + const auto mem_SEL_DIRECT_MEM_OP_D = + ((new_term.mem_sel_op_d + new_term.mem_sel_op_poseidon_read_d) + new_term.mem_sel_op_poseidon_write_d); + const auto mem_NUM_SUB_CLK = FF(12); + const auto mem_IND_OP = (((new_term.mem_sel_resolve_ind_addr_a + new_term.mem_sel_resolve_ind_addr_b) + + new_term.mem_sel_resolve_ind_addr_c) + + new_term.mem_sel_resolve_ind_addr_d); + const auto mem_SUB_CLK = + (new_term.mem_sel_mem * ((((new_term.mem_sel_resolve_ind_addr_b + mem_SEL_DIRECT_MEM_OP_B) + + (FF(2) * (new_term.mem_sel_resolve_ind_addr_c + mem_SEL_DIRECT_MEM_OP_C))) + + (FF(3) * (new_term.mem_sel_resolve_ind_addr_d + mem_SEL_DIRECT_MEM_OP_D))) + + (FF(4) * ((FF(1) - mem_IND_OP) + new_term.mem_rw)))); + const auto mem_DIFF = ((new_term.mem_lastAccess * (new_term.mem_glob_addr_shift - new_term.mem_glob_addr)) + + ((FF(1) - new_term.mem_lastAccess) * (new_term.mem_tsp_shift - new_term.mem_tsp))); + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.mem_lastAccess * (-new_term.mem_lastAccess + FF(1))); + auto tmp = (new_term.mem_lastAccess * (FF(1) - new_term.mem_lastAccess)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = (new_term.mem_last * (-new_term.mem_last + FF(1))); + auto tmp = (new_term.mem_last * (FF(1) - new_term.mem_last)); tmp *= scaling_factor; std::get<1>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = (new_term.mem_rw * (-new_term.mem_rw + FF(1))); + auto tmp = (new_term.mem_rw * (FF(1) - new_term.mem_rw)); tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = (new_term.mem_tag_err * (-new_term.mem_tag_err + FF(1))); + auto tmp = (new_term.mem_tag_err * (FF(1) - new_term.mem_tag_err)); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_op_a * (-new_term.mem_sel_op_a + FF(1))); + auto tmp = (new_term.mem_sel_op_a * (FF(1) - new_term.mem_sel_op_a)); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_op_b * (-new_term.mem_sel_op_b + FF(1))); + auto tmp = (new_term.mem_sel_op_b * (FF(1) - new_term.mem_sel_op_b)); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_op_c * (-new_term.mem_sel_op_c + FF(1))); + auto tmp = (new_term.mem_sel_op_c * (FF(1) - new_term.mem_sel_op_c)); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_op_d * (-new_term.mem_sel_op_d + FF(1))); + auto tmp = (new_term.mem_sel_op_d * (FF(1) - new_term.mem_sel_op_d)); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_op_slice * (-new_term.mem_sel_op_slice + FF(1))); + auto tmp = (new_term.mem_sel_op_slice * (FF(1) - new_term.mem_sel_op_slice)); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_resolve_ind_addr_a * (-new_term.mem_sel_resolve_ind_addr_a + FF(1))); + auto tmp = (new_term.mem_sel_resolve_ind_addr_a * (FF(1) - new_term.mem_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_resolve_ind_addr_b * (-new_term.mem_sel_resolve_ind_addr_b + FF(1))); + auto tmp = (new_term.mem_sel_resolve_ind_addr_b * (FF(1) - new_term.mem_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_resolve_ind_addr_c * (-new_term.mem_sel_resolve_ind_addr_c + FF(1))); + auto tmp = (new_term.mem_sel_resolve_ind_addr_c * (FF(1) - new_term.mem_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_resolve_ind_addr_d * (-new_term.mem_sel_resolve_ind_addr_d + FF(1))); + auto tmp = (new_term.mem_sel_resolve_ind_addr_d * (FF(1) - new_term.mem_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_mem - ((((((((((new_term.mem_sel_op_a + new_term.mem_sel_op_poseidon_read_a) + - new_term.mem_sel_op_poseidon_write_a) + - ((new_term.mem_sel_op_b + new_term.mem_sel_op_poseidon_read_b) + - new_term.mem_sel_op_poseidon_write_b)) + - ((new_term.mem_sel_op_c + new_term.mem_sel_op_poseidon_read_c) + - new_term.mem_sel_op_poseidon_write_c)) + - ((new_term.mem_sel_op_d + new_term.mem_sel_op_poseidon_read_d) + - new_term.mem_sel_op_poseidon_write_d)) + - new_term.mem_sel_resolve_ind_addr_a) + - new_term.mem_sel_resolve_ind_addr_b) + - new_term.mem_sel_resolve_ind_addr_c) + - new_term.mem_sel_resolve_ind_addr_d) + - new_term.mem_sel_op_slice)); + auto tmp = (new_term.mem_sel_mem - + ((((((((mem_SEL_DIRECT_MEM_OP_A + mem_SEL_DIRECT_MEM_OP_B) + mem_SEL_DIRECT_MEM_OP_C) + + mem_SEL_DIRECT_MEM_OP_D) + + new_term.mem_sel_resolve_ind_addr_a) + + new_term.mem_sel_resolve_ind_addr_b) + + new_term.mem_sel_resolve_ind_addr_c) + + new_term.mem_sel_resolve_ind_addr_d) + + new_term.mem_sel_op_slice)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } @@ -176,7 +141,7 @@ template class memImpl { { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; auto tmp = - (((-new_term.main_sel_first + FF(1)) * new_term.mem_sel_mem_shift) * (-new_term.mem_sel_mem + FF(1))); + (((FF(1) - new_term.main_sel_first) * new_term.mem_sel_mem_shift) * (FF(1) - new_term.mem_sel_mem)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } @@ -188,38 +153,19 @@ template class memImpl { } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (((-new_term.mem_last + FF(1)) * new_term.mem_sel_mem) * (-new_term.mem_sel_mem_shift + FF(1))); + auto tmp = (((FF(1) - new_term.mem_last) * new_term.mem_sel_mem) * (FF(1) - new_term.mem_sel_mem_shift)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_rng_chk - (new_term.mem_sel_mem * (-new_term.mem_last + FF(1)))); + auto tmp = (new_term.mem_sel_rng_chk - (new_term.mem_sel_mem * (FF(1) - new_term.mem_last))); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.mem_tsp - - ((new_term.mem_clk * FF(12)) + - (new_term.mem_sel_mem * - ((((new_term.mem_sel_resolve_ind_addr_b + - ((new_term.mem_sel_op_b + new_term.mem_sel_op_poseidon_read_b) + - new_term.mem_sel_op_poseidon_write_b)) + - ((new_term.mem_sel_resolve_ind_addr_c + - ((new_term.mem_sel_op_c + new_term.mem_sel_op_poseidon_read_c) + - new_term.mem_sel_op_poseidon_write_c)) * - FF(2))) + - ((new_term.mem_sel_resolve_ind_addr_d + - ((new_term.mem_sel_op_d + new_term.mem_sel_op_poseidon_read_d) + - new_term.mem_sel_op_poseidon_write_d)) * - FF(3))) + - (((-(((new_term.mem_sel_resolve_ind_addr_a + new_term.mem_sel_resolve_ind_addr_b) + - new_term.mem_sel_resolve_ind_addr_c) + - new_term.mem_sel_resolve_ind_addr_d) + - FF(1)) + - new_term.mem_rw) * - FF(4)))))); + auto tmp = (new_term.mem_tsp - ((mem_NUM_SUB_CLK * new_term.mem_clk) + mem_SUB_CLK)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } @@ -231,69 +177,66 @@ template class memImpl { } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * (-new_term.mem_lastAccess + FF(1))); + auto tmp = (new_term.main_sel_first * (FF(1) - new_term.mem_lastAccess)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = ((-new_term.mem_lastAccess + FF(1)) * (new_term.mem_glob_addr_shift - new_term.mem_glob_addr)); + auto tmp = ((FF(1) - new_term.mem_lastAccess) * (new_term.mem_glob_addr_shift - new_term.mem_glob_addr)); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = (new_term.mem_sel_rng_chk * - (((((new_term.mem_lastAccess * (new_term.mem_glob_addr_shift - new_term.mem_glob_addr)) + - ((-new_term.mem_lastAccess + FF(1)) * (new_term.mem_tsp_shift - new_term.mem_tsp))) - - (new_term.mem_diff_hi * FF(4294967296UL))) - - (new_term.mem_diff_mid * FF(65536))) - - new_term.mem_diff_lo)); + auto tmp = + (new_term.mem_sel_rng_chk * + (((mem_DIFF - (new_term.mem_diff_hi * FF(4294967296UL))) - (new_term.mem_diff_mid * FF(65536))) - + new_term.mem_diff_lo)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (((-new_term.mem_lastAccess + FF(1)) * (-new_term.mem_rw_shift + FF(1))) * + auto tmp = (((FF(1) - new_term.mem_lastAccess) * (FF(1) - new_term.mem_rw_shift)) * (new_term.mem_val_shift - new_term.mem_val)); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (((-new_term.mem_lastAccess + FF(1)) * (-new_term.mem_rw_shift + FF(1))) * + auto tmp = (((FF(1) - new_term.mem_lastAccess) * (FF(1) - new_term.mem_rw_shift)) * (new_term.mem_tag_shift - new_term.mem_tag)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = ((new_term.mem_lastAccess * (-new_term.mem_rw_shift + FF(1))) * new_term.mem_val_shift); + auto tmp = ((new_term.mem_lastAccess * (FF(1) - new_term.mem_rw_shift)) * new_term.mem_val_shift); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; - auto tmp = - (new_term.mem_skip_check_tag - - ((new_term.mem_sel_op_cmov * - ((new_term.mem_sel_op_d + (new_term.mem_sel_op_a * (-new_term.mem_sel_mov_ia_to_ic + FF(1)))) + - (new_term.mem_sel_op_b * (-new_term.mem_sel_mov_ib_to_ic + FF(1))))) + - new_term.mem_sel_op_slice)); + auto tmp = (new_term.mem_skip_check_tag - + ((new_term.mem_sel_op_cmov * + ((new_term.mem_sel_op_d + (new_term.mem_sel_op_a * (FF(1) - new_term.mem_sel_mov_ia_to_ic))) + + (new_term.mem_sel_op_b * (FF(1) - new_term.mem_sel_mov_ib_to_ic)))) + + new_term.mem_sel_op_slice)); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = (((new_term.mem_tag * (-new_term.mem_skip_check_tag + FF(1))) * (-new_term.mem_rw + FF(1))) * - (((new_term.mem_r_in_tag - new_term.mem_tag) * (-new_term.mem_one_min_inv + FF(1))) - + auto tmp = (((new_term.mem_tag * (FF(1) - new_term.mem_skip_check_tag)) * (FF(1) - new_term.mem_rw)) * + (((new_term.mem_r_in_tag - new_term.mem_tag) * (FF(1) - new_term.mem_one_min_inv)) - new_term.mem_tag_err)); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = ((new_term.mem_tag * (-new_term.mem_tag_err + FF(1))) * new_term.mem_one_min_inv); + auto tmp = ((new_term.mem_tag * (FF(1) - new_term.mem_tag_err)) * new_term.mem_one_min_inv); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp index d494daec4b7..537b30b0d32 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp @@ -6,27 +6,6 @@ namespace bb::Avm_vm { -template struct MemSliceRow { - FF slice_addr{}; - FF slice_addr_shift{}; - FF slice_clk{}; - FF slice_clk_shift{}; - FF slice_cnt{}; - FF slice_cnt_shift{}; - FF slice_col_offset{}; - FF slice_col_offset_shift{}; - FF slice_one_min_inv{}; - FF slice_sel_cd_cpy{}; - FF slice_sel_cd_cpy_shift{}; - FF slice_sel_mem_active{}; - FF slice_sel_mem_active_shift{}; - FF slice_sel_return{}; - FF slice_sel_return_shift{}; - FF slice_sel_start_shift{}; - FF slice_space_id{}; - FF slice_space_id_shift{}; -}; - template class mem_sliceImpl { public: using FF = FF_; @@ -39,6 +18,7 @@ template class mem_sliceImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; auto tmp = (new_term.slice_sel_mem_active - (new_term.slice_sel_cd_cpy + new_term.slice_sel_return)); @@ -47,13 +27,13 @@ template class mem_sliceImpl { } { using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = ((new_term.slice_cnt * (-new_term.slice_one_min_inv + FF(1))) - new_term.slice_sel_mem_active); + auto tmp = ((new_term.slice_cnt * (FF(1) - new_term.slice_one_min_inv)) - new_term.slice_sel_mem_active); tmp *= scaling_factor; std::get<1>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = ((-new_term.slice_sel_mem_active + FF(1)) * new_term.slice_one_min_inv); + auto tmp = ((FF(1) - new_term.slice_sel_mem_active) * new_term.slice_one_min_inv); tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } @@ -104,8 +84,8 @@ template class mem_sliceImpl { } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (((-new_term.slice_sel_mem_active + FF(1)) * new_term.slice_sel_mem_active_shift) * - (-new_term.slice_sel_start_shift + FF(1))); + auto tmp = (((FF(1) - new_term.slice_sel_mem_active) * new_term.slice_sel_mem_active_shift) * + (FF(1) - new_term.slice_sel_start_shift)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/pedersen.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/pedersen.hpp index d0d0998fec7..8ca5201e767 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/pedersen.hpp @@ -6,10 +6,6 @@ namespace bb::Avm_vm { -template struct PedersenRow { - FF pedersen_sel_pedersen{}; -}; - template class pedersenImpl { public: using FF = FF_; @@ -22,9 +18,10 @@ template class pedersenImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.pedersen_sel_pedersen * (-new_term.pedersen_sel_pedersen + FF(1))); + auto tmp = (new_term.pedersen_sel_pedersen * (FF(1) - new_term.pedersen_sel_pedersen)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp index 6afb59543ff..6e21f0cf6c1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp @@ -20,7 +20,7 @@ class perm_main_alu_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_alu, + return std::forward_as_tuple(in.perm_main_alu_inv, in.main_sel_alu, in.main_sel_alu, in.alu_sel_alu, @@ -60,7 +60,7 @@ class perm_main_alu_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_alu, + return std::forward_as_tuple(in.perm_main_alu_inv, in.main_sel_alu, in.main_sel_alu, in.alu_sel_alu, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp index 872e6b6dce4..076fbd2339e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp @@ -20,7 +20,7 @@ class perm_main_bin_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_bin, + return std::forward_as_tuple(in.perm_main_bin_inv, in.main_sel_bin, in.main_sel_bin, in.binary_start, @@ -40,7 +40,7 @@ class perm_main_bin_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_bin, + return std::forward_as_tuple(in.perm_main_bin_inv, in.main_sel_bin, in.main_sel_bin, in.binary_start, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp index 9014c3af10c..70fabd25948 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp @@ -20,7 +20,7 @@ class perm_main_conv_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_conv, + return std::forward_as_tuple(in.perm_main_conv_inv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, in.conversion_sel_to_radix_le, @@ -36,7 +36,7 @@ class perm_main_conv_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_conv, + return std::forward_as_tuple(in.perm_main_conv_inv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, in.conversion_sel_to_radix_le, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp index 069e757eb05..bdfd6252bd1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp @@ -20,7 +20,7 @@ class perm_main_mem_a_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_a, + return std::forward_as_tuple(in.perm_main_mem_a_inv, in.main_sel_mem_op_a, in.main_sel_mem_op_a, in.mem_sel_op_a, @@ -46,7 +46,7 @@ class perm_main_mem_a_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_a, + return std::forward_as_tuple(in.perm_main_mem_a_inv, in.main_sel_mem_op_a, in.main_sel_mem_op_a, in.mem_sel_op_a, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp index 78c234553b4..e42a86af392 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp @@ -20,7 +20,7 @@ class perm_main_mem_b_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_b, + return std::forward_as_tuple(in.perm_main_mem_b_inv, in.main_sel_mem_op_b, in.main_sel_mem_op_b, in.mem_sel_op_b, @@ -46,7 +46,7 @@ class perm_main_mem_b_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_b, + return std::forward_as_tuple(in.perm_main_mem_b_inv, in.main_sel_mem_op_b, in.main_sel_mem_op_b, in.mem_sel_op_b, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp index c8644cbf456..d5a4693b804 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp @@ -20,7 +20,7 @@ class perm_main_mem_c_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_c, + return std::forward_as_tuple(in.perm_main_mem_c_inv, in.main_sel_mem_op_c, in.main_sel_mem_op_c, in.mem_sel_op_c, @@ -42,7 +42,7 @@ class perm_main_mem_c_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_c, + return std::forward_as_tuple(in.perm_main_mem_c_inv, in.main_sel_mem_op_c, in.main_sel_mem_op_c, in.mem_sel_op_c, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp index cba0b47f08e..7ca9ac219e3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp @@ -20,7 +20,7 @@ class perm_main_mem_d_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_d, + return std::forward_as_tuple(in.perm_main_mem_d_inv, in.main_sel_mem_op_d, in.main_sel_mem_op_d, in.mem_sel_op_d, @@ -44,7 +44,7 @@ class perm_main_mem_d_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_d, + return std::forward_as_tuple(in.perm_main_mem_d_inv, in.main_sel_mem_op_d, in.main_sel_mem_op_d, in.mem_sel_op_d, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp index 5ed5c2b0068..8da6e08631c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp @@ -20,7 +20,7 @@ class perm_main_mem_ind_addr_a_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_a_inv, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.mem_sel_resolve_ind_addr_a, @@ -36,7 +36,7 @@ class perm_main_mem_ind_addr_a_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_a_inv, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.mem_sel_resolve_ind_addr_a, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp index 8533af76d93..6f3ee4ed7cd 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp @@ -20,7 +20,7 @@ class perm_main_mem_ind_addr_b_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_b_inv, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.mem_sel_resolve_ind_addr_b, @@ -36,7 +36,7 @@ class perm_main_mem_ind_addr_b_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_b_inv, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.mem_sel_resolve_ind_addr_b, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp index 03efaa45c4b..3d698de8da1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp @@ -20,7 +20,7 @@ class perm_main_mem_ind_addr_c_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_c_inv, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.mem_sel_resolve_ind_addr_c, @@ -36,7 +36,7 @@ class perm_main_mem_ind_addr_c_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_c_inv, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.mem_sel_resolve_ind_addr_c, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp index 8f8a2195066..621e7c9bf25 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp @@ -20,7 +20,7 @@ class perm_main_mem_ind_addr_d_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_d_inv, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.mem_sel_resolve_ind_addr_d, @@ -36,7 +36,7 @@ class perm_main_mem_ind_addr_d_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, + return std::forward_as_tuple(in.perm_main_mem_ind_addr_d_inv, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.mem_sel_resolve_ind_addr_d, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pedersen.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pedersen.hpp index f91956a8870..77bd92cea43 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pedersen.hpp @@ -20,7 +20,7 @@ class perm_main_pedersen_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pedersen, + return std::forward_as_tuple(in.perm_main_pedersen_inv, in.main_sel_op_pedersen, in.main_sel_op_pedersen, in.pedersen_sel_pedersen, @@ -32,7 +32,7 @@ class perm_main_pedersen_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pedersen, + return std::forward_as_tuple(in.perm_main_pedersen_inv, in.main_sel_op_pedersen, in.main_sel_op_pedersen, in.pedersen_sel_pedersen, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp index 039aafc23d6..2c5a4a1f702 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp @@ -20,7 +20,7 @@ class perm_main_pos2_perm_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pos2_perm, + return std::forward_as_tuple(in.perm_main_pos2_perm_inv, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, in.poseidon2_sel_poseidon_perm, @@ -34,7 +34,7 @@ class perm_main_pos2_perm_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pos2_perm, + return std::forward_as_tuple(in.perm_main_pos2_perm_inv, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, in.poseidon2_sel_poseidon_perm, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_slice.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_slice.hpp index abdd10c9300..550c68d60ce 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_slice.hpp @@ -20,7 +20,7 @@ class perm_main_slice_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_slice, + return std::forward_as_tuple(in.perm_main_slice_inv, in.main_sel_slice_gadget, in.main_sel_slice_gadget, in.slice_sel_start, @@ -42,7 +42,7 @@ class perm_main_slice_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_slice, + return std::forward_as_tuple(in.perm_main_slice_inv, in.main_sel_slice_gadget, in.main_sel_slice_gadget, in.slice_sel_start, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp index 55f910a2cdf..80b8c9797f9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_read_a_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_a, + return std::forward_as_tuple(in.perm_pos_mem_read_a_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_a, @@ -38,7 +38,7 @@ class perm_pos_mem_read_a_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_a, + return std::forward_as_tuple(in.perm_pos_mem_read_a_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_a, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp index a704aa2b344..4251a4020a7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_read_b_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_b, + return std::forward_as_tuple(in.perm_pos_mem_read_b_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_b, @@ -38,7 +38,7 @@ class perm_pos_mem_read_b_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_b, + return std::forward_as_tuple(in.perm_pos_mem_read_b_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_b, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp index 04a34ab0744..bebb8e7df94 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_read_c_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_c, + return std::forward_as_tuple(in.perm_pos_mem_read_c_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_c, @@ -38,7 +38,7 @@ class perm_pos_mem_read_c_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_c, + return std::forward_as_tuple(in.perm_pos_mem_read_c_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_c, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp index 3f5ac896d2e..7ee60a756df 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_read_d_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_d, + return std::forward_as_tuple(in.perm_pos_mem_read_d_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_d, @@ -38,7 +38,7 @@ class perm_pos_mem_read_d_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_read_d, + return std::forward_as_tuple(in.perm_pos_mem_read_d_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_d, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp index 141a62e1e75..6d7ffcdc6b0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_write_a_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_a, + return std::forward_as_tuple(in.perm_pos_mem_write_a_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_a, @@ -38,7 +38,7 @@ class perm_pos_mem_write_a_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_a, + return std::forward_as_tuple(in.perm_pos_mem_write_a_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_a, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp index 585a5aa9095..c4b43fe35b2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_write_b_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_b, + return std::forward_as_tuple(in.perm_pos_mem_write_b_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_b, @@ -38,7 +38,7 @@ class perm_pos_mem_write_b_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_b, + return std::forward_as_tuple(in.perm_pos_mem_write_b_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_b, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp index a83d9d95141..8b7f292ccf6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_write_c_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_c, + return std::forward_as_tuple(in.perm_pos_mem_write_c_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_c, @@ -38,7 +38,7 @@ class perm_pos_mem_write_c_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_c, + return std::forward_as_tuple(in.perm_pos_mem_write_c_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_c, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp index 4f75387af02..2b07f2e1e9e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp @@ -20,7 +20,7 @@ class perm_pos_mem_write_d_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_d, + return std::forward_as_tuple(in.perm_pos_mem_write_d_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_d, @@ -38,7 +38,7 @@ class perm_pos_mem_write_d_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_pos_mem_write_d, + return std::forward_as_tuple(in.perm_pos_mem_write_d_inv, in.poseidon2_sel_poseidon_perm, in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_d, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp index c42c3329075..b935c223383 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp @@ -20,7 +20,7 @@ class perm_slice_mem_permutation_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_slice_mem, + return std::forward_as_tuple(in.perm_slice_mem_inv, in.slice_sel_mem_active, in.slice_sel_mem_active, in.mem_sel_op_slice, @@ -38,7 +38,7 @@ class perm_slice_mem_permutation_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_slice_mem, + return std::forward_as_tuple(in.perm_slice_mem_inv, in.slice_sel_mem_active, in.slice_sel_mem_active, in.mem_sel_op_slice, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/poseidon2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/poseidon2.hpp index 08909d0808e..5523bd984c3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/poseidon2.hpp @@ -6,301 +6,19 @@ namespace bb::Avm_vm { -template struct Poseidon2Row { - FF poseidon2_B_10_0{}; - FF poseidon2_B_10_1{}; - FF poseidon2_B_10_2{}; - FF poseidon2_B_10_3{}; - FF poseidon2_B_11_0{}; - FF poseidon2_B_11_1{}; - FF poseidon2_B_11_2{}; - FF poseidon2_B_11_3{}; - FF poseidon2_B_12_0{}; - FF poseidon2_B_12_1{}; - FF poseidon2_B_12_2{}; - FF poseidon2_B_12_3{}; - FF poseidon2_B_13_0{}; - FF poseidon2_B_13_1{}; - FF poseidon2_B_13_2{}; - FF poseidon2_B_13_3{}; - FF poseidon2_B_14_0{}; - FF poseidon2_B_14_1{}; - FF poseidon2_B_14_2{}; - FF poseidon2_B_14_3{}; - FF poseidon2_B_15_0{}; - FF poseidon2_B_15_1{}; - FF poseidon2_B_15_2{}; - FF poseidon2_B_15_3{}; - FF poseidon2_B_16_0{}; - FF poseidon2_B_16_1{}; - FF poseidon2_B_16_2{}; - FF poseidon2_B_16_3{}; - FF poseidon2_B_17_0{}; - FF poseidon2_B_17_1{}; - FF poseidon2_B_17_2{}; - FF poseidon2_B_17_3{}; - FF poseidon2_B_18_0{}; - FF poseidon2_B_18_1{}; - FF poseidon2_B_18_2{}; - FF poseidon2_B_18_3{}; - FF poseidon2_B_19_0{}; - FF poseidon2_B_19_1{}; - FF poseidon2_B_19_2{}; - FF poseidon2_B_19_3{}; - FF poseidon2_B_20_0{}; - FF poseidon2_B_20_1{}; - FF poseidon2_B_20_2{}; - FF poseidon2_B_20_3{}; - FF poseidon2_B_21_0{}; - FF poseidon2_B_21_1{}; - FF poseidon2_B_21_2{}; - FF poseidon2_B_21_3{}; - FF poseidon2_B_22_0{}; - FF poseidon2_B_22_1{}; - FF poseidon2_B_22_2{}; - FF poseidon2_B_22_3{}; - FF poseidon2_B_23_0{}; - FF poseidon2_B_23_1{}; - FF poseidon2_B_23_2{}; - FF poseidon2_B_23_3{}; - FF poseidon2_B_24_0{}; - FF poseidon2_B_24_1{}; - FF poseidon2_B_24_2{}; - FF poseidon2_B_24_3{}; - FF poseidon2_B_25_0{}; - FF poseidon2_B_25_1{}; - FF poseidon2_B_25_2{}; - FF poseidon2_B_25_3{}; - FF poseidon2_B_26_0{}; - FF poseidon2_B_26_1{}; - FF poseidon2_B_26_2{}; - FF poseidon2_B_26_3{}; - FF poseidon2_B_27_0{}; - FF poseidon2_B_27_1{}; - FF poseidon2_B_27_2{}; - FF poseidon2_B_27_3{}; - FF poseidon2_B_28_0{}; - FF poseidon2_B_28_1{}; - FF poseidon2_B_28_2{}; - FF poseidon2_B_28_3{}; - FF poseidon2_B_29_0{}; - FF poseidon2_B_29_1{}; - FF poseidon2_B_29_2{}; - FF poseidon2_B_29_3{}; - FF poseidon2_B_30_0{}; - FF poseidon2_B_30_1{}; - FF poseidon2_B_30_2{}; - FF poseidon2_B_30_3{}; - FF poseidon2_B_31_0{}; - FF poseidon2_B_31_1{}; - FF poseidon2_B_31_2{}; - FF poseidon2_B_31_3{}; - FF poseidon2_B_32_0{}; - FF poseidon2_B_32_1{}; - FF poseidon2_B_32_2{}; - FF poseidon2_B_32_3{}; - FF poseidon2_B_33_0{}; - FF poseidon2_B_33_1{}; - FF poseidon2_B_33_2{}; - FF poseidon2_B_33_3{}; - FF poseidon2_B_34_0{}; - FF poseidon2_B_34_1{}; - FF poseidon2_B_34_2{}; - FF poseidon2_B_34_3{}; - FF poseidon2_B_35_0{}; - FF poseidon2_B_35_1{}; - FF poseidon2_B_35_2{}; - FF poseidon2_B_35_3{}; - FF poseidon2_B_36_0{}; - FF poseidon2_B_36_1{}; - FF poseidon2_B_36_2{}; - FF poseidon2_B_36_3{}; - FF poseidon2_B_37_0{}; - FF poseidon2_B_37_1{}; - FF poseidon2_B_37_2{}; - FF poseidon2_B_37_3{}; - FF poseidon2_B_38_0{}; - FF poseidon2_B_38_1{}; - FF poseidon2_B_38_2{}; - FF poseidon2_B_38_3{}; - FF poseidon2_B_39_0{}; - FF poseidon2_B_39_1{}; - FF poseidon2_B_39_2{}; - FF poseidon2_B_39_3{}; - FF poseidon2_B_40_0{}; - FF poseidon2_B_40_1{}; - FF poseidon2_B_40_2{}; - FF poseidon2_B_40_3{}; - FF poseidon2_B_41_0{}; - FF poseidon2_B_41_1{}; - FF poseidon2_B_41_2{}; - FF poseidon2_B_41_3{}; - FF poseidon2_B_42_0{}; - FF poseidon2_B_42_1{}; - FF poseidon2_B_42_2{}; - FF poseidon2_B_42_3{}; - FF poseidon2_B_43_0{}; - FF poseidon2_B_43_1{}; - FF poseidon2_B_43_2{}; - FF poseidon2_B_43_3{}; - FF poseidon2_B_44_0{}; - FF poseidon2_B_44_1{}; - FF poseidon2_B_44_2{}; - FF poseidon2_B_44_3{}; - FF poseidon2_B_45_0{}; - FF poseidon2_B_45_1{}; - FF poseidon2_B_45_2{}; - FF poseidon2_B_45_3{}; - FF poseidon2_B_46_0{}; - FF poseidon2_B_46_1{}; - FF poseidon2_B_46_2{}; - FF poseidon2_B_46_3{}; - FF poseidon2_B_47_0{}; - FF poseidon2_B_47_1{}; - FF poseidon2_B_47_2{}; - FF poseidon2_B_47_3{}; - FF poseidon2_B_48_0{}; - FF poseidon2_B_48_1{}; - FF poseidon2_B_48_2{}; - FF poseidon2_B_48_3{}; - FF poseidon2_B_49_0{}; - FF poseidon2_B_49_1{}; - FF poseidon2_B_49_2{}; - FF poseidon2_B_49_3{}; - FF poseidon2_B_4_0{}; - FF poseidon2_B_4_1{}; - FF poseidon2_B_4_2{}; - FF poseidon2_B_4_3{}; - FF poseidon2_B_50_0{}; - FF poseidon2_B_50_1{}; - FF poseidon2_B_50_2{}; - FF poseidon2_B_50_3{}; - FF poseidon2_B_51_0{}; - FF poseidon2_B_51_1{}; - FF poseidon2_B_51_2{}; - FF poseidon2_B_51_3{}; - FF poseidon2_B_52_0{}; - FF poseidon2_B_52_1{}; - FF poseidon2_B_52_2{}; - FF poseidon2_B_52_3{}; - FF poseidon2_B_53_0{}; - FF poseidon2_B_53_1{}; - FF poseidon2_B_53_2{}; - FF poseidon2_B_53_3{}; - FF poseidon2_B_54_0{}; - FF poseidon2_B_54_1{}; - FF poseidon2_B_54_2{}; - FF poseidon2_B_54_3{}; - FF poseidon2_B_55_0{}; - FF poseidon2_B_55_1{}; - FF poseidon2_B_55_2{}; - FF poseidon2_B_55_3{}; - FF poseidon2_B_56_0{}; - FF poseidon2_B_56_1{}; - FF poseidon2_B_56_2{}; - FF poseidon2_B_56_3{}; - FF poseidon2_B_57_0{}; - FF poseidon2_B_57_1{}; - FF poseidon2_B_57_2{}; - FF poseidon2_B_57_3{}; - FF poseidon2_B_58_0{}; - FF poseidon2_B_58_1{}; - FF poseidon2_B_58_2{}; - FF poseidon2_B_58_3{}; - FF poseidon2_B_59_0{}; - FF poseidon2_B_59_1{}; - FF poseidon2_B_59_2{}; - FF poseidon2_B_59_3{}; - FF poseidon2_B_5_0{}; - FF poseidon2_B_5_1{}; - FF poseidon2_B_5_2{}; - FF poseidon2_B_5_3{}; - FF poseidon2_B_6_0{}; - FF poseidon2_B_6_1{}; - FF poseidon2_B_6_2{}; - FF poseidon2_B_6_3{}; - FF poseidon2_B_7_0{}; - FF poseidon2_B_7_1{}; - FF poseidon2_B_7_2{}; - FF poseidon2_B_7_3{}; - FF poseidon2_B_8_0{}; - FF poseidon2_B_8_1{}; - FF poseidon2_B_8_2{}; - FF poseidon2_B_8_3{}; - FF poseidon2_B_9_0{}; - FF poseidon2_B_9_1{}; - FF poseidon2_B_9_2{}; - FF poseidon2_B_9_3{}; - FF poseidon2_EXT_LAYER_4{}; - FF poseidon2_EXT_LAYER_5{}; - FF poseidon2_EXT_LAYER_6{}; - FF poseidon2_EXT_LAYER_7{}; - FF poseidon2_T_0_4{}; - FF poseidon2_T_0_5{}; - FF poseidon2_T_0_6{}; - FF poseidon2_T_0_7{}; - FF poseidon2_T_1_4{}; - FF poseidon2_T_1_5{}; - FF poseidon2_T_1_6{}; - FF poseidon2_T_1_7{}; - FF poseidon2_T_2_4{}; - FF poseidon2_T_2_5{}; - FF poseidon2_T_2_6{}; - FF poseidon2_T_2_7{}; - FF poseidon2_T_3_4{}; - FF poseidon2_T_3_5{}; - FF poseidon2_T_3_6{}; - FF poseidon2_T_3_7{}; - FF poseidon2_T_60_4{}; - FF poseidon2_T_60_5{}; - FF poseidon2_T_60_6{}; - FF poseidon2_T_60_7{}; - FF poseidon2_T_61_4{}; - FF poseidon2_T_61_5{}; - FF poseidon2_T_61_6{}; - FF poseidon2_T_61_7{}; - FF poseidon2_T_62_4{}; - FF poseidon2_T_62_5{}; - FF poseidon2_T_62_6{}; - FF poseidon2_T_62_7{}; - FF poseidon2_T_63_4{}; - FF poseidon2_T_63_5{}; - FF poseidon2_T_63_6{}; - FF poseidon2_T_63_7{}; - FF poseidon2_a_0{}; - FF poseidon2_a_1{}; - FF poseidon2_a_2{}; - FF poseidon2_a_3{}; - FF poseidon2_b_0{}; - FF poseidon2_b_1{}; - FF poseidon2_b_2{}; - FF poseidon2_b_3{}; - FF poseidon2_input_addr{}; - FF poseidon2_mem_addr_read_a{}; - FF poseidon2_mem_addr_read_b{}; - FF poseidon2_mem_addr_read_c{}; - FF poseidon2_mem_addr_read_d{}; - FF poseidon2_mem_addr_write_a{}; - FF poseidon2_mem_addr_write_b{}; - FF poseidon2_mem_addr_write_c{}; - FF poseidon2_mem_addr_write_d{}; - FF poseidon2_output_addr{}; - FF poseidon2_sel_poseidon_perm{}; -}; - template class poseidon2Impl { public: using FF = FF_; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 7, - 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, - 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, - 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, - 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, - 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, - 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, - 8, 7, 7, 7, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3 }; template inline static bool skip(const AllEntities& in) @@ -315,9 +33,1120 @@ template class poseidon2Impl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto poseidon2_params_MU_0 = + FF(uint256_t{ 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL }); + const auto poseidon2_params_MU_1 = + FF(uint256_t{ 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL }); + const auto poseidon2_params_MU_2 = + FF(uint256_t{ 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL }); + const auto poseidon2_params_MU_3 = + FF(uint256_t{ 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL }); + const auto poseidon2_params_C_0_0 = + FF(uint256_t{ 10018390284920759269UL, 196898842818127395UL, 5249540449481148995UL, 1853312570062057576UL }); + const auto poseidon2_params_C_0_1 = FF( + uint256_t{ 12486221224710452438UL, 2372038863109147677UL, 8230667498854222355UL, 2764611904404804029UL }); + const auto poseidon2_params_C_0_2 = FF( + uint256_t{ 4466505105966356650UL, 4686185096558265002UL, 16210260819355521378UL, 1844031548168280073UL }); + const auto poseidon2_params_C_0_3 = FF( + uint256_t{ 15002325471271702008UL, 5581154705073500415UL, 1229208533183169201UL, 1549225070791782920UL }); + const auto poseidon2_params_C_1_0 = + FF(uint256_t{ 18309653156114024706UL, 798761732958817262UL, 6904962453156279281UL, 3335412762186210716UL }); + const auto poseidon2_params_C_1_1 = + FF(uint256_t{ 2824096028161810206UL, 14640933461146357672UL, 957840840567621315UL, 1024001058677493842UL }); + const auto poseidon2_params_C_1_2 = FF( + uint256_t{ 14339023814126516630UL, 12239068001133297662UL, 428134084092645147UL, 2673682960814460689UL }); + const auto poseidon2_params_C_1_3 = FF( + uint256_t{ 6214865908119297870UL, 17923963059035301363UL, 10985380589240272449UL, 1430464474809378870UL }); + const auto poseidon2_params_C_2_0 = + FF(uint256_t{ 5109255232332580664UL, 11913027714091798733UL, 4449570166290740355UL, 864862123557185234UL }); + const auto poseidon2_params_C_2_1 = + FF(uint256_t{ 2323272968957708806UL, 354488099726909104UL, 115174089281514891UL, 80808271106704719UL }); + const auto poseidon2_params_C_2_2 = + FF(uint256_t{ 9646436663147525449UL, 3404572679246369876UL, 2350204275212843361UL, 1069216089054537871UL }); + const auto poseidon2_params_C_2_3 = + FF(uint256_t{ 5059356740217174171UL, 4245857056683447103UL, 2426504795124362174UL, 350059533408463330UL }); + const auto poseidon2_params_C_3_0 = + FF(uint256_t{ 14876286709841668328UL, 6932857857384975351UL, 7976037835777844091UL, 738350885205242785UL }); + const auto poseidon2_params_C_3_1 = FF( + uint256_t{ 16522097747524989503UL, 4157368317794149558UL, 10343110624935622906UL, 2709590753056582169UL }); + const auto poseidon2_params_C_3_2 = FF( + uint256_t{ 8805379462752425633UL, 8594508728147436821UL, 15629690186821248127UL, 2936193411053712582UL }); + const auto poseidon2_params_C_3_3 = FF( + uint256_t{ 17046614324338172999UL, 14086280776151114414UL, 2804088968006330580UL, 728643340397380469UL }); + const auto poseidon2_params_C_4_0 = + FF(uint256_t{ 12986735346000814543UL, 6140074342411686364UL, 6041575944194691717UL, 896092723329689904UL }); + const auto poseidon2_params_C_4_1 = FF(0); + const auto poseidon2_params_C_4_2 = FF(0); + const auto poseidon2_params_C_4_3 = FF(0); + const auto poseidon2_params_C_5_0 = FF( + uint256_t{ 9573905030842087441UL, 12243211539080976096UL, 15287161151491266826UL, 1310836290481124728UL }); + const auto poseidon2_params_C_5_1 = FF(0); + const auto poseidon2_params_C_5_2 = FF(0); + const auto poseidon2_params_C_5_3 = FF(0); + const auto poseidon2_params_C_6_0 = + FF(uint256_t{ 8865134002163281525UL, 6813849753829831047UL, 9066778847678578696UL, 2801725307463304665UL }); + const auto poseidon2_params_C_6_1 = FF(0); + const auto poseidon2_params_C_6_2 = FF(0); + const auto poseidon2_params_C_6_3 = FF(0); + const auto poseidon2_params_C_7_0 = FF( + uint256_t{ 4931814869361681093UL, 13712769805002511750UL, 1776191062268299644UL, 2068661504023016414UL }); + const auto poseidon2_params_C_7_1 = FF(0); + const auto poseidon2_params_C_7_2 = FF(0); + const auto poseidon2_params_C_7_3 = FF(0); + const auto poseidon2_params_C_8_0 = + FF(uint256_t{ 8161631444256445904UL, 3049786034047984668UL, 1021328518293651309UL, 2147500022207188878UL }); + const auto poseidon2_params_C_8_1 = FF(0); + const auto poseidon2_params_C_8_2 = FF(0); + const auto poseidon2_params_C_8_3 = FF(0); + const auto poseidon2_params_C_9_0 = + FF(uint256_t{ 12766468767470212468UL, 926098071429114297UL, 17691598410912255471UL, 76565467953470566UL }); + const auto poseidon2_params_C_9_1 = FF(0); + const auto poseidon2_params_C_9_2 = FF(0); + const auto poseidon2_params_C_9_3 = FF(0); + const auto poseidon2_params_C_10_0 = FF( + uint256_t{ 15547843034426617484UL, 13465733818561903358UL, 11157089789589945854UL, 3107062195097242290UL }); + const auto poseidon2_params_C_10_1 = FF(0); + const auto poseidon2_params_C_10_2 = FF(0); + const auto poseidon2_params_C_10_3 = FF(0); + const auto poseidon2_params_C_11_0 = FF( + uint256_t{ 16908372174309343397UL, 17264932925429761530UL, 11508063480483774160UL, 2682419245684831641UL }); + const auto poseidon2_params_C_11_1 = FF(0); + const auto poseidon2_params_C_11_2 = FF(0); + const auto poseidon2_params_C_11_3 = FF(0); + const auto poseidon2_params_C_12_0 = + FF(uint256_t{ 4870692136216401181UL, 17645600130793395310UL, 2758876031472241166UL, 874943362207641089UL }); + const auto poseidon2_params_C_12_1 = FF(0); + const auto poseidon2_params_C_12_2 = FF(0); + const auto poseidon2_params_C_12_3 = FF(0); + const auto poseidon2_params_C_13_0 = FF( + uint256_t{ 4540479402638267003UL, 13477556963426049071UL, 6055112305493291757UL, 1810598527648098537UL }); + const auto poseidon2_params_C_13_1 = FF(0); + const auto poseidon2_params_C_13_2 = FF(0); + const auto poseidon2_params_C_13_3 = FF(0); + const auto poseidon2_params_C_14_0 = + FF(uint256_t{ 7894770769272900997UL, 9595210915998428021UL, 7642295683223718917UL, 2210716392790471408UL }); + const auto poseidon2_params_C_14_1 = FF(0); + const auto poseidon2_params_C_14_2 = FF(0); + const auto poseidon2_params_C_14_3 = FF(0); + const auto poseidon2_params_C_15_0 = FF( + uint256_t{ 10910178561156475899UL, 15811627963917441510UL, 16460518660187536520UL, 1698297851221778809UL }); + const auto poseidon2_params_C_15_1 = FF(0); + const auto poseidon2_params_C_15_2 = FF(0); + const auto poseidon2_params_C_15_3 = FF(0); + const auto poseidon2_params_C_16_0 = + FF(uint256_t{ 7831732902708890908UL, 1464390598836302271UL, 8568564606321342514UL, 3007171090439369509UL }); + const auto poseidon2_params_C_16_1 = FF(0); + const auto poseidon2_params_C_16_2 = FF(0); + const auto poseidon2_params_C_16_3 = FF(0); + const auto poseidon2_params_C_17_0 = FF( + uint256_t{ 12758232712903990792UL, 5937193763836963893UL, 4629415695575460109UL, 2476198378403296665UL }); + const auto poseidon2_params_C_17_1 = FF(0); + const auto poseidon2_params_C_17_2 = FF(0); + const auto poseidon2_params_C_17_3 = FF(0); + const auto poseidon2_params_C_18_0 = + FF(uint256_t{ 16185652584871361881UL, 3161867062328690813UL, 8447947510117581907UL, 452436262606194895UL }); + const auto poseidon2_params_C_18_1 = FF(0); + const auto poseidon2_params_C_18_2 = FF(0); + const auto poseidon2_params_C_18_3 = FF(0); + const auto poseidon2_params_C_19_0 = FF( + uint256_t{ 10531967515434376071UL, 5577695765815843856UL, 9164856352050088505UL, 1205339682110411496UL }); + const auto poseidon2_params_C_19_1 = FF(0); + const auto poseidon2_params_C_19_2 = FF(0); + const auto poseidon2_params_C_19_3 = FF(0); + const auto poseidon2_params_C_20_0 = FF( + uint256_t{ 3898841196333713180UL, 14650521577519770525UL, 5736581618852866049UL, 1010789789328495026UL }); + const auto poseidon2_params_C_20_1 = FF(0); + const auto poseidon2_params_C_20_2 = FF(0); + const auto poseidon2_params_C_20_3 = FF(0); + const auto poseidon2_params_C_21_0 = FF( + uint256_t{ 12103741763020280571UL, 14760208106156268938UL, 15246749619665902195UL, 1987439155030896717UL }); + const auto poseidon2_params_C_21_1 = FF(0); + const auto poseidon2_params_C_21_2 = FF(0); + const auto poseidon2_params_C_21_3 = FF(0); + const auto poseidon2_params_C_22_0 = FF( + uint256_t{ 326429241861474059UL, 11335157279655967493UL, 16233357323017397007UL, 2124770605461456708UL }); + const auto poseidon2_params_C_22_1 = FF(0); + const auto poseidon2_params_C_22_2 = FF(0); + const auto poseidon2_params_C_22_3 = FF(0); + const auto poseidon2_params_C_23_0 = FF( + uint256_t{ 13507610432344102875UL, 9765425316929074945UL, 10455054851855122687UL, 3371280263716451574UL }); + const auto poseidon2_params_C_23_1 = FF(0); + const auto poseidon2_params_C_23_2 = FF(0); + const auto poseidon2_params_C_23_3 = FF(0); + const auto poseidon2_params_C_24_0 = FF( + uint256_t{ 9433430149246843174UL, 16916651192445074064UL, 12002862125451454299UL, 3293088726774108791UL }); + const auto poseidon2_params_C_24_1 = FF(0); + const auto poseidon2_params_C_24_2 = FF(0); + const auto poseidon2_params_C_24_3 = FF(0); + const auto poseidon2_params_C_25_0 = FF( + uint256_t{ 15895963712096768440UL, 10975964170403460506UL, 7594578539046143282UL, 441635248990433378UL }); + const auto poseidon2_params_C_25_1 = FF(0); + const auto poseidon2_params_C_25_2 = FF(0); + const auto poseidon2_params_C_25_3 = FF(0); + const auto poseidon2_params_C_26_0 = + FF(uint256_t{ 55564641555031451UL, 2316046008873247993UL, 6273091099984972305UL, 531938487375579818UL }); + const auto poseidon2_params_C_26_1 = FF(0); + const auto poseidon2_params_C_26_2 = FF(0); + const auto poseidon2_params_C_26_3 = FF(0); + const auto poseidon2_params_C_27_0 = FF( + uint256_t{ 17845282940759944461UL, 6735239388814238924UL, 3181517889518583601UL, 2376846283559998361UL }); + const auto poseidon2_params_C_27_1 = FF(0); + const auto poseidon2_params_C_27_2 = FF(0); + const auto poseidon2_params_C_27_3 = FF(0); + const auto poseidon2_params_C_28_0 = FF( + uint256_t{ 14097127963645492314UL, 1165420652731038559UL, 12527303660854712762UL, 2717289076364278965UL }); + const auto poseidon2_params_C_28_1 = FF(0); + const auto poseidon2_params_C_28_2 = FF(0); + const auto poseidon2_params_C_28_3 = FF(0); + const auto poseidon2_params_C_29_0 = FF( + uint256_t{ 15600044695084040011UL, 255324662529267034UL, 11859356122961343981UL, 2571979992654075442UL }); + const auto poseidon2_params_C_29_1 = FF(0); + const auto poseidon2_params_C_29_2 = FF(0); + const auto poseidon2_params_C_29_3 = FF(0); + const auto poseidon2_params_C_30_0 = + FF(uint256_t{ 1589817027469470176UL, 1086723465680833706UL, 6948011514366564799UL, 2482410610948543635UL }); + const auto poseidon2_params_C_30_1 = FF(0); + const auto poseidon2_params_C_30_2 = FF(0); + const auto poseidon2_params_C_30_3 = FF(0); + const auto poseidon2_params_C_31_0 = FF( + uint256_t{ 6071201116374785253UL, 16554668458221199618UL, 16319484688832471879UL, 2792452762383364279UL }); + const auto poseidon2_params_C_31_1 = FF(0); + const auto poseidon2_params_C_31_2 = FF(0); + const auto poseidon2_params_C_31_3 = FF(0); + const auto poseidon2_params_C_32_0 = FF( + uint256_t{ 13535048470209809113UL, 1831807297936988201UL, 16757520396573457190UL, 508291910620511162UL }); + const auto poseidon2_params_C_32_1 = FF(0); + const auto poseidon2_params_C_32_2 = FF(0); + const auto poseidon2_params_C_32_3 = FF(0); + const auto poseidon2_params_C_33_0 = FF( + uint256_t{ 6946737468087619802UL, 14033399912488027565UL, 12701200401813783486UL, 1348363389498465135UL }); + const auto poseidon2_params_C_33_1 = FF(0); + const auto poseidon2_params_C_33_2 = FF(0); + const auto poseidon2_params_C_33_3 = FF(0); + const auto poseidon2_params_C_34_0 = FF( + uint256_t{ 6788008051328210729UL, 13866524545426155292UL, 4317879914214157329UL, 2633928310905799638UL }); + const auto poseidon2_params_C_34_1 = FF(0); + const auto poseidon2_params_C_34_2 = FF(0); + const auto poseidon2_params_C_34_3 = FF(0); + const auto poseidon2_params_C_35_0 = FF( + uint256_t{ 1183626302001490602UL, 10035686235057284266UL, 1656321729167440177UL, 1887128381037099784UL }); + const auto poseidon2_params_C_35_1 = FF(0); + const auto poseidon2_params_C_35_2 = FF(0); + const auto poseidon2_params_C_35_3 = FF(0); + const auto poseidon2_params_C_36_0 = FF( + uint256_t{ 964566190254741199UL, 17650087760652370459UL, 14904592615785317921UL, 2929864473487096026UL }); + const auto poseidon2_params_C_36_1 = FF(0); + const auto poseidon2_params_C_36_2 = FF(0); + const auto poseidon2_params_C_36_3 = FF(0); + const auto poseidon2_params_C_37_0 = + FF(uint256_t{ 13584300701347139198UL, 512534187550045064UL, 13489711551083721364UL, 41824696873363624UL }); + const auto poseidon2_params_C_37_1 = FF(0); + const auto poseidon2_params_C_37_2 = FF(0); + const auto poseidon2_params_C_37_3 = FF(0); + const auto poseidon2_params_C_38_0 = + FF(uint256_t{ 17586611824788147557UL, 6430987250922925699UL, 9294838151373947091UL, 348446557360066429UL }); + const auto poseidon2_params_C_38_1 = FF(0); + const auto poseidon2_params_C_38_2 = FF(0); + const auto poseidon2_params_C_38_3 = FF(0); + const auto poseidon2_params_C_39_0 = FF( + uint256_t{ 15025298913764434311UL, 14393211163878018166UL, 7154440178410267241UL, 3057088631006286899UL }); + const auto poseidon2_params_C_39_1 = FF(0); + const auto poseidon2_params_C_39_2 = FF(0); + const auto poseidon2_params_C_39_3 = FF(0); + const auto poseidon2_params_C_40_0 = FF( + uint256_t{ 13451769229280519155UL, 17839347496757587523UL, 10553299811918798519UL, 2523373819901075642UL }); + const auto poseidon2_params_C_40_1 = FF(0); + const auto poseidon2_params_C_40_2 = FF(0); + const auto poseidon2_params_C_40_3 = FF(0); + const auto poseidon2_params_C_41_0 = FF( + uint256_t{ 16267315463205810352UL, 13830706729545301172UL, 15413288900478726729UL, 287556136711008934UL }); + const auto poseidon2_params_C_41_1 = FF(0); + const auto poseidon2_params_C_41_2 = FF(0); + const auto poseidon2_params_C_41_3 = FF(0); + const auto poseidon2_params_C_42_0 = + FF(uint256_t{ 4573780169675443044UL, 8758089751960064775UL, 2470295096511057988UL, 51551212240288730UL }); + const auto poseidon2_params_C_42_1 = FF(0); + const auto poseidon2_params_C_42_2 = FF(0); + const auto poseidon2_params_C_42_3 = FF(0); + const auto poseidon2_params_C_43_0 = FF( + uint256_t{ 7093949836145798554UL, 12771428392262798771UL, 17021632567931004395UL, 1558106578814965657UL }); + const auto poseidon2_params_C_43_1 = FF(0); + const auto poseidon2_params_C_43_2 = FF(0); + const auto poseidon2_params_C_43_3 = FF(0); + const auto poseidon2_params_C_44_0 = FF( + uint256_t{ 8205915653008540447UL, 10376314495036230740UL, 5774593793305666491UL, 2231830927015656581UL }); + const auto poseidon2_params_C_44_1 = FF(0); + const auto poseidon2_params_C_44_2 = FF(0); + const auto poseidon2_params_C_44_3 = FF(0); + const auto poseidon2_params_C_45_0 = FF( + uint256_t{ 10783762484003267341UL, 10229708558604896492UL, 1831638669050696278UL, 2190429714552610800UL }); + const auto poseidon2_params_C_45_1 = FF(0); + const auto poseidon2_params_C_45_2 = FF(0); + const auto poseidon2_params_C_45_3 = FF(0); + const auto poseidon2_params_C_46_0 = FF( + uint256_t{ 7310961803978392383UL, 12793746113455595394UL, 17036245927795997300UL, 3106081169494120044UL }); + const auto poseidon2_params_C_46_1 = FF(0); + const auto poseidon2_params_C_46_2 = FF(0); + const auto poseidon2_params_C_46_3 = FF(0); + const auto poseidon2_params_C_47_0 = + FF(uint256_t{ 17421859032088162675UL, 7339791467855418851UL, 4622175020331968961UL, 590786792834928630UL }); + const auto poseidon2_params_C_47_1 = FF(0); + const auto poseidon2_params_C_47_2 = FF(0); + const auto poseidon2_params_C_47_3 = FF(0); + const auto poseidon2_params_C_48_0 = FF( + uint256_t{ 14242884250645212438UL, 12806057845811725595UL, 7743423753614082490UL, 213381026777379804UL }); + const auto poseidon2_params_C_48_1 = FF(0); + const auto poseidon2_params_C_48_2 = FF(0); + const auto poseidon2_params_C_48_3 = FF(0); + const auto poseidon2_params_C_49_0 = FF( + uint256_t{ 1110713325513004805UL, 8318407684973846516UL, 15952888485475298710UL, 1018983205230111328UL }); + const auto poseidon2_params_C_49_1 = FF(0); + const auto poseidon2_params_C_49_2 = FF(0); + const auto poseidon2_params_C_49_3 = FF(0); + const auto poseidon2_params_C_50_0 = + FF(uint256_t{ 533883137631233338UL, 333001117808183237UL, 16968583542443855481UL, 329716098711096173UL }); + const auto poseidon2_params_C_50_1 = FF(0); + const auto poseidon2_params_C_50_2 = FF(0); + const auto poseidon2_params_C_50_3 = FF(0); + const auto poseidon2_params_C_51_0 = + FF(uint256_t{ 4449676039486426793UL, 7760073051300251162UL, 5615103291054015906UL, 2516053143677338215UL }); + const auto poseidon2_params_C_51_1 = FF(0); + const auto poseidon2_params_C_51_2 = FF(0); + const auto poseidon2_params_C_51_3 = FF(0); + const auto poseidon2_params_C_52_0 = FF( + uint256_t{ 16503526645482286870UL, 6358830762575712333UL, 12313512559299087688UL, 2716767262544184013UL }); + const auto poseidon2_params_C_52_1 = FF(0); + const auto poseidon2_params_C_52_2 = FF(0); + const auto poseidon2_params_C_52_3 = FF(0); + const auto poseidon2_params_C_53_0 = FF( + uint256_t{ 5426798011730033104UL, 13085704829880126552UL, 6356732802364281819UL, 2175930396888807151UL }); + const auto poseidon2_params_C_53_1 = FF(0); + const auto poseidon2_params_C_53_2 = FF(0); + const auto poseidon2_params_C_53_3 = FF(0); + const auto poseidon2_params_C_54_0 = FF( + uint256_t{ 8262282602783970021UL, 2576069526442506486UL, 14199683559983367515UL, 3432491072538425468UL }); + const auto poseidon2_params_C_54_1 = FF(0); + const auto poseidon2_params_C_54_2 = FF(0); + const auto poseidon2_params_C_54_3 = FF(0); + const auto poseidon2_params_C_55_0 = FF( + uint256_t{ 14778817021916755205UL, 6110468871588391807UL, 2850248286812407967UL, 3411084787375678665UL }); + const auto poseidon2_params_C_55_1 = FF(0); + const auto poseidon2_params_C_55_2 = FF(0); + const auto poseidon2_params_C_55_3 = FF(0); + const auto poseidon2_params_C_56_0 = + FF(uint256_t{ 4906200604739023933UL, 12096549814065429793UL, 5988343102643160344UL, 309820751832846301UL }); + const auto poseidon2_params_C_56_1 = FF(0); + const auto poseidon2_params_C_56_2 = FF(0); + const auto poseidon2_params_C_56_3 = FF(0); + const auto poseidon2_params_C_57_0 = FF( + uint256_t{ 8709336210313678885UL, 10520000332606345601UL, 4756441214598660785UL, 2483744946546306397UL }); + const auto poseidon2_params_C_57_1 = FF(0); + const auto poseidon2_params_C_57_2 = FF(0); + const auto poseidon2_params_C_57_3 = FF(0); + const auto poseidon2_params_C_58_0 = + FF(uint256_t{ 9617950371599090517UL, 6702332727289490762UL, 7078214601245292934UL, 215269160536524476UL }); + const auto poseidon2_params_C_58_1 = FF(0); + const auto poseidon2_params_C_58_2 = FF(0); + const auto poseidon2_params_C_58_3 = FF(0); + const auto poseidon2_params_C_59_0 = FF( + uint256_t{ 14694170287735041964UL, 13462371741453101277UL, 7691247574208617782UL, 1078917709155142535UL }); + const auto poseidon2_params_C_59_1 = FF(0); + const auto poseidon2_params_C_59_2 = FF(0); + const auto poseidon2_params_C_59_3 = FF(0); + const auto poseidon2_params_C_60_0 = FF( + uint256_t{ 17559938410729200952UL, 12326273425107991305UL, 8641129484519639030UL, 1699848340767391255UL }); + const auto poseidon2_params_C_60_1 = + FF(uint256_t{ 3946956839294125797UL, 10123891284815211853UL, 3676846437799665248UL, 753827773683953838UL }); + const auto poseidon2_params_C_60_2 = FF( + uint256_t{ 10815195850656127580UL, 17940782720817522247UL, 11666428030894512886UL, 2305765957929457259UL }); + const auto poseidon2_params_C_60_3 = + FF(uint256_t{ 437280840171101279UL, 6885928680245806601UL, 6031863836827793624UL, 2698250255620259624UL }); + const auto poseidon2_params_C_61_0 = FF( + uint256_t{ 16961604592822056794UL, 12516844188945734293UL, 2404426354458718742UL, 901141949721836097UL }); + const auto poseidon2_params_C_61_1 = FF( + uint256_t{ 3152898413090790038UL, 16108523113696338432UL, 11492645026300260534UL, 1417477149741880787UL }); + const auto poseidon2_params_C_61_2 = FF( + uint256_t{ 10578217394647568846UL, 6637113826221079930UL, 1364449097464563400UL, 2379869735503406314UL }); + const auto poseidon2_params_C_61_3 = FF( + uint256_t{ 6332539588517624153UL, 17422837239624809585UL, 12296960536238467913UL, 2434905421004621494UL }); + const auto poseidon2_params_C_62_0 = + FF(uint256_t{ 10311634121439582299UL, 2959376558854333994UL, 6697398963915560134UL, 417944321386245900UL }); + const auto poseidon2_params_C_62_1 = FF( + uint256_t{ 16872849857899172004UL, 1640712307042701286UL, 16457516735210998920UL, 1084862449077757478UL }); + const auto poseidon2_params_C_62_2 = + FF(uint256_t{ 10329879351081882815UL, 5178010365334480003UL, 7014208314719145622UL, 385149140585498380UL }); + const auto poseidon2_params_C_62_3 = FF( + uint256_t{ 13199866221884806229UL, 10541991787372042848UL, 14909749656931548440UL, 708152185224876794UL }); + const auto poseidon2_params_C_63_0 = + FF(uint256_t{ 1717216310632203061UL, 17455832130858697862UL, 5278085098799702411UL, 227655898188482835UL }); + const auto poseidon2_params_C_63_1 = FF( + uint256_t{ 17164141620747686731UL, 16689913387728553544UL, 2568326884589391367UL, 3166155980659486882UL }); + const auto poseidon2_params_C_63_2 = FF( + uint256_t{ 1233442753680249567UL, 15490006495937952898UL, 7249042245074469654UL, 2138985910652398451UL }); + const auto poseidon2_params_C_63_3 = + FF(uint256_t{ 4115849303762846724UL, 2230284817967990783UL, 5095423606777193313UL, 1685862792723606183UL }); + const auto poseidon2_EXT_LAYER_0 = (new_term.poseidon2_a_0 + new_term.poseidon2_a_1); + const auto poseidon2_EXT_LAYER_1 = (new_term.poseidon2_a_2 + new_term.poseidon2_a_3); + const auto poseidon2_EXT_LAYER_2 = ((FF(2) * new_term.poseidon2_a_1) + poseidon2_EXT_LAYER_1); + const auto poseidon2_EXT_LAYER_3 = ((FF(2) * new_term.poseidon2_a_3) + poseidon2_EXT_LAYER_0); + const auto poseidon2_ARK_0_0 = (new_term.poseidon2_EXT_LAYER_6 + poseidon2_params_C_0_0); + const auto poseidon2_ARK_0_1 = (new_term.poseidon2_EXT_LAYER_5 + poseidon2_params_C_0_1); + const auto poseidon2_ARK_0_2 = (new_term.poseidon2_EXT_LAYER_7 + poseidon2_params_C_0_2); + const auto poseidon2_ARK_0_3 = (new_term.poseidon2_EXT_LAYER_4 + poseidon2_params_C_0_3); + const auto poseidon2_A_0_0 = + ((((poseidon2_ARK_0_0 * poseidon2_ARK_0_0) * poseidon2_ARK_0_0) * poseidon2_ARK_0_0) * poseidon2_ARK_0_0); + const auto poseidon2_A_0_1 = + ((((poseidon2_ARK_0_1 * poseidon2_ARK_0_1) * poseidon2_ARK_0_1) * poseidon2_ARK_0_1) * poseidon2_ARK_0_1); + const auto poseidon2_A_0_2 = + ((((poseidon2_ARK_0_2 * poseidon2_ARK_0_2) * poseidon2_ARK_0_2) * poseidon2_ARK_0_2) * poseidon2_ARK_0_2); + const auto poseidon2_A_0_3 = + ((((poseidon2_ARK_0_3 * poseidon2_ARK_0_3) * poseidon2_ARK_0_3) * poseidon2_ARK_0_3) * poseidon2_ARK_0_3); + const auto poseidon2_T_0_0 = (poseidon2_A_0_0 + poseidon2_A_0_1); + const auto poseidon2_T_0_1 = (poseidon2_A_0_2 + poseidon2_A_0_3); + const auto poseidon2_T_0_2 = ((FF(2) * poseidon2_A_0_1) + poseidon2_T_0_1); + const auto poseidon2_T_0_3 = ((FF(2) * poseidon2_A_0_3) + poseidon2_T_0_0); + const auto poseidon2_ARK_1_0 = (new_term.poseidon2_T_0_6 + poseidon2_params_C_1_0); + const auto poseidon2_ARK_1_1 = (new_term.poseidon2_T_0_5 + poseidon2_params_C_1_1); + const auto poseidon2_ARK_1_2 = (new_term.poseidon2_T_0_7 + poseidon2_params_C_1_2); + const auto poseidon2_ARK_1_3 = (new_term.poseidon2_T_0_4 + poseidon2_params_C_1_3); + const auto poseidon2_A_1_0 = + ((((poseidon2_ARK_1_0 * poseidon2_ARK_1_0) * poseidon2_ARK_1_0) * poseidon2_ARK_1_0) * poseidon2_ARK_1_0); + const auto poseidon2_A_1_1 = + ((((poseidon2_ARK_1_1 * poseidon2_ARK_1_1) * poseidon2_ARK_1_1) * poseidon2_ARK_1_1) * poseidon2_ARK_1_1); + const auto poseidon2_A_1_2 = + ((((poseidon2_ARK_1_2 * poseidon2_ARK_1_2) * poseidon2_ARK_1_2) * poseidon2_ARK_1_2) * poseidon2_ARK_1_2); + const auto poseidon2_A_1_3 = + ((((poseidon2_ARK_1_3 * poseidon2_ARK_1_3) * poseidon2_ARK_1_3) * poseidon2_ARK_1_3) * poseidon2_ARK_1_3); + const auto poseidon2_T_1_0 = (poseidon2_A_1_0 + poseidon2_A_1_1); + const auto poseidon2_T_1_1 = (poseidon2_A_1_2 + poseidon2_A_1_3); + const auto poseidon2_T_1_2 = ((FF(2) * poseidon2_A_1_1) + poseidon2_T_1_1); + const auto poseidon2_T_1_3 = ((FF(2) * poseidon2_A_1_3) + poseidon2_T_1_0); + const auto poseidon2_ARK_2_0 = (new_term.poseidon2_T_1_6 + poseidon2_params_C_2_0); + const auto poseidon2_ARK_2_1 = (new_term.poseidon2_T_1_5 + poseidon2_params_C_2_1); + const auto poseidon2_ARK_2_2 = (new_term.poseidon2_T_1_7 + poseidon2_params_C_2_2); + const auto poseidon2_ARK_2_3 = (new_term.poseidon2_T_1_4 + poseidon2_params_C_2_3); + const auto poseidon2_A_2_0 = + ((((poseidon2_ARK_2_0 * poseidon2_ARK_2_0) * poseidon2_ARK_2_0) * poseidon2_ARK_2_0) * poseidon2_ARK_2_0); + const auto poseidon2_A_2_1 = + ((((poseidon2_ARK_2_1 * poseidon2_ARK_2_1) * poseidon2_ARK_2_1) * poseidon2_ARK_2_1) * poseidon2_ARK_2_1); + const auto poseidon2_A_2_2 = + ((((poseidon2_ARK_2_2 * poseidon2_ARK_2_2) * poseidon2_ARK_2_2) * poseidon2_ARK_2_2) * poseidon2_ARK_2_2); + const auto poseidon2_A_2_3 = + ((((poseidon2_ARK_2_3 * poseidon2_ARK_2_3) * poseidon2_ARK_2_3) * poseidon2_ARK_2_3) * poseidon2_ARK_2_3); + const auto poseidon2_T_2_0 = (poseidon2_A_2_0 + poseidon2_A_2_1); + const auto poseidon2_T_2_1 = (poseidon2_A_2_2 + poseidon2_A_2_3); + const auto poseidon2_T_2_2 = ((FF(2) * poseidon2_A_2_1) + poseidon2_T_2_1); + const auto poseidon2_T_2_3 = ((FF(2) * poseidon2_A_2_3) + poseidon2_T_2_0); + const auto poseidon2_ARK_3_0 = (new_term.poseidon2_T_2_6 + poseidon2_params_C_3_0); + const auto poseidon2_ARK_3_1 = (new_term.poseidon2_T_2_5 + poseidon2_params_C_3_1); + const auto poseidon2_ARK_3_2 = (new_term.poseidon2_T_2_7 + poseidon2_params_C_3_2); + const auto poseidon2_ARK_3_3 = (new_term.poseidon2_T_2_4 + poseidon2_params_C_3_3); + const auto poseidon2_A_3_0 = + ((((poseidon2_ARK_3_0 * poseidon2_ARK_3_0) * poseidon2_ARK_3_0) * poseidon2_ARK_3_0) * poseidon2_ARK_3_0); + const auto poseidon2_A_3_1 = + ((((poseidon2_ARK_3_1 * poseidon2_ARK_3_1) * poseidon2_ARK_3_1) * poseidon2_ARK_3_1) * poseidon2_ARK_3_1); + const auto poseidon2_A_3_2 = + ((((poseidon2_ARK_3_2 * poseidon2_ARK_3_2) * poseidon2_ARK_3_2) * poseidon2_ARK_3_2) * poseidon2_ARK_3_2); + const auto poseidon2_A_3_3 = + ((((poseidon2_ARK_3_3 * poseidon2_ARK_3_3) * poseidon2_ARK_3_3) * poseidon2_ARK_3_3) * poseidon2_ARK_3_3); + const auto poseidon2_T_3_0 = (poseidon2_A_3_0 + poseidon2_A_3_1); + const auto poseidon2_T_3_1 = (poseidon2_A_3_2 + poseidon2_A_3_3); + const auto poseidon2_T_3_2 = ((FF(2) * poseidon2_A_3_1) + poseidon2_T_3_1); + const auto poseidon2_T_3_3 = ((FF(2) * poseidon2_A_3_3) + poseidon2_T_3_0); + const auto poseidon2_ARK_4_0 = (new_term.poseidon2_T_3_6 + poseidon2_params_C_4_0); + const auto poseidon2_ARK_4_1 = (new_term.poseidon2_T_3_5 + poseidon2_params_C_4_1); + const auto poseidon2_ARK_4_2 = (new_term.poseidon2_T_3_7 + poseidon2_params_C_4_2); + const auto poseidon2_ARK_4_3 = (new_term.poseidon2_T_3_4 + poseidon2_params_C_4_3); + const auto poseidon2_A_4_0 = + ((((poseidon2_ARK_4_0 * poseidon2_ARK_4_0) * poseidon2_ARK_4_0) * poseidon2_ARK_4_0) * poseidon2_ARK_4_0); + const auto poseidon2_A_4_1 = poseidon2_ARK_4_1; + const auto poseidon2_A_4_2 = poseidon2_ARK_4_2; + const auto poseidon2_A_4_3 = poseidon2_ARK_4_3; + const auto poseidon2_SUM_4 = (((poseidon2_A_4_0 + poseidon2_A_4_1) + poseidon2_A_4_2) + poseidon2_A_4_3); + const auto poseidon2_ARK_5_0 = (new_term.poseidon2_B_4_0 + poseidon2_params_C_5_0); + const auto poseidon2_ARK_5_1 = (new_term.poseidon2_B_4_1 + poseidon2_params_C_5_1); + const auto poseidon2_ARK_5_2 = (new_term.poseidon2_B_4_2 + poseidon2_params_C_5_2); + const auto poseidon2_ARK_5_3 = (new_term.poseidon2_B_4_3 + poseidon2_params_C_5_3); + const auto poseidon2_A_5_0 = + ((((poseidon2_ARK_5_0 * poseidon2_ARK_5_0) * poseidon2_ARK_5_0) * poseidon2_ARK_5_0) * poseidon2_ARK_5_0); + const auto poseidon2_A_5_1 = poseidon2_ARK_5_1; + const auto poseidon2_A_5_2 = poseidon2_ARK_5_2; + const auto poseidon2_A_5_3 = poseidon2_ARK_5_3; + const auto poseidon2_SUM_5 = (((poseidon2_A_5_0 + poseidon2_A_5_1) + poseidon2_A_5_2) + poseidon2_A_5_3); + const auto poseidon2_ARK_6_0 = (new_term.poseidon2_B_5_0 + poseidon2_params_C_6_0); + const auto poseidon2_ARK_6_1 = (new_term.poseidon2_B_5_1 + poseidon2_params_C_6_1); + const auto poseidon2_ARK_6_2 = (new_term.poseidon2_B_5_2 + poseidon2_params_C_6_2); + const auto poseidon2_ARK_6_3 = (new_term.poseidon2_B_5_3 + poseidon2_params_C_6_3); + const auto poseidon2_A_6_0 = + ((((poseidon2_ARK_6_0 * poseidon2_ARK_6_0) * poseidon2_ARK_6_0) * poseidon2_ARK_6_0) * poseidon2_ARK_6_0); + const auto poseidon2_A_6_1 = poseidon2_ARK_6_1; + const auto poseidon2_A_6_2 = poseidon2_ARK_6_2; + const auto poseidon2_A_6_3 = poseidon2_ARK_6_3; + const auto poseidon2_SUM_6 = (((poseidon2_A_6_0 + poseidon2_A_6_1) + poseidon2_A_6_2) + poseidon2_A_6_3); + const auto poseidon2_ARK_7_0 = (new_term.poseidon2_B_6_0 + poseidon2_params_C_7_0); + const auto poseidon2_ARK_7_1 = (new_term.poseidon2_B_6_1 + poseidon2_params_C_7_1); + const auto poseidon2_ARK_7_2 = (new_term.poseidon2_B_6_2 + poseidon2_params_C_7_2); + const auto poseidon2_ARK_7_3 = (new_term.poseidon2_B_6_3 + poseidon2_params_C_7_3); + const auto poseidon2_A_7_0 = + ((((poseidon2_ARK_7_0 * poseidon2_ARK_7_0) * poseidon2_ARK_7_0) * poseidon2_ARK_7_0) * poseidon2_ARK_7_0); + const auto poseidon2_A_7_1 = poseidon2_ARK_7_1; + const auto poseidon2_A_7_2 = poseidon2_ARK_7_2; + const auto poseidon2_A_7_3 = poseidon2_ARK_7_3; + const auto poseidon2_SUM_7 = (((poseidon2_A_7_0 + poseidon2_A_7_1) + poseidon2_A_7_2) + poseidon2_A_7_3); + const auto poseidon2_ARK_8_0 = (new_term.poseidon2_B_7_0 + poseidon2_params_C_8_0); + const auto poseidon2_ARK_8_1 = (new_term.poseidon2_B_7_1 + poseidon2_params_C_8_1); + const auto poseidon2_ARK_8_2 = (new_term.poseidon2_B_7_2 + poseidon2_params_C_8_2); + const auto poseidon2_ARK_8_3 = (new_term.poseidon2_B_7_3 + poseidon2_params_C_8_3); + const auto poseidon2_A_8_0 = + ((((poseidon2_ARK_8_0 * poseidon2_ARK_8_0) * poseidon2_ARK_8_0) * poseidon2_ARK_8_0) * poseidon2_ARK_8_0); + const auto poseidon2_A_8_1 = poseidon2_ARK_8_1; + const auto poseidon2_A_8_2 = poseidon2_ARK_8_2; + const auto poseidon2_A_8_3 = poseidon2_ARK_8_3; + const auto poseidon2_SUM_8 = (((poseidon2_A_8_0 + poseidon2_A_8_1) + poseidon2_A_8_2) + poseidon2_A_8_3); + const auto poseidon2_ARK_9_0 = (new_term.poseidon2_B_8_0 + poseidon2_params_C_9_0); + const auto poseidon2_ARK_9_1 = (new_term.poseidon2_B_8_1 + poseidon2_params_C_9_1); + const auto poseidon2_ARK_9_2 = (new_term.poseidon2_B_8_2 + poseidon2_params_C_9_2); + const auto poseidon2_ARK_9_3 = (new_term.poseidon2_B_8_3 + poseidon2_params_C_9_3); + const auto poseidon2_A_9_0 = + ((((poseidon2_ARK_9_0 * poseidon2_ARK_9_0) * poseidon2_ARK_9_0) * poseidon2_ARK_9_0) * poseidon2_ARK_9_0); + const auto poseidon2_A_9_1 = poseidon2_ARK_9_1; + const auto poseidon2_A_9_2 = poseidon2_ARK_9_2; + const auto poseidon2_A_9_3 = poseidon2_ARK_9_3; + const auto poseidon2_SUM_9 = (((poseidon2_A_9_0 + poseidon2_A_9_1) + poseidon2_A_9_2) + poseidon2_A_9_3); + const auto poseidon2_ARK_10_0 = (new_term.poseidon2_B_9_0 + poseidon2_params_C_10_0); + const auto poseidon2_ARK_10_1 = (new_term.poseidon2_B_9_1 + poseidon2_params_C_10_1); + const auto poseidon2_ARK_10_2 = (new_term.poseidon2_B_9_2 + poseidon2_params_C_10_2); + const auto poseidon2_ARK_10_3 = (new_term.poseidon2_B_9_3 + poseidon2_params_C_10_3); + const auto poseidon2_A_10_0 = + ((((poseidon2_ARK_10_0 * poseidon2_ARK_10_0) * poseidon2_ARK_10_0) * poseidon2_ARK_10_0) * + poseidon2_ARK_10_0); + const auto poseidon2_A_10_1 = poseidon2_ARK_10_1; + const auto poseidon2_A_10_2 = poseidon2_ARK_10_2; + const auto poseidon2_A_10_3 = poseidon2_ARK_10_3; + const auto poseidon2_SUM_10 = (((poseidon2_A_10_0 + poseidon2_A_10_1) + poseidon2_A_10_2) + poseidon2_A_10_3); + const auto poseidon2_ARK_11_0 = (new_term.poseidon2_B_10_0 + poseidon2_params_C_11_0); + const auto poseidon2_ARK_11_1 = (new_term.poseidon2_B_10_1 + poseidon2_params_C_11_1); + const auto poseidon2_ARK_11_2 = (new_term.poseidon2_B_10_2 + poseidon2_params_C_11_2); + const auto poseidon2_ARK_11_3 = (new_term.poseidon2_B_10_3 + poseidon2_params_C_11_3); + const auto poseidon2_A_11_0 = + ((((poseidon2_ARK_11_0 * poseidon2_ARK_11_0) * poseidon2_ARK_11_0) * poseidon2_ARK_11_0) * + poseidon2_ARK_11_0); + const auto poseidon2_A_11_1 = poseidon2_ARK_11_1; + const auto poseidon2_A_11_2 = poseidon2_ARK_11_2; + const auto poseidon2_A_11_3 = poseidon2_ARK_11_3; + const auto poseidon2_SUM_11 = (((poseidon2_A_11_0 + poseidon2_A_11_1) + poseidon2_A_11_2) + poseidon2_A_11_3); + const auto poseidon2_ARK_12_0 = (new_term.poseidon2_B_11_0 + poseidon2_params_C_12_0); + const auto poseidon2_ARK_12_1 = (new_term.poseidon2_B_11_1 + poseidon2_params_C_12_1); + const auto poseidon2_ARK_12_2 = (new_term.poseidon2_B_11_2 + poseidon2_params_C_12_2); + const auto poseidon2_ARK_12_3 = (new_term.poseidon2_B_11_3 + poseidon2_params_C_12_3); + const auto poseidon2_A_12_0 = + ((((poseidon2_ARK_12_0 * poseidon2_ARK_12_0) * poseidon2_ARK_12_0) * poseidon2_ARK_12_0) * + poseidon2_ARK_12_0); + const auto poseidon2_A_12_1 = poseidon2_ARK_12_1; + const auto poseidon2_A_12_2 = poseidon2_ARK_12_2; + const auto poseidon2_A_12_3 = poseidon2_ARK_12_3; + const auto poseidon2_SUM_12 = (((poseidon2_A_12_0 + poseidon2_A_12_1) + poseidon2_A_12_2) + poseidon2_A_12_3); + const auto poseidon2_ARK_13_0 = (new_term.poseidon2_B_12_0 + poseidon2_params_C_13_0); + const auto poseidon2_ARK_13_1 = (new_term.poseidon2_B_12_1 + poseidon2_params_C_13_1); + const auto poseidon2_ARK_13_2 = (new_term.poseidon2_B_12_2 + poseidon2_params_C_13_2); + const auto poseidon2_ARK_13_3 = (new_term.poseidon2_B_12_3 + poseidon2_params_C_13_3); + const auto poseidon2_A_13_0 = + ((((poseidon2_ARK_13_0 * poseidon2_ARK_13_0) * poseidon2_ARK_13_0) * poseidon2_ARK_13_0) * + poseidon2_ARK_13_0); + const auto poseidon2_A_13_1 = poseidon2_ARK_13_1; + const auto poseidon2_A_13_2 = poseidon2_ARK_13_2; + const auto poseidon2_A_13_3 = poseidon2_ARK_13_3; + const auto poseidon2_SUM_13 = (((poseidon2_A_13_0 + poseidon2_A_13_1) + poseidon2_A_13_2) + poseidon2_A_13_3); + const auto poseidon2_ARK_14_0 = (new_term.poseidon2_B_13_0 + poseidon2_params_C_14_0); + const auto poseidon2_ARK_14_1 = (new_term.poseidon2_B_13_1 + poseidon2_params_C_14_1); + const auto poseidon2_ARK_14_2 = (new_term.poseidon2_B_13_2 + poseidon2_params_C_14_2); + const auto poseidon2_ARK_14_3 = (new_term.poseidon2_B_13_3 + poseidon2_params_C_14_3); + const auto poseidon2_A_14_0 = + ((((poseidon2_ARK_14_0 * poseidon2_ARK_14_0) * poseidon2_ARK_14_0) * poseidon2_ARK_14_0) * + poseidon2_ARK_14_0); + const auto poseidon2_A_14_1 = poseidon2_ARK_14_1; + const auto poseidon2_A_14_2 = poseidon2_ARK_14_2; + const auto poseidon2_A_14_3 = poseidon2_ARK_14_3; + const auto poseidon2_SUM_14 = (((poseidon2_A_14_0 + poseidon2_A_14_1) + poseidon2_A_14_2) + poseidon2_A_14_3); + const auto poseidon2_ARK_15_0 = (new_term.poseidon2_B_14_0 + poseidon2_params_C_15_0); + const auto poseidon2_ARK_15_1 = (new_term.poseidon2_B_14_1 + poseidon2_params_C_15_1); + const auto poseidon2_ARK_15_2 = (new_term.poseidon2_B_14_2 + poseidon2_params_C_15_2); + const auto poseidon2_ARK_15_3 = (new_term.poseidon2_B_14_3 + poseidon2_params_C_15_3); + const auto poseidon2_A_15_0 = + ((((poseidon2_ARK_15_0 * poseidon2_ARK_15_0) * poseidon2_ARK_15_0) * poseidon2_ARK_15_0) * + poseidon2_ARK_15_0); + const auto poseidon2_A_15_1 = poseidon2_ARK_15_1; + const auto poseidon2_A_15_2 = poseidon2_ARK_15_2; + const auto poseidon2_A_15_3 = poseidon2_ARK_15_3; + const auto poseidon2_SUM_15 = (((poseidon2_A_15_0 + poseidon2_A_15_1) + poseidon2_A_15_2) + poseidon2_A_15_3); + const auto poseidon2_ARK_16_0 = (new_term.poseidon2_B_15_0 + poseidon2_params_C_16_0); + const auto poseidon2_ARK_16_1 = (new_term.poseidon2_B_15_1 + poseidon2_params_C_16_1); + const auto poseidon2_ARK_16_2 = (new_term.poseidon2_B_15_2 + poseidon2_params_C_16_2); + const auto poseidon2_ARK_16_3 = (new_term.poseidon2_B_15_3 + poseidon2_params_C_16_3); + const auto poseidon2_A_16_0 = + ((((poseidon2_ARK_16_0 * poseidon2_ARK_16_0) * poseidon2_ARK_16_0) * poseidon2_ARK_16_0) * + poseidon2_ARK_16_0); + const auto poseidon2_A_16_1 = poseidon2_ARK_16_1; + const auto poseidon2_A_16_2 = poseidon2_ARK_16_2; + const auto poseidon2_A_16_3 = poseidon2_ARK_16_3; + const auto poseidon2_SUM_16 = (((poseidon2_A_16_0 + poseidon2_A_16_1) + poseidon2_A_16_2) + poseidon2_A_16_3); + const auto poseidon2_ARK_17_0 = (new_term.poseidon2_B_16_0 + poseidon2_params_C_17_0); + const auto poseidon2_ARK_17_1 = (new_term.poseidon2_B_16_1 + poseidon2_params_C_17_1); + const auto poseidon2_ARK_17_2 = (new_term.poseidon2_B_16_2 + poseidon2_params_C_17_2); + const auto poseidon2_ARK_17_3 = (new_term.poseidon2_B_16_3 + poseidon2_params_C_17_3); + const auto poseidon2_A_17_0 = + ((((poseidon2_ARK_17_0 * poseidon2_ARK_17_0) * poseidon2_ARK_17_0) * poseidon2_ARK_17_0) * + poseidon2_ARK_17_0); + const auto poseidon2_A_17_1 = poseidon2_ARK_17_1; + const auto poseidon2_A_17_2 = poseidon2_ARK_17_2; + const auto poseidon2_A_17_3 = poseidon2_ARK_17_3; + const auto poseidon2_SUM_17 = (((poseidon2_A_17_0 + poseidon2_A_17_1) + poseidon2_A_17_2) + poseidon2_A_17_3); + const auto poseidon2_ARK_18_0 = (new_term.poseidon2_B_17_0 + poseidon2_params_C_18_0); + const auto poseidon2_ARK_18_1 = (new_term.poseidon2_B_17_1 + poseidon2_params_C_18_1); + const auto poseidon2_ARK_18_2 = (new_term.poseidon2_B_17_2 + poseidon2_params_C_18_2); + const auto poseidon2_ARK_18_3 = (new_term.poseidon2_B_17_3 + poseidon2_params_C_18_3); + const auto poseidon2_A_18_0 = + ((((poseidon2_ARK_18_0 * poseidon2_ARK_18_0) * poseidon2_ARK_18_0) * poseidon2_ARK_18_0) * + poseidon2_ARK_18_0); + const auto poseidon2_A_18_1 = poseidon2_ARK_18_1; + const auto poseidon2_A_18_2 = poseidon2_ARK_18_2; + const auto poseidon2_A_18_3 = poseidon2_ARK_18_3; + const auto poseidon2_SUM_18 = (((poseidon2_A_18_0 + poseidon2_A_18_1) + poseidon2_A_18_2) + poseidon2_A_18_3); + const auto poseidon2_ARK_19_0 = (new_term.poseidon2_B_18_0 + poseidon2_params_C_19_0); + const auto poseidon2_ARK_19_1 = (new_term.poseidon2_B_18_1 + poseidon2_params_C_19_1); + const auto poseidon2_ARK_19_2 = (new_term.poseidon2_B_18_2 + poseidon2_params_C_19_2); + const auto poseidon2_ARK_19_3 = (new_term.poseidon2_B_18_3 + poseidon2_params_C_19_3); + const auto poseidon2_A_19_0 = + ((((poseidon2_ARK_19_0 * poseidon2_ARK_19_0) * poseidon2_ARK_19_0) * poseidon2_ARK_19_0) * + poseidon2_ARK_19_0); + const auto poseidon2_A_19_1 = poseidon2_ARK_19_1; + const auto poseidon2_A_19_2 = poseidon2_ARK_19_2; + const auto poseidon2_A_19_3 = poseidon2_ARK_19_3; + const auto poseidon2_SUM_19 = (((poseidon2_A_19_0 + poseidon2_A_19_1) + poseidon2_A_19_2) + poseidon2_A_19_3); + const auto poseidon2_ARK_20_0 = (new_term.poseidon2_B_19_0 + poseidon2_params_C_20_0); + const auto poseidon2_ARK_20_1 = (new_term.poseidon2_B_19_1 + poseidon2_params_C_20_1); + const auto poseidon2_ARK_20_2 = (new_term.poseidon2_B_19_2 + poseidon2_params_C_20_2); + const auto poseidon2_ARK_20_3 = (new_term.poseidon2_B_19_3 + poseidon2_params_C_20_3); + const auto poseidon2_A_20_0 = + ((((poseidon2_ARK_20_0 * poseidon2_ARK_20_0) * poseidon2_ARK_20_0) * poseidon2_ARK_20_0) * + poseidon2_ARK_20_0); + const auto poseidon2_A_20_1 = poseidon2_ARK_20_1; + const auto poseidon2_A_20_2 = poseidon2_ARK_20_2; + const auto poseidon2_A_20_3 = poseidon2_ARK_20_3; + const auto poseidon2_SUM_20 = (((poseidon2_A_20_0 + poseidon2_A_20_1) + poseidon2_A_20_2) + poseidon2_A_20_3); + const auto poseidon2_ARK_21_0 = (new_term.poseidon2_B_20_0 + poseidon2_params_C_21_0); + const auto poseidon2_ARK_21_1 = (new_term.poseidon2_B_20_1 + poseidon2_params_C_21_1); + const auto poseidon2_ARK_21_2 = (new_term.poseidon2_B_20_2 + poseidon2_params_C_21_2); + const auto poseidon2_ARK_21_3 = (new_term.poseidon2_B_20_3 + poseidon2_params_C_21_3); + const auto poseidon2_A_21_0 = + ((((poseidon2_ARK_21_0 * poseidon2_ARK_21_0) * poseidon2_ARK_21_0) * poseidon2_ARK_21_0) * + poseidon2_ARK_21_0); + const auto poseidon2_A_21_1 = poseidon2_ARK_21_1; + const auto poseidon2_A_21_2 = poseidon2_ARK_21_2; + const auto poseidon2_A_21_3 = poseidon2_ARK_21_3; + const auto poseidon2_SUM_21 = (((poseidon2_A_21_0 + poseidon2_A_21_1) + poseidon2_A_21_2) + poseidon2_A_21_3); + const auto poseidon2_ARK_22_0 = (new_term.poseidon2_B_21_0 + poseidon2_params_C_22_0); + const auto poseidon2_ARK_22_1 = (new_term.poseidon2_B_21_1 + poseidon2_params_C_22_1); + const auto poseidon2_ARK_22_2 = (new_term.poseidon2_B_21_2 + poseidon2_params_C_22_2); + const auto poseidon2_ARK_22_3 = (new_term.poseidon2_B_21_3 + poseidon2_params_C_22_3); + const auto poseidon2_A_22_0 = + ((((poseidon2_ARK_22_0 * poseidon2_ARK_22_0) * poseidon2_ARK_22_0) * poseidon2_ARK_22_0) * + poseidon2_ARK_22_0); + const auto poseidon2_A_22_1 = poseidon2_ARK_22_1; + const auto poseidon2_A_22_2 = poseidon2_ARK_22_2; + const auto poseidon2_A_22_3 = poseidon2_ARK_22_3; + const auto poseidon2_SUM_22 = (((poseidon2_A_22_0 + poseidon2_A_22_1) + poseidon2_A_22_2) + poseidon2_A_22_3); + const auto poseidon2_ARK_23_0 = (new_term.poseidon2_B_22_0 + poseidon2_params_C_23_0); + const auto poseidon2_ARK_23_1 = (new_term.poseidon2_B_22_1 + poseidon2_params_C_23_1); + const auto poseidon2_ARK_23_2 = (new_term.poseidon2_B_22_2 + poseidon2_params_C_23_2); + const auto poseidon2_ARK_23_3 = (new_term.poseidon2_B_22_3 + poseidon2_params_C_23_3); + const auto poseidon2_A_23_0 = + ((((poseidon2_ARK_23_0 * poseidon2_ARK_23_0) * poseidon2_ARK_23_0) * poseidon2_ARK_23_0) * + poseidon2_ARK_23_0); + const auto poseidon2_A_23_1 = poseidon2_ARK_23_1; + const auto poseidon2_A_23_2 = poseidon2_ARK_23_2; + const auto poseidon2_A_23_3 = poseidon2_ARK_23_3; + const auto poseidon2_SUM_23 = (((poseidon2_A_23_0 + poseidon2_A_23_1) + poseidon2_A_23_2) + poseidon2_A_23_3); + const auto poseidon2_ARK_24_0 = (new_term.poseidon2_B_23_0 + poseidon2_params_C_24_0); + const auto poseidon2_ARK_24_1 = (new_term.poseidon2_B_23_1 + poseidon2_params_C_24_1); + const auto poseidon2_ARK_24_2 = (new_term.poseidon2_B_23_2 + poseidon2_params_C_24_2); + const auto poseidon2_ARK_24_3 = (new_term.poseidon2_B_23_3 + poseidon2_params_C_24_3); + const auto poseidon2_A_24_0 = + ((((poseidon2_ARK_24_0 * poseidon2_ARK_24_0) * poseidon2_ARK_24_0) * poseidon2_ARK_24_0) * + poseidon2_ARK_24_0); + const auto poseidon2_A_24_1 = poseidon2_ARK_24_1; + const auto poseidon2_A_24_2 = poseidon2_ARK_24_2; + const auto poseidon2_A_24_3 = poseidon2_ARK_24_3; + const auto poseidon2_SUM_24 = (((poseidon2_A_24_0 + poseidon2_A_24_1) + poseidon2_A_24_2) + poseidon2_A_24_3); + const auto poseidon2_ARK_25_0 = (new_term.poseidon2_B_24_0 + poseidon2_params_C_25_0); + const auto poseidon2_ARK_25_1 = (new_term.poseidon2_B_24_1 + poseidon2_params_C_25_1); + const auto poseidon2_ARK_25_2 = (new_term.poseidon2_B_24_2 + poseidon2_params_C_25_2); + const auto poseidon2_ARK_25_3 = (new_term.poseidon2_B_24_3 + poseidon2_params_C_25_3); + const auto poseidon2_A_25_0 = + ((((poseidon2_ARK_25_0 * poseidon2_ARK_25_0) * poseidon2_ARK_25_0) * poseidon2_ARK_25_0) * + poseidon2_ARK_25_0); + const auto poseidon2_A_25_1 = poseidon2_ARK_25_1; + const auto poseidon2_A_25_2 = poseidon2_ARK_25_2; + const auto poseidon2_A_25_3 = poseidon2_ARK_25_3; + const auto poseidon2_SUM_25 = (((poseidon2_A_25_0 + poseidon2_A_25_1) + poseidon2_A_25_2) + poseidon2_A_25_3); + const auto poseidon2_ARK_26_0 = (new_term.poseidon2_B_25_0 + poseidon2_params_C_26_0); + const auto poseidon2_ARK_26_1 = (new_term.poseidon2_B_25_1 + poseidon2_params_C_26_1); + const auto poseidon2_ARK_26_2 = (new_term.poseidon2_B_25_2 + poseidon2_params_C_26_2); + const auto poseidon2_ARK_26_3 = (new_term.poseidon2_B_25_3 + poseidon2_params_C_26_3); + const auto poseidon2_A_26_0 = + ((((poseidon2_ARK_26_0 * poseidon2_ARK_26_0) * poseidon2_ARK_26_0) * poseidon2_ARK_26_0) * + poseidon2_ARK_26_0); + const auto poseidon2_A_26_1 = poseidon2_ARK_26_1; + const auto poseidon2_A_26_2 = poseidon2_ARK_26_2; + const auto poseidon2_A_26_3 = poseidon2_ARK_26_3; + const auto poseidon2_SUM_26 = (((poseidon2_A_26_0 + poseidon2_A_26_1) + poseidon2_A_26_2) + poseidon2_A_26_3); + const auto poseidon2_ARK_27_0 = (new_term.poseidon2_B_26_0 + poseidon2_params_C_27_0); + const auto poseidon2_ARK_27_1 = (new_term.poseidon2_B_26_1 + poseidon2_params_C_27_1); + const auto poseidon2_ARK_27_2 = (new_term.poseidon2_B_26_2 + poseidon2_params_C_27_2); + const auto poseidon2_ARK_27_3 = (new_term.poseidon2_B_26_3 + poseidon2_params_C_27_3); + const auto poseidon2_A_27_0 = + ((((poseidon2_ARK_27_0 * poseidon2_ARK_27_0) * poseidon2_ARK_27_0) * poseidon2_ARK_27_0) * + poseidon2_ARK_27_0); + const auto poseidon2_A_27_1 = poseidon2_ARK_27_1; + const auto poseidon2_A_27_2 = poseidon2_ARK_27_2; + const auto poseidon2_A_27_3 = poseidon2_ARK_27_3; + const auto poseidon2_SUM_27 = (((poseidon2_A_27_0 + poseidon2_A_27_1) + poseidon2_A_27_2) + poseidon2_A_27_3); + const auto poseidon2_ARK_28_0 = (new_term.poseidon2_B_27_0 + poseidon2_params_C_28_0); + const auto poseidon2_ARK_28_1 = (new_term.poseidon2_B_27_1 + poseidon2_params_C_28_1); + const auto poseidon2_ARK_28_2 = (new_term.poseidon2_B_27_2 + poseidon2_params_C_28_2); + const auto poseidon2_ARK_28_3 = (new_term.poseidon2_B_27_3 + poseidon2_params_C_28_3); + const auto poseidon2_A_28_0 = + ((((poseidon2_ARK_28_0 * poseidon2_ARK_28_0) * poseidon2_ARK_28_0) * poseidon2_ARK_28_0) * + poseidon2_ARK_28_0); + const auto poseidon2_A_28_1 = poseidon2_ARK_28_1; + const auto poseidon2_A_28_2 = poseidon2_ARK_28_2; + const auto poseidon2_A_28_3 = poseidon2_ARK_28_3; + const auto poseidon2_SUM_28 = (((poseidon2_A_28_0 + poseidon2_A_28_1) + poseidon2_A_28_2) + poseidon2_A_28_3); + const auto poseidon2_ARK_29_0 = (new_term.poseidon2_B_28_0 + poseidon2_params_C_29_0); + const auto poseidon2_ARK_29_1 = (new_term.poseidon2_B_28_1 + poseidon2_params_C_29_1); + const auto poseidon2_ARK_29_2 = (new_term.poseidon2_B_28_2 + poseidon2_params_C_29_2); + const auto poseidon2_ARK_29_3 = (new_term.poseidon2_B_28_3 + poseidon2_params_C_29_3); + const auto poseidon2_A_29_0 = + ((((poseidon2_ARK_29_0 * poseidon2_ARK_29_0) * poseidon2_ARK_29_0) * poseidon2_ARK_29_0) * + poseidon2_ARK_29_0); + const auto poseidon2_A_29_1 = poseidon2_ARK_29_1; + const auto poseidon2_A_29_2 = poseidon2_ARK_29_2; + const auto poseidon2_A_29_3 = poseidon2_ARK_29_3; + const auto poseidon2_SUM_29 = (((poseidon2_A_29_0 + poseidon2_A_29_1) + poseidon2_A_29_2) + poseidon2_A_29_3); + const auto poseidon2_ARK_30_0 = (new_term.poseidon2_B_29_0 + poseidon2_params_C_30_0); + const auto poseidon2_ARK_30_1 = (new_term.poseidon2_B_29_1 + poseidon2_params_C_30_1); + const auto poseidon2_ARK_30_2 = (new_term.poseidon2_B_29_2 + poseidon2_params_C_30_2); + const auto poseidon2_ARK_30_3 = (new_term.poseidon2_B_29_3 + poseidon2_params_C_30_3); + const auto poseidon2_A_30_0 = + ((((poseidon2_ARK_30_0 * poseidon2_ARK_30_0) * poseidon2_ARK_30_0) * poseidon2_ARK_30_0) * + poseidon2_ARK_30_0); + const auto poseidon2_A_30_1 = poseidon2_ARK_30_1; + const auto poseidon2_A_30_2 = poseidon2_ARK_30_2; + const auto poseidon2_A_30_3 = poseidon2_ARK_30_3; + const auto poseidon2_SUM_30 = (((poseidon2_A_30_0 + poseidon2_A_30_1) + poseidon2_A_30_2) + poseidon2_A_30_3); + const auto poseidon2_ARK_31_0 = (new_term.poseidon2_B_30_0 + poseidon2_params_C_31_0); + const auto poseidon2_ARK_31_1 = (new_term.poseidon2_B_30_1 + poseidon2_params_C_31_1); + const auto poseidon2_ARK_31_2 = (new_term.poseidon2_B_30_2 + poseidon2_params_C_31_2); + const auto poseidon2_ARK_31_3 = (new_term.poseidon2_B_30_3 + poseidon2_params_C_31_3); + const auto poseidon2_A_31_0 = + ((((poseidon2_ARK_31_0 * poseidon2_ARK_31_0) * poseidon2_ARK_31_0) * poseidon2_ARK_31_0) * + poseidon2_ARK_31_0); + const auto poseidon2_A_31_1 = poseidon2_ARK_31_1; + const auto poseidon2_A_31_2 = poseidon2_ARK_31_2; + const auto poseidon2_A_31_3 = poseidon2_ARK_31_3; + const auto poseidon2_SUM_31 = (((poseidon2_A_31_0 + poseidon2_A_31_1) + poseidon2_A_31_2) + poseidon2_A_31_3); + const auto poseidon2_ARK_32_0 = (new_term.poseidon2_B_31_0 + poseidon2_params_C_32_0); + const auto poseidon2_ARK_32_1 = (new_term.poseidon2_B_31_1 + poseidon2_params_C_32_1); + const auto poseidon2_ARK_32_2 = (new_term.poseidon2_B_31_2 + poseidon2_params_C_32_2); + const auto poseidon2_ARK_32_3 = (new_term.poseidon2_B_31_3 + poseidon2_params_C_32_3); + const auto poseidon2_A_32_0 = + ((((poseidon2_ARK_32_0 * poseidon2_ARK_32_0) * poseidon2_ARK_32_0) * poseidon2_ARK_32_0) * + poseidon2_ARK_32_0); + const auto poseidon2_A_32_1 = poseidon2_ARK_32_1; + const auto poseidon2_A_32_2 = poseidon2_ARK_32_2; + const auto poseidon2_A_32_3 = poseidon2_ARK_32_3; + const auto poseidon2_SUM_32 = (((poseidon2_A_32_0 + poseidon2_A_32_1) + poseidon2_A_32_2) + poseidon2_A_32_3); + const auto poseidon2_ARK_33_0 = (new_term.poseidon2_B_32_0 + poseidon2_params_C_33_0); + const auto poseidon2_ARK_33_1 = (new_term.poseidon2_B_32_1 + poseidon2_params_C_33_1); + const auto poseidon2_ARK_33_2 = (new_term.poseidon2_B_32_2 + poseidon2_params_C_33_2); + const auto poseidon2_ARK_33_3 = (new_term.poseidon2_B_32_3 + poseidon2_params_C_33_3); + const auto poseidon2_A_33_0 = + ((((poseidon2_ARK_33_0 * poseidon2_ARK_33_0) * poseidon2_ARK_33_0) * poseidon2_ARK_33_0) * + poseidon2_ARK_33_0); + const auto poseidon2_A_33_1 = poseidon2_ARK_33_1; + const auto poseidon2_A_33_2 = poseidon2_ARK_33_2; + const auto poseidon2_A_33_3 = poseidon2_ARK_33_3; + const auto poseidon2_SUM_33 = (((poseidon2_A_33_0 + poseidon2_A_33_1) + poseidon2_A_33_2) + poseidon2_A_33_3); + const auto poseidon2_ARK_34_0 = (new_term.poseidon2_B_33_0 + poseidon2_params_C_34_0); + const auto poseidon2_ARK_34_1 = (new_term.poseidon2_B_33_1 + poseidon2_params_C_34_1); + const auto poseidon2_ARK_34_2 = (new_term.poseidon2_B_33_2 + poseidon2_params_C_34_2); + const auto poseidon2_ARK_34_3 = (new_term.poseidon2_B_33_3 + poseidon2_params_C_34_3); + const auto poseidon2_A_34_0 = + ((((poseidon2_ARK_34_0 * poseidon2_ARK_34_0) * poseidon2_ARK_34_0) * poseidon2_ARK_34_0) * + poseidon2_ARK_34_0); + const auto poseidon2_A_34_1 = poseidon2_ARK_34_1; + const auto poseidon2_A_34_2 = poseidon2_ARK_34_2; + const auto poseidon2_A_34_3 = poseidon2_ARK_34_3; + const auto poseidon2_SUM_34 = (((poseidon2_A_34_0 + poseidon2_A_34_1) + poseidon2_A_34_2) + poseidon2_A_34_3); + const auto poseidon2_ARK_35_0 = (new_term.poseidon2_B_34_0 + poseidon2_params_C_35_0); + const auto poseidon2_ARK_35_1 = (new_term.poseidon2_B_34_1 + poseidon2_params_C_35_1); + const auto poseidon2_ARK_35_2 = (new_term.poseidon2_B_34_2 + poseidon2_params_C_35_2); + const auto poseidon2_ARK_35_3 = (new_term.poseidon2_B_34_3 + poseidon2_params_C_35_3); + const auto poseidon2_A_35_0 = + ((((poseidon2_ARK_35_0 * poseidon2_ARK_35_0) * poseidon2_ARK_35_0) * poseidon2_ARK_35_0) * + poseidon2_ARK_35_0); + const auto poseidon2_A_35_1 = poseidon2_ARK_35_1; + const auto poseidon2_A_35_2 = poseidon2_ARK_35_2; + const auto poseidon2_A_35_3 = poseidon2_ARK_35_3; + const auto poseidon2_SUM_35 = (((poseidon2_A_35_0 + poseidon2_A_35_1) + poseidon2_A_35_2) + poseidon2_A_35_3); + const auto poseidon2_ARK_36_0 = (new_term.poseidon2_B_35_0 + poseidon2_params_C_36_0); + const auto poseidon2_ARK_36_1 = (new_term.poseidon2_B_35_1 + poseidon2_params_C_36_1); + const auto poseidon2_ARK_36_2 = (new_term.poseidon2_B_35_2 + poseidon2_params_C_36_2); + const auto poseidon2_ARK_36_3 = (new_term.poseidon2_B_35_3 + poseidon2_params_C_36_3); + const auto poseidon2_A_36_0 = + ((((poseidon2_ARK_36_0 * poseidon2_ARK_36_0) * poseidon2_ARK_36_0) * poseidon2_ARK_36_0) * + poseidon2_ARK_36_0); + const auto poseidon2_A_36_1 = poseidon2_ARK_36_1; + const auto poseidon2_A_36_2 = poseidon2_ARK_36_2; + const auto poseidon2_A_36_3 = poseidon2_ARK_36_3; + const auto poseidon2_SUM_36 = (((poseidon2_A_36_0 + poseidon2_A_36_1) + poseidon2_A_36_2) + poseidon2_A_36_3); + const auto poseidon2_ARK_37_0 = (new_term.poseidon2_B_36_0 + poseidon2_params_C_37_0); + const auto poseidon2_ARK_37_1 = (new_term.poseidon2_B_36_1 + poseidon2_params_C_37_1); + const auto poseidon2_ARK_37_2 = (new_term.poseidon2_B_36_2 + poseidon2_params_C_37_2); + const auto poseidon2_ARK_37_3 = (new_term.poseidon2_B_36_3 + poseidon2_params_C_37_3); + const auto poseidon2_A_37_0 = + ((((poseidon2_ARK_37_0 * poseidon2_ARK_37_0) * poseidon2_ARK_37_0) * poseidon2_ARK_37_0) * + poseidon2_ARK_37_0); + const auto poseidon2_A_37_1 = poseidon2_ARK_37_1; + const auto poseidon2_A_37_2 = poseidon2_ARK_37_2; + const auto poseidon2_A_37_3 = poseidon2_ARK_37_3; + const auto poseidon2_SUM_37 = (((poseidon2_A_37_0 + poseidon2_A_37_1) + poseidon2_A_37_2) + poseidon2_A_37_3); + const auto poseidon2_ARK_38_0 = (new_term.poseidon2_B_37_0 + poseidon2_params_C_38_0); + const auto poseidon2_ARK_38_1 = (new_term.poseidon2_B_37_1 + poseidon2_params_C_38_1); + const auto poseidon2_ARK_38_2 = (new_term.poseidon2_B_37_2 + poseidon2_params_C_38_2); + const auto poseidon2_ARK_38_3 = (new_term.poseidon2_B_37_3 + poseidon2_params_C_38_3); + const auto poseidon2_A_38_0 = + ((((poseidon2_ARK_38_0 * poseidon2_ARK_38_0) * poseidon2_ARK_38_0) * poseidon2_ARK_38_0) * + poseidon2_ARK_38_0); + const auto poseidon2_A_38_1 = poseidon2_ARK_38_1; + const auto poseidon2_A_38_2 = poseidon2_ARK_38_2; + const auto poseidon2_A_38_3 = poseidon2_ARK_38_3; + const auto poseidon2_SUM_38 = (((poseidon2_A_38_0 + poseidon2_A_38_1) + poseidon2_A_38_2) + poseidon2_A_38_3); + const auto poseidon2_ARK_39_0 = (new_term.poseidon2_B_38_0 + poseidon2_params_C_39_0); + const auto poseidon2_ARK_39_1 = (new_term.poseidon2_B_38_1 + poseidon2_params_C_39_1); + const auto poseidon2_ARK_39_2 = (new_term.poseidon2_B_38_2 + poseidon2_params_C_39_2); + const auto poseidon2_ARK_39_3 = (new_term.poseidon2_B_38_3 + poseidon2_params_C_39_3); + const auto poseidon2_A_39_0 = + ((((poseidon2_ARK_39_0 * poseidon2_ARK_39_0) * poseidon2_ARK_39_0) * poseidon2_ARK_39_0) * + poseidon2_ARK_39_0); + const auto poseidon2_A_39_1 = poseidon2_ARK_39_1; + const auto poseidon2_A_39_2 = poseidon2_ARK_39_2; + const auto poseidon2_A_39_3 = poseidon2_ARK_39_3; + const auto poseidon2_SUM_39 = (((poseidon2_A_39_0 + poseidon2_A_39_1) + poseidon2_A_39_2) + poseidon2_A_39_3); + const auto poseidon2_ARK_40_0 = (new_term.poseidon2_B_39_0 + poseidon2_params_C_40_0); + const auto poseidon2_ARK_40_1 = (new_term.poseidon2_B_39_1 + poseidon2_params_C_40_1); + const auto poseidon2_ARK_40_2 = (new_term.poseidon2_B_39_2 + poseidon2_params_C_40_2); + const auto poseidon2_ARK_40_3 = (new_term.poseidon2_B_39_3 + poseidon2_params_C_40_3); + const auto poseidon2_A_40_0 = + ((((poseidon2_ARK_40_0 * poseidon2_ARK_40_0) * poseidon2_ARK_40_0) * poseidon2_ARK_40_0) * + poseidon2_ARK_40_0); + const auto poseidon2_A_40_1 = poseidon2_ARK_40_1; + const auto poseidon2_A_40_2 = poseidon2_ARK_40_2; + const auto poseidon2_A_40_3 = poseidon2_ARK_40_3; + const auto poseidon2_SUM_40 = (((poseidon2_A_40_0 + poseidon2_A_40_1) + poseidon2_A_40_2) + poseidon2_A_40_3); + const auto poseidon2_ARK_41_0 = (new_term.poseidon2_B_40_0 + poseidon2_params_C_41_0); + const auto poseidon2_ARK_41_1 = (new_term.poseidon2_B_40_1 + poseidon2_params_C_41_1); + const auto poseidon2_ARK_41_2 = (new_term.poseidon2_B_40_2 + poseidon2_params_C_41_2); + const auto poseidon2_ARK_41_3 = (new_term.poseidon2_B_40_3 + poseidon2_params_C_41_3); + const auto poseidon2_A_41_0 = + ((((poseidon2_ARK_41_0 * poseidon2_ARK_41_0) * poseidon2_ARK_41_0) * poseidon2_ARK_41_0) * + poseidon2_ARK_41_0); + const auto poseidon2_A_41_1 = poseidon2_ARK_41_1; + const auto poseidon2_A_41_2 = poseidon2_ARK_41_2; + const auto poseidon2_A_41_3 = poseidon2_ARK_41_3; + const auto poseidon2_SUM_41 = (((poseidon2_A_41_0 + poseidon2_A_41_1) + poseidon2_A_41_2) + poseidon2_A_41_3); + const auto poseidon2_ARK_42_0 = (new_term.poseidon2_B_41_0 + poseidon2_params_C_42_0); + const auto poseidon2_ARK_42_1 = (new_term.poseidon2_B_41_1 + poseidon2_params_C_42_1); + const auto poseidon2_ARK_42_2 = (new_term.poseidon2_B_41_2 + poseidon2_params_C_42_2); + const auto poseidon2_ARK_42_3 = (new_term.poseidon2_B_41_3 + poseidon2_params_C_42_3); + const auto poseidon2_A_42_0 = + ((((poseidon2_ARK_42_0 * poseidon2_ARK_42_0) * poseidon2_ARK_42_0) * poseidon2_ARK_42_0) * + poseidon2_ARK_42_0); + const auto poseidon2_A_42_1 = poseidon2_ARK_42_1; + const auto poseidon2_A_42_2 = poseidon2_ARK_42_2; + const auto poseidon2_A_42_3 = poseidon2_ARK_42_3; + const auto poseidon2_SUM_42 = (((poseidon2_A_42_0 + poseidon2_A_42_1) + poseidon2_A_42_2) + poseidon2_A_42_3); + const auto poseidon2_ARK_43_0 = (new_term.poseidon2_B_42_0 + poseidon2_params_C_43_0); + const auto poseidon2_ARK_43_1 = (new_term.poseidon2_B_42_1 + poseidon2_params_C_43_1); + const auto poseidon2_ARK_43_2 = (new_term.poseidon2_B_42_2 + poseidon2_params_C_43_2); + const auto poseidon2_ARK_43_3 = (new_term.poseidon2_B_42_3 + poseidon2_params_C_43_3); + const auto poseidon2_A_43_0 = + ((((poseidon2_ARK_43_0 * poseidon2_ARK_43_0) * poseidon2_ARK_43_0) * poseidon2_ARK_43_0) * + poseidon2_ARK_43_0); + const auto poseidon2_A_43_1 = poseidon2_ARK_43_1; + const auto poseidon2_A_43_2 = poseidon2_ARK_43_2; + const auto poseidon2_A_43_3 = poseidon2_ARK_43_3; + const auto poseidon2_SUM_43 = (((poseidon2_A_43_0 + poseidon2_A_43_1) + poseidon2_A_43_2) + poseidon2_A_43_3); + const auto poseidon2_ARK_44_0 = (new_term.poseidon2_B_43_0 + poseidon2_params_C_44_0); + const auto poseidon2_ARK_44_1 = (new_term.poseidon2_B_43_1 + poseidon2_params_C_44_1); + const auto poseidon2_ARK_44_2 = (new_term.poseidon2_B_43_2 + poseidon2_params_C_44_2); + const auto poseidon2_ARK_44_3 = (new_term.poseidon2_B_43_3 + poseidon2_params_C_44_3); + const auto poseidon2_A_44_0 = + ((((poseidon2_ARK_44_0 * poseidon2_ARK_44_0) * poseidon2_ARK_44_0) * poseidon2_ARK_44_0) * + poseidon2_ARK_44_0); + const auto poseidon2_A_44_1 = poseidon2_ARK_44_1; + const auto poseidon2_A_44_2 = poseidon2_ARK_44_2; + const auto poseidon2_A_44_3 = poseidon2_ARK_44_3; + const auto poseidon2_SUM_44 = (((poseidon2_A_44_0 + poseidon2_A_44_1) + poseidon2_A_44_2) + poseidon2_A_44_3); + const auto poseidon2_ARK_45_0 = (new_term.poseidon2_B_44_0 + poseidon2_params_C_45_0); + const auto poseidon2_ARK_45_1 = (new_term.poseidon2_B_44_1 + poseidon2_params_C_45_1); + const auto poseidon2_ARK_45_2 = (new_term.poseidon2_B_44_2 + poseidon2_params_C_45_2); + const auto poseidon2_ARK_45_3 = (new_term.poseidon2_B_44_3 + poseidon2_params_C_45_3); + const auto poseidon2_A_45_0 = + ((((poseidon2_ARK_45_0 * poseidon2_ARK_45_0) * poseidon2_ARK_45_0) * poseidon2_ARK_45_0) * + poseidon2_ARK_45_0); + const auto poseidon2_A_45_1 = poseidon2_ARK_45_1; + const auto poseidon2_A_45_2 = poseidon2_ARK_45_2; + const auto poseidon2_A_45_3 = poseidon2_ARK_45_3; + const auto poseidon2_SUM_45 = (((poseidon2_A_45_0 + poseidon2_A_45_1) + poseidon2_A_45_2) + poseidon2_A_45_3); + const auto poseidon2_ARK_46_0 = (new_term.poseidon2_B_45_0 + poseidon2_params_C_46_0); + const auto poseidon2_ARK_46_1 = (new_term.poseidon2_B_45_1 + poseidon2_params_C_46_1); + const auto poseidon2_ARK_46_2 = (new_term.poseidon2_B_45_2 + poseidon2_params_C_46_2); + const auto poseidon2_ARK_46_3 = (new_term.poseidon2_B_45_3 + poseidon2_params_C_46_3); + const auto poseidon2_A_46_0 = + ((((poseidon2_ARK_46_0 * poseidon2_ARK_46_0) * poseidon2_ARK_46_0) * poseidon2_ARK_46_0) * + poseidon2_ARK_46_0); + const auto poseidon2_A_46_1 = poseidon2_ARK_46_1; + const auto poseidon2_A_46_2 = poseidon2_ARK_46_2; + const auto poseidon2_A_46_3 = poseidon2_ARK_46_3; + const auto poseidon2_SUM_46 = (((poseidon2_A_46_0 + poseidon2_A_46_1) + poseidon2_A_46_2) + poseidon2_A_46_3); + const auto poseidon2_ARK_47_0 = (new_term.poseidon2_B_46_0 + poseidon2_params_C_47_0); + const auto poseidon2_ARK_47_1 = (new_term.poseidon2_B_46_1 + poseidon2_params_C_47_1); + const auto poseidon2_ARK_47_2 = (new_term.poseidon2_B_46_2 + poseidon2_params_C_47_2); + const auto poseidon2_ARK_47_3 = (new_term.poseidon2_B_46_3 + poseidon2_params_C_47_3); + const auto poseidon2_A_47_0 = + ((((poseidon2_ARK_47_0 * poseidon2_ARK_47_0) * poseidon2_ARK_47_0) * poseidon2_ARK_47_0) * + poseidon2_ARK_47_0); + const auto poseidon2_A_47_1 = poseidon2_ARK_47_1; + const auto poseidon2_A_47_2 = poseidon2_ARK_47_2; + const auto poseidon2_A_47_3 = poseidon2_ARK_47_3; + const auto poseidon2_SUM_47 = (((poseidon2_A_47_0 + poseidon2_A_47_1) + poseidon2_A_47_2) + poseidon2_A_47_3); + const auto poseidon2_ARK_48_0 = (new_term.poseidon2_B_47_0 + poseidon2_params_C_48_0); + const auto poseidon2_ARK_48_1 = (new_term.poseidon2_B_47_1 + poseidon2_params_C_48_1); + const auto poseidon2_ARK_48_2 = (new_term.poseidon2_B_47_2 + poseidon2_params_C_48_2); + const auto poseidon2_ARK_48_3 = (new_term.poseidon2_B_47_3 + poseidon2_params_C_48_3); + const auto poseidon2_A_48_0 = + ((((poseidon2_ARK_48_0 * poseidon2_ARK_48_0) * poseidon2_ARK_48_0) * poseidon2_ARK_48_0) * + poseidon2_ARK_48_0); + const auto poseidon2_A_48_1 = poseidon2_ARK_48_1; + const auto poseidon2_A_48_2 = poseidon2_ARK_48_2; + const auto poseidon2_A_48_3 = poseidon2_ARK_48_3; + const auto poseidon2_SUM_48 = (((poseidon2_A_48_0 + poseidon2_A_48_1) + poseidon2_A_48_2) + poseidon2_A_48_3); + const auto poseidon2_ARK_49_0 = (new_term.poseidon2_B_48_0 + poseidon2_params_C_49_0); + const auto poseidon2_ARK_49_1 = (new_term.poseidon2_B_48_1 + poseidon2_params_C_49_1); + const auto poseidon2_ARK_49_2 = (new_term.poseidon2_B_48_2 + poseidon2_params_C_49_2); + const auto poseidon2_ARK_49_3 = (new_term.poseidon2_B_48_3 + poseidon2_params_C_49_3); + const auto poseidon2_A_49_0 = + ((((poseidon2_ARK_49_0 * poseidon2_ARK_49_0) * poseidon2_ARK_49_0) * poseidon2_ARK_49_0) * + poseidon2_ARK_49_0); + const auto poseidon2_A_49_1 = poseidon2_ARK_49_1; + const auto poseidon2_A_49_2 = poseidon2_ARK_49_2; + const auto poseidon2_A_49_3 = poseidon2_ARK_49_3; + const auto poseidon2_SUM_49 = (((poseidon2_A_49_0 + poseidon2_A_49_1) + poseidon2_A_49_2) + poseidon2_A_49_3); + const auto poseidon2_ARK_50_0 = (new_term.poseidon2_B_49_0 + poseidon2_params_C_50_0); + const auto poseidon2_ARK_50_1 = (new_term.poseidon2_B_49_1 + poseidon2_params_C_50_1); + const auto poseidon2_ARK_50_2 = (new_term.poseidon2_B_49_2 + poseidon2_params_C_50_2); + const auto poseidon2_ARK_50_3 = (new_term.poseidon2_B_49_3 + poseidon2_params_C_50_3); + const auto poseidon2_A_50_0 = + ((((poseidon2_ARK_50_0 * poseidon2_ARK_50_0) * poseidon2_ARK_50_0) * poseidon2_ARK_50_0) * + poseidon2_ARK_50_0); + const auto poseidon2_A_50_1 = poseidon2_ARK_50_1; + const auto poseidon2_A_50_2 = poseidon2_ARK_50_2; + const auto poseidon2_A_50_3 = poseidon2_ARK_50_3; + const auto poseidon2_SUM_50 = (((poseidon2_A_50_0 + poseidon2_A_50_1) + poseidon2_A_50_2) + poseidon2_A_50_3); + const auto poseidon2_ARK_51_0 = (new_term.poseidon2_B_50_0 + poseidon2_params_C_51_0); + const auto poseidon2_ARK_51_1 = (new_term.poseidon2_B_50_1 + poseidon2_params_C_51_1); + const auto poseidon2_ARK_51_2 = (new_term.poseidon2_B_50_2 + poseidon2_params_C_51_2); + const auto poseidon2_ARK_51_3 = (new_term.poseidon2_B_50_3 + poseidon2_params_C_51_3); + const auto poseidon2_A_51_0 = + ((((poseidon2_ARK_51_0 * poseidon2_ARK_51_0) * poseidon2_ARK_51_0) * poseidon2_ARK_51_0) * + poseidon2_ARK_51_0); + const auto poseidon2_A_51_1 = poseidon2_ARK_51_1; + const auto poseidon2_A_51_2 = poseidon2_ARK_51_2; + const auto poseidon2_A_51_3 = poseidon2_ARK_51_3; + const auto poseidon2_SUM_51 = (((poseidon2_A_51_0 + poseidon2_A_51_1) + poseidon2_A_51_2) + poseidon2_A_51_3); + const auto poseidon2_ARK_52_0 = (new_term.poseidon2_B_51_0 + poseidon2_params_C_52_0); + const auto poseidon2_ARK_52_1 = (new_term.poseidon2_B_51_1 + poseidon2_params_C_52_1); + const auto poseidon2_ARK_52_2 = (new_term.poseidon2_B_51_2 + poseidon2_params_C_52_2); + const auto poseidon2_ARK_52_3 = (new_term.poseidon2_B_51_3 + poseidon2_params_C_52_3); + const auto poseidon2_A_52_0 = + ((((poseidon2_ARK_52_0 * poseidon2_ARK_52_0) * poseidon2_ARK_52_0) * poseidon2_ARK_52_0) * + poseidon2_ARK_52_0); + const auto poseidon2_A_52_1 = poseidon2_ARK_52_1; + const auto poseidon2_A_52_2 = poseidon2_ARK_52_2; + const auto poseidon2_A_52_3 = poseidon2_ARK_52_3; + const auto poseidon2_SUM_52 = (((poseidon2_A_52_0 + poseidon2_A_52_1) + poseidon2_A_52_2) + poseidon2_A_52_3); + const auto poseidon2_ARK_53_0 = (new_term.poseidon2_B_52_0 + poseidon2_params_C_53_0); + const auto poseidon2_ARK_53_1 = (new_term.poseidon2_B_52_1 + poseidon2_params_C_53_1); + const auto poseidon2_ARK_53_2 = (new_term.poseidon2_B_52_2 + poseidon2_params_C_53_2); + const auto poseidon2_ARK_53_3 = (new_term.poseidon2_B_52_3 + poseidon2_params_C_53_3); + const auto poseidon2_A_53_0 = + ((((poseidon2_ARK_53_0 * poseidon2_ARK_53_0) * poseidon2_ARK_53_0) * poseidon2_ARK_53_0) * + poseidon2_ARK_53_0); + const auto poseidon2_A_53_1 = poseidon2_ARK_53_1; + const auto poseidon2_A_53_2 = poseidon2_ARK_53_2; + const auto poseidon2_A_53_3 = poseidon2_ARK_53_3; + const auto poseidon2_SUM_53 = (((poseidon2_A_53_0 + poseidon2_A_53_1) + poseidon2_A_53_2) + poseidon2_A_53_3); + const auto poseidon2_ARK_54_0 = (new_term.poseidon2_B_53_0 + poseidon2_params_C_54_0); + const auto poseidon2_ARK_54_1 = (new_term.poseidon2_B_53_1 + poseidon2_params_C_54_1); + const auto poseidon2_ARK_54_2 = (new_term.poseidon2_B_53_2 + poseidon2_params_C_54_2); + const auto poseidon2_ARK_54_3 = (new_term.poseidon2_B_53_3 + poseidon2_params_C_54_3); + const auto poseidon2_A_54_0 = + ((((poseidon2_ARK_54_0 * poseidon2_ARK_54_0) * poseidon2_ARK_54_0) * poseidon2_ARK_54_0) * + poseidon2_ARK_54_0); + const auto poseidon2_A_54_1 = poseidon2_ARK_54_1; + const auto poseidon2_A_54_2 = poseidon2_ARK_54_2; + const auto poseidon2_A_54_3 = poseidon2_ARK_54_3; + const auto poseidon2_SUM_54 = (((poseidon2_A_54_0 + poseidon2_A_54_1) + poseidon2_A_54_2) + poseidon2_A_54_3); + const auto poseidon2_ARK_55_0 = (new_term.poseidon2_B_54_0 + poseidon2_params_C_55_0); + const auto poseidon2_ARK_55_1 = (new_term.poseidon2_B_54_1 + poseidon2_params_C_55_1); + const auto poseidon2_ARK_55_2 = (new_term.poseidon2_B_54_2 + poseidon2_params_C_55_2); + const auto poseidon2_ARK_55_3 = (new_term.poseidon2_B_54_3 + poseidon2_params_C_55_3); + const auto poseidon2_A_55_0 = + ((((poseidon2_ARK_55_0 * poseidon2_ARK_55_0) * poseidon2_ARK_55_0) * poseidon2_ARK_55_0) * + poseidon2_ARK_55_0); + const auto poseidon2_A_55_1 = poseidon2_ARK_55_1; + const auto poseidon2_A_55_2 = poseidon2_ARK_55_2; + const auto poseidon2_A_55_3 = poseidon2_ARK_55_3; + const auto poseidon2_SUM_55 = (((poseidon2_A_55_0 + poseidon2_A_55_1) + poseidon2_A_55_2) + poseidon2_A_55_3); + const auto poseidon2_ARK_56_0 = (new_term.poseidon2_B_55_0 + poseidon2_params_C_56_0); + const auto poseidon2_ARK_56_1 = (new_term.poseidon2_B_55_1 + poseidon2_params_C_56_1); + const auto poseidon2_ARK_56_2 = (new_term.poseidon2_B_55_2 + poseidon2_params_C_56_2); + const auto poseidon2_ARK_56_3 = (new_term.poseidon2_B_55_3 + poseidon2_params_C_56_3); + const auto poseidon2_A_56_0 = + ((((poseidon2_ARK_56_0 * poseidon2_ARK_56_0) * poseidon2_ARK_56_0) * poseidon2_ARK_56_0) * + poseidon2_ARK_56_0); + const auto poseidon2_A_56_1 = poseidon2_ARK_56_1; + const auto poseidon2_A_56_2 = poseidon2_ARK_56_2; + const auto poseidon2_A_56_3 = poseidon2_ARK_56_3; + const auto poseidon2_SUM_56 = (((poseidon2_A_56_0 + poseidon2_A_56_1) + poseidon2_A_56_2) + poseidon2_A_56_3); + const auto poseidon2_ARK_57_0 = (new_term.poseidon2_B_56_0 + poseidon2_params_C_57_0); + const auto poseidon2_ARK_57_1 = (new_term.poseidon2_B_56_1 + poseidon2_params_C_57_1); + const auto poseidon2_ARK_57_2 = (new_term.poseidon2_B_56_2 + poseidon2_params_C_57_2); + const auto poseidon2_ARK_57_3 = (new_term.poseidon2_B_56_3 + poseidon2_params_C_57_3); + const auto poseidon2_A_57_0 = + ((((poseidon2_ARK_57_0 * poseidon2_ARK_57_0) * poseidon2_ARK_57_0) * poseidon2_ARK_57_0) * + poseidon2_ARK_57_0); + const auto poseidon2_A_57_1 = poseidon2_ARK_57_1; + const auto poseidon2_A_57_2 = poseidon2_ARK_57_2; + const auto poseidon2_A_57_3 = poseidon2_ARK_57_3; + const auto poseidon2_SUM_57 = (((poseidon2_A_57_0 + poseidon2_A_57_1) + poseidon2_A_57_2) + poseidon2_A_57_3); + const auto poseidon2_ARK_58_0 = (new_term.poseidon2_B_57_0 + poseidon2_params_C_58_0); + const auto poseidon2_ARK_58_1 = (new_term.poseidon2_B_57_1 + poseidon2_params_C_58_1); + const auto poseidon2_ARK_58_2 = (new_term.poseidon2_B_57_2 + poseidon2_params_C_58_2); + const auto poseidon2_ARK_58_3 = (new_term.poseidon2_B_57_3 + poseidon2_params_C_58_3); + const auto poseidon2_A_58_0 = + ((((poseidon2_ARK_58_0 * poseidon2_ARK_58_0) * poseidon2_ARK_58_0) * poseidon2_ARK_58_0) * + poseidon2_ARK_58_0); + const auto poseidon2_A_58_1 = poseidon2_ARK_58_1; + const auto poseidon2_A_58_2 = poseidon2_ARK_58_2; + const auto poseidon2_A_58_3 = poseidon2_ARK_58_3; + const auto poseidon2_SUM_58 = (((poseidon2_A_58_0 + poseidon2_A_58_1) + poseidon2_A_58_2) + poseidon2_A_58_3); + const auto poseidon2_ARK_59_0 = (new_term.poseidon2_B_58_0 + poseidon2_params_C_59_0); + const auto poseidon2_ARK_59_1 = (new_term.poseidon2_B_58_1 + poseidon2_params_C_59_1); + const auto poseidon2_ARK_59_2 = (new_term.poseidon2_B_58_2 + poseidon2_params_C_59_2); + const auto poseidon2_ARK_59_3 = (new_term.poseidon2_B_58_3 + poseidon2_params_C_59_3); + const auto poseidon2_A_59_0 = + ((((poseidon2_ARK_59_0 * poseidon2_ARK_59_0) * poseidon2_ARK_59_0) * poseidon2_ARK_59_0) * + poseidon2_ARK_59_0); + const auto poseidon2_A_59_1 = poseidon2_ARK_59_1; + const auto poseidon2_A_59_2 = poseidon2_ARK_59_2; + const auto poseidon2_A_59_3 = poseidon2_ARK_59_3; + const auto poseidon2_SUM_59 = (((poseidon2_A_59_0 + poseidon2_A_59_1) + poseidon2_A_59_2) + poseidon2_A_59_3); + const auto poseidon2_ARK_60_0 = (new_term.poseidon2_B_59_0 + poseidon2_params_C_60_0); + const auto poseidon2_ARK_60_1 = (new_term.poseidon2_B_59_1 + poseidon2_params_C_60_1); + const auto poseidon2_ARK_60_2 = (new_term.poseidon2_B_59_2 + poseidon2_params_C_60_2); + const auto poseidon2_ARK_60_3 = (new_term.poseidon2_B_59_3 + poseidon2_params_C_60_3); + const auto poseidon2_A_60_0 = + ((((poseidon2_ARK_60_0 * poseidon2_ARK_60_0) * poseidon2_ARK_60_0) * poseidon2_ARK_60_0) * + poseidon2_ARK_60_0); + const auto poseidon2_A_60_1 = + ((((poseidon2_ARK_60_1 * poseidon2_ARK_60_1) * poseidon2_ARK_60_1) * poseidon2_ARK_60_1) * + poseidon2_ARK_60_1); + const auto poseidon2_A_60_2 = + ((((poseidon2_ARK_60_2 * poseidon2_ARK_60_2) * poseidon2_ARK_60_2) * poseidon2_ARK_60_2) * + poseidon2_ARK_60_2); + const auto poseidon2_A_60_3 = + ((((poseidon2_ARK_60_3 * poseidon2_ARK_60_3) * poseidon2_ARK_60_3) * poseidon2_ARK_60_3) * + poseidon2_ARK_60_3); + const auto poseidon2_T_60_0 = (poseidon2_A_60_0 + poseidon2_A_60_1); + const auto poseidon2_T_60_1 = (poseidon2_A_60_2 + poseidon2_A_60_3); + const auto poseidon2_T_60_2 = ((FF(2) * poseidon2_A_60_1) + poseidon2_T_60_1); + const auto poseidon2_T_60_3 = ((FF(2) * poseidon2_A_60_3) + poseidon2_T_60_0); + const auto poseidon2_ARK_61_0 = (new_term.poseidon2_T_60_6 + poseidon2_params_C_61_0); + const auto poseidon2_ARK_61_1 = (new_term.poseidon2_T_60_5 + poseidon2_params_C_61_1); + const auto poseidon2_ARK_61_2 = (new_term.poseidon2_T_60_7 + poseidon2_params_C_61_2); + const auto poseidon2_ARK_61_3 = (new_term.poseidon2_T_60_4 + poseidon2_params_C_61_3); + const auto poseidon2_A_61_0 = + ((((poseidon2_ARK_61_0 * poseidon2_ARK_61_0) * poseidon2_ARK_61_0) * poseidon2_ARK_61_0) * + poseidon2_ARK_61_0); + const auto poseidon2_A_61_1 = + ((((poseidon2_ARK_61_1 * poseidon2_ARK_61_1) * poseidon2_ARK_61_1) * poseidon2_ARK_61_1) * + poseidon2_ARK_61_1); + const auto poseidon2_A_61_2 = + ((((poseidon2_ARK_61_2 * poseidon2_ARK_61_2) * poseidon2_ARK_61_2) * poseidon2_ARK_61_2) * + poseidon2_ARK_61_2); + const auto poseidon2_A_61_3 = + ((((poseidon2_ARK_61_3 * poseidon2_ARK_61_3) * poseidon2_ARK_61_3) * poseidon2_ARK_61_3) * + poseidon2_ARK_61_3); + const auto poseidon2_T_61_0 = (poseidon2_A_61_0 + poseidon2_A_61_1); + const auto poseidon2_T_61_1 = (poseidon2_A_61_2 + poseidon2_A_61_3); + const auto poseidon2_T_61_2 = ((FF(2) * poseidon2_A_61_1) + poseidon2_T_61_1); + const auto poseidon2_T_61_3 = ((FF(2) * poseidon2_A_61_3) + poseidon2_T_61_0); + const auto poseidon2_ARK_62_0 = (new_term.poseidon2_T_61_6 + poseidon2_params_C_62_0); + const auto poseidon2_ARK_62_1 = (new_term.poseidon2_T_61_5 + poseidon2_params_C_62_1); + const auto poseidon2_ARK_62_2 = (new_term.poseidon2_T_61_7 + poseidon2_params_C_62_2); + const auto poseidon2_ARK_62_3 = (new_term.poseidon2_T_61_4 + poseidon2_params_C_62_3); + const auto poseidon2_A_62_0 = + ((((poseidon2_ARK_62_0 * poseidon2_ARK_62_0) * poseidon2_ARK_62_0) * poseidon2_ARK_62_0) * + poseidon2_ARK_62_0); + const auto poseidon2_A_62_1 = + ((((poseidon2_ARK_62_1 * poseidon2_ARK_62_1) * poseidon2_ARK_62_1) * poseidon2_ARK_62_1) * + poseidon2_ARK_62_1); + const auto poseidon2_A_62_2 = + ((((poseidon2_ARK_62_2 * poseidon2_ARK_62_2) * poseidon2_ARK_62_2) * poseidon2_ARK_62_2) * + poseidon2_ARK_62_2); + const auto poseidon2_A_62_3 = + ((((poseidon2_ARK_62_3 * poseidon2_ARK_62_3) * poseidon2_ARK_62_3) * poseidon2_ARK_62_3) * + poseidon2_ARK_62_3); + const auto poseidon2_T_62_0 = (poseidon2_A_62_0 + poseidon2_A_62_1); + const auto poseidon2_T_62_1 = (poseidon2_A_62_2 + poseidon2_A_62_3); + const auto poseidon2_T_62_2 = ((FF(2) * poseidon2_A_62_1) + poseidon2_T_62_1); + const auto poseidon2_T_62_3 = ((FF(2) * poseidon2_A_62_3) + poseidon2_T_62_0); + const auto poseidon2_ARK_63_0 = (new_term.poseidon2_T_62_6 + poseidon2_params_C_63_0); + const auto poseidon2_ARK_63_1 = (new_term.poseidon2_T_62_5 + poseidon2_params_C_63_1); + const auto poseidon2_ARK_63_2 = (new_term.poseidon2_T_62_7 + poseidon2_params_C_63_2); + const auto poseidon2_ARK_63_3 = (new_term.poseidon2_T_62_4 + poseidon2_params_C_63_3); + const auto poseidon2_A_63_0 = + ((((poseidon2_ARK_63_0 * poseidon2_ARK_63_0) * poseidon2_ARK_63_0) * poseidon2_ARK_63_0) * + poseidon2_ARK_63_0); + const auto poseidon2_A_63_1 = + ((((poseidon2_ARK_63_1 * poseidon2_ARK_63_1) * poseidon2_ARK_63_1) * poseidon2_ARK_63_1) * + poseidon2_ARK_63_1); + const auto poseidon2_A_63_2 = + ((((poseidon2_ARK_63_2 * poseidon2_ARK_63_2) * poseidon2_ARK_63_2) * poseidon2_ARK_63_2) * + poseidon2_ARK_63_2); + const auto poseidon2_A_63_3 = + ((((poseidon2_ARK_63_3 * poseidon2_ARK_63_3) * poseidon2_ARK_63_3) * poseidon2_ARK_63_3) * + poseidon2_ARK_63_3); + const auto poseidon2_T_63_0 = (poseidon2_A_63_0 + poseidon2_A_63_1); + const auto poseidon2_T_63_1 = (poseidon2_A_63_2 + poseidon2_A_63_3); + const auto poseidon2_T_63_2 = ((FF(2) * poseidon2_A_63_1) + poseidon2_T_63_1); + const auto poseidon2_T_63_3 = ((FF(2) * poseidon2_A_63_3) + poseidon2_T_63_0); + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.poseidon2_sel_poseidon_perm * (-new_term.poseidon2_sel_poseidon_perm + FF(1))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * (FF(1) - new_term.poseidon2_sel_poseidon_perm)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } @@ -380,11563 +1209,1820 @@ template class poseidon2Impl { { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_EXT_LAYER_4 - - (((new_term.poseidon2_a_2 + new_term.poseidon2_a_3) * FF(4)) + - ((new_term.poseidon2_a_3 * FF(2)) + (new_term.poseidon2_a_0 + new_term.poseidon2_a_1))))); + (new_term.poseidon2_EXT_LAYER_4 - ((FF(4) * poseidon2_EXT_LAYER_1) + poseidon2_EXT_LAYER_3))); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_EXT_LAYER_5 - - (((new_term.poseidon2_a_0 + new_term.poseidon2_a_1) * FF(4)) + - ((new_term.poseidon2_a_1 * FF(2)) + (new_term.poseidon2_a_2 + new_term.poseidon2_a_3))))); + (new_term.poseidon2_EXT_LAYER_5 - ((FF(4) * poseidon2_EXT_LAYER_0) + poseidon2_EXT_LAYER_2))); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_EXT_LAYER_6 - - (((new_term.poseidon2_a_3 * FF(2)) + (new_term.poseidon2_a_0 + new_term.poseidon2_a_1)) + - new_term.poseidon2_EXT_LAYER_5))); + (new_term.poseidon2_EXT_LAYER_6 - (poseidon2_EXT_LAYER_3 + new_term.poseidon2_EXT_LAYER_5))); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_EXT_LAYER_7 - - (((new_term.poseidon2_a_1 * FF(2)) + (new_term.poseidon2_a_2 + new_term.poseidon2_a_3)) + - new_term.poseidon2_EXT_LAYER_4))); + (new_term.poseidon2_EXT_LAYER_7 - (poseidon2_EXT_LAYER_2 + new_term.poseidon2_EXT_LAYER_4))); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_0_4 - - ((((((((new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL })) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) + - (((((new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })))) * - FF(4)) + - (((((((new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - FF(2)) + - ((((((new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL })) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) + - (((((new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })))))))); + (new_term.poseidon2_T_0_4 - ((FF(4) * poseidon2_T_0_1) + poseidon2_T_0_3))); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_0_5 - - ((((((((new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL })) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) + - (((((new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })))) * - FF(4)) + - (((((((new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - FF(2)) + - ((((((new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL })) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) + - (((((new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })))))))); + (new_term.poseidon2_T_0_5 - ((FF(4) * poseidon2_T_0_0) + poseidon2_T_0_2))); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_0_6 - - ((((((((new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - FF(2)) + - ((((((new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL })) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) * - (new_term.poseidon2_EXT_LAYER_6 + FF(uint256_t{ 10018390284920759269UL, - 196898842818127395UL, - 5249540449481148995UL, - 1853312570062057576UL }))) + - (((((new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))))) + - new_term.poseidon2_T_0_5))); + (new_term.poseidon2_T_0_6 - (poseidon2_T_0_3 + new_term.poseidon2_T_0_5))); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_0_7 - - ((((((((new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL })) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - (new_term.poseidon2_EXT_LAYER_5 + FF(uint256_t{ 12486221224710452438UL, - 2372038863109147677UL, - 8230667498854222355UL, - 2764611904404804029UL }))) * - FF(2)) + - ((((((new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL })) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) * - (new_term.poseidon2_EXT_LAYER_7 + FF(uint256_t{ 4466505105966356650UL, - 4686185096558265002UL, - 16210260819355521378UL, - 1844031548168280073UL }))) + - (((((new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL })) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))) * - (new_term.poseidon2_EXT_LAYER_4 + FF(uint256_t{ 15002325471271702008UL, - 5581154705073500415UL, - 1229208533183169201UL, - 1549225070791782920UL }))))) + - new_term.poseidon2_T_0_4))); + (new_term.poseidon2_T_0_7 - (poseidon2_T_0_2 + new_term.poseidon2_T_0_4))); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_1_4 - - ((((((((new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL })) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) + - (((((new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL })) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) + - (((((new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })))))))); + (new_term.poseidon2_T_1_4 - ((FF(4) * poseidon2_T_1_1) + poseidon2_T_1_3))); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_1_5 - - ((((((((new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL })) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) + - (((((new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL })) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) + - (((((new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })))))))); + (new_term.poseidon2_T_1_5 - ((FF(4) * poseidon2_T_1_0) + poseidon2_T_1_2))); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_1_6 - - ((((((((new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL })) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) * - (new_term.poseidon2_T_0_6 + FF(uint256_t{ 18309653156114024706UL, - 798761732958817262UL, - 6904962453156279281UL, - 3335412762186210716UL }))) + - (((((new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))))) + - new_term.poseidon2_T_1_5))); + (new_term.poseidon2_T_1_6 - (poseidon2_T_1_3 + new_term.poseidon2_T_1_5))); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_1_7 - - ((((((((new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL })) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - (new_term.poseidon2_T_0_5 + FF(uint256_t{ 2824096028161810206UL, - 14640933461146357672UL, - 957840840567621315UL, - 1024001058677493842UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL })) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) * - (new_term.poseidon2_T_0_7 + FF(uint256_t{ 14339023814126516630UL, - 12239068001133297662UL, - 428134084092645147UL, - 2673682960814460689UL }))) + - (((((new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL })) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))) * - (new_term.poseidon2_T_0_4 + FF(uint256_t{ 6214865908119297870UL, - 17923963059035301363UL, - 10985380589240272449UL, - 1430464474809378870UL }))))) + - new_term.poseidon2_T_1_4))); + (new_term.poseidon2_T_1_7 - (poseidon2_T_1_2 + new_term.poseidon2_T_1_4))); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_2_4 - - ((((((((new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL })) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) + - (((((new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL })) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) + - (((((new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })))))))); + (new_term.poseidon2_T_2_4 - ((FF(4) * poseidon2_T_2_1) + poseidon2_T_2_3))); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_2_5 - - ((((((((new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL })) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) + - (((((new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + - FF(uint256_t{ - 2323272968957708806UL, 354488099726909104UL, 115174089281514891UL, 80808271106704719UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL })) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) + - (((((new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })))))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_T_2_5 - ((FF(4) * poseidon2_T_2_0) + poseidon2_T_2_2))); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_2_6 - - ((((((((new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL })) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) * - (new_term.poseidon2_T_1_6 + FF(uint256_t{ 5109255232332580664UL, - 11913027714091798733UL, - 4449570166290740355UL, - 864862123557185234UL }))) + - (((((new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))))) + - new_term.poseidon2_T_2_5))); + (new_term.poseidon2_T_2_6 - (poseidon2_T_2_3 + new_term.poseidon2_T_2_5))); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_2_7 - - ((((((((new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL })) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + FF(uint256_t{ 2323272968957708806UL, - 354488099726909104UL, - 115174089281514891UL, - 80808271106704719UL }))) * - (new_term.poseidon2_T_1_5 + - FF(uint256_t{ - 2323272968957708806UL, 354488099726909104UL, 115174089281514891UL, 80808271106704719UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL })) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) * - (new_term.poseidon2_T_1_7 + FF(uint256_t{ 9646436663147525449UL, - 3404572679246369876UL, - 2350204275212843361UL, - 1069216089054537871UL }))) + - (((((new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL })) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))) * - (new_term.poseidon2_T_1_4 + FF(uint256_t{ 5059356740217174171UL, - 4245857056683447103UL, - 2426504795124362174UL, - 350059533408463330UL }))))) + - new_term.poseidon2_T_2_4))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_T_2_7 - (poseidon2_T_2_2 + new_term.poseidon2_T_2_4))); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_3_4 - - ((((((((new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL })) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) + - (((((new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL })) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) + - (((((new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })))))))); + (new_term.poseidon2_T_3_4 - ((FF(4) * poseidon2_T_3_1) + poseidon2_T_3_3))); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_3_5 - - ((((((((new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL })) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) + - (((((new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL })) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) + - (((((new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })))))))); + (new_term.poseidon2_T_3_5 - ((FF(4) * poseidon2_T_3_0) + poseidon2_T_3_2))); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_3_6 - - ((((((((new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL })) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) * - (new_term.poseidon2_T_2_6 + FF(uint256_t{ 14876286709841668328UL, - 6932857857384975351UL, - 7976037835777844091UL, - 738350885205242785UL }))) + - (((((new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))))) + - new_term.poseidon2_T_3_5))); + (new_term.poseidon2_T_3_6 - (poseidon2_T_3_3 + new_term.poseidon2_T_3_5))); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_3_7 - - ((((((((new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL })) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - (new_term.poseidon2_T_2_5 + FF(uint256_t{ 16522097747524989503UL, - 4157368317794149558UL, - 10343110624935622906UL, - 2709590753056582169UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL })) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) * - (new_term.poseidon2_T_2_7 + FF(uint256_t{ 8805379462752425633UL, - 8594508728147436821UL, - 15629690186821248127UL, - 2936193411053712582UL }))) + - (((((new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL })) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))) * - (new_term.poseidon2_T_2_4 + FF(uint256_t{ 17046614324338172999UL, - 14086280776151114414UL, - 2804088968006330580UL, - 728643340397380469UL }))))) + - new_term.poseidon2_T_3_4))); + (new_term.poseidon2_T_3_7 - (poseidon2_T_3_2 + new_term.poseidon2_T_3_4))); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_4_0 - - (((((((new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL })) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL })) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) + - (new_term.poseidon2_T_3_5 + FF(0))) + - (new_term.poseidon2_T_3_7 + FF(0))) + - (new_term.poseidon2_T_3_4 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_4_0 - ((poseidon2_params_MU_0 * poseidon2_A_4_0) + poseidon2_SUM_4))); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_4_1 - - (((new_term.poseidon2_T_3_5 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL })) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) + - (new_term.poseidon2_T_3_5 + FF(0))) + - (new_term.poseidon2_T_3_7 + FF(0))) + - (new_term.poseidon2_T_3_4 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_4_1 - ((poseidon2_params_MU_1 * poseidon2_A_4_1) + poseidon2_SUM_4))); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_4_2 - - (((new_term.poseidon2_T_3_7 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL })) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) + - (new_term.poseidon2_T_3_5 + FF(0))) + - (new_term.poseidon2_T_3_7 + FF(0))) + - (new_term.poseidon2_T_3_4 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_4_2 - ((poseidon2_params_MU_2 * poseidon2_A_4_2) + poseidon2_SUM_4))); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_4_3 - - (((new_term.poseidon2_T_3_4 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL })) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) * - (new_term.poseidon2_T_3_6 + FF(uint256_t{ 12986735346000814543UL, - 6140074342411686364UL, - 6041575944194691717UL, - 896092723329689904UL }))) + - (new_term.poseidon2_T_3_5 + FF(0))) + - (new_term.poseidon2_T_3_7 + FF(0))) + - (new_term.poseidon2_T_3_4 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_4_3 - ((poseidon2_params_MU_3 * poseidon2_A_4_3) + poseidon2_SUM_4))); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_5_0 - - (((((((new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL })) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL })) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) + - (new_term.poseidon2_B_4_1 + FF(0))) + - (new_term.poseidon2_B_4_2 + FF(0))) + - (new_term.poseidon2_B_4_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_5_0 - ((poseidon2_params_MU_0 * poseidon2_A_5_0) + poseidon2_SUM_5))); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_5_1 - - (((new_term.poseidon2_B_4_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL })) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) + - (new_term.poseidon2_B_4_1 + FF(0))) + - (new_term.poseidon2_B_4_2 + FF(0))) + - (new_term.poseidon2_B_4_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_5_1 - ((poseidon2_params_MU_1 * poseidon2_A_5_1) + poseidon2_SUM_5))); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_5_2 - - (((new_term.poseidon2_B_4_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL })) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) + - (new_term.poseidon2_B_4_1 + FF(0))) + - (new_term.poseidon2_B_4_2 + FF(0))) + - (new_term.poseidon2_B_4_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_5_2 - ((poseidon2_params_MU_2 * poseidon2_A_5_2) + poseidon2_SUM_5))); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_5_3 - - (((new_term.poseidon2_B_4_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL })) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) * - (new_term.poseidon2_B_4_0 + FF(uint256_t{ 9573905030842087441UL, - 12243211539080976096UL, - 15287161151491266826UL, - 1310836290481124728UL }))) + - (new_term.poseidon2_B_4_1 + FF(0))) + - (new_term.poseidon2_B_4_2 + FF(0))) + - (new_term.poseidon2_B_4_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_5_3 - ((poseidon2_params_MU_3 * poseidon2_A_5_3) + poseidon2_SUM_5))); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_6_0 - - (((((((new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL })) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL })) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) + - (new_term.poseidon2_B_5_1 + FF(0))) + - (new_term.poseidon2_B_5_2 + FF(0))) + - (new_term.poseidon2_B_5_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_6_0 - ((poseidon2_params_MU_0 * poseidon2_A_6_0) + poseidon2_SUM_6))); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_6_1 - - (((new_term.poseidon2_B_5_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL })) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) + - (new_term.poseidon2_B_5_1 + FF(0))) + - (new_term.poseidon2_B_5_2 + FF(0))) + - (new_term.poseidon2_B_5_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_6_1 - ((poseidon2_params_MU_1 * poseidon2_A_6_1) + poseidon2_SUM_6))); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_6_2 - - (((new_term.poseidon2_B_5_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL })) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) + - (new_term.poseidon2_B_5_1 + FF(0))) + - (new_term.poseidon2_B_5_2 + FF(0))) + - (new_term.poseidon2_B_5_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_6_2 - ((poseidon2_params_MU_2 * poseidon2_A_6_2) + poseidon2_SUM_6))); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_6_3 - - (((new_term.poseidon2_B_5_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL })) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) * - (new_term.poseidon2_B_5_0 + FF(uint256_t{ 8865134002163281525UL, - 6813849753829831047UL, - 9066778847678578696UL, - 2801725307463304665UL }))) + - (new_term.poseidon2_B_5_1 + FF(0))) + - (new_term.poseidon2_B_5_2 + FF(0))) + - (new_term.poseidon2_B_5_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_6_3 - ((poseidon2_params_MU_3 * poseidon2_A_6_3) + poseidon2_SUM_6))); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_7_0 - - (((((((new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL })) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL })) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) + - (new_term.poseidon2_B_6_1 + FF(0))) + - (new_term.poseidon2_B_6_2 + FF(0))) + - (new_term.poseidon2_B_6_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_7_0 - ((poseidon2_params_MU_0 * poseidon2_A_7_0) + poseidon2_SUM_7))); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_7_1 - - (((new_term.poseidon2_B_6_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL })) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) + - (new_term.poseidon2_B_6_1 + FF(0))) + - (new_term.poseidon2_B_6_2 + FF(0))) + - (new_term.poseidon2_B_6_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_7_1 - ((poseidon2_params_MU_1 * poseidon2_A_7_1) + poseidon2_SUM_7))); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_7_2 - - (((new_term.poseidon2_B_6_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL })) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) + - (new_term.poseidon2_B_6_1 + FF(0))) + - (new_term.poseidon2_B_6_2 + FF(0))) + - (new_term.poseidon2_B_6_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_7_2 - ((poseidon2_params_MU_2 * poseidon2_A_7_2) + poseidon2_SUM_7))); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_7_3 - - (((new_term.poseidon2_B_6_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL })) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) * - (new_term.poseidon2_B_6_0 + FF(uint256_t{ 4931814869361681093UL, - 13712769805002511750UL, - 1776191062268299644UL, - 2068661504023016414UL }))) + - (new_term.poseidon2_B_6_1 + FF(0))) + - (new_term.poseidon2_B_6_2 + FF(0))) + - (new_term.poseidon2_B_6_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_7_3 - ((poseidon2_params_MU_3 * poseidon2_A_7_3) + poseidon2_SUM_7))); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_8_0 - - (((((((new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL })) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL })) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) + - (new_term.poseidon2_B_7_1 + FF(0))) + - (new_term.poseidon2_B_7_2 + FF(0))) + - (new_term.poseidon2_B_7_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_8_0 - ((poseidon2_params_MU_0 * poseidon2_A_8_0) + poseidon2_SUM_8))); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_8_1 - - (((new_term.poseidon2_B_7_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL })) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) + - (new_term.poseidon2_B_7_1 + FF(0))) + - (new_term.poseidon2_B_7_2 + FF(0))) + - (new_term.poseidon2_B_7_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_8_1 - ((poseidon2_params_MU_1 * poseidon2_A_8_1) + poseidon2_SUM_8))); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_8_2 - - (((new_term.poseidon2_B_7_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL })) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) + - (new_term.poseidon2_B_7_1 + FF(0))) + - (new_term.poseidon2_B_7_2 + FF(0))) + - (new_term.poseidon2_B_7_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_8_2 - ((poseidon2_params_MU_2 * poseidon2_A_8_2) + poseidon2_SUM_8))); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_8_3 - - (((new_term.poseidon2_B_7_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL })) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) * - (new_term.poseidon2_B_7_0 + FF(uint256_t{ 8161631444256445904UL, - 3049786034047984668UL, - 1021328518293651309UL, - 2147500022207188878UL }))) + - (new_term.poseidon2_B_7_1 + FF(0))) + - (new_term.poseidon2_B_7_2 + FF(0))) + - (new_term.poseidon2_B_7_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_8_3 - ((poseidon2_params_MU_3 * poseidon2_A_8_3) + poseidon2_SUM_8))); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_9_0 - - (((((((new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL })) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL })) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) + - (new_term.poseidon2_B_8_1 + FF(0))) + - (new_term.poseidon2_B_8_2 + FF(0))) + - (new_term.poseidon2_B_8_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_9_0 - ((poseidon2_params_MU_0 * poseidon2_A_9_0) + poseidon2_SUM_9))); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_9_1 - - (((new_term.poseidon2_B_8_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL })) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) + - (new_term.poseidon2_B_8_1 + FF(0))) + - (new_term.poseidon2_B_8_2 + FF(0))) + - (new_term.poseidon2_B_8_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_9_1 - ((poseidon2_params_MU_1 * poseidon2_A_9_1) + poseidon2_SUM_9))); tmp *= scaling_factor; std::get<50>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_9_2 - - (((new_term.poseidon2_B_8_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL })) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) + - (new_term.poseidon2_B_8_1 + FF(0))) + - (new_term.poseidon2_B_8_2 + FF(0))) + - (new_term.poseidon2_B_8_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_9_2 - ((poseidon2_params_MU_2 * poseidon2_A_9_2) + poseidon2_SUM_9))); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_9_3 - - (((new_term.poseidon2_B_8_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL })) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) * - (new_term.poseidon2_B_8_0 + FF(uint256_t{ 12766468767470212468UL, - 926098071429114297UL, - 17691598410912255471UL, - 76565467953470566UL }))) + - (new_term.poseidon2_B_8_1 + FF(0))) + - (new_term.poseidon2_B_8_2 + FF(0))) + - (new_term.poseidon2_B_8_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_9_3 - ((poseidon2_params_MU_3 * poseidon2_A_9_3) + poseidon2_SUM_9))); tmp *= scaling_factor; std::get<52>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_10_0 - - (((((((new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL })) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL })) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) + - (new_term.poseidon2_B_9_1 + FF(0))) + - (new_term.poseidon2_B_9_2 + FF(0))) + - (new_term.poseidon2_B_9_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_10_0 - ((poseidon2_params_MU_0 * poseidon2_A_10_0) + poseidon2_SUM_10))); tmp *= scaling_factor; std::get<53>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_10_1 - - (((new_term.poseidon2_B_9_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL })) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) + - (new_term.poseidon2_B_9_1 + FF(0))) + - (new_term.poseidon2_B_9_2 + FF(0))) + - (new_term.poseidon2_B_9_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_10_1 - ((poseidon2_params_MU_1 * poseidon2_A_10_1) + poseidon2_SUM_10))); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_10_2 - - (((new_term.poseidon2_B_9_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL })) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) + - (new_term.poseidon2_B_9_1 + FF(0))) + - (new_term.poseidon2_B_9_2 + FF(0))) + - (new_term.poseidon2_B_9_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_10_2 - ((poseidon2_params_MU_2 * poseidon2_A_10_2) + poseidon2_SUM_10))); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_10_3 - - (((new_term.poseidon2_B_9_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL })) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) * - (new_term.poseidon2_B_9_0 + FF(uint256_t{ 15547843034426617484UL, - 13465733818561903358UL, - 11157089789589945854UL, - 3107062195097242290UL }))) + - (new_term.poseidon2_B_9_1 + FF(0))) + - (new_term.poseidon2_B_9_2 + FF(0))) + - (new_term.poseidon2_B_9_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_10_3 - ((poseidon2_params_MU_3 * poseidon2_A_10_3) + poseidon2_SUM_10))); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_11_0 - - (((((((new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL })) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL })) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) + - (new_term.poseidon2_B_10_1 + FF(0))) + - (new_term.poseidon2_B_10_2 + FF(0))) + - (new_term.poseidon2_B_10_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_11_0 - ((poseidon2_params_MU_0 * poseidon2_A_11_0) + poseidon2_SUM_11))); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_11_1 - - (((new_term.poseidon2_B_10_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL })) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) + - (new_term.poseidon2_B_10_1 + FF(0))) + - (new_term.poseidon2_B_10_2 + FF(0))) + - (new_term.poseidon2_B_10_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_11_1 - ((poseidon2_params_MU_1 * poseidon2_A_11_1) + poseidon2_SUM_11))); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_11_2 - - (((new_term.poseidon2_B_10_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL })) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) + - (new_term.poseidon2_B_10_1 + FF(0))) + - (new_term.poseidon2_B_10_2 + FF(0))) + - (new_term.poseidon2_B_10_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_11_2 - ((poseidon2_params_MU_2 * poseidon2_A_11_2) + poseidon2_SUM_11))); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_11_3 - - (((new_term.poseidon2_B_10_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL })) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) * - (new_term.poseidon2_B_10_0 + FF(uint256_t{ 16908372174309343397UL, - 17264932925429761530UL, - 11508063480483774160UL, - 2682419245684831641UL }))) + - (new_term.poseidon2_B_10_1 + FF(0))) + - (new_term.poseidon2_B_10_2 + FF(0))) + - (new_term.poseidon2_B_10_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_11_3 - ((poseidon2_params_MU_3 * poseidon2_A_11_3) + poseidon2_SUM_11))); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_12_0 - - (((((((new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL })) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL })) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) + - (new_term.poseidon2_B_11_1 + FF(0))) + - (new_term.poseidon2_B_11_2 + FF(0))) + - (new_term.poseidon2_B_11_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_12_0 - ((poseidon2_params_MU_0 * poseidon2_A_12_0) + poseidon2_SUM_12))); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_12_1 - - (((new_term.poseidon2_B_11_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL })) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) + - (new_term.poseidon2_B_11_1 + FF(0))) + - (new_term.poseidon2_B_11_2 + FF(0))) + - (new_term.poseidon2_B_11_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_12_1 - ((poseidon2_params_MU_1 * poseidon2_A_12_1) + poseidon2_SUM_12))); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_12_2 - - (((new_term.poseidon2_B_11_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL })) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) + - (new_term.poseidon2_B_11_1 + FF(0))) + - (new_term.poseidon2_B_11_2 + FF(0))) + - (new_term.poseidon2_B_11_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_12_2 - ((poseidon2_params_MU_2 * poseidon2_A_12_2) + poseidon2_SUM_12))); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_12_3 - - (((new_term.poseidon2_B_11_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL })) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) * - (new_term.poseidon2_B_11_0 + FF(uint256_t{ 4870692136216401181UL, - 17645600130793395310UL, - 2758876031472241166UL, - 874943362207641089UL }))) + - (new_term.poseidon2_B_11_1 + FF(0))) + - (new_term.poseidon2_B_11_2 + FF(0))) + - (new_term.poseidon2_B_11_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_12_3 - ((poseidon2_params_MU_3 * poseidon2_A_12_3) + poseidon2_SUM_12))); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_13_0 - - (((((((new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL })) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL })) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) + - (new_term.poseidon2_B_12_1 + FF(0))) + - (new_term.poseidon2_B_12_2 + FF(0))) + - (new_term.poseidon2_B_12_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_13_0 - ((poseidon2_params_MU_0 * poseidon2_A_13_0) + poseidon2_SUM_13))); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_13_1 - - (((new_term.poseidon2_B_12_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL })) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) + - (new_term.poseidon2_B_12_1 + FF(0))) + - (new_term.poseidon2_B_12_2 + FF(0))) + - (new_term.poseidon2_B_12_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_13_1 - ((poseidon2_params_MU_1 * poseidon2_A_13_1) + poseidon2_SUM_13))); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_13_2 - - (((new_term.poseidon2_B_12_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL })) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) + - (new_term.poseidon2_B_12_1 + FF(0))) + - (new_term.poseidon2_B_12_2 + FF(0))) + - (new_term.poseidon2_B_12_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_13_2 - ((poseidon2_params_MU_2 * poseidon2_A_13_2) + poseidon2_SUM_13))); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_13_3 - - (((new_term.poseidon2_B_12_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL })) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) * - (new_term.poseidon2_B_12_0 + FF(uint256_t{ 4540479402638267003UL, - 13477556963426049071UL, - 6055112305493291757UL, - 1810598527648098537UL }))) + - (new_term.poseidon2_B_12_1 + FF(0))) + - (new_term.poseidon2_B_12_2 + FF(0))) + - (new_term.poseidon2_B_12_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_13_3 - ((poseidon2_params_MU_3 * poseidon2_A_13_3) + poseidon2_SUM_13))); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_14_0 - - (((((((new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL })) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL })) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) + - (new_term.poseidon2_B_13_1 + FF(0))) + - (new_term.poseidon2_B_13_2 + FF(0))) + - (new_term.poseidon2_B_13_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_14_0 - ((poseidon2_params_MU_0 * poseidon2_A_14_0) + poseidon2_SUM_14))); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_14_1 - - (((new_term.poseidon2_B_13_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL })) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) + - (new_term.poseidon2_B_13_1 + FF(0))) + - (new_term.poseidon2_B_13_2 + FF(0))) + - (new_term.poseidon2_B_13_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_14_1 - ((poseidon2_params_MU_1 * poseidon2_A_14_1) + poseidon2_SUM_14))); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_14_2 - - (((new_term.poseidon2_B_13_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL })) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) + - (new_term.poseidon2_B_13_1 + FF(0))) + - (new_term.poseidon2_B_13_2 + FF(0))) + - (new_term.poseidon2_B_13_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_14_2 - ((poseidon2_params_MU_2 * poseidon2_A_14_2) + poseidon2_SUM_14))); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_14_3 - - (((new_term.poseidon2_B_13_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL })) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) * - (new_term.poseidon2_B_13_0 + FF(uint256_t{ 7894770769272900997UL, - 9595210915998428021UL, - 7642295683223718917UL, - 2210716392790471408UL }))) + - (new_term.poseidon2_B_13_1 + FF(0))) + - (new_term.poseidon2_B_13_2 + FF(0))) + - (new_term.poseidon2_B_13_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_14_3 - ((poseidon2_params_MU_3 * poseidon2_A_14_3) + poseidon2_SUM_14))); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_15_0 - - (((((((new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL })) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL })) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) + - (new_term.poseidon2_B_14_1 + FF(0))) + - (new_term.poseidon2_B_14_2 + FF(0))) + - (new_term.poseidon2_B_14_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_15_0 - ((poseidon2_params_MU_0 * poseidon2_A_15_0) + poseidon2_SUM_15))); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_15_1 - - (((new_term.poseidon2_B_14_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL })) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) + - (new_term.poseidon2_B_14_1 + FF(0))) + - (new_term.poseidon2_B_14_2 + FF(0))) + - (new_term.poseidon2_B_14_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_15_1 - ((poseidon2_params_MU_1 * poseidon2_A_15_1) + poseidon2_SUM_15))); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_15_2 - - (((new_term.poseidon2_B_14_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL })) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) + - (new_term.poseidon2_B_14_1 + FF(0))) + - (new_term.poseidon2_B_14_2 + FF(0))) + - (new_term.poseidon2_B_14_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_15_2 - ((poseidon2_params_MU_2 * poseidon2_A_15_2) + poseidon2_SUM_15))); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_15_3 - - (((new_term.poseidon2_B_14_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL })) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) * - (new_term.poseidon2_B_14_0 + FF(uint256_t{ 10910178561156475899UL, - 15811627963917441510UL, - 16460518660187536520UL, - 1698297851221778809UL }))) + - (new_term.poseidon2_B_14_1 + FF(0))) + - (new_term.poseidon2_B_14_2 + FF(0))) + - (new_term.poseidon2_B_14_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_15_3 - ((poseidon2_params_MU_3 * poseidon2_A_15_3) + poseidon2_SUM_15))); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_16_0 - - (((((((new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL })) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL })) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) + - (new_term.poseidon2_B_15_1 + FF(0))) + - (new_term.poseidon2_B_15_2 + FF(0))) + - (new_term.poseidon2_B_15_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_16_0 - ((poseidon2_params_MU_0 * poseidon2_A_16_0) + poseidon2_SUM_16))); tmp *= scaling_factor; std::get<77>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_16_1 - - (((new_term.poseidon2_B_15_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL })) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) + - (new_term.poseidon2_B_15_1 + FF(0))) + - (new_term.poseidon2_B_15_2 + FF(0))) + - (new_term.poseidon2_B_15_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_16_1 - ((poseidon2_params_MU_1 * poseidon2_A_16_1) + poseidon2_SUM_16))); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_16_2 - - (((new_term.poseidon2_B_15_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL })) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) + - (new_term.poseidon2_B_15_1 + FF(0))) + - (new_term.poseidon2_B_15_2 + FF(0))) + - (new_term.poseidon2_B_15_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_16_2 - ((poseidon2_params_MU_2 * poseidon2_A_16_2) + poseidon2_SUM_16))); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_16_3 - - (((new_term.poseidon2_B_15_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL })) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) * - (new_term.poseidon2_B_15_0 + FF(uint256_t{ 7831732902708890908UL, - 1464390598836302271UL, - 8568564606321342514UL, - 3007171090439369509UL }))) + - (new_term.poseidon2_B_15_1 + FF(0))) + - (new_term.poseidon2_B_15_2 + FF(0))) + - (new_term.poseidon2_B_15_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_16_3 - ((poseidon2_params_MU_3 * poseidon2_A_16_3) + poseidon2_SUM_16))); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_17_0 - - (((((((new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL })) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL })) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) + - (new_term.poseidon2_B_16_1 + FF(0))) + - (new_term.poseidon2_B_16_2 + FF(0))) + - (new_term.poseidon2_B_16_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_17_0 - ((poseidon2_params_MU_0 * poseidon2_A_17_0) + poseidon2_SUM_17))); tmp *= scaling_factor; std::get<81>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_17_1 - - (((new_term.poseidon2_B_16_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL })) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) + - (new_term.poseidon2_B_16_1 + FF(0))) + - (new_term.poseidon2_B_16_2 + FF(0))) + - (new_term.poseidon2_B_16_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_17_1 - ((poseidon2_params_MU_1 * poseidon2_A_17_1) + poseidon2_SUM_17))); tmp *= scaling_factor; std::get<82>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_17_2 - - (((new_term.poseidon2_B_16_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL })) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) + - (new_term.poseidon2_B_16_1 + FF(0))) + - (new_term.poseidon2_B_16_2 + FF(0))) + - (new_term.poseidon2_B_16_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_17_2 - ((poseidon2_params_MU_2 * poseidon2_A_17_2) + poseidon2_SUM_17))); tmp *= scaling_factor; std::get<83>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_17_3 - - (((new_term.poseidon2_B_16_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL })) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) * - (new_term.poseidon2_B_16_0 + FF(uint256_t{ 12758232712903990792UL, - 5937193763836963893UL, - 4629415695575460109UL, - 2476198378403296665UL }))) + - (new_term.poseidon2_B_16_1 + FF(0))) + - (new_term.poseidon2_B_16_2 + FF(0))) + - (new_term.poseidon2_B_16_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_17_3 - ((poseidon2_params_MU_3 * poseidon2_A_17_3) + poseidon2_SUM_17))); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_18_0 - - (((((((new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL })) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL })) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) + - (new_term.poseidon2_B_17_1 + FF(0))) + - (new_term.poseidon2_B_17_2 + FF(0))) + - (new_term.poseidon2_B_17_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_18_0 - ((poseidon2_params_MU_0 * poseidon2_A_18_0) + poseidon2_SUM_18))); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_18_1 - - (((new_term.poseidon2_B_17_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL })) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) + - (new_term.poseidon2_B_17_1 + FF(0))) + - (new_term.poseidon2_B_17_2 + FF(0))) + - (new_term.poseidon2_B_17_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_18_1 - ((poseidon2_params_MU_1 * poseidon2_A_18_1) + poseidon2_SUM_18))); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_18_2 - - (((new_term.poseidon2_B_17_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL })) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) + - (new_term.poseidon2_B_17_1 + FF(0))) + - (new_term.poseidon2_B_17_2 + FF(0))) + - (new_term.poseidon2_B_17_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_18_2 - ((poseidon2_params_MU_2 * poseidon2_A_18_2) + poseidon2_SUM_18))); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<88, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_18_3 - - (((new_term.poseidon2_B_17_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL })) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) * - (new_term.poseidon2_B_17_0 + FF(uint256_t{ 16185652584871361881UL, - 3161867062328690813UL, - 8447947510117581907UL, - 452436262606194895UL }))) + - (new_term.poseidon2_B_17_1 + FF(0))) + - (new_term.poseidon2_B_17_2 + FF(0))) + - (new_term.poseidon2_B_17_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_18_3 - ((poseidon2_params_MU_3 * poseidon2_A_18_3) + poseidon2_SUM_18))); tmp *= scaling_factor; std::get<88>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<89, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_19_0 - - (((((((new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL })) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL })) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) + - (new_term.poseidon2_B_18_1 + FF(0))) + - (new_term.poseidon2_B_18_2 + FF(0))) + - (new_term.poseidon2_B_18_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_19_0 - ((poseidon2_params_MU_0 * poseidon2_A_19_0) + poseidon2_SUM_19))); tmp *= scaling_factor; std::get<89>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<90, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_19_1 - - (((new_term.poseidon2_B_18_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL })) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) + - (new_term.poseidon2_B_18_1 + FF(0))) + - (new_term.poseidon2_B_18_2 + FF(0))) + - (new_term.poseidon2_B_18_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_19_1 - ((poseidon2_params_MU_1 * poseidon2_A_19_1) + poseidon2_SUM_19))); tmp *= scaling_factor; std::get<90>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<91, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_19_2 - - (((new_term.poseidon2_B_18_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL })) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) + - (new_term.poseidon2_B_18_1 + FF(0))) + - (new_term.poseidon2_B_18_2 + FF(0))) + - (new_term.poseidon2_B_18_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_19_2 - ((poseidon2_params_MU_2 * poseidon2_A_19_2) + poseidon2_SUM_19))); tmp *= scaling_factor; std::get<91>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<92, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_19_3 - - (((new_term.poseidon2_B_18_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL })) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) * - (new_term.poseidon2_B_18_0 + FF(uint256_t{ 10531967515434376071UL, - 5577695765815843856UL, - 9164856352050088505UL, - 1205339682110411496UL }))) + - (new_term.poseidon2_B_18_1 + FF(0))) + - (new_term.poseidon2_B_18_2 + FF(0))) + - (new_term.poseidon2_B_18_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_19_3 - ((poseidon2_params_MU_3 * poseidon2_A_19_3) + poseidon2_SUM_19))); tmp *= scaling_factor; std::get<92>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<93, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_20_0 - - (((((((new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL })) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL })) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) + - (new_term.poseidon2_B_19_1 + FF(0))) + - (new_term.poseidon2_B_19_2 + FF(0))) + - (new_term.poseidon2_B_19_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_20_0 - ((poseidon2_params_MU_0 * poseidon2_A_20_0) + poseidon2_SUM_20))); tmp *= scaling_factor; std::get<93>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<94, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_20_1 - - (((new_term.poseidon2_B_19_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL })) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) + - (new_term.poseidon2_B_19_1 + FF(0))) + - (new_term.poseidon2_B_19_2 + FF(0))) + - (new_term.poseidon2_B_19_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_20_1 - ((poseidon2_params_MU_1 * poseidon2_A_20_1) + poseidon2_SUM_20))); tmp *= scaling_factor; std::get<94>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<95, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_20_2 - - (((new_term.poseidon2_B_19_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL })) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) + - (new_term.poseidon2_B_19_1 + FF(0))) + - (new_term.poseidon2_B_19_2 + FF(0))) + - (new_term.poseidon2_B_19_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_20_2 - ((poseidon2_params_MU_2 * poseidon2_A_20_2) + poseidon2_SUM_20))); tmp *= scaling_factor; std::get<95>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<96, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_20_3 - - (((new_term.poseidon2_B_19_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL })) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) * - (new_term.poseidon2_B_19_0 + FF(uint256_t{ 3898841196333713180UL, - 14650521577519770525UL, - 5736581618852866049UL, - 1010789789328495026UL }))) + - (new_term.poseidon2_B_19_1 + FF(0))) + - (new_term.poseidon2_B_19_2 + FF(0))) + - (new_term.poseidon2_B_19_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_20_3 - ((poseidon2_params_MU_3 * poseidon2_A_20_3) + poseidon2_SUM_20))); tmp *= scaling_factor; std::get<96>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<97, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_21_0 - - (((((((new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL })) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL })) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) + - (new_term.poseidon2_B_20_1 + FF(0))) + - (new_term.poseidon2_B_20_2 + FF(0))) + - (new_term.poseidon2_B_20_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_21_0 - ((poseidon2_params_MU_0 * poseidon2_A_21_0) + poseidon2_SUM_21))); tmp *= scaling_factor; std::get<97>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<98, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_21_1 - - (((new_term.poseidon2_B_20_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL })) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) + - (new_term.poseidon2_B_20_1 + FF(0))) + - (new_term.poseidon2_B_20_2 + FF(0))) + - (new_term.poseidon2_B_20_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_21_1 - ((poseidon2_params_MU_1 * poseidon2_A_21_1) + poseidon2_SUM_21))); tmp *= scaling_factor; std::get<98>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_21_2 - - (((new_term.poseidon2_B_20_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL })) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) + - (new_term.poseidon2_B_20_1 + FF(0))) + - (new_term.poseidon2_B_20_2 + FF(0))) + - (new_term.poseidon2_B_20_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_21_2 - ((poseidon2_params_MU_2 * poseidon2_A_21_2) + poseidon2_SUM_21))); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_21_3 - - (((new_term.poseidon2_B_20_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL })) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) * - (new_term.poseidon2_B_20_0 + FF(uint256_t{ 12103741763020280571UL, - 14760208106156268938UL, - 15246749619665902195UL, - 1987439155030896717UL }))) + - (new_term.poseidon2_B_20_1 + FF(0))) + - (new_term.poseidon2_B_20_2 + FF(0))) + - (new_term.poseidon2_B_20_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_21_3 - ((poseidon2_params_MU_3 * poseidon2_A_21_3) + poseidon2_SUM_21))); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_22_0 - - (((((((new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL })) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL })) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) + - (new_term.poseidon2_B_21_1 + FF(0))) + - (new_term.poseidon2_B_21_2 + FF(0))) + - (new_term.poseidon2_B_21_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_22_0 - ((poseidon2_params_MU_0 * poseidon2_A_22_0) + poseidon2_SUM_22))); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_22_1 - - (((new_term.poseidon2_B_21_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL })) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) + - (new_term.poseidon2_B_21_1 + FF(0))) + - (new_term.poseidon2_B_21_2 + FF(0))) + - (new_term.poseidon2_B_21_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_22_1 - ((poseidon2_params_MU_1 * poseidon2_A_22_1) + poseidon2_SUM_22))); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_22_2 - - (((new_term.poseidon2_B_21_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL })) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) + - (new_term.poseidon2_B_21_1 + FF(0))) + - (new_term.poseidon2_B_21_2 + FF(0))) + - (new_term.poseidon2_B_21_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_22_2 - ((poseidon2_params_MU_2 * poseidon2_A_22_2) + poseidon2_SUM_22))); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_22_3 - - (((new_term.poseidon2_B_21_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL })) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) * - (new_term.poseidon2_B_21_0 + FF(uint256_t{ 326429241861474059UL, - 11335157279655967493UL, - 16233357323017397007UL, - 2124770605461456708UL }))) + - (new_term.poseidon2_B_21_1 + FF(0))) + - (new_term.poseidon2_B_21_2 + FF(0))) + - (new_term.poseidon2_B_21_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_22_3 - ((poseidon2_params_MU_3 * poseidon2_A_22_3) + poseidon2_SUM_22))); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_23_0 - - (((((((new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL })) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL })) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) + - (new_term.poseidon2_B_22_1 + FF(0))) + - (new_term.poseidon2_B_22_2 + FF(0))) + - (new_term.poseidon2_B_22_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_23_0 - ((poseidon2_params_MU_0 * poseidon2_A_23_0) + poseidon2_SUM_23))); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_23_1 - - (((new_term.poseidon2_B_22_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL })) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) + - (new_term.poseidon2_B_22_1 + FF(0))) + - (new_term.poseidon2_B_22_2 + FF(0))) + - (new_term.poseidon2_B_22_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_23_1 - ((poseidon2_params_MU_1 * poseidon2_A_23_1) + poseidon2_SUM_23))); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_23_2 - - (((new_term.poseidon2_B_22_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL })) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) + - (new_term.poseidon2_B_22_1 + FF(0))) + - (new_term.poseidon2_B_22_2 + FF(0))) + - (new_term.poseidon2_B_22_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_23_2 - ((poseidon2_params_MU_2 * poseidon2_A_23_2) + poseidon2_SUM_23))); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_23_3 - - (((new_term.poseidon2_B_22_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL })) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) * - (new_term.poseidon2_B_22_0 + FF(uint256_t{ 13507610432344102875UL, - 9765425316929074945UL, - 10455054851855122687UL, - 3371280263716451574UL }))) + - (new_term.poseidon2_B_22_1 + FF(0))) + - (new_term.poseidon2_B_22_2 + FF(0))) + - (new_term.poseidon2_B_22_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_23_3 - ((poseidon2_params_MU_3 * poseidon2_A_23_3) + poseidon2_SUM_23))); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_24_0 - - (((((((new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL })) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL })) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) + - (new_term.poseidon2_B_23_1 + FF(0))) + - (new_term.poseidon2_B_23_2 + FF(0))) + - (new_term.poseidon2_B_23_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_24_0 - ((poseidon2_params_MU_0 * poseidon2_A_24_0) + poseidon2_SUM_24))); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_24_1 - - (((new_term.poseidon2_B_23_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL })) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) + - (new_term.poseidon2_B_23_1 + FF(0))) + - (new_term.poseidon2_B_23_2 + FF(0))) + - (new_term.poseidon2_B_23_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_24_1 - ((poseidon2_params_MU_1 * poseidon2_A_24_1) + poseidon2_SUM_24))); tmp *= scaling_factor; std::get<110>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_24_2 - - (((new_term.poseidon2_B_23_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL })) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) + - (new_term.poseidon2_B_23_1 + FF(0))) + - (new_term.poseidon2_B_23_2 + FF(0))) + - (new_term.poseidon2_B_23_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_24_2 - ((poseidon2_params_MU_2 * poseidon2_A_24_2) + poseidon2_SUM_24))); tmp *= scaling_factor; std::get<111>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_24_3 - - (((new_term.poseidon2_B_23_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL })) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) * - (new_term.poseidon2_B_23_0 + FF(uint256_t{ 9433430149246843174UL, - 16916651192445074064UL, - 12002862125451454299UL, - 3293088726774108791UL }))) + - (new_term.poseidon2_B_23_1 + FF(0))) + - (new_term.poseidon2_B_23_2 + FF(0))) + - (new_term.poseidon2_B_23_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_24_3 - ((poseidon2_params_MU_3 * poseidon2_A_24_3) + poseidon2_SUM_24))); tmp *= scaling_factor; std::get<112>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<113, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_25_0 - - (((((((new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL })) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL })) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) + - (new_term.poseidon2_B_24_1 + FF(0))) + - (new_term.poseidon2_B_24_2 + FF(0))) + - (new_term.poseidon2_B_24_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_25_0 - ((poseidon2_params_MU_0 * poseidon2_A_25_0) + poseidon2_SUM_25))); tmp *= scaling_factor; std::get<113>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<114, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_25_1 - - (((new_term.poseidon2_B_24_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL })) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) + - (new_term.poseidon2_B_24_1 + FF(0))) + - (new_term.poseidon2_B_24_2 + FF(0))) + - (new_term.poseidon2_B_24_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_25_1 - ((poseidon2_params_MU_1 * poseidon2_A_25_1) + poseidon2_SUM_25))); tmp *= scaling_factor; std::get<114>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<115, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_25_2 - - (((new_term.poseidon2_B_24_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL })) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) + - (new_term.poseidon2_B_24_1 + FF(0))) + - (new_term.poseidon2_B_24_2 + FF(0))) + - (new_term.poseidon2_B_24_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_25_2 - ((poseidon2_params_MU_2 * poseidon2_A_25_2) + poseidon2_SUM_25))); tmp *= scaling_factor; std::get<115>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<116, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_25_3 - - (((new_term.poseidon2_B_24_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL })) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) * - (new_term.poseidon2_B_24_0 + FF(uint256_t{ 15895963712096768440UL, - 10975964170403460506UL, - 7594578539046143282UL, - 441635248990433378UL }))) + - (new_term.poseidon2_B_24_1 + FF(0))) + - (new_term.poseidon2_B_24_2 + FF(0))) + - (new_term.poseidon2_B_24_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_25_3 - ((poseidon2_params_MU_3 * poseidon2_A_25_3) + poseidon2_SUM_25))); tmp *= scaling_factor; std::get<116>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<117, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_26_0 - - (((((((new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL })) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + - FF(uint256_t{ - 55564641555031451UL, 2316046008873247993UL, 6273091099984972305UL, 531938487375579818UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL })) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) + - (new_term.poseidon2_B_25_1 + FF(0))) + - (new_term.poseidon2_B_25_2 + FF(0))) + - (new_term.poseidon2_B_25_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_26_0 - ((poseidon2_params_MU_0 * poseidon2_A_26_0) + poseidon2_SUM_26))); tmp *= scaling_factor; std::get<117>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<118, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_26_1 - - (((new_term.poseidon2_B_25_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL })) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) + - (new_term.poseidon2_B_25_1 + FF(0))) + - (new_term.poseidon2_B_25_2 + FF(0))) + - (new_term.poseidon2_B_25_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_26_1 - ((poseidon2_params_MU_1 * poseidon2_A_26_1) + poseidon2_SUM_26))); tmp *= scaling_factor; std::get<118>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<119, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_26_2 - - (((new_term.poseidon2_B_25_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL })) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) + - (new_term.poseidon2_B_25_1 + FF(0))) + - (new_term.poseidon2_B_25_2 + FF(0))) + - (new_term.poseidon2_B_25_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_26_2 - ((poseidon2_params_MU_2 * poseidon2_A_26_2) + poseidon2_SUM_26))); tmp *= scaling_factor; std::get<119>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<120, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_26_3 - - (((new_term.poseidon2_B_25_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL })) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) * - (new_term.poseidon2_B_25_0 + FF(uint256_t{ 55564641555031451UL, - 2316046008873247993UL, - 6273091099984972305UL, - 531938487375579818UL }))) + - (new_term.poseidon2_B_25_1 + FF(0))) + - (new_term.poseidon2_B_25_2 + FF(0))) + - (new_term.poseidon2_B_25_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_26_3 - ((poseidon2_params_MU_3 * poseidon2_A_26_3) + poseidon2_SUM_26))); tmp *= scaling_factor; std::get<120>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<121, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_27_0 - - (((((((new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL })) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL })) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) + - (new_term.poseidon2_B_26_1 + FF(0))) + - (new_term.poseidon2_B_26_2 + FF(0))) + - (new_term.poseidon2_B_26_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_27_0 - ((poseidon2_params_MU_0 * poseidon2_A_27_0) + poseidon2_SUM_27))); tmp *= scaling_factor; std::get<121>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<122, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_27_1 - - (((new_term.poseidon2_B_26_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL })) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) + - (new_term.poseidon2_B_26_1 + FF(0))) + - (new_term.poseidon2_B_26_2 + FF(0))) + - (new_term.poseidon2_B_26_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_27_1 - ((poseidon2_params_MU_1 * poseidon2_A_27_1) + poseidon2_SUM_27))); tmp *= scaling_factor; std::get<122>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<123, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_27_2 - - (((new_term.poseidon2_B_26_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL })) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) + - (new_term.poseidon2_B_26_1 + FF(0))) + - (new_term.poseidon2_B_26_2 + FF(0))) + - (new_term.poseidon2_B_26_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_27_2 - ((poseidon2_params_MU_2 * poseidon2_A_27_2) + poseidon2_SUM_27))); tmp *= scaling_factor; std::get<123>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<124, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_27_3 - - (((new_term.poseidon2_B_26_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL })) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) * - (new_term.poseidon2_B_26_0 + FF(uint256_t{ 17845282940759944461UL, - 6735239388814238924UL, - 3181517889518583601UL, - 2376846283559998361UL }))) + - (new_term.poseidon2_B_26_1 + FF(0))) + - (new_term.poseidon2_B_26_2 + FF(0))) + - (new_term.poseidon2_B_26_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_27_3 - ((poseidon2_params_MU_3 * poseidon2_A_27_3) + poseidon2_SUM_27))); tmp *= scaling_factor; std::get<124>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<125, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_28_0 - - (((((((new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL })) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL })) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) + - (new_term.poseidon2_B_27_1 + FF(0))) + - (new_term.poseidon2_B_27_2 + FF(0))) + - (new_term.poseidon2_B_27_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_28_0 - ((poseidon2_params_MU_0 * poseidon2_A_28_0) + poseidon2_SUM_28))); tmp *= scaling_factor; std::get<125>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<126, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_28_1 - - (((new_term.poseidon2_B_27_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL })) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) + - (new_term.poseidon2_B_27_1 + FF(0))) + - (new_term.poseidon2_B_27_2 + FF(0))) + - (new_term.poseidon2_B_27_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_28_1 - ((poseidon2_params_MU_1 * poseidon2_A_28_1) + poseidon2_SUM_28))); tmp *= scaling_factor; std::get<126>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<127, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_28_2 - - (((new_term.poseidon2_B_27_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL })) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) + - (new_term.poseidon2_B_27_1 + FF(0))) + - (new_term.poseidon2_B_27_2 + FF(0))) + - (new_term.poseidon2_B_27_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_28_2 - ((poseidon2_params_MU_2 * poseidon2_A_28_2) + poseidon2_SUM_28))); tmp *= scaling_factor; std::get<127>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<128, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_28_3 - - (((new_term.poseidon2_B_27_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL })) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) * - (new_term.poseidon2_B_27_0 + FF(uint256_t{ 14097127963645492314UL, - 1165420652731038559UL, - 12527303660854712762UL, - 2717289076364278965UL }))) + - (new_term.poseidon2_B_27_1 + FF(0))) + - (new_term.poseidon2_B_27_2 + FF(0))) + - (new_term.poseidon2_B_27_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_28_3 - ((poseidon2_params_MU_3 * poseidon2_A_28_3) + poseidon2_SUM_28))); tmp *= scaling_factor; std::get<128>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<129, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_29_0 - - (((((((new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL })) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL })) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) + - (new_term.poseidon2_B_28_1 + FF(0))) + - (new_term.poseidon2_B_28_2 + FF(0))) + - (new_term.poseidon2_B_28_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_29_0 - ((poseidon2_params_MU_0 * poseidon2_A_29_0) + poseidon2_SUM_29))); tmp *= scaling_factor; std::get<129>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<130, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_29_1 - - (((new_term.poseidon2_B_28_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL })) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) + - (new_term.poseidon2_B_28_1 + FF(0))) + - (new_term.poseidon2_B_28_2 + FF(0))) + - (new_term.poseidon2_B_28_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_29_1 - ((poseidon2_params_MU_1 * poseidon2_A_29_1) + poseidon2_SUM_29))); tmp *= scaling_factor; std::get<130>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<131, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_29_2 - - (((new_term.poseidon2_B_28_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL })) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) + - (new_term.poseidon2_B_28_1 + FF(0))) + - (new_term.poseidon2_B_28_2 + FF(0))) + - (new_term.poseidon2_B_28_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_29_2 - ((poseidon2_params_MU_2 * poseidon2_A_29_2) + poseidon2_SUM_29))); tmp *= scaling_factor; std::get<131>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<132, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_29_3 - - (((new_term.poseidon2_B_28_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL })) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) * - (new_term.poseidon2_B_28_0 + FF(uint256_t{ 15600044695084040011UL, - 255324662529267034UL, - 11859356122961343981UL, - 2571979992654075442UL }))) + - (new_term.poseidon2_B_28_1 + FF(0))) + - (new_term.poseidon2_B_28_2 + FF(0))) + - (new_term.poseidon2_B_28_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_29_3 - ((poseidon2_params_MU_3 * poseidon2_A_29_3) + poseidon2_SUM_29))); tmp *= scaling_factor; std::get<132>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<133, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_30_0 - - (((((((new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL })) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL })) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) + - (new_term.poseidon2_B_29_1 + FF(0))) + - (new_term.poseidon2_B_29_2 + FF(0))) + - (new_term.poseidon2_B_29_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_30_0 - ((poseidon2_params_MU_0 * poseidon2_A_30_0) + poseidon2_SUM_30))); tmp *= scaling_factor; std::get<133>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<134, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_30_1 - - (((new_term.poseidon2_B_29_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL })) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) + - (new_term.poseidon2_B_29_1 + FF(0))) + - (new_term.poseidon2_B_29_2 + FF(0))) + - (new_term.poseidon2_B_29_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_30_1 - ((poseidon2_params_MU_1 * poseidon2_A_30_1) + poseidon2_SUM_30))); tmp *= scaling_factor; std::get<134>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<135, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_30_2 - - (((new_term.poseidon2_B_29_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL })) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) + - (new_term.poseidon2_B_29_1 + FF(0))) + - (new_term.poseidon2_B_29_2 + FF(0))) + - (new_term.poseidon2_B_29_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_30_2 - ((poseidon2_params_MU_2 * poseidon2_A_30_2) + poseidon2_SUM_30))); tmp *= scaling_factor; std::get<135>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<136, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_30_3 - - (((new_term.poseidon2_B_29_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL })) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) * - (new_term.poseidon2_B_29_0 + FF(uint256_t{ 1589817027469470176UL, - 1086723465680833706UL, - 6948011514366564799UL, - 2482410610948543635UL }))) + - (new_term.poseidon2_B_29_1 + FF(0))) + - (new_term.poseidon2_B_29_2 + FF(0))) + - (new_term.poseidon2_B_29_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_30_3 - ((poseidon2_params_MU_3 * poseidon2_A_30_3) + poseidon2_SUM_30))); tmp *= scaling_factor; std::get<136>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<137, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_31_0 - - (((((((new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL })) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL })) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) + - (new_term.poseidon2_B_30_1 + FF(0))) + - (new_term.poseidon2_B_30_2 + FF(0))) + - (new_term.poseidon2_B_30_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_31_0 - ((poseidon2_params_MU_0 * poseidon2_A_31_0) + poseidon2_SUM_31))); tmp *= scaling_factor; std::get<137>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<138, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_31_1 - - (((new_term.poseidon2_B_30_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL })) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) + - (new_term.poseidon2_B_30_1 + FF(0))) + - (new_term.poseidon2_B_30_2 + FF(0))) + - (new_term.poseidon2_B_30_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_31_1 - ((poseidon2_params_MU_1 * poseidon2_A_31_1) + poseidon2_SUM_31))); tmp *= scaling_factor; std::get<138>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<139, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_31_2 - - (((new_term.poseidon2_B_30_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL })) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) + - (new_term.poseidon2_B_30_1 + FF(0))) + - (new_term.poseidon2_B_30_2 + FF(0))) + - (new_term.poseidon2_B_30_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_31_2 - ((poseidon2_params_MU_2 * poseidon2_A_31_2) + poseidon2_SUM_31))); tmp *= scaling_factor; std::get<139>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<140, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_31_3 - - (((new_term.poseidon2_B_30_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL })) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) * - (new_term.poseidon2_B_30_0 + FF(uint256_t{ 6071201116374785253UL, - 16554668458221199618UL, - 16319484688832471879UL, - 2792452762383364279UL }))) + - (new_term.poseidon2_B_30_1 + FF(0))) + - (new_term.poseidon2_B_30_2 + FF(0))) + - (new_term.poseidon2_B_30_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_31_3 - ((poseidon2_params_MU_3 * poseidon2_A_31_3) + poseidon2_SUM_31))); tmp *= scaling_factor; std::get<140>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<141, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_32_0 - - (((((((new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL })) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL })) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) + - (new_term.poseidon2_B_31_1 + FF(0))) + - (new_term.poseidon2_B_31_2 + FF(0))) + - (new_term.poseidon2_B_31_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_32_0 - ((poseidon2_params_MU_0 * poseidon2_A_32_0) + poseidon2_SUM_32))); tmp *= scaling_factor; std::get<141>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<142, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_32_1 - - (((new_term.poseidon2_B_31_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL })) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) + - (new_term.poseidon2_B_31_1 + FF(0))) + - (new_term.poseidon2_B_31_2 + FF(0))) + - (new_term.poseidon2_B_31_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_32_1 - ((poseidon2_params_MU_1 * poseidon2_A_32_1) + poseidon2_SUM_32))); tmp *= scaling_factor; std::get<142>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<143, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_32_2 - - (((new_term.poseidon2_B_31_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL })) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) + - (new_term.poseidon2_B_31_1 + FF(0))) + - (new_term.poseidon2_B_31_2 + FF(0))) + - (new_term.poseidon2_B_31_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_32_2 - ((poseidon2_params_MU_2 * poseidon2_A_32_2) + poseidon2_SUM_32))); tmp *= scaling_factor; std::get<143>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<144, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_32_3 - - (((new_term.poseidon2_B_31_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL })) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) * - (new_term.poseidon2_B_31_0 + FF(uint256_t{ 13535048470209809113UL, - 1831807297936988201UL, - 16757520396573457190UL, - 508291910620511162UL }))) + - (new_term.poseidon2_B_31_1 + FF(0))) + - (new_term.poseidon2_B_31_2 + FF(0))) + - (new_term.poseidon2_B_31_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_32_3 - ((poseidon2_params_MU_3 * poseidon2_A_32_3) + poseidon2_SUM_32))); tmp *= scaling_factor; std::get<144>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<145, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_33_0 - - (((((((new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL })) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL })) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) + - (new_term.poseidon2_B_32_1 + FF(0))) + - (new_term.poseidon2_B_32_2 + FF(0))) + - (new_term.poseidon2_B_32_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_33_0 - ((poseidon2_params_MU_0 * poseidon2_A_33_0) + poseidon2_SUM_33))); tmp *= scaling_factor; std::get<145>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<146, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_33_1 - - (((new_term.poseidon2_B_32_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL })) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) + - (new_term.poseidon2_B_32_1 + FF(0))) + - (new_term.poseidon2_B_32_2 + FF(0))) + - (new_term.poseidon2_B_32_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_33_1 - ((poseidon2_params_MU_1 * poseidon2_A_33_1) + poseidon2_SUM_33))); tmp *= scaling_factor; std::get<146>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<147, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_33_2 - - (((new_term.poseidon2_B_32_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL })) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) + - (new_term.poseidon2_B_32_1 + FF(0))) + - (new_term.poseidon2_B_32_2 + FF(0))) + - (new_term.poseidon2_B_32_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_33_2 - ((poseidon2_params_MU_2 * poseidon2_A_33_2) + poseidon2_SUM_33))); tmp *= scaling_factor; std::get<147>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<148, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_33_3 - - (((new_term.poseidon2_B_32_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL })) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) * - (new_term.poseidon2_B_32_0 + FF(uint256_t{ 6946737468087619802UL, - 14033399912488027565UL, - 12701200401813783486UL, - 1348363389498465135UL }))) + - (new_term.poseidon2_B_32_1 + FF(0))) + - (new_term.poseidon2_B_32_2 + FF(0))) + - (new_term.poseidon2_B_32_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_33_3 - ((poseidon2_params_MU_3 * poseidon2_A_33_3) + poseidon2_SUM_33))); tmp *= scaling_factor; std::get<148>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<149, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_34_0 - - (((((((new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL })) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL })) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) + - (new_term.poseidon2_B_33_1 + FF(0))) + - (new_term.poseidon2_B_33_2 + FF(0))) + - (new_term.poseidon2_B_33_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_34_0 - ((poseidon2_params_MU_0 * poseidon2_A_34_0) + poseidon2_SUM_34))); tmp *= scaling_factor; std::get<149>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<150, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_34_1 - - (((new_term.poseidon2_B_33_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL })) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) + - (new_term.poseidon2_B_33_1 + FF(0))) + - (new_term.poseidon2_B_33_2 + FF(0))) + - (new_term.poseidon2_B_33_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_34_1 - ((poseidon2_params_MU_1 * poseidon2_A_34_1) + poseidon2_SUM_34))); tmp *= scaling_factor; std::get<150>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<151, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_34_2 - - (((new_term.poseidon2_B_33_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL })) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) + - (new_term.poseidon2_B_33_1 + FF(0))) + - (new_term.poseidon2_B_33_2 + FF(0))) + - (new_term.poseidon2_B_33_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_34_2 - ((poseidon2_params_MU_2 * poseidon2_A_34_2) + poseidon2_SUM_34))); tmp *= scaling_factor; std::get<151>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<152, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_34_3 - - (((new_term.poseidon2_B_33_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL })) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) * - (new_term.poseidon2_B_33_0 + FF(uint256_t{ 6788008051328210729UL, - 13866524545426155292UL, - 4317879914214157329UL, - 2633928310905799638UL }))) + - (new_term.poseidon2_B_33_1 + FF(0))) + - (new_term.poseidon2_B_33_2 + FF(0))) + - (new_term.poseidon2_B_33_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_34_3 - ((poseidon2_params_MU_3 * poseidon2_A_34_3) + poseidon2_SUM_34))); tmp *= scaling_factor; std::get<152>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<153, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_35_0 - - (((((((new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL })) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL })) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) + - (new_term.poseidon2_B_34_1 + FF(0))) + - (new_term.poseidon2_B_34_2 + FF(0))) + - (new_term.poseidon2_B_34_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_35_0 - ((poseidon2_params_MU_0 * poseidon2_A_35_0) + poseidon2_SUM_35))); tmp *= scaling_factor; std::get<153>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<154, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_35_1 - - (((new_term.poseidon2_B_34_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL })) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) + - (new_term.poseidon2_B_34_1 + FF(0))) + - (new_term.poseidon2_B_34_2 + FF(0))) + - (new_term.poseidon2_B_34_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_35_1 - ((poseidon2_params_MU_1 * poseidon2_A_35_1) + poseidon2_SUM_35))); tmp *= scaling_factor; std::get<154>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<155, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_35_2 - - (((new_term.poseidon2_B_34_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL })) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) + - (new_term.poseidon2_B_34_1 + FF(0))) + - (new_term.poseidon2_B_34_2 + FF(0))) + - (new_term.poseidon2_B_34_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_35_2 - ((poseidon2_params_MU_2 * poseidon2_A_35_2) + poseidon2_SUM_35))); tmp *= scaling_factor; std::get<155>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<156, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_35_3 - - (((new_term.poseidon2_B_34_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL })) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) * - (new_term.poseidon2_B_34_0 + FF(uint256_t{ 1183626302001490602UL, - 10035686235057284266UL, - 1656321729167440177UL, - 1887128381037099784UL }))) + - (new_term.poseidon2_B_34_1 + FF(0))) + - (new_term.poseidon2_B_34_2 + FF(0))) + - (new_term.poseidon2_B_34_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_35_3 - ((poseidon2_params_MU_3 * poseidon2_A_35_3) + poseidon2_SUM_35))); tmp *= scaling_factor; std::get<156>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<157, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_36_0 - - (((((((new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL })) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL })) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) + - (new_term.poseidon2_B_35_1 + FF(0))) + - (new_term.poseidon2_B_35_2 + FF(0))) + - (new_term.poseidon2_B_35_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_36_0 - ((poseidon2_params_MU_0 * poseidon2_A_36_0) + poseidon2_SUM_36))); tmp *= scaling_factor; std::get<157>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<158, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_36_1 - - (((new_term.poseidon2_B_35_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL })) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) + - (new_term.poseidon2_B_35_1 + FF(0))) + - (new_term.poseidon2_B_35_2 + FF(0))) + - (new_term.poseidon2_B_35_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_36_1 - ((poseidon2_params_MU_1 * poseidon2_A_36_1) + poseidon2_SUM_36))); tmp *= scaling_factor; std::get<158>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<159, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_36_2 - - (((new_term.poseidon2_B_35_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL })) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) + - (new_term.poseidon2_B_35_1 + FF(0))) + - (new_term.poseidon2_B_35_2 + FF(0))) + - (new_term.poseidon2_B_35_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_36_2 - ((poseidon2_params_MU_2 * poseidon2_A_36_2) + poseidon2_SUM_36))); tmp *= scaling_factor; std::get<159>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<160, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_36_3 - - (((new_term.poseidon2_B_35_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL })) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) * - (new_term.poseidon2_B_35_0 + FF(uint256_t{ 964566190254741199UL, - 17650087760652370459UL, - 14904592615785317921UL, - 2929864473487096026UL }))) + - (new_term.poseidon2_B_35_1 + FF(0))) + - (new_term.poseidon2_B_35_2 + FF(0))) + - (new_term.poseidon2_B_35_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_36_3 - ((poseidon2_params_MU_3 * poseidon2_A_36_3) + poseidon2_SUM_36))); tmp *= scaling_factor; std::get<160>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<161, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_37_0 - - (((((((new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL })) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL })) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) + - (new_term.poseidon2_B_36_1 + FF(0))) + - (new_term.poseidon2_B_36_2 + FF(0))) + - (new_term.poseidon2_B_36_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_37_0 - ((poseidon2_params_MU_0 * poseidon2_A_37_0) + poseidon2_SUM_37))); tmp *= scaling_factor; std::get<161>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<162, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_37_1 - - (((new_term.poseidon2_B_36_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL })) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) + - (new_term.poseidon2_B_36_1 + FF(0))) + - (new_term.poseidon2_B_36_2 + FF(0))) + - (new_term.poseidon2_B_36_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_37_1 - ((poseidon2_params_MU_1 * poseidon2_A_37_1) + poseidon2_SUM_37))); tmp *= scaling_factor; std::get<162>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<163, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_37_2 - - (((new_term.poseidon2_B_36_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL })) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) + - (new_term.poseidon2_B_36_1 + FF(0))) + - (new_term.poseidon2_B_36_2 + FF(0))) + - (new_term.poseidon2_B_36_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_37_2 - ((poseidon2_params_MU_2 * poseidon2_A_37_2) + poseidon2_SUM_37))); tmp *= scaling_factor; std::get<163>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<164, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_37_3 - - (((new_term.poseidon2_B_36_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL })) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) * - (new_term.poseidon2_B_36_0 + FF(uint256_t{ 13584300701347139198UL, - 512534187550045064UL, - 13489711551083721364UL, - 41824696873363624UL }))) + - (new_term.poseidon2_B_36_1 + FF(0))) + - (new_term.poseidon2_B_36_2 + FF(0))) + - (new_term.poseidon2_B_36_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_37_3 - ((poseidon2_params_MU_3 * poseidon2_A_37_3) + poseidon2_SUM_37))); tmp *= scaling_factor; std::get<164>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<165, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_38_0 - - (((((((new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL })) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL })) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) + - (new_term.poseidon2_B_37_1 + FF(0))) + - (new_term.poseidon2_B_37_2 + FF(0))) + - (new_term.poseidon2_B_37_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_38_0 - ((poseidon2_params_MU_0 * poseidon2_A_38_0) + poseidon2_SUM_38))); tmp *= scaling_factor; std::get<165>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<166, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_38_1 - - (((new_term.poseidon2_B_37_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL })) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) + - (new_term.poseidon2_B_37_1 + FF(0))) + - (new_term.poseidon2_B_37_2 + FF(0))) + - (new_term.poseidon2_B_37_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_38_1 - ((poseidon2_params_MU_1 * poseidon2_A_38_1) + poseidon2_SUM_38))); tmp *= scaling_factor; std::get<166>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<167, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_38_2 - - (((new_term.poseidon2_B_37_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL })) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) + - (new_term.poseidon2_B_37_1 + FF(0))) + - (new_term.poseidon2_B_37_2 + FF(0))) + - (new_term.poseidon2_B_37_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_38_2 - ((poseidon2_params_MU_2 * poseidon2_A_38_2) + poseidon2_SUM_38))); tmp *= scaling_factor; std::get<167>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<168, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_38_3 - - (((new_term.poseidon2_B_37_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL })) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) * - (new_term.poseidon2_B_37_0 + FF(uint256_t{ 17586611824788147557UL, - 6430987250922925699UL, - 9294838151373947091UL, - 348446557360066429UL }))) + - (new_term.poseidon2_B_37_1 + FF(0))) + - (new_term.poseidon2_B_37_2 + FF(0))) + - (new_term.poseidon2_B_37_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_38_3 - ((poseidon2_params_MU_3 * poseidon2_A_38_3) + poseidon2_SUM_38))); tmp *= scaling_factor; std::get<168>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<169, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_39_0 - - (((((((new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL })) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL })) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) + - (new_term.poseidon2_B_38_1 + FF(0))) + - (new_term.poseidon2_B_38_2 + FF(0))) + - (new_term.poseidon2_B_38_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_39_0 - ((poseidon2_params_MU_0 * poseidon2_A_39_0) + poseidon2_SUM_39))); tmp *= scaling_factor; std::get<169>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<170, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_39_1 - - (((new_term.poseidon2_B_38_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL })) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) + - (new_term.poseidon2_B_38_1 + FF(0))) + - (new_term.poseidon2_B_38_2 + FF(0))) + - (new_term.poseidon2_B_38_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_39_1 - ((poseidon2_params_MU_1 * poseidon2_A_39_1) + poseidon2_SUM_39))); tmp *= scaling_factor; std::get<170>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<171, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_39_2 - - (((new_term.poseidon2_B_38_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL })) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) + - (new_term.poseidon2_B_38_1 + FF(0))) + - (new_term.poseidon2_B_38_2 + FF(0))) + - (new_term.poseidon2_B_38_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_39_2 - ((poseidon2_params_MU_2 * poseidon2_A_39_2) + poseidon2_SUM_39))); tmp *= scaling_factor; std::get<171>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<172, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_39_3 - - (((new_term.poseidon2_B_38_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL })) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) * - (new_term.poseidon2_B_38_0 + FF(uint256_t{ 15025298913764434311UL, - 14393211163878018166UL, - 7154440178410267241UL, - 3057088631006286899UL }))) + - (new_term.poseidon2_B_38_1 + FF(0))) + - (new_term.poseidon2_B_38_2 + FF(0))) + - (new_term.poseidon2_B_38_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_39_3 - ((poseidon2_params_MU_3 * poseidon2_A_39_3) + poseidon2_SUM_39))); tmp *= scaling_factor; std::get<172>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<173, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_40_0 - - (((((((new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL })) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL })) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) + - (new_term.poseidon2_B_39_1 + FF(0))) + - (new_term.poseidon2_B_39_2 + FF(0))) + - (new_term.poseidon2_B_39_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_40_0 - ((poseidon2_params_MU_0 * poseidon2_A_40_0) + poseidon2_SUM_40))); tmp *= scaling_factor; std::get<173>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<174, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_40_1 - - (((new_term.poseidon2_B_39_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL })) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) + - (new_term.poseidon2_B_39_1 + FF(0))) + - (new_term.poseidon2_B_39_2 + FF(0))) + - (new_term.poseidon2_B_39_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_40_1 - ((poseidon2_params_MU_1 * poseidon2_A_40_1) + poseidon2_SUM_40))); tmp *= scaling_factor; std::get<174>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<175, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_40_2 - - (((new_term.poseidon2_B_39_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL })) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) + - (new_term.poseidon2_B_39_1 + FF(0))) + - (new_term.poseidon2_B_39_2 + FF(0))) + - (new_term.poseidon2_B_39_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_40_2 - ((poseidon2_params_MU_2 * poseidon2_A_40_2) + poseidon2_SUM_40))); tmp *= scaling_factor; std::get<175>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<176, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_40_3 - - (((new_term.poseidon2_B_39_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL })) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) * - (new_term.poseidon2_B_39_0 + FF(uint256_t{ 13451769229280519155UL, - 17839347496757587523UL, - 10553299811918798519UL, - 2523373819901075642UL }))) + - (new_term.poseidon2_B_39_1 + FF(0))) + - (new_term.poseidon2_B_39_2 + FF(0))) + - (new_term.poseidon2_B_39_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_40_3 - ((poseidon2_params_MU_3 * poseidon2_A_40_3) + poseidon2_SUM_40))); tmp *= scaling_factor; std::get<176>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<177, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_41_0 - - (((((((new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL })) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL })) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) + - (new_term.poseidon2_B_40_1 + FF(0))) + - (new_term.poseidon2_B_40_2 + FF(0))) + - (new_term.poseidon2_B_40_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_41_0 - ((poseidon2_params_MU_0 * poseidon2_A_41_0) + poseidon2_SUM_41))); tmp *= scaling_factor; std::get<177>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<178, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_41_1 - - (((new_term.poseidon2_B_40_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL })) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) + - (new_term.poseidon2_B_40_1 + FF(0))) + - (new_term.poseidon2_B_40_2 + FF(0))) + - (new_term.poseidon2_B_40_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_41_1 - ((poseidon2_params_MU_1 * poseidon2_A_41_1) + poseidon2_SUM_41))); tmp *= scaling_factor; std::get<178>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<179, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_41_2 - - (((new_term.poseidon2_B_40_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL })) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) + - (new_term.poseidon2_B_40_1 + FF(0))) + - (new_term.poseidon2_B_40_2 + FF(0))) + - (new_term.poseidon2_B_40_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_41_2 - ((poseidon2_params_MU_2 * poseidon2_A_41_2) + poseidon2_SUM_41))); tmp *= scaling_factor; std::get<179>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<180, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_41_3 - - (((new_term.poseidon2_B_40_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL })) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) * - (new_term.poseidon2_B_40_0 + FF(uint256_t{ 16267315463205810352UL, - 13830706729545301172UL, - 15413288900478726729UL, - 287556136711008934UL }))) + - (new_term.poseidon2_B_40_1 + FF(0))) + - (new_term.poseidon2_B_40_2 + FF(0))) + - (new_term.poseidon2_B_40_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_41_3 - ((poseidon2_params_MU_3 * poseidon2_A_41_3) + poseidon2_SUM_41))); tmp *= scaling_factor; std::get<180>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<181, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_42_0 - - (((((((new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL })) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL })) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) + - (new_term.poseidon2_B_41_1 + FF(0))) + - (new_term.poseidon2_B_41_2 + FF(0))) + - (new_term.poseidon2_B_41_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_42_0 - ((poseidon2_params_MU_0 * poseidon2_A_42_0) + poseidon2_SUM_42))); tmp *= scaling_factor; std::get<181>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<182, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_42_1 - - (((new_term.poseidon2_B_41_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL })) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) + - (new_term.poseidon2_B_41_1 + FF(0))) + - (new_term.poseidon2_B_41_2 + FF(0))) + - (new_term.poseidon2_B_41_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_42_1 - ((poseidon2_params_MU_1 * poseidon2_A_42_1) + poseidon2_SUM_42))); tmp *= scaling_factor; std::get<182>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<183, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_42_2 - - (((new_term.poseidon2_B_41_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL })) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) + - (new_term.poseidon2_B_41_1 + FF(0))) + - (new_term.poseidon2_B_41_2 + FF(0))) + - (new_term.poseidon2_B_41_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_42_2 - ((poseidon2_params_MU_2 * poseidon2_A_42_2) + poseidon2_SUM_42))); tmp *= scaling_factor; std::get<183>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<184, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_42_3 - - (((new_term.poseidon2_B_41_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL })) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) * - (new_term.poseidon2_B_41_0 + FF(uint256_t{ 4573780169675443044UL, - 8758089751960064775UL, - 2470295096511057988UL, - 51551212240288730UL }))) + - (new_term.poseidon2_B_41_1 + FF(0))) + - (new_term.poseidon2_B_41_2 + FF(0))) + - (new_term.poseidon2_B_41_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_42_3 - ((poseidon2_params_MU_3 * poseidon2_A_42_3) + poseidon2_SUM_42))); tmp *= scaling_factor; std::get<184>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<185, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_43_0 - - (((((((new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL })) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL })) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) + - (new_term.poseidon2_B_42_1 + FF(0))) + - (new_term.poseidon2_B_42_2 + FF(0))) + - (new_term.poseidon2_B_42_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_43_0 - ((poseidon2_params_MU_0 * poseidon2_A_43_0) + poseidon2_SUM_43))); tmp *= scaling_factor; std::get<185>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<186, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_43_1 - - (((new_term.poseidon2_B_42_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL })) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) + - (new_term.poseidon2_B_42_1 + FF(0))) + - (new_term.poseidon2_B_42_2 + FF(0))) + - (new_term.poseidon2_B_42_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_43_1 - ((poseidon2_params_MU_1 * poseidon2_A_43_1) + poseidon2_SUM_43))); tmp *= scaling_factor; std::get<186>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<187, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_43_2 - - (((new_term.poseidon2_B_42_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL })) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) + - (new_term.poseidon2_B_42_1 + FF(0))) + - (new_term.poseidon2_B_42_2 + FF(0))) + - (new_term.poseidon2_B_42_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_43_2 - ((poseidon2_params_MU_2 * poseidon2_A_43_2) + poseidon2_SUM_43))); tmp *= scaling_factor; std::get<187>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<188, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_43_3 - - (((new_term.poseidon2_B_42_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL })) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) * - (new_term.poseidon2_B_42_0 + FF(uint256_t{ 7093949836145798554UL, - 12771428392262798771UL, - 17021632567931004395UL, - 1558106578814965657UL }))) + - (new_term.poseidon2_B_42_1 + FF(0))) + - (new_term.poseidon2_B_42_2 + FF(0))) + - (new_term.poseidon2_B_42_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_43_3 - ((poseidon2_params_MU_3 * poseidon2_A_43_3) + poseidon2_SUM_43))); tmp *= scaling_factor; std::get<188>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<189, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_44_0 - - (((((((new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL })) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL })) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) + - (new_term.poseidon2_B_43_1 + FF(0))) + - (new_term.poseidon2_B_43_2 + FF(0))) + - (new_term.poseidon2_B_43_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_44_0 - ((poseidon2_params_MU_0 * poseidon2_A_44_0) + poseidon2_SUM_44))); tmp *= scaling_factor; std::get<189>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<190, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_44_1 - - (((new_term.poseidon2_B_43_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL })) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) + - (new_term.poseidon2_B_43_1 + FF(0))) + - (new_term.poseidon2_B_43_2 + FF(0))) + - (new_term.poseidon2_B_43_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_44_1 - ((poseidon2_params_MU_1 * poseidon2_A_44_1) + poseidon2_SUM_44))); tmp *= scaling_factor; std::get<190>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<191, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_44_2 - - (((new_term.poseidon2_B_43_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL })) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) + - (new_term.poseidon2_B_43_1 + FF(0))) + - (new_term.poseidon2_B_43_2 + FF(0))) + - (new_term.poseidon2_B_43_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_44_2 - ((poseidon2_params_MU_2 * poseidon2_A_44_2) + poseidon2_SUM_44))); tmp *= scaling_factor; std::get<191>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<192, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_44_3 - - (((new_term.poseidon2_B_43_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL })) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) * - (new_term.poseidon2_B_43_0 + FF(uint256_t{ 8205915653008540447UL, - 10376314495036230740UL, - 5774593793305666491UL, - 2231830927015656581UL }))) + - (new_term.poseidon2_B_43_1 + FF(0))) + - (new_term.poseidon2_B_43_2 + FF(0))) + - (new_term.poseidon2_B_43_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_44_3 - ((poseidon2_params_MU_3 * poseidon2_A_44_3) + poseidon2_SUM_44))); tmp *= scaling_factor; std::get<192>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<193, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_45_0 - - (((((((new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL })) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL })) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) + - (new_term.poseidon2_B_44_1 + FF(0))) + - (new_term.poseidon2_B_44_2 + FF(0))) + - (new_term.poseidon2_B_44_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_45_0 - ((poseidon2_params_MU_0 * poseidon2_A_45_0) + poseidon2_SUM_45))); tmp *= scaling_factor; std::get<193>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<194, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_45_1 - - (((new_term.poseidon2_B_44_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL })) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) + - (new_term.poseidon2_B_44_1 + FF(0))) + - (new_term.poseidon2_B_44_2 + FF(0))) + - (new_term.poseidon2_B_44_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_45_1 - ((poseidon2_params_MU_1 * poseidon2_A_45_1) + poseidon2_SUM_45))); tmp *= scaling_factor; std::get<194>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<195, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_45_2 - - (((new_term.poseidon2_B_44_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL })) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) + - (new_term.poseidon2_B_44_1 + FF(0))) + - (new_term.poseidon2_B_44_2 + FF(0))) + - (new_term.poseidon2_B_44_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_45_2 - ((poseidon2_params_MU_2 * poseidon2_A_45_2) + poseidon2_SUM_45))); tmp *= scaling_factor; std::get<195>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<196, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_45_3 - - (((new_term.poseidon2_B_44_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL })) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) * - (new_term.poseidon2_B_44_0 + FF(uint256_t{ 10783762484003267341UL, - 10229708558604896492UL, - 1831638669050696278UL, - 2190429714552610800UL }))) + - (new_term.poseidon2_B_44_1 + FF(0))) + - (new_term.poseidon2_B_44_2 + FF(0))) + - (new_term.poseidon2_B_44_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_45_3 - ((poseidon2_params_MU_3 * poseidon2_A_45_3) + poseidon2_SUM_45))); tmp *= scaling_factor; std::get<196>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<197, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_46_0 - - (((((((new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL })) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL })) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) + - (new_term.poseidon2_B_45_1 + FF(0))) + - (new_term.poseidon2_B_45_2 + FF(0))) + - (new_term.poseidon2_B_45_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_46_0 - ((poseidon2_params_MU_0 * poseidon2_A_46_0) + poseidon2_SUM_46))); tmp *= scaling_factor; std::get<197>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<198, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_46_1 - - (((new_term.poseidon2_B_45_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL })) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) + - (new_term.poseidon2_B_45_1 + FF(0))) + - (new_term.poseidon2_B_45_2 + FF(0))) + - (new_term.poseidon2_B_45_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_46_1 - ((poseidon2_params_MU_1 * poseidon2_A_46_1) + poseidon2_SUM_46))); tmp *= scaling_factor; std::get<198>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<199, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_46_2 - - (((new_term.poseidon2_B_45_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL })) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) + - (new_term.poseidon2_B_45_1 + FF(0))) + - (new_term.poseidon2_B_45_2 + FF(0))) + - (new_term.poseidon2_B_45_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_46_2 - ((poseidon2_params_MU_2 * poseidon2_A_46_2) + poseidon2_SUM_46))); tmp *= scaling_factor; std::get<199>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<200, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_46_3 - - (((new_term.poseidon2_B_45_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL })) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) * - (new_term.poseidon2_B_45_0 + FF(uint256_t{ 7310961803978392383UL, - 12793746113455595394UL, - 17036245927795997300UL, - 3106081169494120044UL }))) + - (new_term.poseidon2_B_45_1 + FF(0))) + - (new_term.poseidon2_B_45_2 + FF(0))) + - (new_term.poseidon2_B_45_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_46_3 - ((poseidon2_params_MU_3 * poseidon2_A_46_3) + poseidon2_SUM_46))); tmp *= scaling_factor; std::get<200>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<201, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_47_0 - - (((((((new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL })) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL })) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) + - (new_term.poseidon2_B_46_1 + FF(0))) + - (new_term.poseidon2_B_46_2 + FF(0))) + - (new_term.poseidon2_B_46_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_47_0 - ((poseidon2_params_MU_0 * poseidon2_A_47_0) + poseidon2_SUM_47))); tmp *= scaling_factor; std::get<201>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<202, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_47_1 - - (((new_term.poseidon2_B_46_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL })) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) + - (new_term.poseidon2_B_46_1 + FF(0))) + - (new_term.poseidon2_B_46_2 + FF(0))) + - (new_term.poseidon2_B_46_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_47_1 - ((poseidon2_params_MU_1 * poseidon2_A_47_1) + poseidon2_SUM_47))); tmp *= scaling_factor; std::get<202>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<203, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_47_2 - - (((new_term.poseidon2_B_46_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL })) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) + - (new_term.poseidon2_B_46_1 + FF(0))) + - (new_term.poseidon2_B_46_2 + FF(0))) + - (new_term.poseidon2_B_46_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_47_2 - ((poseidon2_params_MU_2 * poseidon2_A_47_2) + poseidon2_SUM_47))); tmp *= scaling_factor; std::get<203>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<204, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_47_3 - - (((new_term.poseidon2_B_46_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL })) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) * - (new_term.poseidon2_B_46_0 + FF(uint256_t{ 17421859032088162675UL, - 7339791467855418851UL, - 4622175020331968961UL, - 590786792834928630UL }))) + - (new_term.poseidon2_B_46_1 + FF(0))) + - (new_term.poseidon2_B_46_2 + FF(0))) + - (new_term.poseidon2_B_46_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_47_3 - ((poseidon2_params_MU_3 * poseidon2_A_47_3) + poseidon2_SUM_47))); tmp *= scaling_factor; std::get<204>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<205, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_48_0 - - (((((((new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL })) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL })) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) + - (new_term.poseidon2_B_47_1 + FF(0))) + - (new_term.poseidon2_B_47_2 + FF(0))) + - (new_term.poseidon2_B_47_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_48_0 - ((poseidon2_params_MU_0 * poseidon2_A_48_0) + poseidon2_SUM_48))); tmp *= scaling_factor; std::get<205>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<206, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_48_1 - - (((new_term.poseidon2_B_47_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL })) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) + - (new_term.poseidon2_B_47_1 + FF(0))) + - (new_term.poseidon2_B_47_2 + FF(0))) + - (new_term.poseidon2_B_47_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_48_1 - ((poseidon2_params_MU_1 * poseidon2_A_48_1) + poseidon2_SUM_48))); tmp *= scaling_factor; std::get<206>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<207, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_48_2 - - (((new_term.poseidon2_B_47_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL })) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) + - (new_term.poseidon2_B_47_1 + FF(0))) + - (new_term.poseidon2_B_47_2 + FF(0))) + - (new_term.poseidon2_B_47_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_48_2 - ((poseidon2_params_MU_2 * poseidon2_A_48_2) + poseidon2_SUM_48))); tmp *= scaling_factor; std::get<207>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<208, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_48_3 - - (((new_term.poseidon2_B_47_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL })) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) * - (new_term.poseidon2_B_47_0 + FF(uint256_t{ 14242884250645212438UL, - 12806057845811725595UL, - 7743423753614082490UL, - 213381026777379804UL }))) + - (new_term.poseidon2_B_47_1 + FF(0))) + - (new_term.poseidon2_B_47_2 + FF(0))) + - (new_term.poseidon2_B_47_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_48_3 - ((poseidon2_params_MU_3 * poseidon2_A_48_3) + poseidon2_SUM_48))); tmp *= scaling_factor; std::get<208>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<209, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_49_0 - - (((((((new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL })) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL })) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) + - (new_term.poseidon2_B_48_1 + FF(0))) + - (new_term.poseidon2_B_48_2 + FF(0))) + - (new_term.poseidon2_B_48_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_49_0 - ((poseidon2_params_MU_0 * poseidon2_A_49_0) + poseidon2_SUM_49))); tmp *= scaling_factor; std::get<209>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<210, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_49_1 - - (((new_term.poseidon2_B_48_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL })) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) + - (new_term.poseidon2_B_48_1 + FF(0))) + - (new_term.poseidon2_B_48_2 + FF(0))) + - (new_term.poseidon2_B_48_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_49_1 - ((poseidon2_params_MU_1 * poseidon2_A_49_1) + poseidon2_SUM_49))); tmp *= scaling_factor; std::get<210>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<211, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_49_2 - - (((new_term.poseidon2_B_48_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL })) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) + - (new_term.poseidon2_B_48_1 + FF(0))) + - (new_term.poseidon2_B_48_2 + FF(0))) + - (new_term.poseidon2_B_48_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_49_2 - ((poseidon2_params_MU_2 * poseidon2_A_49_2) + poseidon2_SUM_49))); tmp *= scaling_factor; std::get<211>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<212, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_49_3 - - (((new_term.poseidon2_B_48_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL })) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) * - (new_term.poseidon2_B_48_0 + FF(uint256_t{ 1110713325513004805UL, - 8318407684973846516UL, - 15952888485475298710UL, - 1018983205230111328UL }))) + - (new_term.poseidon2_B_48_1 + FF(0))) + - (new_term.poseidon2_B_48_2 + FF(0))) + - (new_term.poseidon2_B_48_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_49_3 - ((poseidon2_params_MU_3 * poseidon2_A_49_3) + poseidon2_SUM_49))); tmp *= scaling_factor; std::get<212>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<213, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_50_0 - - (((((((new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL })) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL })) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) + - (new_term.poseidon2_B_49_1 + FF(0))) + - (new_term.poseidon2_B_49_2 + FF(0))) + - (new_term.poseidon2_B_49_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_50_0 - ((poseidon2_params_MU_0 * poseidon2_A_50_0) + poseidon2_SUM_50))); tmp *= scaling_factor; std::get<213>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<214, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_50_1 - - (((new_term.poseidon2_B_49_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL })) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) + - (new_term.poseidon2_B_49_1 + FF(0))) + - (new_term.poseidon2_B_49_2 + FF(0))) + - (new_term.poseidon2_B_49_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_50_1 - ((poseidon2_params_MU_1 * poseidon2_A_50_1) + poseidon2_SUM_50))); tmp *= scaling_factor; std::get<214>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<215, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_50_2 - - (((new_term.poseidon2_B_49_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL })) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) + - (new_term.poseidon2_B_49_1 + FF(0))) + - (new_term.poseidon2_B_49_2 + FF(0))) + - (new_term.poseidon2_B_49_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_50_2 - ((poseidon2_params_MU_2 * poseidon2_A_50_2) + poseidon2_SUM_50))); tmp *= scaling_factor; std::get<215>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<216, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_50_3 - - (((new_term.poseidon2_B_49_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL })) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) * - (new_term.poseidon2_B_49_0 + FF(uint256_t{ 533883137631233338UL, - 333001117808183237UL, - 16968583542443855481UL, - 329716098711096173UL }))) + - (new_term.poseidon2_B_49_1 + FF(0))) + - (new_term.poseidon2_B_49_2 + FF(0))) + - (new_term.poseidon2_B_49_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_50_3 - ((poseidon2_params_MU_3 * poseidon2_A_50_3) + poseidon2_SUM_50))); tmp *= scaling_factor; std::get<216>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<217, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_51_0 - - (((((((new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL })) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL })) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) + - (new_term.poseidon2_B_50_1 + FF(0))) + - (new_term.poseidon2_B_50_2 + FF(0))) + - (new_term.poseidon2_B_50_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_51_0 - ((poseidon2_params_MU_0 * poseidon2_A_51_0) + poseidon2_SUM_51))); tmp *= scaling_factor; std::get<217>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<218, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_51_1 - - (((new_term.poseidon2_B_50_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL })) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) + - (new_term.poseidon2_B_50_1 + FF(0))) + - (new_term.poseidon2_B_50_2 + FF(0))) + - (new_term.poseidon2_B_50_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_51_1 - ((poseidon2_params_MU_1 * poseidon2_A_51_1) + poseidon2_SUM_51))); tmp *= scaling_factor; std::get<218>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<219, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_51_2 - - (((new_term.poseidon2_B_50_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL })) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) + - (new_term.poseidon2_B_50_1 + FF(0))) + - (new_term.poseidon2_B_50_2 + FF(0))) + - (new_term.poseidon2_B_50_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_51_2 - ((poseidon2_params_MU_2 * poseidon2_A_51_2) + poseidon2_SUM_51))); tmp *= scaling_factor; std::get<219>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<220, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_51_3 - - (((new_term.poseidon2_B_50_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL })) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) * - (new_term.poseidon2_B_50_0 + FF(uint256_t{ 4449676039486426793UL, - 7760073051300251162UL, - 5615103291054015906UL, - 2516053143677338215UL }))) + - (new_term.poseidon2_B_50_1 + FF(0))) + - (new_term.poseidon2_B_50_2 + FF(0))) + - (new_term.poseidon2_B_50_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_51_3 - ((poseidon2_params_MU_3 * poseidon2_A_51_3) + poseidon2_SUM_51))); tmp *= scaling_factor; std::get<220>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<221, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_52_0 - - (((((((new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL })) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL })) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) + - (new_term.poseidon2_B_51_1 + FF(0))) + - (new_term.poseidon2_B_51_2 + FF(0))) + - (new_term.poseidon2_B_51_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_52_0 - ((poseidon2_params_MU_0 * poseidon2_A_52_0) + poseidon2_SUM_52))); tmp *= scaling_factor; std::get<221>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<222, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_52_1 - - (((new_term.poseidon2_B_51_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL })) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) + - (new_term.poseidon2_B_51_1 + FF(0))) + - (new_term.poseidon2_B_51_2 + FF(0))) + - (new_term.poseidon2_B_51_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_52_1 - ((poseidon2_params_MU_1 * poseidon2_A_52_1) + poseidon2_SUM_52))); tmp *= scaling_factor; std::get<222>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<223, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_52_2 - - (((new_term.poseidon2_B_51_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL })) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) + - (new_term.poseidon2_B_51_1 + FF(0))) + - (new_term.poseidon2_B_51_2 + FF(0))) + - (new_term.poseidon2_B_51_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_52_2 - ((poseidon2_params_MU_2 * poseidon2_A_52_2) + poseidon2_SUM_52))); tmp *= scaling_factor; std::get<223>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<224, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_52_3 - - (((new_term.poseidon2_B_51_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL })) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) * - (new_term.poseidon2_B_51_0 + FF(uint256_t{ 16503526645482286870UL, - 6358830762575712333UL, - 12313512559299087688UL, - 2716767262544184013UL }))) + - (new_term.poseidon2_B_51_1 + FF(0))) + - (new_term.poseidon2_B_51_2 + FF(0))) + - (new_term.poseidon2_B_51_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_52_3 - ((poseidon2_params_MU_3 * poseidon2_A_52_3) + poseidon2_SUM_52))); tmp *= scaling_factor; std::get<224>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<225, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_53_0 - - (((((((new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL })) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL })) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) + - (new_term.poseidon2_B_52_1 + FF(0))) + - (new_term.poseidon2_B_52_2 + FF(0))) + - (new_term.poseidon2_B_52_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_53_0 - ((poseidon2_params_MU_0 * poseidon2_A_53_0) + poseidon2_SUM_53))); tmp *= scaling_factor; std::get<225>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<226, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_53_1 - - (((new_term.poseidon2_B_52_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL })) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) + - (new_term.poseidon2_B_52_1 + FF(0))) + - (new_term.poseidon2_B_52_2 + FF(0))) + - (new_term.poseidon2_B_52_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_53_1 - ((poseidon2_params_MU_1 * poseidon2_A_53_1) + poseidon2_SUM_53))); tmp *= scaling_factor; std::get<226>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<227, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_53_2 - - (((new_term.poseidon2_B_52_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL })) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) + - (new_term.poseidon2_B_52_1 + FF(0))) + - (new_term.poseidon2_B_52_2 + FF(0))) + - (new_term.poseidon2_B_52_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_53_2 - ((poseidon2_params_MU_2 * poseidon2_A_53_2) + poseidon2_SUM_53))); tmp *= scaling_factor; std::get<227>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<228, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_53_3 - - (((new_term.poseidon2_B_52_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL })) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) * - (new_term.poseidon2_B_52_0 + FF(uint256_t{ 5426798011730033104UL, - 13085704829880126552UL, - 6356732802364281819UL, - 2175930396888807151UL }))) + - (new_term.poseidon2_B_52_1 + FF(0))) + - (new_term.poseidon2_B_52_2 + FF(0))) + - (new_term.poseidon2_B_52_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_53_3 - ((poseidon2_params_MU_3 * poseidon2_A_53_3) + poseidon2_SUM_53))); tmp *= scaling_factor; std::get<228>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<229, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_54_0 - - (((((((new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL })) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL })) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) + - (new_term.poseidon2_B_53_1 + FF(0))) + - (new_term.poseidon2_B_53_2 + FF(0))) + - (new_term.poseidon2_B_53_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_54_0 - ((poseidon2_params_MU_0 * poseidon2_A_54_0) + poseidon2_SUM_54))); tmp *= scaling_factor; std::get<229>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<230, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_54_1 - - (((new_term.poseidon2_B_53_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL })) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) + - (new_term.poseidon2_B_53_1 + FF(0))) + - (new_term.poseidon2_B_53_2 + FF(0))) + - (new_term.poseidon2_B_53_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_54_1 - ((poseidon2_params_MU_1 * poseidon2_A_54_1) + poseidon2_SUM_54))); tmp *= scaling_factor; std::get<230>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<231, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_54_2 - - (((new_term.poseidon2_B_53_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL })) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) + - (new_term.poseidon2_B_53_1 + FF(0))) + - (new_term.poseidon2_B_53_2 + FF(0))) + - (new_term.poseidon2_B_53_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_54_2 - ((poseidon2_params_MU_2 * poseidon2_A_54_2) + poseidon2_SUM_54))); tmp *= scaling_factor; std::get<231>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<232, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_54_3 - - (((new_term.poseidon2_B_53_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL })) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) * - (new_term.poseidon2_B_53_0 + FF(uint256_t{ 8262282602783970021UL, - 2576069526442506486UL, - 14199683559983367515UL, - 3432491072538425468UL }))) + - (new_term.poseidon2_B_53_1 + FF(0))) + - (new_term.poseidon2_B_53_2 + FF(0))) + - (new_term.poseidon2_B_53_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_54_3 - ((poseidon2_params_MU_3 * poseidon2_A_54_3) + poseidon2_SUM_54))); tmp *= scaling_factor; std::get<232>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<233, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_55_0 - - (((((((new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL })) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL })) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) + - (new_term.poseidon2_B_54_1 + FF(0))) + - (new_term.poseidon2_B_54_2 + FF(0))) + - (new_term.poseidon2_B_54_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_55_0 - ((poseidon2_params_MU_0 * poseidon2_A_55_0) + poseidon2_SUM_55))); tmp *= scaling_factor; std::get<233>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<234, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_55_1 - - (((new_term.poseidon2_B_54_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL })) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) + - (new_term.poseidon2_B_54_1 + FF(0))) + - (new_term.poseidon2_B_54_2 + FF(0))) + - (new_term.poseidon2_B_54_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_55_1 - ((poseidon2_params_MU_1 * poseidon2_A_55_1) + poseidon2_SUM_55))); tmp *= scaling_factor; std::get<234>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<235, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_55_2 - - (((new_term.poseidon2_B_54_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL })) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) + - (new_term.poseidon2_B_54_1 + FF(0))) + - (new_term.poseidon2_B_54_2 + FF(0))) + - (new_term.poseidon2_B_54_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_55_2 - ((poseidon2_params_MU_2 * poseidon2_A_55_2) + poseidon2_SUM_55))); tmp *= scaling_factor; std::get<235>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<236, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_55_3 - - (((new_term.poseidon2_B_54_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL })) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) * - (new_term.poseidon2_B_54_0 + FF(uint256_t{ 14778817021916755205UL, - 6110468871588391807UL, - 2850248286812407967UL, - 3411084787375678665UL }))) + - (new_term.poseidon2_B_54_1 + FF(0))) + - (new_term.poseidon2_B_54_2 + FF(0))) + - (new_term.poseidon2_B_54_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_55_3 - ((poseidon2_params_MU_3 * poseidon2_A_55_3) + poseidon2_SUM_55))); tmp *= scaling_factor; std::get<236>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<237, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_56_0 - - (((((((new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL })) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL })) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) + - (new_term.poseidon2_B_55_1 + FF(0))) + - (new_term.poseidon2_B_55_2 + FF(0))) + - (new_term.poseidon2_B_55_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_56_0 - ((poseidon2_params_MU_0 * poseidon2_A_56_0) + poseidon2_SUM_56))); tmp *= scaling_factor; std::get<237>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<238, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_56_1 - - (((new_term.poseidon2_B_55_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL })) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) + - (new_term.poseidon2_B_55_1 + FF(0))) + - (new_term.poseidon2_B_55_2 + FF(0))) + - (new_term.poseidon2_B_55_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_56_1 - ((poseidon2_params_MU_1 * poseidon2_A_56_1) + poseidon2_SUM_56))); tmp *= scaling_factor; std::get<238>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<239, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_56_2 - - (((new_term.poseidon2_B_55_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL })) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) + - (new_term.poseidon2_B_55_1 + FF(0))) + - (new_term.poseidon2_B_55_2 + FF(0))) + - (new_term.poseidon2_B_55_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_56_2 - ((poseidon2_params_MU_2 * poseidon2_A_56_2) + poseidon2_SUM_56))); tmp *= scaling_factor; std::get<239>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<240, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_56_3 - - (((new_term.poseidon2_B_55_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL })) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) * - (new_term.poseidon2_B_55_0 + FF(uint256_t{ 4906200604739023933UL, - 12096549814065429793UL, - 5988343102643160344UL, - 309820751832846301UL }))) + - (new_term.poseidon2_B_55_1 + FF(0))) + - (new_term.poseidon2_B_55_2 + FF(0))) + - (new_term.poseidon2_B_55_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_56_3 - ((poseidon2_params_MU_3 * poseidon2_A_56_3) + poseidon2_SUM_56))); tmp *= scaling_factor; std::get<240>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<241, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_57_0 - - (((((((new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL })) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL })) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) + - (new_term.poseidon2_B_56_1 + FF(0))) + - (new_term.poseidon2_B_56_2 + FF(0))) + - (new_term.poseidon2_B_56_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_57_0 - ((poseidon2_params_MU_0 * poseidon2_A_57_0) + poseidon2_SUM_57))); tmp *= scaling_factor; std::get<241>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<242, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_57_1 - - (((new_term.poseidon2_B_56_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL })) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) + - (new_term.poseidon2_B_56_1 + FF(0))) + - (new_term.poseidon2_B_56_2 + FF(0))) + - (new_term.poseidon2_B_56_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_57_1 - ((poseidon2_params_MU_1 * poseidon2_A_57_1) + poseidon2_SUM_57))); tmp *= scaling_factor; std::get<242>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<243, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_57_2 - - (((new_term.poseidon2_B_56_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL })) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) + - (new_term.poseidon2_B_56_1 + FF(0))) + - (new_term.poseidon2_B_56_2 + FF(0))) + - (new_term.poseidon2_B_56_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_57_2 - ((poseidon2_params_MU_2 * poseidon2_A_57_2) + poseidon2_SUM_57))); tmp *= scaling_factor; std::get<243>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<244, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_57_3 - - (((new_term.poseidon2_B_56_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL })) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) * - (new_term.poseidon2_B_56_0 + FF(uint256_t{ 8709336210313678885UL, - 10520000332606345601UL, - 4756441214598660785UL, - 2483744946546306397UL }))) + - (new_term.poseidon2_B_56_1 + FF(0))) + - (new_term.poseidon2_B_56_2 + FF(0))) + - (new_term.poseidon2_B_56_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_57_3 - ((poseidon2_params_MU_3 * poseidon2_A_57_3) + poseidon2_SUM_57))); tmp *= scaling_factor; std::get<244>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<245, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_58_0 - - (((((((new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL })) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL })) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) + - (new_term.poseidon2_B_57_1 + FF(0))) + - (new_term.poseidon2_B_57_2 + FF(0))) + - (new_term.poseidon2_B_57_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_58_0 - ((poseidon2_params_MU_0 * poseidon2_A_58_0) + poseidon2_SUM_58))); tmp *= scaling_factor; std::get<245>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<246, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_58_1 - - (((new_term.poseidon2_B_57_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL })) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) + - (new_term.poseidon2_B_57_1 + FF(0))) + - (new_term.poseidon2_B_57_2 + FF(0))) + - (new_term.poseidon2_B_57_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_58_1 - ((poseidon2_params_MU_1 * poseidon2_A_58_1) + poseidon2_SUM_58))); tmp *= scaling_factor; std::get<246>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<247, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_58_2 - - (((new_term.poseidon2_B_57_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL })) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) + - (new_term.poseidon2_B_57_1 + FF(0))) + - (new_term.poseidon2_B_57_2 + FF(0))) + - (new_term.poseidon2_B_57_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_58_2 - ((poseidon2_params_MU_2 * poseidon2_A_58_2) + poseidon2_SUM_58))); tmp *= scaling_factor; std::get<247>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<248, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_58_3 - - (((new_term.poseidon2_B_57_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL })) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) * - (new_term.poseidon2_B_57_0 + FF(uint256_t{ 9617950371599090517UL, - 6702332727289490762UL, - 7078214601245292934UL, - 215269160536524476UL }))) + - (new_term.poseidon2_B_57_1 + FF(0))) + - (new_term.poseidon2_B_57_2 + FF(0))) + - (new_term.poseidon2_B_57_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_58_3 - ((poseidon2_params_MU_3 * poseidon2_A_58_3) + poseidon2_SUM_58))); tmp *= scaling_factor; std::get<248>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<249, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_59_0 - - (((((((new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL })) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - FF(uint256_t{ - 13071735289386612455UL, 937867514930142591UL, 338297992309721356UL, 1214967615784395659UL })) + - ((((((((new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL })) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) + - (new_term.poseidon2_B_58_1 + FF(0))) + - (new_term.poseidon2_B_58_2 + FF(0))) + - (new_term.poseidon2_B_58_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_59_0 - ((poseidon2_params_MU_0 * poseidon2_A_59_0) + poseidon2_SUM_59))); tmp *= scaling_factor; std::get<249>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<250, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_59_1 - - (((new_term.poseidon2_B_58_1 + FF(0)) * - FF(uint256_t{ - 12135856085615145995UL, 11087747206803725188UL, 92802976007797685UL, 875972510381039422UL })) + - ((((((((new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL })) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) + - (new_term.poseidon2_B_58_1 + FF(0))) + - (new_term.poseidon2_B_58_2 + FF(0))) + - (new_term.poseidon2_B_58_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_59_1 - ((poseidon2_params_MU_1 * poseidon2_A_59_1) + poseidon2_SUM_59))); tmp *= scaling_factor; std::get<250>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<251, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_59_2 - - (((new_term.poseidon2_B_58_2 + FF(0)) * - FF(uint256_t{ - 8072276821399088149UL, 12835106910674049377UL, 12882375598172350360UL, 23726925003953432UL })) + - ((((((((new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL })) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) + - (new_term.poseidon2_B_58_1 + FF(0))) + - (new_term.poseidon2_B_58_2 + FF(0))) + - (new_term.poseidon2_B_58_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_59_2 - ((poseidon2_params_MU_2 * poseidon2_A_59_2) + poseidon2_SUM_59))); tmp *= scaling_factor; std::get<251>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<252, ContainerOverSubrelations>; - auto tmp = - (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_B_59_3 - - (((new_term.poseidon2_B_58_3 + FF(0)) * - FF(uint256_t{ - 1422103134736368267UL, 5972060781611222310UL, 3327741120806881763UL, 2462344296021899375UL })) + - ((((((((new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL })) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) * - (new_term.poseidon2_B_58_0 + FF(uint256_t{ 14694170287735041964UL, - 13462371741453101277UL, - 7691247574208617782UL, - 1078917709155142535UL }))) + - (new_term.poseidon2_B_58_1 + FF(0))) + - (new_term.poseidon2_B_58_2 + FF(0))) + - (new_term.poseidon2_B_58_3 + FF(0)))))); + auto tmp = (new_term.poseidon2_sel_poseidon_perm * + (new_term.poseidon2_B_59_3 - ((poseidon2_params_MU_3 * poseidon2_A_59_3) + poseidon2_SUM_59))); tmp *= scaling_factor; std::get<252>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<253, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_60_4 - - ((((((((new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL })) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) + - (((((new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })))) * - FF(4)) + - (((((((new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - FF(2)) + - ((((((new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL })) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) + - (((((new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })))))))); + (new_term.poseidon2_T_60_4 - ((FF(4) * poseidon2_T_60_1) + poseidon2_T_60_3))); tmp *= scaling_factor; std::get<253>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<254, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_60_5 - - ((((((((new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL })) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) + - (((((new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })))) * - FF(4)) + - (((((((new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - FF(2)) + - ((((((new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL })) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) + - (((((new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })))))))); + (new_term.poseidon2_T_60_5 - ((FF(4) * poseidon2_T_60_0) + poseidon2_T_60_2))); tmp *= scaling_factor; std::get<254>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<255, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_60_6 - - ((((((((new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - FF(2)) + - ((((((new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL })) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) * - (new_term.poseidon2_B_59_0 + FF(uint256_t{ 17559938410729200952UL, - 12326273425107991305UL, - 8641129484519639030UL, - 1699848340767391255UL }))) + - (((((new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))))) + - new_term.poseidon2_T_60_5))); + (new_term.poseidon2_T_60_6 - (poseidon2_T_60_3 + new_term.poseidon2_T_60_5))); tmp *= scaling_factor; std::get<255>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<256, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_60_7 - - ((((((((new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL })) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - (new_term.poseidon2_B_59_1 + FF(uint256_t{ 3946956839294125797UL, - 10123891284815211853UL, - 3676846437799665248UL, - 753827773683953838UL }))) * - FF(2)) + - ((((((new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL })) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) * - (new_term.poseidon2_B_59_2 + FF(uint256_t{ 10815195850656127580UL, - 17940782720817522247UL, - 11666428030894512886UL, - 2305765957929457259UL }))) + - (((((new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL })) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))) * - (new_term.poseidon2_B_59_3 + FF(uint256_t{ 437280840171101279UL, - 6885928680245806601UL, - 6031863836827793624UL, - 2698250255620259624UL }))))) + - new_term.poseidon2_T_60_4))); + (new_term.poseidon2_T_60_7 - (poseidon2_T_60_2 + new_term.poseidon2_T_60_4))); tmp *= scaling_factor; std::get<256>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<257, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_61_4 - - ((((((((new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL })) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) + - (((((new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL })) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) + - (((((new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })))))))); + (new_term.poseidon2_T_61_4 - ((FF(4) * poseidon2_T_61_1) + poseidon2_T_61_3))); tmp *= scaling_factor; std::get<257>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<258, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_61_5 - - ((((((((new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL })) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) + - (((((new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL })) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) + - (((((new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })))))))); + (new_term.poseidon2_T_61_5 - ((FF(4) * poseidon2_T_61_0) + poseidon2_T_61_2))); tmp *= scaling_factor; std::get<258>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<259, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_61_6 - - ((((((((new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL })) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) * - (new_term.poseidon2_T_60_6 + FF(uint256_t{ 16961604592822056794UL, - 12516844188945734293UL, - 2404426354458718742UL, - 901141949721836097UL }))) + - (((((new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))))) + - new_term.poseidon2_T_61_5))); + (new_term.poseidon2_T_61_6 - (poseidon2_T_61_3 + new_term.poseidon2_T_61_5))); tmp *= scaling_factor; std::get<259>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<260, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_61_7 - - ((((((((new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL })) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - (new_term.poseidon2_T_60_5 + FF(uint256_t{ 3152898413090790038UL, - 16108523113696338432UL, - 11492645026300260534UL, - 1417477149741880787UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL })) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) * - (new_term.poseidon2_T_60_7 + FF(uint256_t{ 10578217394647568846UL, - 6637113826221079930UL, - 1364449097464563400UL, - 2379869735503406314UL }))) + - (((((new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL })) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))) * - (new_term.poseidon2_T_60_4 + FF(uint256_t{ 6332539588517624153UL, - 17422837239624809585UL, - 12296960536238467913UL, - 2434905421004621494UL }))))) + - new_term.poseidon2_T_61_4))); + (new_term.poseidon2_T_61_7 - (poseidon2_T_61_2 + new_term.poseidon2_T_61_4))); tmp *= scaling_factor; std::get<260>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<261, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_62_4 - - ((((((((new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL })) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) + - (((((new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL })) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) + - (((((new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })))))))); + (new_term.poseidon2_T_62_4 - ((FF(4) * poseidon2_T_62_1) + poseidon2_T_62_3))); tmp *= scaling_factor; std::get<261>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<262, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_62_5 - - ((((((((new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL })) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) + - (((((new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL })) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) + - (((((new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })))))))); + (new_term.poseidon2_T_62_5 - ((FF(4) * poseidon2_T_62_0) + poseidon2_T_62_2))); tmp *= scaling_factor; std::get<262>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<263, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_62_6 - - ((((((((new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL })) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) * - (new_term.poseidon2_T_61_6 + FF(uint256_t{ 10311634121439582299UL, - 2959376558854333994UL, - 6697398963915560134UL, - 417944321386245900UL }))) + - (((((new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))))) + - new_term.poseidon2_T_62_5))); + (new_term.poseidon2_T_62_6 - (poseidon2_T_62_3 + new_term.poseidon2_T_62_5))); tmp *= scaling_factor; std::get<263>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<264, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_62_7 - - ((((((((new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL })) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - (new_term.poseidon2_T_61_5 + FF(uint256_t{ 16872849857899172004UL, - 1640712307042701286UL, - 16457516735210998920UL, - 1084862449077757478UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL })) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) * - (new_term.poseidon2_T_61_7 + FF(uint256_t{ 10329879351081882815UL, - 5178010365334480003UL, - 7014208314719145622UL, - 385149140585498380UL }))) + - (((((new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL })) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))) * - (new_term.poseidon2_T_61_4 + FF(uint256_t{ 13199866221884806229UL, - 10541991787372042848UL, - 14909749656931548440UL, - 708152185224876794UL }))))) + - new_term.poseidon2_T_62_4))); + (new_term.poseidon2_T_62_7 - (poseidon2_T_62_2 + new_term.poseidon2_T_62_4))); tmp *= scaling_factor; std::get<264>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<265, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_63_4 - - ((((((((new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL })) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) + - (((((new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL })) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) + - (((((new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })))))))); + (new_term.poseidon2_T_63_4 - ((FF(4) * poseidon2_T_63_1) + poseidon2_T_63_3))); tmp *= scaling_factor; std::get<265>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<266, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_63_5 - - ((((((((new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL })) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) + - (((((new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })))) * - FF(4)) + - (((((((new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL })) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) + - (((((new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })))))))); + (new_term.poseidon2_T_63_5 - ((FF(4) * poseidon2_T_63_0) + poseidon2_T_63_2))); tmp *= scaling_factor; std::get<266>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<267, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_63_6 - - ((((((((new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL })) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) * - (new_term.poseidon2_T_62_6 + FF(uint256_t{ 1717216310632203061UL, - 17455832130858697862UL, - 5278085098799702411UL, - 227655898188482835UL }))) + - (((((new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))))) + - new_term.poseidon2_T_63_5))); + (new_term.poseidon2_T_63_6 - (poseidon2_T_63_3 + new_term.poseidon2_T_63_5))); tmp *= scaling_factor; std::get<267>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<268, ContainerOverSubrelations>; auto tmp = (new_term.poseidon2_sel_poseidon_perm * - (new_term.poseidon2_T_63_7 - - ((((((((new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL })) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - (new_term.poseidon2_T_62_5 + FF(uint256_t{ 17164141620747686731UL, - 16689913387728553544UL, - 2568326884589391367UL, - 3166155980659486882UL }))) * - FF(2)) + - ((((((new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL })) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) * - (new_term.poseidon2_T_62_7 + FF(uint256_t{ 1233442753680249567UL, - 15490006495937952898UL, - 7249042245074469654UL, - 2138985910652398451UL }))) + - (((((new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL })) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))) * - (new_term.poseidon2_T_62_4 + FF(uint256_t{ 4115849303762846724UL, - 2230284817967990783UL, - 5095423606777193313UL, - 1685862792723606183UL }))))) + - new_term.poseidon2_T_63_4))); + (new_term.poseidon2_T_63_7 - (poseidon2_T_63_2 + new_term.poseidon2_T_63_4))); tmp *= scaling_factor; std::get<268>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp index 2a940db495e..2cb250af6a4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp @@ -35,7 +35,7 @@ class range_check_da_gas_hi_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_hi, + return std::forward_as_tuple(in.range_check_da_gas_hi_inv, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class range_check_da_gas_hi_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_hi, + return std::forward_as_tuple(in.range_check_da_gas_hi_inv, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp index 63c17060e85..565ec47b08a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp @@ -35,7 +35,7 @@ class range_check_da_gas_lo_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_lo, + return std::forward_as_tuple(in.range_check_da_gas_lo_inv, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class range_check_da_gas_lo_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_lo, + return std::forward_as_tuple(in.range_check_da_gas_lo_inv, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp index 7722789c2ed..bc6cb1b1345 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp @@ -35,7 +35,7 @@ class range_check_l2_gas_hi_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_hi, + return std::forward_as_tuple(in.range_check_l2_gas_hi_inv, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class range_check_l2_gas_hi_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_hi, + return std::forward_as_tuple(in.range_check_l2_gas_hi_inv, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp index a2de806c54b..827ef901195 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp @@ -35,7 +35,7 @@ class range_check_l2_gas_lo_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_lo, + return std::forward_as_tuple(in.range_check_l2_gas_lo_inv, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, @@ -45,7 +45,7 @@ class range_check_l2_gas_lo_lookup_settings { template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_lo, + return std::forward_as_tuple(in.range_check_l2_gas_lo_inv, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, in.main_sel_rng_16, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/sha256.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/sha256.hpp index 8b0b6896871..226b15f852a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/sha256.hpp @@ -6,10 +6,6 @@ namespace bb::Avm_vm { -template struct Sha256Row { - FF sha256_sel_sha256_compression{}; -}; - template class sha256Impl { public: using FF = FF_; @@ -22,9 +18,10 @@ template class sha256Impl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.sha256_sel_sha256_compression * (-new_term.sha256_sel_sha256_compression + FF(1))); + auto tmp = (new_term.sha256_sel_sha256_compression * (FF(1) - new_term.sha256_sel_sha256_compression)); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp index 6c88f2c3cb4..7953b2a3a6e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp @@ -11,7 +11,6 @@ namespace bb::avm_trace { class AvmPoseidon2TraceBuilder { public: - using Poseidon2Row = bb::Avm_vm::Poseidon2Row; struct Poseidon2TraceEntry { uint32_t clk = 0; std::array input; @@ -32,586 +31,299 @@ class AvmPoseidon2TraceBuilder { uint32_t input_addr, uint32_t output_addr); - Poseidon2Row static into_canonical(Poseidon2TraceEntry const& src) - { - // The primary input row, which is used to read the input of the permutation from memory - Poseidon2Row dest; - // Mem Stuff - dest.poseidon2_a_0 = src.input[0]; - dest.poseidon2_a_1 = src.input[1]; - dest.poseidon2_a_2 = src.input[2]; - dest.poseidon2_a_3 = src.input[3]; - dest.poseidon2_b_0 = src.output[0]; - dest.poseidon2_b_1 = src.output[1]; - dest.poseidon2_b_2 = src.output[2]; - dest.poseidon2_b_3 = src.output[3]; - dest.poseidon2_input_addr = src.input_addr; - dest.poseidon2_output_addr = src.output_addr; - dest.poseidon2_mem_addr_read_a = src.input_addr; - dest.poseidon2_mem_addr_read_b = src.input_addr + 1; - dest.poseidon2_mem_addr_read_c = src.input_addr + 2; - dest.poseidon2_mem_addr_read_d = src.input_addr + 3; - dest.poseidon2_mem_addr_write_a = src.output_addr; - dest.poseidon2_mem_addr_write_b = src.output_addr + 1; - dest.poseidon2_mem_addr_write_c = src.output_addr + 2; - dest.poseidon2_mem_addr_write_d = src.output_addr + 3; - dest.poseidon2_sel_poseidon_perm = FF(1); - // First Ext Round - dest.poseidon2_EXT_LAYER_6 = src.first_ext[0]; - dest.poseidon2_EXT_LAYER_5 = src.first_ext[1]; - dest.poseidon2_EXT_LAYER_7 = src.first_ext[2]; - dest.poseidon2_EXT_LAYER_4 = src.first_ext[3]; - // Full rounds - dest.poseidon2_T_0_6 = src.interm_round_vals[0][0]; - dest.poseidon2_T_0_5 = src.interm_round_vals[0][1]; - dest.poseidon2_T_0_7 = src.interm_round_vals[0][2]; - dest.poseidon2_T_0_4 = src.interm_round_vals[0][3]; - dest.poseidon2_T_1_6 = src.interm_round_vals[1][0]; - dest.poseidon2_T_1_5 = src.interm_round_vals[1][1]; - dest.poseidon2_T_1_7 = src.interm_round_vals[1][2]; - dest.poseidon2_T_1_4 = src.interm_round_vals[1][3]; - dest.poseidon2_T_2_6 = src.interm_round_vals[2][0]; - dest.poseidon2_T_2_5 = src.interm_round_vals[2][1]; - dest.poseidon2_T_2_7 = src.interm_round_vals[2][2]; - dest.poseidon2_T_2_4 = src.interm_round_vals[2][3]; - dest.poseidon2_T_3_6 = src.interm_round_vals[3][0]; - dest.poseidon2_T_3_5 = src.interm_round_vals[3][1]; - dest.poseidon2_T_3_7 = src.interm_round_vals[3][2]; - dest.poseidon2_T_3_4 = src.interm_round_vals[3][3]; - // Partial rounds - dest.poseidon2_B_4_0 = src.interm_round_vals[4][0]; - dest.poseidon2_B_4_1 = src.interm_round_vals[4][1]; - dest.poseidon2_B_4_2 = src.interm_round_vals[4][2]; - dest.poseidon2_B_4_3 = src.interm_round_vals[4][3]; - dest.poseidon2_B_5_0 = src.interm_round_vals[5][0]; - dest.poseidon2_B_5_1 = src.interm_round_vals[5][1]; - dest.poseidon2_B_5_2 = src.interm_round_vals[5][2]; - dest.poseidon2_B_5_3 = src.interm_round_vals[5][3]; - dest.poseidon2_B_6_0 = src.interm_round_vals[6][0]; - dest.poseidon2_B_6_1 = src.interm_round_vals[6][1]; - dest.poseidon2_B_6_2 = src.interm_round_vals[6][2]; - dest.poseidon2_B_6_3 = src.interm_round_vals[6][3]; - dest.poseidon2_B_7_0 = src.interm_round_vals[7][0]; - dest.poseidon2_B_7_1 = src.interm_round_vals[7][1]; - dest.poseidon2_B_7_2 = src.interm_round_vals[7][2]; - dest.poseidon2_B_7_3 = src.interm_round_vals[7][3]; - dest.poseidon2_B_8_0 = src.interm_round_vals[8][0]; - dest.poseidon2_B_8_1 = src.interm_round_vals[8][1]; - dest.poseidon2_B_8_2 = src.interm_round_vals[8][2]; - dest.poseidon2_B_8_3 = src.interm_round_vals[8][3]; - dest.poseidon2_B_9_0 = src.interm_round_vals[9][0]; - dest.poseidon2_B_9_1 = src.interm_round_vals[9][1]; - dest.poseidon2_B_9_2 = src.interm_round_vals[9][2]; - dest.poseidon2_B_9_3 = src.interm_round_vals[9][3]; - dest.poseidon2_B_10_0 = src.interm_round_vals[10][0]; - dest.poseidon2_B_10_1 = src.interm_round_vals[10][1]; - dest.poseidon2_B_10_2 = src.interm_round_vals[10][2]; - dest.poseidon2_B_10_3 = src.interm_round_vals[10][3]; - dest.poseidon2_B_11_0 = src.interm_round_vals[11][0]; - dest.poseidon2_B_11_1 = src.interm_round_vals[11][1]; - dest.poseidon2_B_11_2 = src.interm_round_vals[11][2]; - dest.poseidon2_B_11_3 = src.interm_round_vals[11][3]; - dest.poseidon2_B_12_0 = src.interm_round_vals[12][0]; - dest.poseidon2_B_12_1 = src.interm_round_vals[12][1]; - dest.poseidon2_B_12_2 = src.interm_round_vals[12][2]; - dest.poseidon2_B_12_3 = src.interm_round_vals[12][3]; - dest.poseidon2_B_13_0 = src.interm_round_vals[13][0]; - dest.poseidon2_B_13_1 = src.interm_round_vals[13][1]; - dest.poseidon2_B_13_2 = src.interm_round_vals[13][2]; - dest.poseidon2_B_13_3 = src.interm_round_vals[13][3]; - dest.poseidon2_B_14_0 = src.interm_round_vals[14][0]; - dest.poseidon2_B_14_1 = src.interm_round_vals[14][1]; - dest.poseidon2_B_14_2 = src.interm_round_vals[14][2]; - dest.poseidon2_B_14_3 = src.interm_round_vals[14][3]; - dest.poseidon2_B_15_0 = src.interm_round_vals[15][0]; - dest.poseidon2_B_15_1 = src.interm_round_vals[15][1]; - dest.poseidon2_B_15_2 = src.interm_round_vals[15][2]; - dest.poseidon2_B_15_3 = src.interm_round_vals[15][3]; - dest.poseidon2_B_16_0 = src.interm_round_vals[16][0]; - dest.poseidon2_B_16_1 = src.interm_round_vals[16][1]; - dest.poseidon2_B_16_2 = src.interm_round_vals[16][2]; - dest.poseidon2_B_16_3 = src.interm_round_vals[16][3]; - dest.poseidon2_B_17_0 = src.interm_round_vals[17][0]; - dest.poseidon2_B_17_1 = src.interm_round_vals[17][1]; - dest.poseidon2_B_17_2 = src.interm_round_vals[17][2]; - dest.poseidon2_B_17_3 = src.interm_round_vals[17][3]; - dest.poseidon2_B_18_0 = src.interm_round_vals[18][0]; - dest.poseidon2_B_18_1 = src.interm_round_vals[18][1]; - dest.poseidon2_B_18_2 = src.interm_round_vals[18][2]; - dest.poseidon2_B_18_3 = src.interm_round_vals[18][3]; - dest.poseidon2_B_19_0 = src.interm_round_vals[19][0]; - dest.poseidon2_B_19_1 = src.interm_round_vals[19][1]; - dest.poseidon2_B_19_2 = src.interm_round_vals[19][2]; - dest.poseidon2_B_19_3 = src.interm_round_vals[19][3]; - dest.poseidon2_B_20_0 = src.interm_round_vals[20][0]; - dest.poseidon2_B_20_1 = src.interm_round_vals[20][1]; - dest.poseidon2_B_20_2 = src.interm_round_vals[20][2]; - dest.poseidon2_B_20_3 = src.interm_round_vals[20][3]; - dest.poseidon2_B_21_0 = src.interm_round_vals[21][0]; - dest.poseidon2_B_21_1 = src.interm_round_vals[21][1]; - dest.poseidon2_B_21_2 = src.interm_round_vals[21][2]; - dest.poseidon2_B_21_3 = src.interm_round_vals[21][3]; - dest.poseidon2_B_22_0 = src.interm_round_vals[22][0]; - dest.poseidon2_B_22_1 = src.interm_round_vals[22][1]; - dest.poseidon2_B_22_2 = src.interm_round_vals[22][2]; - dest.poseidon2_B_22_3 = src.interm_round_vals[22][3]; - dest.poseidon2_B_23_0 = src.interm_round_vals[23][0]; - dest.poseidon2_B_23_1 = src.interm_round_vals[23][1]; - dest.poseidon2_B_23_2 = src.interm_round_vals[23][2]; - dest.poseidon2_B_23_3 = src.interm_round_vals[23][3]; - dest.poseidon2_B_24_0 = src.interm_round_vals[24][0]; - dest.poseidon2_B_24_1 = src.interm_round_vals[24][1]; - dest.poseidon2_B_24_2 = src.interm_round_vals[24][2]; - dest.poseidon2_B_24_3 = src.interm_round_vals[24][3]; - dest.poseidon2_B_25_0 = src.interm_round_vals[25][0]; - dest.poseidon2_B_25_1 = src.interm_round_vals[25][1]; - dest.poseidon2_B_25_2 = src.interm_round_vals[25][2]; - dest.poseidon2_B_25_3 = src.interm_round_vals[25][3]; - dest.poseidon2_B_26_0 = src.interm_round_vals[26][0]; - dest.poseidon2_B_26_1 = src.interm_round_vals[26][1]; - dest.poseidon2_B_26_2 = src.interm_round_vals[26][2]; - dest.poseidon2_B_26_3 = src.interm_round_vals[26][3]; - dest.poseidon2_B_27_0 = src.interm_round_vals[27][0]; - dest.poseidon2_B_27_1 = src.interm_round_vals[27][1]; - dest.poseidon2_B_27_2 = src.interm_round_vals[27][2]; - dest.poseidon2_B_27_3 = src.interm_round_vals[27][3]; - dest.poseidon2_B_28_0 = src.interm_round_vals[28][0]; - dest.poseidon2_B_28_1 = src.interm_round_vals[28][1]; - dest.poseidon2_B_28_2 = src.interm_round_vals[28][2]; - dest.poseidon2_B_28_3 = src.interm_round_vals[28][3]; - dest.poseidon2_B_29_0 = src.interm_round_vals[29][0]; - dest.poseidon2_B_29_1 = src.interm_round_vals[29][1]; - dest.poseidon2_B_29_2 = src.interm_round_vals[29][2]; - dest.poseidon2_B_29_3 = src.interm_round_vals[29][3]; - dest.poseidon2_B_30_0 = src.interm_round_vals[30][0]; - dest.poseidon2_B_30_1 = src.interm_round_vals[30][1]; - dest.poseidon2_B_30_2 = src.interm_round_vals[30][2]; - dest.poseidon2_B_30_3 = src.interm_round_vals[30][3]; - dest.poseidon2_B_31_0 = src.interm_round_vals[31][0]; - dest.poseidon2_B_31_1 = src.interm_round_vals[31][1]; - dest.poseidon2_B_31_2 = src.interm_round_vals[31][2]; - dest.poseidon2_B_31_3 = src.interm_round_vals[31][3]; - dest.poseidon2_B_32_0 = src.interm_round_vals[32][0]; - dest.poseidon2_B_32_1 = src.interm_round_vals[32][1]; - dest.poseidon2_B_32_2 = src.interm_round_vals[32][2]; - dest.poseidon2_B_32_3 = src.interm_round_vals[32][3]; - dest.poseidon2_B_33_0 = src.interm_round_vals[33][0]; - dest.poseidon2_B_33_1 = src.interm_round_vals[33][1]; - dest.poseidon2_B_33_2 = src.interm_round_vals[33][2]; - dest.poseidon2_B_33_3 = src.interm_round_vals[33][3]; - dest.poseidon2_B_34_0 = src.interm_round_vals[34][0]; - dest.poseidon2_B_34_1 = src.interm_round_vals[34][1]; - dest.poseidon2_B_34_2 = src.interm_round_vals[34][2]; - dest.poseidon2_B_34_3 = src.interm_round_vals[34][3]; - dest.poseidon2_B_35_0 = src.interm_round_vals[35][0]; - dest.poseidon2_B_35_1 = src.interm_round_vals[35][1]; - dest.poseidon2_B_35_2 = src.interm_round_vals[35][2]; - dest.poseidon2_B_35_3 = src.interm_round_vals[35][3]; - dest.poseidon2_B_36_0 = src.interm_round_vals[36][0]; - dest.poseidon2_B_36_1 = src.interm_round_vals[36][1]; - dest.poseidon2_B_36_2 = src.interm_round_vals[36][2]; - dest.poseidon2_B_36_3 = src.interm_round_vals[36][3]; - dest.poseidon2_B_37_0 = src.interm_round_vals[37][0]; - dest.poseidon2_B_37_1 = src.interm_round_vals[37][1]; - dest.poseidon2_B_37_2 = src.interm_round_vals[37][2]; - dest.poseidon2_B_37_3 = src.interm_round_vals[37][3]; - dest.poseidon2_B_38_0 = src.interm_round_vals[38][0]; - dest.poseidon2_B_38_1 = src.interm_round_vals[38][1]; - dest.poseidon2_B_38_2 = src.interm_round_vals[38][2]; - dest.poseidon2_B_38_3 = src.interm_round_vals[38][3]; - dest.poseidon2_B_39_0 = src.interm_round_vals[39][0]; - dest.poseidon2_B_39_1 = src.interm_round_vals[39][1]; - dest.poseidon2_B_39_2 = src.interm_round_vals[39][2]; - dest.poseidon2_B_39_3 = src.interm_round_vals[39][3]; - dest.poseidon2_B_40_0 = src.interm_round_vals[40][0]; - dest.poseidon2_B_40_1 = src.interm_round_vals[40][1]; - dest.poseidon2_B_40_2 = src.interm_round_vals[40][2]; - dest.poseidon2_B_40_3 = src.interm_round_vals[40][3]; - dest.poseidon2_B_41_0 = src.interm_round_vals[41][0]; - dest.poseidon2_B_41_1 = src.interm_round_vals[41][1]; - dest.poseidon2_B_41_2 = src.interm_round_vals[41][2]; - dest.poseidon2_B_41_3 = src.interm_round_vals[41][3]; - dest.poseidon2_B_42_0 = src.interm_round_vals[42][0]; - dest.poseidon2_B_42_1 = src.interm_round_vals[42][1]; - dest.poseidon2_B_42_2 = src.interm_round_vals[42][2]; - dest.poseidon2_B_42_3 = src.interm_round_vals[42][3]; - dest.poseidon2_B_43_0 = src.interm_round_vals[43][0]; - dest.poseidon2_B_43_1 = src.interm_round_vals[43][1]; - dest.poseidon2_B_43_2 = src.interm_round_vals[43][2]; - dest.poseidon2_B_43_3 = src.interm_round_vals[43][3]; - dest.poseidon2_B_44_0 = src.interm_round_vals[44][0]; - dest.poseidon2_B_44_1 = src.interm_round_vals[44][1]; - dest.poseidon2_B_44_2 = src.interm_round_vals[44][2]; - dest.poseidon2_B_44_3 = src.interm_round_vals[44][3]; - dest.poseidon2_B_45_0 = src.interm_round_vals[45][0]; - dest.poseidon2_B_45_1 = src.interm_round_vals[45][1]; - dest.poseidon2_B_45_2 = src.interm_round_vals[45][2]; - dest.poseidon2_B_45_3 = src.interm_round_vals[45][3]; - dest.poseidon2_B_46_0 = src.interm_round_vals[46][0]; - dest.poseidon2_B_46_1 = src.interm_round_vals[46][1]; - dest.poseidon2_B_46_2 = src.interm_round_vals[46][2]; - dest.poseidon2_B_46_3 = src.interm_round_vals[46][3]; - dest.poseidon2_B_47_0 = src.interm_round_vals[47][0]; - dest.poseidon2_B_47_1 = src.interm_round_vals[47][1]; - dest.poseidon2_B_47_2 = src.interm_round_vals[47][2]; - dest.poseidon2_B_47_3 = src.interm_round_vals[47][3]; - dest.poseidon2_B_48_0 = src.interm_round_vals[48][0]; - dest.poseidon2_B_48_1 = src.interm_round_vals[48][1]; - dest.poseidon2_B_48_2 = src.interm_round_vals[48][2]; - dest.poseidon2_B_48_3 = src.interm_round_vals[48][3]; - dest.poseidon2_B_49_0 = src.interm_round_vals[49][0]; - dest.poseidon2_B_49_1 = src.interm_round_vals[49][1]; - dest.poseidon2_B_49_2 = src.interm_round_vals[49][2]; - dest.poseidon2_B_49_3 = src.interm_round_vals[49][3]; - dest.poseidon2_B_50_0 = src.interm_round_vals[50][0]; - dest.poseidon2_B_50_1 = src.interm_round_vals[50][1]; - dest.poseidon2_B_50_2 = src.interm_round_vals[50][2]; - dest.poseidon2_B_50_3 = src.interm_round_vals[50][3]; - dest.poseidon2_B_51_0 = src.interm_round_vals[51][0]; - dest.poseidon2_B_51_1 = src.interm_round_vals[51][1]; - dest.poseidon2_B_51_2 = src.interm_round_vals[51][2]; - dest.poseidon2_B_51_3 = src.interm_round_vals[51][3]; - dest.poseidon2_B_52_0 = src.interm_round_vals[52][0]; - dest.poseidon2_B_52_1 = src.interm_round_vals[52][1]; - dest.poseidon2_B_52_2 = src.interm_round_vals[52][2]; - dest.poseidon2_B_52_3 = src.interm_round_vals[52][3]; - dest.poseidon2_B_53_0 = src.interm_round_vals[53][0]; - dest.poseidon2_B_53_1 = src.interm_round_vals[53][1]; - dest.poseidon2_B_53_2 = src.interm_round_vals[53][2]; - dest.poseidon2_B_53_3 = src.interm_round_vals[53][3]; - dest.poseidon2_B_54_0 = src.interm_round_vals[54][0]; - dest.poseidon2_B_54_1 = src.interm_round_vals[54][1]; - dest.poseidon2_B_54_2 = src.interm_round_vals[54][2]; - dest.poseidon2_B_54_3 = src.interm_round_vals[54][3]; - dest.poseidon2_B_55_0 = src.interm_round_vals[55][0]; - dest.poseidon2_B_55_1 = src.interm_round_vals[55][1]; - dest.poseidon2_B_55_2 = src.interm_round_vals[55][2]; - dest.poseidon2_B_55_3 = src.interm_round_vals[55][3]; - dest.poseidon2_B_56_0 = src.interm_round_vals[56][0]; - dest.poseidon2_B_56_1 = src.interm_round_vals[56][1]; - dest.poseidon2_B_56_2 = src.interm_round_vals[56][2]; - dest.poseidon2_B_56_3 = src.interm_round_vals[56][3]; - dest.poseidon2_B_57_0 = src.interm_round_vals[57][0]; - dest.poseidon2_B_57_1 = src.interm_round_vals[57][1]; - dest.poseidon2_B_57_2 = src.interm_round_vals[57][2]; - dest.poseidon2_B_57_3 = src.interm_round_vals[57][3]; - dest.poseidon2_B_58_0 = src.interm_round_vals[58][0]; - dest.poseidon2_B_58_1 = src.interm_round_vals[58][1]; - dest.poseidon2_B_58_2 = src.interm_round_vals[58][2]; - dest.poseidon2_B_58_3 = src.interm_round_vals[58][3]; - dest.poseidon2_B_59_0 = src.interm_round_vals[59][0]; - dest.poseidon2_B_59_1 = src.interm_round_vals[59][1]; - dest.poseidon2_B_59_2 = src.interm_round_vals[59][2]; - dest.poseidon2_B_59_3 = src.interm_round_vals[59][3]; - // Full rounds - dest.poseidon2_T_60_6 = src.interm_round_vals[60][0]; - dest.poseidon2_T_60_5 = src.interm_round_vals[60][1]; - dest.poseidon2_T_60_7 = src.interm_round_vals[60][2]; - dest.poseidon2_T_60_4 = src.interm_round_vals[60][3]; - - dest.poseidon2_T_61_6 = src.interm_round_vals[61][0]; - dest.poseidon2_T_61_5 = src.interm_round_vals[61][1]; - dest.poseidon2_T_61_7 = src.interm_round_vals[61][2]; - dest.poseidon2_T_61_4 = src.interm_round_vals[61][3]; - - dest.poseidon2_T_62_6 = src.interm_round_vals[62][0]; - dest.poseidon2_T_62_5 = src.interm_round_vals[62][1]; - dest.poseidon2_T_62_7 = src.interm_round_vals[62][2]; - dest.poseidon2_T_62_4 = src.interm_round_vals[62][3]; + private: + std::vector poseidon2_trace; +}; - dest.poseidon2_T_63_6 = src.interm_round_vals[63][0]; - dest.poseidon2_T_63_5 = src.interm_round_vals[63][1]; - dest.poseidon2_T_63_7 = src.interm_round_vals[63][2]; - dest.poseidon2_T_63_4 = src.interm_round_vals[63][3]; +template void merge_into(DestRow& dest, const AvmPoseidon2TraceBuilder::Poseidon2TraceEntry& src) +{ + // Mem Stuff + dest.poseidon2_a_0 = src.input[0]; + dest.poseidon2_a_1 = src.input[1]; + dest.poseidon2_a_2 = src.input[2]; + dest.poseidon2_a_3 = src.input[3]; + dest.poseidon2_b_0 = src.output[0]; + dest.poseidon2_b_1 = src.output[1]; + dest.poseidon2_b_2 = src.output[2]; + dest.poseidon2_b_3 = src.output[3]; + dest.poseidon2_input_addr = src.input_addr; + dest.poseidon2_output_addr = src.output_addr; + dest.poseidon2_mem_addr_read_a = src.input_addr; + dest.poseidon2_mem_addr_read_b = src.input_addr + 1; + dest.poseidon2_mem_addr_read_c = src.input_addr + 2; + dest.poseidon2_mem_addr_read_d = src.input_addr + 3; + dest.poseidon2_mem_addr_write_a = src.output_addr; + dest.poseidon2_mem_addr_write_b = src.output_addr + 1; + dest.poseidon2_mem_addr_write_c = src.output_addr + 2; + dest.poseidon2_mem_addr_write_d = src.output_addr + 3; + dest.poseidon2_sel_poseidon_perm = FF(1); + // First Ext Round + dest.poseidon2_EXT_LAYER_6 = src.first_ext[0]; + dest.poseidon2_EXT_LAYER_5 = src.first_ext[1]; + dest.poseidon2_EXT_LAYER_7 = src.first_ext[2]; + dest.poseidon2_EXT_LAYER_4 = src.first_ext[3]; + // Full rounds + dest.poseidon2_T_0_6 = src.interm_round_vals[0][0]; + dest.poseidon2_T_0_5 = src.interm_round_vals[0][1]; + dest.poseidon2_T_0_7 = src.interm_round_vals[0][2]; + dest.poseidon2_T_0_4 = src.interm_round_vals[0][3]; + dest.poseidon2_T_1_6 = src.interm_round_vals[1][0]; + dest.poseidon2_T_1_5 = src.interm_round_vals[1][1]; + dest.poseidon2_T_1_7 = src.interm_round_vals[1][2]; + dest.poseidon2_T_1_4 = src.interm_round_vals[1][3]; + dest.poseidon2_T_2_6 = src.interm_round_vals[2][0]; + dest.poseidon2_T_2_5 = src.interm_round_vals[2][1]; + dest.poseidon2_T_2_7 = src.interm_round_vals[2][2]; + dest.poseidon2_T_2_4 = src.interm_round_vals[2][3]; + dest.poseidon2_T_3_6 = src.interm_round_vals[3][0]; + dest.poseidon2_T_3_5 = src.interm_round_vals[3][1]; + dest.poseidon2_T_3_7 = src.interm_round_vals[3][2]; + dest.poseidon2_T_3_4 = src.interm_round_vals[3][3]; + // Partial rounds + dest.poseidon2_B_4_0 = src.interm_round_vals[4][0]; + dest.poseidon2_B_4_1 = src.interm_round_vals[4][1]; + dest.poseidon2_B_4_2 = src.interm_round_vals[4][2]; + dest.poseidon2_B_4_3 = src.interm_round_vals[4][3]; + dest.poseidon2_B_5_0 = src.interm_round_vals[5][0]; + dest.poseidon2_B_5_1 = src.interm_round_vals[5][1]; + dest.poseidon2_B_5_2 = src.interm_round_vals[5][2]; + dest.poseidon2_B_5_3 = src.interm_round_vals[5][3]; + dest.poseidon2_B_6_0 = src.interm_round_vals[6][0]; + dest.poseidon2_B_6_1 = src.interm_round_vals[6][1]; + dest.poseidon2_B_6_2 = src.interm_round_vals[6][2]; + dest.poseidon2_B_6_3 = src.interm_round_vals[6][3]; + dest.poseidon2_B_7_0 = src.interm_round_vals[7][0]; + dest.poseidon2_B_7_1 = src.interm_round_vals[7][1]; + dest.poseidon2_B_7_2 = src.interm_round_vals[7][2]; + dest.poseidon2_B_7_3 = src.interm_round_vals[7][3]; + dest.poseidon2_B_8_0 = src.interm_round_vals[8][0]; + dest.poseidon2_B_8_1 = src.interm_round_vals[8][1]; + dest.poseidon2_B_8_2 = src.interm_round_vals[8][2]; + dest.poseidon2_B_8_3 = src.interm_round_vals[8][3]; + dest.poseidon2_B_9_0 = src.interm_round_vals[9][0]; + dest.poseidon2_B_9_1 = src.interm_round_vals[9][1]; + dest.poseidon2_B_9_2 = src.interm_round_vals[9][2]; + dest.poseidon2_B_9_3 = src.interm_round_vals[9][3]; + dest.poseidon2_B_10_0 = src.interm_round_vals[10][0]; + dest.poseidon2_B_10_1 = src.interm_round_vals[10][1]; + dest.poseidon2_B_10_2 = src.interm_round_vals[10][2]; + dest.poseidon2_B_10_3 = src.interm_round_vals[10][3]; + dest.poseidon2_B_11_0 = src.interm_round_vals[11][0]; + dest.poseidon2_B_11_1 = src.interm_round_vals[11][1]; + dest.poseidon2_B_11_2 = src.interm_round_vals[11][2]; + dest.poseidon2_B_11_3 = src.interm_round_vals[11][3]; + dest.poseidon2_B_12_0 = src.interm_round_vals[12][0]; + dest.poseidon2_B_12_1 = src.interm_round_vals[12][1]; + dest.poseidon2_B_12_2 = src.interm_round_vals[12][2]; + dest.poseidon2_B_12_3 = src.interm_round_vals[12][3]; + dest.poseidon2_B_13_0 = src.interm_round_vals[13][0]; + dest.poseidon2_B_13_1 = src.interm_round_vals[13][1]; + dest.poseidon2_B_13_2 = src.interm_round_vals[13][2]; + dest.poseidon2_B_13_3 = src.interm_round_vals[13][3]; + dest.poseidon2_B_14_0 = src.interm_round_vals[14][0]; + dest.poseidon2_B_14_1 = src.interm_round_vals[14][1]; + dest.poseidon2_B_14_2 = src.interm_round_vals[14][2]; + dest.poseidon2_B_14_3 = src.interm_round_vals[14][3]; + dest.poseidon2_B_15_0 = src.interm_round_vals[15][0]; + dest.poseidon2_B_15_1 = src.interm_round_vals[15][1]; + dest.poseidon2_B_15_2 = src.interm_round_vals[15][2]; + dest.poseidon2_B_15_3 = src.interm_round_vals[15][3]; + dest.poseidon2_B_16_0 = src.interm_round_vals[16][0]; + dest.poseidon2_B_16_1 = src.interm_round_vals[16][1]; + dest.poseidon2_B_16_2 = src.interm_round_vals[16][2]; + dest.poseidon2_B_16_3 = src.interm_round_vals[16][3]; + dest.poseidon2_B_17_0 = src.interm_round_vals[17][0]; + dest.poseidon2_B_17_1 = src.interm_round_vals[17][1]; + dest.poseidon2_B_17_2 = src.interm_round_vals[17][2]; + dest.poseidon2_B_17_3 = src.interm_round_vals[17][3]; + dest.poseidon2_B_18_0 = src.interm_round_vals[18][0]; + dest.poseidon2_B_18_1 = src.interm_round_vals[18][1]; + dest.poseidon2_B_18_2 = src.interm_round_vals[18][2]; + dest.poseidon2_B_18_3 = src.interm_round_vals[18][3]; + dest.poseidon2_B_19_0 = src.interm_round_vals[19][0]; + dest.poseidon2_B_19_1 = src.interm_round_vals[19][1]; + dest.poseidon2_B_19_2 = src.interm_round_vals[19][2]; + dest.poseidon2_B_19_3 = src.interm_round_vals[19][3]; + dest.poseidon2_B_20_0 = src.interm_round_vals[20][0]; + dest.poseidon2_B_20_1 = src.interm_round_vals[20][1]; + dest.poseidon2_B_20_2 = src.interm_round_vals[20][2]; + dest.poseidon2_B_20_3 = src.interm_round_vals[20][3]; + dest.poseidon2_B_21_0 = src.interm_round_vals[21][0]; + dest.poseidon2_B_21_1 = src.interm_round_vals[21][1]; + dest.poseidon2_B_21_2 = src.interm_round_vals[21][2]; + dest.poseidon2_B_21_3 = src.interm_round_vals[21][3]; + dest.poseidon2_B_22_0 = src.interm_round_vals[22][0]; + dest.poseidon2_B_22_1 = src.interm_round_vals[22][1]; + dest.poseidon2_B_22_2 = src.interm_round_vals[22][2]; + dest.poseidon2_B_22_3 = src.interm_round_vals[22][3]; + dest.poseidon2_B_23_0 = src.interm_round_vals[23][0]; + dest.poseidon2_B_23_1 = src.interm_round_vals[23][1]; + dest.poseidon2_B_23_2 = src.interm_round_vals[23][2]; + dest.poseidon2_B_23_3 = src.interm_round_vals[23][3]; + dest.poseidon2_B_24_0 = src.interm_round_vals[24][0]; + dest.poseidon2_B_24_1 = src.interm_round_vals[24][1]; + dest.poseidon2_B_24_2 = src.interm_round_vals[24][2]; + dest.poseidon2_B_24_3 = src.interm_round_vals[24][3]; + dest.poseidon2_B_25_0 = src.interm_round_vals[25][0]; + dest.poseidon2_B_25_1 = src.interm_round_vals[25][1]; + dest.poseidon2_B_25_2 = src.interm_round_vals[25][2]; + dest.poseidon2_B_25_3 = src.interm_round_vals[25][3]; + dest.poseidon2_B_26_0 = src.interm_round_vals[26][0]; + dest.poseidon2_B_26_1 = src.interm_round_vals[26][1]; + dest.poseidon2_B_26_2 = src.interm_round_vals[26][2]; + dest.poseidon2_B_26_3 = src.interm_round_vals[26][3]; + dest.poseidon2_B_27_0 = src.interm_round_vals[27][0]; + dest.poseidon2_B_27_1 = src.interm_round_vals[27][1]; + dest.poseidon2_B_27_2 = src.interm_round_vals[27][2]; + dest.poseidon2_B_27_3 = src.interm_round_vals[27][3]; + dest.poseidon2_B_28_0 = src.interm_round_vals[28][0]; + dest.poseidon2_B_28_1 = src.interm_round_vals[28][1]; + dest.poseidon2_B_28_2 = src.interm_round_vals[28][2]; + dest.poseidon2_B_28_3 = src.interm_round_vals[28][3]; + dest.poseidon2_B_29_0 = src.interm_round_vals[29][0]; + dest.poseidon2_B_29_1 = src.interm_round_vals[29][1]; + dest.poseidon2_B_29_2 = src.interm_round_vals[29][2]; + dest.poseidon2_B_29_3 = src.interm_round_vals[29][3]; + dest.poseidon2_B_30_0 = src.interm_round_vals[30][0]; + dest.poseidon2_B_30_1 = src.interm_round_vals[30][1]; + dest.poseidon2_B_30_2 = src.interm_round_vals[30][2]; + dest.poseidon2_B_30_3 = src.interm_round_vals[30][3]; + dest.poseidon2_B_31_0 = src.interm_round_vals[31][0]; + dest.poseidon2_B_31_1 = src.interm_round_vals[31][1]; + dest.poseidon2_B_31_2 = src.interm_round_vals[31][2]; + dest.poseidon2_B_31_3 = src.interm_round_vals[31][3]; + dest.poseidon2_B_32_0 = src.interm_round_vals[32][0]; + dest.poseidon2_B_32_1 = src.interm_round_vals[32][1]; + dest.poseidon2_B_32_2 = src.interm_round_vals[32][2]; + dest.poseidon2_B_32_3 = src.interm_round_vals[32][3]; + dest.poseidon2_B_33_0 = src.interm_round_vals[33][0]; + dest.poseidon2_B_33_1 = src.interm_round_vals[33][1]; + dest.poseidon2_B_33_2 = src.interm_round_vals[33][2]; + dest.poseidon2_B_33_3 = src.interm_round_vals[33][3]; + dest.poseidon2_B_34_0 = src.interm_round_vals[34][0]; + dest.poseidon2_B_34_1 = src.interm_round_vals[34][1]; + dest.poseidon2_B_34_2 = src.interm_round_vals[34][2]; + dest.poseidon2_B_34_3 = src.interm_round_vals[34][3]; + dest.poseidon2_B_35_0 = src.interm_round_vals[35][0]; + dest.poseidon2_B_35_1 = src.interm_round_vals[35][1]; + dest.poseidon2_B_35_2 = src.interm_round_vals[35][2]; + dest.poseidon2_B_35_3 = src.interm_round_vals[35][3]; + dest.poseidon2_B_36_0 = src.interm_round_vals[36][0]; + dest.poseidon2_B_36_1 = src.interm_round_vals[36][1]; + dest.poseidon2_B_36_2 = src.interm_round_vals[36][2]; + dest.poseidon2_B_36_3 = src.interm_round_vals[36][3]; + dest.poseidon2_B_37_0 = src.interm_round_vals[37][0]; + dest.poseidon2_B_37_1 = src.interm_round_vals[37][1]; + dest.poseidon2_B_37_2 = src.interm_round_vals[37][2]; + dest.poseidon2_B_37_3 = src.interm_round_vals[37][3]; + dest.poseidon2_B_38_0 = src.interm_round_vals[38][0]; + dest.poseidon2_B_38_1 = src.interm_round_vals[38][1]; + dest.poseidon2_B_38_2 = src.interm_round_vals[38][2]; + dest.poseidon2_B_38_3 = src.interm_round_vals[38][3]; + dest.poseidon2_B_39_0 = src.interm_round_vals[39][0]; + dest.poseidon2_B_39_1 = src.interm_round_vals[39][1]; + dest.poseidon2_B_39_2 = src.interm_round_vals[39][2]; + dest.poseidon2_B_39_3 = src.interm_round_vals[39][3]; + dest.poseidon2_B_40_0 = src.interm_round_vals[40][0]; + dest.poseidon2_B_40_1 = src.interm_round_vals[40][1]; + dest.poseidon2_B_40_2 = src.interm_round_vals[40][2]; + dest.poseidon2_B_40_3 = src.interm_round_vals[40][3]; + dest.poseidon2_B_41_0 = src.interm_round_vals[41][0]; + dest.poseidon2_B_41_1 = src.interm_round_vals[41][1]; + dest.poseidon2_B_41_2 = src.interm_round_vals[41][2]; + dest.poseidon2_B_41_3 = src.interm_round_vals[41][3]; + dest.poseidon2_B_42_0 = src.interm_round_vals[42][0]; + dest.poseidon2_B_42_1 = src.interm_round_vals[42][1]; + dest.poseidon2_B_42_2 = src.interm_round_vals[42][2]; + dest.poseidon2_B_42_3 = src.interm_round_vals[42][3]; + dest.poseidon2_B_43_0 = src.interm_round_vals[43][0]; + dest.poseidon2_B_43_1 = src.interm_round_vals[43][1]; + dest.poseidon2_B_43_2 = src.interm_round_vals[43][2]; + dest.poseidon2_B_43_3 = src.interm_round_vals[43][3]; + dest.poseidon2_B_44_0 = src.interm_round_vals[44][0]; + dest.poseidon2_B_44_1 = src.interm_round_vals[44][1]; + dest.poseidon2_B_44_2 = src.interm_round_vals[44][2]; + dest.poseidon2_B_44_3 = src.interm_round_vals[44][3]; + dest.poseidon2_B_45_0 = src.interm_round_vals[45][0]; + dest.poseidon2_B_45_1 = src.interm_round_vals[45][1]; + dest.poseidon2_B_45_2 = src.interm_round_vals[45][2]; + dest.poseidon2_B_45_3 = src.interm_round_vals[45][3]; + dest.poseidon2_B_46_0 = src.interm_round_vals[46][0]; + dest.poseidon2_B_46_1 = src.interm_round_vals[46][1]; + dest.poseidon2_B_46_2 = src.interm_round_vals[46][2]; + dest.poseidon2_B_46_3 = src.interm_round_vals[46][3]; + dest.poseidon2_B_47_0 = src.interm_round_vals[47][0]; + dest.poseidon2_B_47_1 = src.interm_round_vals[47][1]; + dest.poseidon2_B_47_2 = src.interm_round_vals[47][2]; + dest.poseidon2_B_47_3 = src.interm_round_vals[47][3]; + dest.poseidon2_B_48_0 = src.interm_round_vals[48][0]; + dest.poseidon2_B_48_1 = src.interm_round_vals[48][1]; + dest.poseidon2_B_48_2 = src.interm_round_vals[48][2]; + dest.poseidon2_B_48_3 = src.interm_round_vals[48][3]; + dest.poseidon2_B_49_0 = src.interm_round_vals[49][0]; + dest.poseidon2_B_49_1 = src.interm_round_vals[49][1]; + dest.poseidon2_B_49_2 = src.interm_round_vals[49][2]; + dest.poseidon2_B_49_3 = src.interm_round_vals[49][3]; + dest.poseidon2_B_50_0 = src.interm_round_vals[50][0]; + dest.poseidon2_B_50_1 = src.interm_round_vals[50][1]; + dest.poseidon2_B_50_2 = src.interm_round_vals[50][2]; + dest.poseidon2_B_50_3 = src.interm_round_vals[50][3]; + dest.poseidon2_B_51_0 = src.interm_round_vals[51][0]; + dest.poseidon2_B_51_1 = src.interm_round_vals[51][1]; + dest.poseidon2_B_51_2 = src.interm_round_vals[51][2]; + dest.poseidon2_B_51_3 = src.interm_round_vals[51][3]; + dest.poseidon2_B_52_0 = src.interm_round_vals[52][0]; + dest.poseidon2_B_52_1 = src.interm_round_vals[52][1]; + dest.poseidon2_B_52_2 = src.interm_round_vals[52][2]; + dest.poseidon2_B_52_3 = src.interm_round_vals[52][3]; + dest.poseidon2_B_53_0 = src.interm_round_vals[53][0]; + dest.poseidon2_B_53_1 = src.interm_round_vals[53][1]; + dest.poseidon2_B_53_2 = src.interm_round_vals[53][2]; + dest.poseidon2_B_53_3 = src.interm_round_vals[53][3]; + dest.poseidon2_B_54_0 = src.interm_round_vals[54][0]; + dest.poseidon2_B_54_1 = src.interm_round_vals[54][1]; + dest.poseidon2_B_54_2 = src.interm_round_vals[54][2]; + dest.poseidon2_B_54_3 = src.interm_round_vals[54][3]; + dest.poseidon2_B_55_0 = src.interm_round_vals[55][0]; + dest.poseidon2_B_55_1 = src.interm_round_vals[55][1]; + dest.poseidon2_B_55_2 = src.interm_round_vals[55][2]; + dest.poseidon2_B_55_3 = src.interm_round_vals[55][3]; + dest.poseidon2_B_56_0 = src.interm_round_vals[56][0]; + dest.poseidon2_B_56_1 = src.interm_round_vals[56][1]; + dest.poseidon2_B_56_2 = src.interm_round_vals[56][2]; + dest.poseidon2_B_56_3 = src.interm_round_vals[56][3]; + dest.poseidon2_B_57_0 = src.interm_round_vals[57][0]; + dest.poseidon2_B_57_1 = src.interm_round_vals[57][1]; + dest.poseidon2_B_57_2 = src.interm_round_vals[57][2]; + dest.poseidon2_B_57_3 = src.interm_round_vals[57][3]; + dest.poseidon2_B_58_0 = src.interm_round_vals[58][0]; + dest.poseidon2_B_58_1 = src.interm_round_vals[58][1]; + dest.poseidon2_B_58_2 = src.interm_round_vals[58][2]; + dest.poseidon2_B_58_3 = src.interm_round_vals[58][3]; + dest.poseidon2_B_59_0 = src.interm_round_vals[59][0]; + dest.poseidon2_B_59_1 = src.interm_round_vals[59][1]; + dest.poseidon2_B_59_2 = src.interm_round_vals[59][2]; + dest.poseidon2_B_59_3 = src.interm_round_vals[59][3]; + // Full rounds + dest.poseidon2_T_60_6 = src.interm_round_vals[60][0]; + dest.poseidon2_T_60_5 = src.interm_round_vals[60][1]; + dest.poseidon2_T_60_7 = src.interm_round_vals[60][2]; + dest.poseidon2_T_60_4 = src.interm_round_vals[60][3]; - return dest; - } + dest.poseidon2_T_61_6 = src.interm_round_vals[61][0]; + dest.poseidon2_T_61_5 = src.interm_round_vals[61][1]; + dest.poseidon2_T_61_7 = src.interm_round_vals[61][2]; + dest.poseidon2_T_61_4 = src.interm_round_vals[61][3]; - template void merge_into(DestRow& dest, Poseidon2Row const& src) - { - dest.poseidon2_a_0 = src.poseidon2_a_0; - dest.poseidon2_a_1 = src.poseidon2_a_1; - dest.poseidon2_a_2 = src.poseidon2_a_2; - dest.poseidon2_a_3 = src.poseidon2_a_3; - dest.poseidon2_b_0 = src.poseidon2_b_0; - dest.poseidon2_b_1 = src.poseidon2_b_1; - dest.poseidon2_b_2 = src.poseidon2_b_2; - dest.poseidon2_b_3 = src.poseidon2_b_3; - dest.poseidon2_input_addr = src.poseidon2_input_addr; - dest.poseidon2_output_addr = src.poseidon2_output_addr; - dest.poseidon2_mem_addr_read_a = src.poseidon2_mem_addr_read_a; - dest.poseidon2_mem_addr_read_b = src.poseidon2_mem_addr_read_b; - dest.poseidon2_mem_addr_read_c = src.poseidon2_mem_addr_read_c; - dest.poseidon2_mem_addr_read_d = src.poseidon2_mem_addr_read_d; - dest.poseidon2_mem_addr_write_a = src.poseidon2_mem_addr_write_a; - dest.poseidon2_mem_addr_write_b = src.poseidon2_mem_addr_write_b; - dest.poseidon2_mem_addr_write_c = src.poseidon2_mem_addr_write_c; - dest.poseidon2_mem_addr_write_d = src.poseidon2_mem_addr_write_d; - dest.poseidon2_sel_poseidon_perm = src.poseidon2_sel_poseidon_perm; - dest.poseidon2_B_10_0 = src.poseidon2_B_10_0; - dest.poseidon2_B_10_1 = src.poseidon2_B_10_1; - dest.poseidon2_B_10_2 = src.poseidon2_B_10_2; - dest.poseidon2_B_10_3 = src.poseidon2_B_10_3; - dest.poseidon2_B_11_0 = src.poseidon2_B_11_0; - dest.poseidon2_B_11_1 = src.poseidon2_B_11_1; - dest.poseidon2_B_11_2 = src.poseidon2_B_11_2; - dest.poseidon2_B_11_3 = src.poseidon2_B_11_3; - dest.poseidon2_B_12_0 = src.poseidon2_B_12_0; - dest.poseidon2_B_12_1 = src.poseidon2_B_12_1; - dest.poseidon2_B_12_2 = src.poseidon2_B_12_2; - dest.poseidon2_B_12_3 = src.poseidon2_B_12_3; - dest.poseidon2_B_13_0 = src.poseidon2_B_13_0; - dest.poseidon2_B_13_1 = src.poseidon2_B_13_1; - dest.poseidon2_B_13_2 = src.poseidon2_B_13_2; - dest.poseidon2_B_13_3 = src.poseidon2_B_13_3; - dest.poseidon2_B_14_0 = src.poseidon2_B_14_0; - dest.poseidon2_B_14_1 = src.poseidon2_B_14_1; - dest.poseidon2_B_14_2 = src.poseidon2_B_14_2; - dest.poseidon2_B_14_3 = src.poseidon2_B_14_3; - dest.poseidon2_B_15_0 = src.poseidon2_B_15_0; - dest.poseidon2_B_15_1 = src.poseidon2_B_15_1; - dest.poseidon2_B_15_2 = src.poseidon2_B_15_2; - dest.poseidon2_B_15_3 = src.poseidon2_B_15_3; - dest.poseidon2_B_16_0 = src.poseidon2_B_16_0; - dest.poseidon2_B_16_1 = src.poseidon2_B_16_1; - dest.poseidon2_B_16_2 = src.poseidon2_B_16_2; - dest.poseidon2_B_16_3 = src.poseidon2_B_16_3; - dest.poseidon2_B_17_0 = src.poseidon2_B_17_0; - dest.poseidon2_B_17_1 = src.poseidon2_B_17_1; - dest.poseidon2_B_17_2 = src.poseidon2_B_17_2; - dest.poseidon2_B_17_3 = src.poseidon2_B_17_3; - dest.poseidon2_B_18_0 = src.poseidon2_B_18_0; - dest.poseidon2_B_18_1 = src.poseidon2_B_18_1; - dest.poseidon2_B_18_2 = src.poseidon2_B_18_2; - dest.poseidon2_B_18_3 = src.poseidon2_B_18_3; - dest.poseidon2_B_19_0 = src.poseidon2_B_19_0; - dest.poseidon2_B_19_1 = src.poseidon2_B_19_1; - dest.poseidon2_B_19_2 = src.poseidon2_B_19_2; - dest.poseidon2_B_19_3 = src.poseidon2_B_19_3; - dest.poseidon2_B_20_0 = src.poseidon2_B_20_0; - dest.poseidon2_B_20_1 = src.poseidon2_B_20_1; - dest.poseidon2_B_20_2 = src.poseidon2_B_20_2; - dest.poseidon2_B_20_3 = src.poseidon2_B_20_3; - dest.poseidon2_B_21_0 = src.poseidon2_B_21_0; - dest.poseidon2_B_21_1 = src.poseidon2_B_21_1; - dest.poseidon2_B_21_2 = src.poseidon2_B_21_2; - dest.poseidon2_B_21_3 = src.poseidon2_B_21_3; - dest.poseidon2_B_22_0 = src.poseidon2_B_22_0; - dest.poseidon2_B_22_1 = src.poseidon2_B_22_1; - dest.poseidon2_B_22_2 = src.poseidon2_B_22_2; - dest.poseidon2_B_22_3 = src.poseidon2_B_22_3; - dest.poseidon2_B_23_0 = src.poseidon2_B_23_0; - dest.poseidon2_B_23_1 = src.poseidon2_B_23_1; - dest.poseidon2_B_23_2 = src.poseidon2_B_23_2; - dest.poseidon2_B_23_3 = src.poseidon2_B_23_3; - dest.poseidon2_B_24_0 = src.poseidon2_B_24_0; - dest.poseidon2_B_24_1 = src.poseidon2_B_24_1; - dest.poseidon2_B_24_2 = src.poseidon2_B_24_2; - dest.poseidon2_B_24_3 = src.poseidon2_B_24_3; - dest.poseidon2_B_25_0 = src.poseidon2_B_25_0; - dest.poseidon2_B_25_1 = src.poseidon2_B_25_1; - dest.poseidon2_B_25_2 = src.poseidon2_B_25_2; - dest.poseidon2_B_25_3 = src.poseidon2_B_25_3; - dest.poseidon2_B_26_0 = src.poseidon2_B_26_0; - dest.poseidon2_B_26_1 = src.poseidon2_B_26_1; - dest.poseidon2_B_26_2 = src.poseidon2_B_26_2; - dest.poseidon2_B_26_3 = src.poseidon2_B_26_3; - dest.poseidon2_B_27_0 = src.poseidon2_B_27_0; - dest.poseidon2_B_27_1 = src.poseidon2_B_27_1; - dest.poseidon2_B_27_2 = src.poseidon2_B_27_2; - dest.poseidon2_B_27_3 = src.poseidon2_B_27_3; - dest.poseidon2_B_28_0 = src.poseidon2_B_28_0; - dest.poseidon2_B_28_1 = src.poseidon2_B_28_1; - dest.poseidon2_B_28_2 = src.poseidon2_B_28_2; - dest.poseidon2_B_28_3 = src.poseidon2_B_28_3; - dest.poseidon2_B_29_0 = src.poseidon2_B_29_0; - dest.poseidon2_B_29_1 = src.poseidon2_B_29_1; - dest.poseidon2_B_29_2 = src.poseidon2_B_29_2; - dest.poseidon2_B_29_3 = src.poseidon2_B_29_3; - dest.poseidon2_B_30_0 = src.poseidon2_B_30_0; - dest.poseidon2_B_30_1 = src.poseidon2_B_30_1; - dest.poseidon2_B_30_2 = src.poseidon2_B_30_2; - dest.poseidon2_B_30_3 = src.poseidon2_B_30_3; - dest.poseidon2_B_31_0 = src.poseidon2_B_31_0; - dest.poseidon2_B_31_1 = src.poseidon2_B_31_1; - dest.poseidon2_B_31_2 = src.poseidon2_B_31_2; - dest.poseidon2_B_31_3 = src.poseidon2_B_31_3; - dest.poseidon2_B_32_0 = src.poseidon2_B_32_0; - dest.poseidon2_B_32_1 = src.poseidon2_B_32_1; - dest.poseidon2_B_32_2 = src.poseidon2_B_32_2; - dest.poseidon2_B_32_3 = src.poseidon2_B_32_3; - dest.poseidon2_B_33_0 = src.poseidon2_B_33_0; - dest.poseidon2_B_33_1 = src.poseidon2_B_33_1; - dest.poseidon2_B_33_2 = src.poseidon2_B_33_2; - dest.poseidon2_B_33_3 = src.poseidon2_B_33_3; - dest.poseidon2_B_34_0 = src.poseidon2_B_34_0; - dest.poseidon2_B_34_1 = src.poseidon2_B_34_1; - dest.poseidon2_B_34_2 = src.poseidon2_B_34_2; - dest.poseidon2_B_34_3 = src.poseidon2_B_34_3; - dest.poseidon2_B_35_0 = src.poseidon2_B_35_0; - dest.poseidon2_B_35_1 = src.poseidon2_B_35_1; - dest.poseidon2_B_35_2 = src.poseidon2_B_35_2; - dest.poseidon2_B_35_3 = src.poseidon2_B_35_3; - dest.poseidon2_B_36_0 = src.poseidon2_B_36_0; - dest.poseidon2_B_36_1 = src.poseidon2_B_36_1; - dest.poseidon2_B_36_2 = src.poseidon2_B_36_2; - dest.poseidon2_B_36_3 = src.poseidon2_B_36_3; - dest.poseidon2_B_37_0 = src.poseidon2_B_37_0; - dest.poseidon2_B_37_1 = src.poseidon2_B_37_1; - dest.poseidon2_B_37_2 = src.poseidon2_B_37_2; - dest.poseidon2_B_37_3 = src.poseidon2_B_37_3; - dest.poseidon2_B_38_0 = src.poseidon2_B_38_0; - dest.poseidon2_B_38_1 = src.poseidon2_B_38_1; - dest.poseidon2_B_38_2 = src.poseidon2_B_38_2; - dest.poseidon2_B_38_3 = src.poseidon2_B_38_3; - dest.poseidon2_B_39_0 = src.poseidon2_B_39_0; - dest.poseidon2_B_39_1 = src.poseidon2_B_39_1; - dest.poseidon2_B_39_2 = src.poseidon2_B_39_2; - dest.poseidon2_B_39_3 = src.poseidon2_B_39_3; - dest.poseidon2_B_40_0 = src.poseidon2_B_40_0; - dest.poseidon2_B_40_1 = src.poseidon2_B_40_1; - dest.poseidon2_B_40_2 = src.poseidon2_B_40_2; - dest.poseidon2_B_40_3 = src.poseidon2_B_40_3; - dest.poseidon2_B_41_0 = src.poseidon2_B_41_0; - dest.poseidon2_B_41_1 = src.poseidon2_B_41_1; - dest.poseidon2_B_41_2 = src.poseidon2_B_41_2; - dest.poseidon2_B_41_3 = src.poseidon2_B_41_3; - dest.poseidon2_B_42_0 = src.poseidon2_B_42_0; - dest.poseidon2_B_42_1 = src.poseidon2_B_42_1; - dest.poseidon2_B_42_2 = src.poseidon2_B_42_2; - dest.poseidon2_B_42_3 = src.poseidon2_B_42_3; - dest.poseidon2_B_43_0 = src.poseidon2_B_43_0; - dest.poseidon2_B_43_1 = src.poseidon2_B_43_1; - dest.poseidon2_B_43_2 = src.poseidon2_B_43_2; - dest.poseidon2_B_43_3 = src.poseidon2_B_43_3; - dest.poseidon2_B_44_0 = src.poseidon2_B_44_0; - dest.poseidon2_B_44_1 = src.poseidon2_B_44_1; - dest.poseidon2_B_44_2 = src.poseidon2_B_44_2; - dest.poseidon2_B_44_3 = src.poseidon2_B_44_3; - dest.poseidon2_B_45_0 = src.poseidon2_B_45_0; - dest.poseidon2_B_45_1 = src.poseidon2_B_45_1; - dest.poseidon2_B_45_2 = src.poseidon2_B_45_2; - dest.poseidon2_B_45_3 = src.poseidon2_B_45_3; - dest.poseidon2_B_46_0 = src.poseidon2_B_46_0; - dest.poseidon2_B_46_1 = src.poseidon2_B_46_1; - dest.poseidon2_B_46_2 = src.poseidon2_B_46_2; - dest.poseidon2_B_46_3 = src.poseidon2_B_46_3; - dest.poseidon2_B_47_0 = src.poseidon2_B_47_0; - dest.poseidon2_B_47_1 = src.poseidon2_B_47_1; - dest.poseidon2_B_47_2 = src.poseidon2_B_47_2; - dest.poseidon2_B_47_3 = src.poseidon2_B_47_3; - dest.poseidon2_B_48_0 = src.poseidon2_B_48_0; - dest.poseidon2_B_48_1 = src.poseidon2_B_48_1; - dest.poseidon2_B_48_2 = src.poseidon2_B_48_2; - dest.poseidon2_B_48_3 = src.poseidon2_B_48_3; - dest.poseidon2_B_49_0 = src.poseidon2_B_49_0; - dest.poseidon2_B_49_1 = src.poseidon2_B_49_1; - dest.poseidon2_B_49_2 = src.poseidon2_B_49_2; - dest.poseidon2_B_49_3 = src.poseidon2_B_49_3; - dest.poseidon2_B_4_0 = src.poseidon2_B_4_0; - dest.poseidon2_B_4_1 = src.poseidon2_B_4_1; - dest.poseidon2_B_4_2 = src.poseidon2_B_4_2; - dest.poseidon2_B_4_3 = src.poseidon2_B_4_3; - dest.poseidon2_B_50_0 = src.poseidon2_B_50_0; - dest.poseidon2_B_50_1 = src.poseidon2_B_50_1; - dest.poseidon2_B_50_2 = src.poseidon2_B_50_2; - dest.poseidon2_B_50_3 = src.poseidon2_B_50_3; - dest.poseidon2_B_51_0 = src.poseidon2_B_51_0; - dest.poseidon2_B_51_1 = src.poseidon2_B_51_1; - dest.poseidon2_B_51_2 = src.poseidon2_B_51_2; - dest.poseidon2_B_51_3 = src.poseidon2_B_51_3; - dest.poseidon2_B_52_0 = src.poseidon2_B_52_0; - dest.poseidon2_B_52_1 = src.poseidon2_B_52_1; - dest.poseidon2_B_52_2 = src.poseidon2_B_52_2; - dest.poseidon2_B_52_3 = src.poseidon2_B_52_3; - dest.poseidon2_B_53_0 = src.poseidon2_B_53_0; - dest.poseidon2_B_53_1 = src.poseidon2_B_53_1; - dest.poseidon2_B_53_2 = src.poseidon2_B_53_2; - dest.poseidon2_B_53_3 = src.poseidon2_B_53_3; - dest.poseidon2_B_54_0 = src.poseidon2_B_54_0; - dest.poseidon2_B_54_1 = src.poseidon2_B_54_1; - dest.poseidon2_B_54_2 = src.poseidon2_B_54_2; - dest.poseidon2_B_54_3 = src.poseidon2_B_54_3; - dest.poseidon2_B_55_0 = src.poseidon2_B_55_0; - dest.poseidon2_B_55_1 = src.poseidon2_B_55_1; - dest.poseidon2_B_55_2 = src.poseidon2_B_55_2; - dest.poseidon2_B_55_3 = src.poseidon2_B_55_3; - dest.poseidon2_B_56_0 = src.poseidon2_B_56_0; - dest.poseidon2_B_56_1 = src.poseidon2_B_56_1; - dest.poseidon2_B_56_2 = src.poseidon2_B_56_2; - dest.poseidon2_B_56_3 = src.poseidon2_B_56_3; - dest.poseidon2_B_57_0 = src.poseidon2_B_57_0; - dest.poseidon2_B_57_1 = src.poseidon2_B_57_1; - dest.poseidon2_B_57_2 = src.poseidon2_B_57_2; - dest.poseidon2_B_57_3 = src.poseidon2_B_57_3; - dest.poseidon2_B_58_0 = src.poseidon2_B_58_0; - dest.poseidon2_B_58_1 = src.poseidon2_B_58_1; - dest.poseidon2_B_58_2 = src.poseidon2_B_58_2; - dest.poseidon2_B_58_3 = src.poseidon2_B_58_3; - dest.poseidon2_B_59_0 = src.poseidon2_B_59_0; - dest.poseidon2_B_59_1 = src.poseidon2_B_59_1; - dest.poseidon2_B_59_2 = src.poseidon2_B_59_2; - dest.poseidon2_B_59_3 = src.poseidon2_B_59_3; - dest.poseidon2_B_5_0 = src.poseidon2_B_5_0; - dest.poseidon2_B_5_1 = src.poseidon2_B_5_1; - dest.poseidon2_B_5_2 = src.poseidon2_B_5_2; - dest.poseidon2_B_5_3 = src.poseidon2_B_5_3; - dest.poseidon2_B_6_0 = src.poseidon2_B_6_0; - dest.poseidon2_B_6_1 = src.poseidon2_B_6_1; - dest.poseidon2_B_6_2 = src.poseidon2_B_6_2; - dest.poseidon2_B_6_3 = src.poseidon2_B_6_3; - dest.poseidon2_B_7_0 = src.poseidon2_B_7_0; - dest.poseidon2_B_7_1 = src.poseidon2_B_7_1; - dest.poseidon2_B_7_2 = src.poseidon2_B_7_2; - dest.poseidon2_B_7_3 = src.poseidon2_B_7_3; - dest.poseidon2_B_8_0 = src.poseidon2_B_8_0; - dest.poseidon2_B_8_1 = src.poseidon2_B_8_1; - dest.poseidon2_B_8_2 = src.poseidon2_B_8_2; - dest.poseidon2_B_8_3 = src.poseidon2_B_8_3; - dest.poseidon2_B_9_0 = src.poseidon2_B_9_0; - dest.poseidon2_B_9_1 = src.poseidon2_B_9_1; - dest.poseidon2_B_9_2 = src.poseidon2_B_9_2; - dest.poseidon2_B_9_3 = src.poseidon2_B_9_3; - dest.poseidon2_T_0_4 = src.poseidon2_T_0_4; - dest.poseidon2_T_0_5 = src.poseidon2_T_0_5; - dest.poseidon2_T_0_6 = src.poseidon2_T_0_6; - dest.poseidon2_T_0_7 = src.poseidon2_T_0_7; - dest.poseidon2_T_1_4 = src.poseidon2_T_1_4; - dest.poseidon2_T_1_5 = src.poseidon2_T_1_5; - dest.poseidon2_T_1_6 = src.poseidon2_T_1_6; - dest.poseidon2_T_1_7 = src.poseidon2_T_1_7; - dest.poseidon2_T_2_4 = src.poseidon2_T_2_4; - dest.poseidon2_T_2_5 = src.poseidon2_T_2_5; - dest.poseidon2_T_2_6 = src.poseidon2_T_2_6; - dest.poseidon2_T_2_7 = src.poseidon2_T_2_7; - dest.poseidon2_T_3_4 = src.poseidon2_T_3_4; - dest.poseidon2_T_3_5 = src.poseidon2_T_3_5; - dest.poseidon2_T_3_6 = src.poseidon2_T_3_6; - dest.poseidon2_T_3_7 = src.poseidon2_T_3_7; - dest.poseidon2_T_60_4 = src.poseidon2_T_60_4; - dest.poseidon2_T_60_5 = src.poseidon2_T_60_5; - dest.poseidon2_T_60_6 = src.poseidon2_T_60_6; - dest.poseidon2_T_60_7 = src.poseidon2_T_60_7; - dest.poseidon2_T_61_4 = src.poseidon2_T_61_4; - dest.poseidon2_T_61_5 = src.poseidon2_T_61_5; - dest.poseidon2_T_61_6 = src.poseidon2_T_61_6; - dest.poseidon2_T_61_7 = src.poseidon2_T_61_7; - dest.poseidon2_T_62_4 = src.poseidon2_T_62_4; - dest.poseidon2_T_62_5 = src.poseidon2_T_62_5; - dest.poseidon2_T_62_6 = src.poseidon2_T_62_6; - dest.poseidon2_T_62_7 = src.poseidon2_T_62_7; - dest.poseidon2_T_63_4 = src.poseidon2_T_63_4; - dest.poseidon2_T_63_5 = src.poseidon2_T_63_5; - dest.poseidon2_T_63_6 = src.poseidon2_T_63_6; - dest.poseidon2_T_63_7 = src.poseidon2_T_63_7; - dest.poseidon2_EXT_LAYER_6 = src.poseidon2_EXT_LAYER_6; - dest.poseidon2_EXT_LAYER_5 = src.poseidon2_EXT_LAYER_5; - dest.poseidon2_EXT_LAYER_7 = src.poseidon2_EXT_LAYER_7; - dest.poseidon2_EXT_LAYER_4 = src.poseidon2_EXT_LAYER_4; - } + dest.poseidon2_T_62_6 = src.interm_round_vals[62][0]; + dest.poseidon2_T_62_5 = src.interm_round_vals[62][1]; + dest.poseidon2_T_62_7 = src.interm_round_vals[62][2]; + dest.poseidon2_T_62_4 = src.interm_round_vals[62][3]; - private: - std::vector poseidon2_trace; -}; // namespace bb::avm_trace + dest.poseidon2_T_63_6 = src.interm_round_vals[63][0]; + dest.poseidon2_T_63_5 = src.interm_round_vals[63][1]; + dest.poseidon2_T_63_7 = src.interm_round_vals[63][2]; + dest.poseidon2_T_63_4 = src.interm_round_vals[63][3]; +} } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp index 55c04d355c9..fe0b1040c83 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp @@ -38,7 +38,7 @@ uint32_t AvmGasTraceBuilder::get_da_gas_left() return gas_trace.back().remaining_da_gas; } -void AvmGasTraceBuilder::constrain_gas_lookup(uint32_t clk, OpCode opcode) +void AvmGasTraceBuilder::constrain_gas(uint32_t clk, OpCode opcode, [[maybe_unused]] uint32_t dyn_gas_multiplier) { // TODO: increase lookup counter for the opcode we are looking up into gas_opcode_lookup_counter[opcode]++; @@ -72,7 +72,7 @@ void AvmGasTraceBuilder::constrain_gas_for_external_call(uint32_t clk, const OpCode opcode = OpCode::CALL; // TODO: increase lookup counter for the opcode we are looking up into - // gas_opcode_lookup_counter[opcode]++; + gas_opcode_lookup_counter[opcode]++; // Get the gas prices for this opcode const auto& GAS_COST_TABLE = FixedGasTable::get(); @@ -87,10 +87,8 @@ void AvmGasTraceBuilder::constrain_gas_for_external_call(uint32_t clk, GasTraceEntry entry = { .clk = clk, .opcode = OpCode::CALL, - .l2_gas_cost = 0, // We need 0 in this case because we do not activate the gas_cost_active selector to satisfy - // #[L2_GAS_INACTIVE]. - .da_gas_cost = 0, // We need 0 in this case because we do not activate the gas_cost_active selector to satisfy - // #[DA_GAS_INACTIVE]. + .l2_gas_cost = opcode_l2_gas_cost, + .da_gas_cost = opcode_da_gas_cost, .remaining_l2_gas = remaining_l2_gas, .remaining_da_gas = remaining_da_gas, }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp index 8653b93b18d..88033a75416 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp @@ -27,7 +27,7 @@ class AvmGasTraceBuilder { void reset(); std::vector finalize(); - void constrain_gas_lookup(uint32_t clk, OpCode opcode); + void constrain_gas(uint32_t clk, OpCode opcode, uint32_t dyn_gas_multiplier = 0); void constrain_gas_for_external_call(uint32_t clk, uint32_t nested_l2_gas_cost, uint32_t nested_da_gas_cost); void set_initial_gas(uint32_t l2_gas, uint32_t da_gas); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp index 13ab95d3b9c..5b2a496f33d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp @@ -85,7 +85,6 @@ void log_avm_trace([[maybe_unused]] std::vector const& trace, info("diff_lo: ", trace.at(i).mem_diff_lo); info("=======GAS ACCOUNTING================================================================"); - info("opcode active: ", trace.at(i).main_sel_mem_op_activate_gas); info("l2_gas_remaining: ", trace.at(i).main_l2_gas_remaining); info("da_gas_remaining: ", trace.at(i).main_da_gas_remaining); info("l2_gas_op_cost: ", trace.at(i).main_l2_gas_op_cost); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/mem_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/mem_trace.hpp index 10124892b7c..0bdd8cc9ed4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/mem_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/mem_trace.hpp @@ -108,6 +108,9 @@ class AvmMemTraceBuilder { uint32_t direct_dst_offset); std::vector read_return_opcode(uint32_t clk, uint8_t space_id, uint32_t direct_ret_offset, uint32_t ret_size); + // DO NOT USE FOR REAL OPERATIONS + FF unconstrained_read(uint8_t space_id, uint32_t addr) { return memory[space_id][addr].val; } + private: std::vector mem_trace; // Entries will be sorted by m_clk, m_sub_clk after finalize(). diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp index 0e0954ee2e8..65e98eae021 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -13,6 +13,7 @@ #include #include +#include "barretenberg/common/assert.hpp" #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" @@ -289,167 +290,46 @@ AvmTraceBuilder::MemOp AvmTraceBuilder::constrained_write_to_memory(uint8_t spac .val = value }; } -// TODO(ilyas: #6383): Temporary way to bulk read slices -template -uint32_t AvmTraceBuilder::read_slice_to_memory(uint8_t space_id, - uint32_t clk, - AddressWithMode addr, - AvmMemoryTag r_tag, - AvmMemoryTag w_tag, - FF internal_return_ptr, - size_t slice_len, - std::vector& slice) +FF AvmTraceBuilder::unconstrained_read_from_memory(AddressWithMode addr) { - // If the mem_op is indirect, it goes into register A - bool is_indirect = addr.mode == AddressingMode::INDIRECT; - auto src_offset = addr.offset; - // We have 4 registers that we are able to use to read from memory within a single main trace row - auto register_order = std::array{ IntermRegister::IA, IntermRegister::IB, IntermRegister::IC, IntermRegister::ID }; - // If the slice size isnt a multiple of 4, we still need an extra row to write the remainder - uint32_t const num_main_rows = static_cast(slice_len) / 4 + static_cast(slice_len % 4 != 0); - for (uint32_t i = 0; i < num_main_rows; i++) { - Row main_row{ - .main_clk = clk + i, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(r_tag)), - .main_w_in_tag = FF(static_cast(w_tag)), - }; - // Write 4 values to memory in each_row - for (uint32_t j = 0; j < 4; j++) { - auto offset = i * 4 + j; - // If we exceed the slice size, we break - if (offset >= slice_len) { - break; - } - MemOp mem_read; - if (is_indirect) { - // If the first address is indirect we read it into register A, this can only happen once per slice read - mem_read = constrained_read_from_memory(space_id, clk + i, addr, r_tag, w_tag, IntermRegister::IA); - // Set this to false for the rest of the reads - is_indirect = false; - src_offset = mem_read.direct_address; - } else { - auto mem_load = mem_trace_builder.read_and_load_from_memory( - space_id, clk + i, register_order[j], src_offset + offset, r_tag, w_tag); - mem_read = MemOp{ - .is_indirect = false, - .indirect_address = 0, - .direct_address = src_offset + offset, - .tag = r_tag, - .tag_match = mem_load.tag_match, - .val = MEM(mem_load.val), - }; - } - slice.emplace_back(MEM(mem_read.val)); - // This looks a bit gross, but it is fine for now. - if (j == 0) { - main_row.main_ia = slice.at(offset); - main_row.main_ind_addr_a = FF(mem_read.indirect_address); - main_row.main_sel_resolve_ind_addr_a = FF(static_cast(mem_read.is_indirect)); - main_row.main_mem_addr_a = FF(mem_read.direct_address); - main_row.main_sel_mem_op_a = FF(1); - main_row.main_tag_err = FF(static_cast(!mem_read.tag_match)); - } else if (j == 1) { - main_row.main_ib = slice.at(offset); - main_row.main_mem_addr_b = FF(mem_read.direct_address); - main_row.main_sel_mem_op_b = FF(1); - main_row.main_tag_err = FF(static_cast(!mem_read.tag_match)); - } else if (j == 2) { - main_row.main_ic = slice.at(offset); - main_row.main_mem_addr_c = FF(mem_read.direct_address); - main_row.main_sel_mem_op_c = FF(1); - main_row.main_tag_err = FF(static_cast(!mem_read.tag_match)); - } else { - main_row.main_id = slice.at(offset); - main_row.main_mem_addr_d = FF(mem_read.direct_address); - main_row.main_sel_mem_op_d = FF(1); - main_row.main_tag_err = FF(static_cast(!mem_read.tag_match)); - } - } - main_trace.emplace_back(main_row); + auto offset = addr.offset; + if (addr.mode == AddressingMode::INDIRECT) { + offset = static_cast(mem_trace_builder.unconstrained_read(call_ptr, offset)); } - return num_main_rows; + return mem_trace_builder.unconstrained_read(call_ptr, offset); } -// TODO(ilyas: #6383): Temporary way to bulk write slices -uint32_t AvmTraceBuilder::write_slice_to_memory(uint8_t space_id, - uint32_t clk, - AddressWithMode addr, - AvmMemoryTag r_tag, - AvmMemoryTag w_tag, - FF internal_return_ptr, - std::vector const& slice) +void AvmTraceBuilder::write_to_memory(AddressWithMode addr, FF val, AvmMemoryTag w_tag) { - bool is_indirect = addr.mode == AddressingMode::INDIRECT; - auto dst_offset = addr.offset; - // We have 4 registers that we are able to use to write to memory within a single main trace row - auto register_order = std::array{ IntermRegister::IA, IntermRegister::IB, IntermRegister::IC, IntermRegister::ID }; - // If the slice size isnt a multiple of 4, we still need an extra row to write the remainder - uint32_t const num_main_rows = - static_cast(slice.size()) / 4 + static_cast(slice.size() % 4 != 0); - for (uint32_t i = 0; i < num_main_rows; i++) { - Row main_row{ - .main_clk = clk + i, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(r_tag)), - .main_w_in_tag = FF(static_cast(w_tag)), - }; - // Write 4 values to memory in each_row - for (uint32_t j = 0; j < 4; j++) { - auto offset = i * 4 + j; - // If we exceed the slice size, we break - if (offset >= slice.size()) { - break; - } - MemOp mem_write; - if (is_indirect) { - mem_write = constrained_write_to_memory( - space_id, clk + i, addr, slice.at(offset), r_tag, w_tag, IntermRegister::IA); - // Ensure futures calls are direct - is_indirect = false; - dst_offset = mem_write.direct_address; - } else { - mem_trace_builder.write_into_memory( - space_id, clk + i, register_order[j], dst_offset + offset, slice.at(offset), r_tag, w_tag); - mem_write = MemOp{ - .is_indirect = false, - .indirect_address = 0, - .direct_address = dst_offset + offset, - .tag = w_tag, - .tag_match = true, - .val = slice.at(offset), - }; - } - // This looks a bit gross, but it is fine for now. - if (j == 0) { - main_row.main_ia = slice.at(offset); - main_row.main_ind_addr_a = FF(mem_write.indirect_address); - main_row.main_sel_resolve_ind_addr_a = FF(static_cast(mem_write.is_indirect)); - main_row.main_mem_addr_a = FF(mem_write.direct_address); - main_row.main_sel_mem_op_a = FF(1); - main_row.main_rwa = FF(1); - } else if (j == 1) { - main_row.main_ib = slice.at(offset); - main_row.main_mem_addr_b = FF(mem_write.direct_address); - main_row.main_sel_mem_op_b = FF(1); - main_row.main_rwb = FF(1); - } else if (j == 2) { - main_row.main_ic = slice.at(offset); - main_row.main_mem_addr_c = FF(mem_write.direct_address); - main_row.main_sel_mem_op_c = FF(1); - main_row.main_rwc = FF(1); - } else { - main_row.main_id = slice.at(offset); - main_row.main_mem_addr_d = FF(mem_write.direct_address); - main_row.main_sel_mem_op_d = FF(1); - main_row.main_rwd = FF(1); - } - } - main_trace.emplace_back(main_row); + // op_set_internal increments the pc, so we need to store the current pc and then jump back to it + // to legaly reset the pc. + auto current_pc = pc; + op_set_internal(static_cast(addr.mode), val, addr.offset, w_tag); + op_jump(current_pc); +} + +template +void AvmTraceBuilder::read_slice_from_memory(AddressWithMode addr, size_t slice_len, std::vector& slice) +{ + uint32_t base_addr = addr.offset; + if (addr.mode == AddressingMode::INDIRECT) { + base_addr = static_cast(mem_trace_builder.unconstrained_read(call_ptr, base_addr)); + } + + for (uint32_t i = 0; i < slice_len; i++) { + slice.push_back(static_cast(mem_trace_builder.unconstrained_read(call_ptr, base_addr + i))); + } +} + +template +void AvmTraceBuilder::write_slice_to_memory(AddressWithMode addr, AvmMemoryTag w_tag, const T& slice) +{ + auto base_addr = addr.mode == AddressingMode::INDIRECT + ? static_cast(mem_trace_builder.unconstrained_read(call_ptr, addr.offset)) + : addr.offset; + for (uint32_t i = 0; i < slice.size(); i++) { + write_to_memory(base_addr + i, slice[i], w_tag); } - return num_main_rows; } // Finalise Lookup Counts @@ -530,7 +410,7 @@ void AvmTraceBuilder::op_add( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::ADD); + gas_trace_builder.constrain_gas(clk, OpCode::ADD); main_trace.push_back(Row{ .main_clk = clk, @@ -597,7 +477,7 @@ void AvmTraceBuilder::op_sub( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SUB); + gas_trace_builder.constrain_gas(clk, OpCode::SUB); main_trace.push_back(Row{ .main_clk = clk, @@ -664,7 +544,7 @@ void AvmTraceBuilder::op_mul( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::MUL); + gas_trace_builder.constrain_gas(clk, OpCode::MUL); main_trace.push_back(Row{ .main_clk = clk, @@ -742,7 +622,7 @@ void AvmTraceBuilder::op_div( auto write_dst = constrained_write_to_memory(call_ptr, clk, resolved_dst, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::DIV); + gas_trace_builder.constrain_gas(clk, OpCode::DIV); main_trace.push_back(Row{ .main_clk = clk, @@ -822,7 +702,7 @@ void AvmTraceBuilder::op_fdiv(uint8_t indirect, uint32_t a_offset, uint32_t b_of call_ptr, clk, resolved_c, c, AvmMemoryTag::FF, AvmMemoryTag::FF, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::FDIV); + gas_trace_builder.constrain_gas(clk, OpCode::FDIV); main_trace.push_back(Row{ .main_clk = clk, @@ -892,7 +772,7 @@ void AvmTraceBuilder::op_eq( constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, AvmMemoryTag::U8, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::EQ); + gas_trace_builder.constrain_gas(clk, OpCode::EQ); main_trace.push_back(Row{ .main_clk = clk, @@ -944,7 +824,7 @@ void AvmTraceBuilder::op_lt( constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, AvmMemoryTag::U8, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::LT); + gas_trace_builder.constrain_gas(clk, OpCode::LT); main_trace.push_back(Row{ .main_clk = clk, @@ -997,7 +877,7 @@ void AvmTraceBuilder::op_lte( constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, AvmMemoryTag::U8, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::LTE); + gas_trace_builder.constrain_gas(clk, OpCode::LTE); main_trace.push_back(Row{ .main_clk = clk, @@ -1053,7 +933,7 @@ void AvmTraceBuilder::op_and( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::AND); + gas_trace_builder.constrain_gas(clk, OpCode::AND); main_trace.push_back(Row{ .main_clk = clk, @@ -1105,7 +985,7 @@ void AvmTraceBuilder::op_or( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::OR); + gas_trace_builder.constrain_gas(clk, OpCode::OR); main_trace.push_back(Row{ .main_clk = clk, @@ -1158,7 +1038,7 @@ void AvmTraceBuilder::op_xor( auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::XOR); + gas_trace_builder.constrain_gas(clk, OpCode::XOR); main_trace.push_back(Row{ .main_clk = clk, @@ -1221,7 +1101,7 @@ void AvmTraceBuilder::op_not(uint8_t indirect, uint32_t a_offset, uint32_t dst_o auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::NOT); + gas_trace_builder.constrain_gas(clk, OpCode::NOT); main_trace.push_back(Row{ .main_clk = clk, @@ -1267,7 +1147,7 @@ void AvmTraceBuilder::op_shl( // Write into memory value c from intermediate register ic. auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SHL); + gas_trace_builder.constrain_gas(clk, OpCode::SHL); main_trace.push_back(Row{ .main_clk = clk, @@ -1319,7 +1199,7 @@ void AvmTraceBuilder::op_shr( // Write into memory value c from intermediate register ic. auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, c, in_tag, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SHR); + gas_trace_builder.constrain_gas(clk, OpCode::SHR); main_trace.push_back(Row{ .main_clk = clk, @@ -1400,7 +1280,7 @@ void AvmTraceBuilder::op_cast(uint8_t indirect, uint32_t a_offset, uint32_t dst_ mem_trace_builder.write_into_memory(call_ptr, clk, IntermRegister::IC, direct_dst_offset, c, memEntry.tag, dst_tag); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::CAST); + gas_trace_builder.constrain_gas(clk, OpCode::CAST); main_trace.push_back(Row{ .main_clk = clk, @@ -1478,7 +1358,7 @@ void AvmTraceBuilder::op_address(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_address = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::ADDRESS); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::ADDRESS); main_trace.push_back(row); } @@ -1490,7 +1370,7 @@ void AvmTraceBuilder::op_storage_address(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_storage_address = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::STORAGEADDRESS); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::STORAGEADDRESS); main_trace.push_back(row); } @@ -1502,7 +1382,7 @@ void AvmTraceBuilder::op_sender(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_sender = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::SENDER); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::SENDER); main_trace.push_back(row); } @@ -1515,7 +1395,7 @@ void AvmTraceBuilder::op_function_selector(uint8_t indirect, uint32_t dst_offset row.main_sel_op_function_selector = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::FUNCTIONSELECTOR); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::FUNCTIONSELECTOR); main_trace.push_back(row); } @@ -1527,7 +1407,7 @@ void AvmTraceBuilder::op_transaction_fee(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_transaction_fee = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::TRANSACTIONFEE); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::TRANSACTIONFEE); main_trace.push_back(row); } @@ -1543,7 +1423,7 @@ void AvmTraceBuilder::op_chain_id(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_chain_id = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::CHAINID); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::CHAINID); main_trace.push_back(row); } @@ -1555,7 +1435,7 @@ void AvmTraceBuilder::op_version(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_version = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::VERSION); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::VERSION); main_trace.push_back(row); } @@ -1567,7 +1447,7 @@ void AvmTraceBuilder::op_block_number(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_block_number = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::BLOCKNUMBER); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::BLOCKNUMBER); main_trace.push_back(row); } @@ -1579,7 +1459,7 @@ void AvmTraceBuilder::op_timestamp(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_timestamp = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::TIMESTAMP); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::TIMESTAMP); main_trace.push_back(row); } @@ -1591,7 +1471,7 @@ void AvmTraceBuilder::op_coinbase(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_coinbase = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::COINBASE); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::COINBASE); main_trace.push_back(row); } @@ -1603,7 +1483,7 @@ void AvmTraceBuilder::op_fee_per_l2_gas(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_fee_per_l2_gas = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::FEEPERL2GAS); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::FEEPERL2GAS); main_trace.push_back(row); } @@ -1615,7 +1495,7 @@ void AvmTraceBuilder::op_fee_per_da_gas(uint8_t indirect, uint32_t dst_offset) row.main_sel_op_fee_per_da_gas = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(static_cast(row.main_clk), OpCode::FEEPERDAGAS); + gas_trace_builder.constrain_gas(static_cast(row.main_clk), OpCode::FEEPERDAGAS); main_trace.push_back(row); } @@ -1670,7 +1550,7 @@ void AvmTraceBuilder::op_calldata_copy(uint8_t indirect, uint32_t cd_offset, uin } // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::CALLDATACOPY); + gas_trace_builder.constrain_gas(clk, OpCode::CALLDATACOPY, copy_size); main_trace.push_back(Row{ .main_clk = clk, @@ -1704,7 +1584,7 @@ void AvmTraceBuilder::execute_gasleft(OpCode opcode, uint8_t indirect, uint32_t auto [resolved_dst] = unpack_indirects<1>(indirect, { dst_offset }); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, opcode); + gas_trace_builder.constrain_gas(clk, opcode); uint32_t gas_remaining = 0; @@ -1766,7 +1646,7 @@ void AvmTraceBuilder::op_jump(uint32_t jmp_dest) auto clk = static_cast(main_trace.size()) + 1; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::JUMP); + gas_trace_builder.constrain_gas(clk, OpCode::JUMP); main_trace.push_back(Row{ .main_clk = clk, @@ -1815,7 +1695,7 @@ void AvmTraceBuilder::op_jumpi(uint8_t indirect, uint32_t jmp_dest, uint32_t con uint32_t next_pc = !id_zero ? jmp_dest : pc + 1; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::JUMPI); + gas_trace_builder.constrain_gas(clk, OpCode::JUMPI); main_trace.push_back(Row{ .main_clk = clk, @@ -1867,7 +1747,7 @@ void AvmTraceBuilder::op_internal_call(uint32_t jmp_dest) AvmMemoryTag::U32); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::INTERNALCALL); + gas_trace_builder.constrain_gas(clk, OpCode::INTERNALCALL); main_trace.push_back(Row{ .main_clk = clk, @@ -1909,7 +1789,7 @@ void AvmTraceBuilder::op_internal_return() INTERNAL_CALL_SPACE_ID, clk, IntermRegister::IA, internal_return_ptr - 1, AvmMemoryTag::U32, AvmMemoryTag::U0); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::INTERNALRETURN); + gas_trace_builder.constrain_gas(clk, OpCode::INTERNALRETURN); main_trace.push_back(Row{ .main_clk = clk, @@ -1949,15 +1829,20 @@ void AvmTraceBuilder::op_internal_return() */ void AvmTraceBuilder::op_set(uint8_t indirect, uint128_t val, uint32_t dst_offset, AvmMemoryTag in_tag) { - auto const clk = static_cast(main_trace.size()) + 1; auto const val_ff = FF{ uint256_t::from_uint128(val) }; + op_set_internal(indirect, val_ff, dst_offset, in_tag); +} + +void AvmTraceBuilder::op_set_internal(uint8_t indirect, FF val_ff, uint32_t dst_offset, AvmMemoryTag in_tag) +{ + auto const clk = static_cast(main_trace.size()) + 1; auto [resolved_c] = unpack_indirects<1>(indirect, { dst_offset }); auto write_c = constrained_write_to_memory(call_ptr, clk, resolved_c, val_ff, AvmMemoryTag::U0, in_tag, IntermRegister::IC); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SET); + gas_trace_builder.constrain_gas(clk, OpCode::SET); main_trace.push_back(Row{ .main_clk = clk, @@ -1968,7 +1853,6 @@ void AvmTraceBuilder::op_set(uint8_t indirect, uint128_t val, uint32_t dst_offse .main_mem_addr_c = FF(write_c.direct_address), .main_pc = pc++, .main_rwc = 1, - .main_sel_mem_op_activate_gas = 1, // TODO: remove in the long term .main_sel_mem_op_c = 1, .main_sel_resolve_ind_addr_c = FF(static_cast(write_c.is_indirect)), .main_tag_err = static_cast(!write_c.tag_match), @@ -2015,7 +1899,7 @@ void AvmTraceBuilder::op_mov(uint8_t indirect, uint32_t src_offset, uint32_t dst mem_trace_builder.write_into_memory(call_ptr, clk, IntermRegister::IC, direct_dst_offset, val, tag, tag); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::MOV); + gas_trace_builder.constrain_gas(clk, OpCode::MOV); main_trace.push_back(Row{ .main_clk = clk, @@ -2115,7 +1999,7 @@ void AvmTraceBuilder::op_cmov( FF const inv = !id_zero ? cond_mem_entry.val.invert() : 1; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::CMOV); + gas_trace_builder.constrain_gas(clk, OpCode::CMOV); main_trace.push_back(Row{ .main_clk = clk, @@ -2367,6 +2251,7 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t .main_sel_resolve_ind_addr_a = FF(static_cast(read_slot.is_indirect)), .main_tag_err = FF(static_cast(!read_slot.tag_match)), }); + gas_trace_builder.constrain_gas(clk, OpCode::SLOAD); clk++; AddressWithMode write_dst = resolved_dest; @@ -2399,7 +2284,9 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t kernel_trace_builder.op_sload(clk, side_effect_counter, row.main_ib, row.main_ia); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SLOAD); + // TODO: when/if we move this to its own gadget, and we have 1 row only, we should pass the size as + // n_multiplier here. + gas_trace_builder.constrain_gas(clk, OpCode::SLOAD); main_trace.push_back(row); @@ -2435,6 +2322,7 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t .main_tag_err = FF(static_cast(!read_slot.tag_match)), .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), }); + gas_trace_builder.constrain_gas(clk, OpCode::SSTORE); clk++; AddressWithMode read_src = resolved_src; @@ -2463,7 +2351,9 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t kernel_trace_builder.op_sstore(clk, side_effect_counter, row.main_ib, row.main_ia); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SSTORE); + // TODO: when/if we move this to its own gadget, and we have 1 row only, we should pass the size as + // n_multiplier here. + gas_trace_builder.constrain_gas(clk, OpCode::SSTORE); main_trace.push_back(row); @@ -2487,7 +2377,7 @@ void AvmTraceBuilder::op_note_hash_exists(uint8_t indirect, uint32_t note_hash_o row.main_sel_op_note_hash_exists = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::NOTEHASHEXISTS); + gas_trace_builder.constrain_gas(clk, OpCode::NOTEHASHEXISTS); main_trace.push_back(row); @@ -2504,7 +2394,7 @@ void AvmTraceBuilder::op_emit_note_hash(uint8_t indirect, uint32_t note_hash_off row.main_sel_op_emit_note_hash = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::EMITNOTEHASH); + gas_trace_builder.constrain_gas(clk, OpCode::EMITNOTEHASH); main_trace.push_back(row); @@ -2523,7 +2413,7 @@ void AvmTraceBuilder::op_nullifier_exists(uint8_t indirect, uint32_t nullifier_o row.main_sel_op_nullifier_exists = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::NULLIFIEREXISTS); + gas_trace_builder.constrain_gas(clk, OpCode::NULLIFIEREXISTS); main_trace.push_back(row); @@ -2540,7 +2430,7 @@ void AvmTraceBuilder::op_emit_nullifier(uint8_t indirect, uint32_t nullifier_off row.main_sel_op_emit_nullifier = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::EMITNULLIFIER); + gas_trace_builder.constrain_gas(clk, OpCode::EMITNULLIFIER); main_trace.push_back(row); @@ -2558,7 +2448,7 @@ void AvmTraceBuilder::op_l1_to_l2_msg_exists(uint8_t indirect, uint32_t log_offs row.main_sel_op_l1_to_l2_msg_exists = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::L1TOL2MSGEXISTS); + gas_trace_builder.constrain_gas(clk, OpCode::L1TOL2MSGEXISTS); main_trace.push_back(row); @@ -2576,7 +2466,7 @@ void AvmTraceBuilder::op_get_contract_instance(uint8_t indirect, uint32_t addres bool tag_match = read_address.tag_match; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::GETCONTRACTINSTANCE); + gas_trace_builder.constrain_gas(clk, OpCode::GETCONTRACTINSTANCE); main_trace.push_back(Row{ .main_clk = clk, @@ -2587,12 +2477,11 @@ void AvmTraceBuilder::op_get_contract_instance(uint8_t indirect, uint32_t addres .main_pc = FF(pc++), .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_activate_gas = FF(1), // TODO: remove in the long term .main_sel_op_get_contract_instance = FF(1), .main_sel_resolve_ind_addr_a = FF(static_cast(read_address.is_indirect)), .main_tag_err = FF(static_cast(!tag_match)), }); - clk++; + // Read the contract instance ContractInstanceHint contract_instance = execution_hints.contract_instance_hints.at(read_address.val); @@ -2603,13 +2492,7 @@ void AvmTraceBuilder::op_get_contract_instance(uint8_t indirect, uint32_t addres contract_instance.contract_class_id, contract_instance.initialisation_hash, contract_instance.public_key_hash }; - write_slice_to_memory(call_ptr, - clk, - resolved_dst_offset, - AvmMemoryTag::U0, - AvmMemoryTag::FF, - internal_return_ptr, - contract_instance_vec); + write_slice_to_memory(resolved_dst_offset, AvmMemoryTag::FF, contract_instance_vec); debug("contract_instance cnt: ", side_effect_counter); side_effect_counter++; @@ -2626,13 +2509,19 @@ void AvmTraceBuilder::op_emit_unencrypted_log(uint8_t indirect, auto const clk = static_cast(main_trace.size()) + 1; // FIXME: read (and constrain) log_size_offset + auto [resolved_log_offset, resolved_log_size_offset] = + unpack_indirects<2>(indirect, { log_offset, log_size_offset }); + auto log_size = unconstrained_read_from_memory(resolved_log_size_offset); + // FIXME: we need to constrain the log_size_offset mem read (and tag check), not just one field! - Row row = create_kernel_output_opcode(indirect, clk, log_offset); + // FIXME: we shouldn't pass resolved_log_offset.offset; we should modify create_kernel_output_opcode to take an + // addresswithmode. + Row row = create_kernel_output_opcode(indirect, clk, resolved_log_offset.offset); kernel_trace_builder.op_emit_unencrypted_log(clk, side_effect_counter, row.main_ia); row.main_sel_op_emit_unencrypted_log = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::EMITUNENCRYPTEDLOG); + gas_trace_builder.constrain_gas(clk, OpCode::EMITUNENCRYPTEDLOG, static_cast(log_size)); main_trace.push_back(row); @@ -2644,14 +2533,14 @@ void AvmTraceBuilder::op_emit_l2_to_l1_msg(uint8_t indirect, uint32_t recipient_ { auto const clk = static_cast(main_trace.size()) + 1; - // Note: unorthadox order - as seen in L2ToL1Message struct in TS + // Note: unorthodox order - as seen in L2ToL1Message struct in TS Row row = create_kernel_output_opcode_with_metadata( indirect, clk, content_offset, AvmMemoryTag::FF, recipient_offset, AvmMemoryTag::FF); kernel_trace_builder.op_emit_l2_to_l1_msg(clk, side_effect_counter, row.main_ia, row.main_ib); row.main_sel_op_emit_l2_to_l1_msg = FF(1); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SENDL2TOL1MSG); + gas_trace_builder.constrain_gas(clk, OpCode::SENDL2TOL1MSG); main_trace.push_back(row); @@ -2731,7 +2620,7 @@ void AvmTraceBuilder::op_call(uint8_t indirect, .main_mem_addr_b = FF(read_gas_l2.direct_address + 1), .main_mem_addr_c = FF(read_addr.direct_address), .main_mem_addr_d = FF(read_args.direct_address), - .main_pc = FF(pc), + .main_pc = FF(pc++), .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), .main_sel_mem_op_a = FF(1), .main_sel_mem_op_b = FF(1), @@ -2743,24 +2632,16 @@ void AvmTraceBuilder::op_call(uint8_t indirect, .main_sel_resolve_ind_addr_d = FF(static_cast(read_args.is_indirect)), .main_tag_err = FF(static_cast(!tag_match)), }); - clk++; + // The return data hint is used for now, we check it has the same length as the ret_size ASSERT(hint.return_data.size() == ret_size); // Write the return data to memory - uint32_t num_rows = write_slice_to_memory( - call_ptr, clk, resolved_ret_offset, AvmMemoryTag::U0, AvmMemoryTag::FF, internal_return_ptr, hint.return_data); - clk += num_rows; + write_slice_to_memory(resolved_ret_offset, AvmMemoryTag::FF, hint.return_data); // Write the success flag to memory - write_slice_to_memory(call_ptr, - clk, - resolved_success_offset, - AvmMemoryTag::U0, - AvmMemoryTag::U8, - internal_return_ptr, - { hint.success }); + write_slice_to_memory(resolved_success_offset, AvmMemoryTag::U8, std::vector{ hint.success }); external_call_counter++; - pc++; - // Adjust the side_effect_counter to the the value at the end of the external call. + + // Adjust the side_effect_counter to the value at the end of the external call. side_effect_counter = static_cast(hint.end_side_effect_counter); } @@ -2781,6 +2662,7 @@ void AvmTraceBuilder::op_call(uint8_t indirect, */ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset, uint32_t ret_size) { + // FIXME: this is wrong. E.g., we wouldn't be charging gas. if (ret_size == 0) { halt(); return {}; @@ -2796,7 +2678,6 @@ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset // The only memory operation performed from the main trace is a possible indirect load for resolving the // direct destination offset stored in main_mem_addr_c. // All the other memory operations are triggered by the slice gadget. - if (is_operand_indirect(indirect, 0)) { indirect_flag = true; auto ind_read = @@ -2811,7 +2692,7 @@ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset } // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::RETURN); + gas_trace_builder.constrain_gas(clk, OpCode::RETURN, ret_size); main_trace.push_back(Row{ .main_clk = clk, @@ -2862,7 +2743,7 @@ void AvmTraceBuilder::op_keccak(uint8_t indirect, unpack_indirects<3>(indirect, { output_offset, input_offset, input_size_offset }); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::KECCAK); + gas_trace_builder.constrain_gas(clk, OpCode::KECCAK); // Read the input length first auto input_length_read = constrained_read_from_memory( @@ -2888,16 +2769,7 @@ void AvmTraceBuilder::op_keccak(uint8_t indirect, std::vector input; input.reserve(uint32_t(input_length_read.val)); // Read the slice length from memory - uint32_t num_main_rows = read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::U8, - AvmMemoryTag::U8, - FF(internal_return_ptr), - uint32_t(input_length_read.val), - input); - - clk += num_main_rows; + read_slice_from_memory(resolved_input_offset, uint32_t(input_length_read.val), input); std::array result = keccak_trace_builder.keccak(keccak_op_clk, input, uint32_t(input_length_read.val)); // We convert the results to field elements here @@ -2906,8 +2778,7 @@ void AvmTraceBuilder::op_keccak(uint8_t indirect, ff_result.emplace_back(result[i]); } // Write the result to memory after - write_slice_to_memory( - call_ptr, clk, resolved_output_offset, AvmMemoryTag::U8, AvmMemoryTag::U8, FF(internal_return_ptr), ff_result); + write_slice_to_memory(resolved_output_offset, AvmMemoryTag::U8, ff_result); } /** @@ -2948,7 +2819,7 @@ void AvmTraceBuilder::op_poseidon2_permutation(uint8_t indirect, uint32_t input_ } // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::POSEIDON2); + gas_trace_builder.constrain_gas(clk, OpCode::POSEIDON2); // Main trace contains on operand values from the bytecode and resolved indirects main_trace.push_back(Row{ @@ -3063,7 +2934,7 @@ void AvmTraceBuilder::op_sha256(uint8_t indirect, auto [resolved_output_offset, resolved_input_offset, resolved_input_size_offset] = unpack_indirects<3>(indirect, { output_offset, input_offset, input_size_offset }); - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SHA256); + gas_trace_builder.constrain_gas(clk, OpCode::SHA256); auto input_length_read = constrained_read_from_memory( call_ptr, clk, resolved_input_size_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IB); @@ -3087,16 +2958,8 @@ void AvmTraceBuilder::op_sha256(uint8_t indirect, std::vector input; input.reserve(uint32_t(input_length_read.val)); - uint32_t num_main_rows = read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::U8, - AvmMemoryTag::U0, - FF(internal_return_ptr), - uint32_t(input_length_read.val), - input); - clk += num_main_rows; - // + read_slice_from_memory(resolved_input_offset, uint32_t(input_length_read.val), input); + std::array result = sha256_trace_builder.sha256(input, sha256_op_clk); std::vector ff_result; @@ -3104,12 +2967,11 @@ void AvmTraceBuilder::op_sha256(uint8_t indirect, ff_result.emplace_back(result[i]); } // Write the result to memory after - write_slice_to_memory( - call_ptr, clk, resolved_output_offset, AvmMemoryTag::U0, AvmMemoryTag::U8, FF(internal_return_ptr), ff_result); + write_slice_to_memory(resolved_output_offset, AvmMemoryTag::U8, ff_result); } /** - * @brief Pedersen Hash with direct or indirect memory access. + * @brief Pedersen Hash with direct or indirect memory access. * @param indirect byte encoding information about indirect/direct memory access. * @param gen_ctx_offset An index in memory pointing to where the u32 offset for the pedersen hash generators. * @param input_offset An index in memory pointing to the first FF value of the input array to be used in the next @@ -3124,13 +2986,19 @@ void AvmTraceBuilder::op_pedersen_hash(uint8_t indirect, auto clk = static_cast(main_trace.size()) + 1; auto [resolved_gen_ctx_offset, resolved_output_offset, resolved_input_offset, resolved_input_size_offset] = unpack_indirects<4>(indirect, { gen_ctx_offset, output_offset, input_offset, input_size_offset }); + auto input_read = constrained_read_from_memory( call_ptr, clk, resolved_input_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); + // auto input_size_read = constrained_read_from_memory( + // call_ptr, clk, resolved_input_size_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IB); + // auto gen_ctx_read = constrained_read_from_memory( + // call_ptr, clk, resolved_gen_ctx_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IC); + auto input_size_read = unconstrained_read_from_memory(resolved_input_size_offset); + auto gen_ctx_read = unconstrained_read_from_memory(resolved_gen_ctx_offset); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::PEDERSEN); + gas_trace_builder.constrain_gas(clk, OpCode::PEDERSEN); - uint32_t pedersen_clk = clk; // We read the input and output addresses in one row as they should contain FF elements main_trace.push_back(Row{ .main_clk = clk, @@ -3145,43 +3013,11 @@ void AvmTraceBuilder::op_pedersen_hash(uint8_t indirect, .main_sel_resolve_ind_addr_a = FF(static_cast(input_read.is_indirect)), .main_tag_err = FF(static_cast(!input_read.tag_match)), }); - clk++; - // We read the input size and gen_ctx addresses in one row as they should contain U32 elements - auto input_size_read = constrained_read_from_memory( - call_ptr, clk, resolved_input_size_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IA); - auto gen_ctx_read = constrained_read_from_memory( - call_ptr, clk, resolved_gen_ctx_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IB); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = input_size_read.val, - .main_ib = gen_ctx_read.val, - .main_ind_addr_a = FF(input_size_read.indirect_address), - .main_ind_addr_b = FF(gen_ctx_read.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(input_size_read.direct_address), - .main_mem_addr_b = FF(gen_ctx_read.direct_address), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U32)), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(input_size_read.is_indirect)), - .main_sel_resolve_ind_addr_b = FF(static_cast(gen_ctx_read.is_indirect)), - }); - clk++; std::vector inputs; - uint32_t num_main_rows = read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::FF, - AvmMemoryTag::FF, - FF(internal_return_ptr), - uint32_t(input_size_read.val), - inputs); - clk += num_main_rows; - FF output = pedersen_trace_builder.pedersen_hash(inputs, uint32_t(gen_ctx_read.val), pedersen_clk); - write_slice_to_memory( - call_ptr, clk, resolved_output_offset, AvmMemoryTag::FF, AvmMemoryTag::FF, FF(internal_return_ptr), { output }); + read_slice_from_memory(resolved_input_offset, uint32_t(input_size_read), inputs); + FF output = pedersen_trace_builder.pedersen_hash(inputs, uint32_t(gen_ctx_read), clk); + write_slice_to_memory(resolved_output_offset, AvmMemoryTag::FF, std::vector{ output }); } void AvmTraceBuilder::op_ec_add(uint8_t indirect, @@ -3209,117 +3045,40 @@ void AvmTraceBuilder::op_ec_add(uint8_t indirect, rhs_is_inf_offset, output_offset }); // Load lhs point - auto lhs_x_read = constrained_read_from_memory( - call_ptr, clk, resolved_lhs_x_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); - auto lhs_y_read = constrained_read_from_memory( - call_ptr, clk, resolved_lhs_y_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IB); + auto lhs_x_read = unconstrained_read_from_memory(resolved_lhs_x_offset); + auto lhs_y_read = unconstrained_read_from_memory(resolved_lhs_y_offset); // Load rhs point - auto rhs_x_read = constrained_read_from_memory( - call_ptr, clk, resolved_rhs_x_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IC); - auto rhs_y_read = constrained_read_from_memory( - call_ptr, clk, resolved_rhs_y_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::ID); - bool tag_match = lhs_x_read.tag_match && lhs_y_read.tag_match && rhs_x_read.tag_match && rhs_y_read.tag_match; - - // Save this clk time to line up with the gadget op. - auto ecc_clk = clk; - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = lhs_x_read.val, - .main_ib = lhs_y_read.val, - .main_ic = rhs_x_read.val, - .main_id = rhs_y_read.val, - .main_ind_addr_a = FF(lhs_x_read.indirect_address), - .main_ind_addr_b = FF(lhs_y_read.indirect_address), - .main_ind_addr_c = FF(rhs_x_read.indirect_address), - .main_ind_addr_d = FF(rhs_y_read.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(lhs_x_read.direct_address), - .main_mem_addr_b = FF(lhs_y_read.direct_address), - .main_mem_addr_c = FF(rhs_x_read.direct_address), - .main_mem_addr_d = FF(rhs_y_read.direct_address), - .main_pc = FF(pc++), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_mem_op_c = FF(1), - .main_sel_mem_op_d = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(lhs_x_read.is_indirect)), - .main_sel_resolve_ind_addr_b = FF(static_cast(lhs_y_read.is_indirect)), - .main_sel_resolve_ind_addr_c = FF(static_cast(rhs_x_read.is_indirect)), - .main_sel_resolve_ind_addr_d = FF(static_cast(rhs_y_read.is_indirect)), - .main_tag_err = FF(static_cast(!tag_match)), - }); - clk++; + auto rhs_x_read = unconstrained_read_from_memory(resolved_rhs_x_offset); + auto rhs_y_read = unconstrained_read_from_memory(resolved_rhs_y_offset); // Load the infinite bools separately since they have a different memory tag - auto lhs_is_inf_read = constrained_read_from_memory( - call_ptr, clk, resolved_lhs_is_inf_offset, AvmMemoryTag::U8, AvmMemoryTag::U0, IntermRegister::IA); - auto rhs_is_inf_read = constrained_read_from_memory( - call_ptr, clk, resolved_rhs_is_inf_offset, AvmMemoryTag::U8, AvmMemoryTag::U0, IntermRegister::IB); - bool tag_match_inf = lhs_is_inf_read.tag_match && rhs_is_inf_read.tag_match; + auto lhs_is_inf_read = unconstrained_read_from_memory(resolved_lhs_is_inf_offset); + auto rhs_is_inf_read = unconstrained_read_from_memory(resolved_rhs_is_inf_offset); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = lhs_is_inf_read.val, - .main_ib = rhs_is_inf_read.val, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(lhs_is_inf_offset), - .main_mem_addr_b = FF(rhs_is_inf_offset), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U8)), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_tag_err = FF(static_cast(!tag_match_inf)), - }); - clk++; - grumpkin::g1::affine_element lhs = uint8_t(lhs_is_inf_read.val) == 1 + grumpkin::g1::affine_element lhs = uint8_t(lhs_is_inf_read) == 1 ? grumpkin::g1::affine_element::infinity() - : grumpkin::g1::affine_element{ lhs_x_read.val, lhs_y_read.val }; - grumpkin::g1::affine_element rhs = uint8_t(rhs_is_inf_read.val) == 1 + : grumpkin::g1::affine_element{ lhs_x_read, lhs_y_read }; + grumpkin::g1::affine_element rhs = uint8_t(rhs_is_inf_read) == 1 ? grumpkin::g1::affine_element::infinity() - : grumpkin::g1::affine_element{ rhs_x_read.val, rhs_y_read.val }; - auto result = ecc_trace_builder.embedded_curve_add(lhs, rhs, ecc_clk); + : grumpkin::g1::affine_element{ rhs_x_read, rhs_y_read }; + auto result = ecc_trace_builder.embedded_curve_add(lhs, rhs, clk); - // Write point coordinates - auto write_x = constrained_write_to_memory( - call_ptr, clk, resolved_output_offset, result.x, AvmMemoryTag::U0, AvmMemoryTag::FF, IntermRegister::IA); - // Write y (directly) using the write_x.direct_address + 1 - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IB, write_x.direct_address + 1, result.y, AvmMemoryTag::U0, AvmMemoryTag::FF); main_trace.push_back(Row{ .main_clk = clk, - .main_ia = result.x, - .main_ib = result.y, - .main_ind_addr_a = FF(write_x.indirect_address), .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address), - .main_mem_addr_b = FF(write_x.direct_address + 1), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_rwb = FF(1), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(write_x.is_indirect)), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), + .main_pc = FF(pc++), + .main_tag_err = FF(0), }); - clk++; - mem_trace_builder.write_into_memory(call_ptr, - clk, - IntermRegister::IA, - write_x.direct_address + 2, - result.is_point_at_infinity(), - AvmMemoryTag::U0, - AvmMemoryTag::U8); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = result.is_point_at_infinity(), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address + 2), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_sel_mem_op_a = FF(1), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::U8)), - }); + gas_trace_builder.constrain_gas(clk, OpCode::ECADD); + + // Write point coordinates + auto out_addr_direct = + resolved_output_offset.mode == AddressingMode::DIRECT + ? resolved_output_offset.offset + : static_cast(mem_trace_builder.unconstrained_read(call_ptr, resolved_output_offset.offset)); + write_to_memory(out_addr_direct, result.x, AvmMemoryTag::FF); + write_to_memory(out_addr_direct + 1, result.y, AvmMemoryTag::FF); + write_to_memory(out_addr_direct + 2, result.is_point_at_infinity(), AvmMemoryTag::U8); } void AvmTraceBuilder::op_variable_msm(uint8_t indirect, @@ -3332,28 +3091,20 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, auto [resolved_points_offset, resolved_scalars_offset, resolved_output_offset] = unpack_indirects<3>(indirect, { points_offset, scalars_offset, output_offset }); - auto points_length_read = mem_trace_builder.read_and_load_from_memory( - call_ptr, clk, IntermRegister::IA, point_length_offset, AvmMemoryTag::U32, AvmMemoryTag::U0); - - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = points_length_read.val, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(point_length_offset), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U32)), - .main_sel_mem_op_a = FF(1), - .main_tag_err = FF(static_cast(!points_length_read.tag_match)), - }); - clk++; + auto points_length = unconstrained_read_from_memory(point_length_offset); // Points are stored as [x1, y1, inf1, x2, y2, inf2, ...] with the types [FF, FF, U8, FF, FF, U8, ...] - uint32_t num_points = uint32_t(points_length_read.val) / 3; // 3 elements per point + uint32_t num_points = uint32_t(points_length) / 3; // 3 elements per point // We need to split up the reads due to the memory tags, std::vector points_coords_vec; std::vector points_inf_vec; std::vector scalars_vec; - AddressWithMode coords_offset = resolved_points_offset; + + AddressWithMode coords_offset_direct = + resolved_points_offset.mode == AddressingMode::DIRECT + ? resolved_points_offset + : static_cast(mem_trace_builder.unconstrained_read(call_ptr, resolved_points_offset.offset)); + // Loading the points is a bit more complex since we need to read the coordinates and the infinity flags // separately The current circuit constraints does not allow for multiple memory tags to be loaded from within // the same row. If we could we would be able to replace the following loops with a single read_slice_to_memory @@ -3362,67 +3113,18 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, // Read the coordinates first, +2 since we read 2 points per row, the first load could be indirect for (uint32_t i = 0; i < num_points; i++) { - auto point_x1_read = constrained_read_from_memory( - call_ptr, clk, coords_offset, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); - auto point_y1_read = mem_trace_builder.read_and_load_from_memory( - call_ptr, clk, IntermRegister::IB, point_x1_read.direct_address + 1, AvmMemoryTag::FF, AvmMemoryTag::U0); - - bool tag_match = point_x1_read.tag_match && point_y1_read.tag_match; - points_coords_vec.insert(points_coords_vec.end(), { point_x1_read.val, point_y1_read.val }); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = point_x1_read.val, - .main_ib = point_y1_read.val, - .main_ind_addr_a = FF(point_x1_read.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(point_x1_read.direct_address), - .main_mem_addr_b = FF(point_x1_read.direct_address + 1), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(point_x1_read.is_indirect)), - .main_tag_err = FF(static_cast(!tag_match)), - }); - clk++; - // Update the coords offset to read the next point (subsequent points are always direct and separated by 3 - // addresses) - coords_offset = { AddressingMode::DIRECT, point_x1_read.direct_address + 3 }; - } - uint32_t inf_direct_address = resolved_points_offset.offset + 2; - // Read the Infinities flags - for (uint32_t i = 0; i < num_points; i++) { - auto point_inf_read = mem_trace_builder.read_and_load_from_memory( - call_ptr, clk, IntermRegister::IA, inf_direct_address, AvmMemoryTag::U8, AvmMemoryTag::U0); - points_inf_vec.emplace_back(point_inf_read.val); - - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = point_inf_read.val, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(inf_direct_address), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U8)), - .main_sel_mem_op_a = FF(1), - .main_tag_err = FF(static_cast(!point_inf_read.tag_match)), - }); - clk++; - // Update the inf offset to read the next point (subsequent points are always direct and separated by 3 - inf_direct_address += 3; + auto point_x1 = unconstrained_read_from_memory(coords_offset_direct + 3 * i); + auto point_y1 = unconstrained_read_from_memory(coords_offset_direct + 3 * i + 1); + auto infty = unconstrained_read_from_memory(coords_offset_direct + 3 * i + 2); + points_coords_vec.insert(points_coords_vec.end(), { point_x1, point_y1 }); + points_inf_vec.emplace_back(infty); } // Scalar read length is num_points* 2 since scalars are stored as lo and hi limbs uint32_t scalar_read_length = num_points * 2; // Scalars are easy to read since they are stored as [lo1, hi1, lo2, hi2, ...] with the types [FF, FF, FF,FF, // ...] - auto num_scalar_rows = read_slice_to_memory(call_ptr, - clk, - resolved_scalars_offset, - AvmMemoryTag::FF, - AvmMemoryTag::U0, - FF(internal_return_ptr), - scalar_read_length, - scalars_vec); - clk += num_scalar_rows; + read_slice_from_memory(resolved_scalars_offset, scalar_read_length, scalars_vec); + // Reconstruct Grumpkin points std::vector points; for (size_t i = 0; i < num_points; i++) { @@ -3447,49 +3149,24 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, } // Perform the variable MSM - could just put the logic in here since there are no constraints. auto result = ecc_trace_builder.variable_msm(points, scalars, clk); - // Write the result back to memory [x, y, inf] with tags [FF, FF, U8] - auto write_x = constrained_write_to_memory( - call_ptr, clk, resolved_output_offset, result.x, AvmMemoryTag::U0, AvmMemoryTag::FF, IntermRegister::IA); - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IB, write_x.direct_address + 1, result.y, AvmMemoryTag::U0, AvmMemoryTag::FF); main_trace.push_back(Row{ .main_clk = clk, - .main_ia = result.x, - .main_ib = result.y, - .main_ind_addr_a = FF(write_x.indirect_address), .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address), - .main_mem_addr_b = FF(write_x.direct_address + 1), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_rwb = FF(1), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(write_x.is_indirect)), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), - }); - clk++; - // Write the infinity - mem_trace_builder.write_into_memory(call_ptr, - clk, - IntermRegister::IA, - write_x.direct_address + 2, - result.is_point_at_infinity(), - AvmMemoryTag::U0, - AvmMemoryTag::U8); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = static_cast(result.is_point_at_infinity()), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address + 2), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_sel_mem_op_a = FF(1), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::U8)), + .main_pc = FF(pc++), + .main_tag_err = FF(0), }); - pc++; + gas_trace_builder.constrain_gas(clk, OpCode::MSM); + + // Write the result back to memory [x, y, inf] with tags [FF, FF, U8] + AddressWithMode output_offset_direct = + resolved_output_offset.mode == AddressingMode::DIRECT + ? resolved_output_offset + : static_cast(mem_trace_builder.unconstrained_read(call_ptr, resolved_output_offset.offset)); + write_to_memory(output_offset_direct, result.x, AvmMemoryTag::FF); + write_to_memory(output_offset_direct + 1, result.y, AvmMemoryTag::FF); + write_to_memory(output_offset_direct + 2, result.is_point_at_infinity(), AvmMemoryTag::U8); } void AvmTraceBuilder::op_pedersen_commit(uint8_t indirect, @@ -3502,85 +3179,31 @@ void AvmTraceBuilder::op_pedersen_commit(uint8_t indirect, auto [resolved_input_offset, resolved_output_offset, resolved_input_size_offset, resolved_gen_ctx_offset] = unpack_indirects<4>(indirect, { input_offset, output_offset, input_size_offset, gen_ctx_offset }); - auto input_length_read = constrained_read_from_memory( - call_ptr, clk, resolved_input_size_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IA); - auto gen_ctx_read = constrained_read_from_memory( - call_ptr, clk, resolved_gen_ctx_offset, AvmMemoryTag::U32, AvmMemoryTag::U0, IntermRegister::IB); - - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = input_length_read.val, - .main_ib = gen_ctx_read.val, - .main_ind_addr_a = FF(input_length_read.indirect_address), - .main_ind_addr_b = FF(gen_ctx_read.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(input_length_read.direct_address), - .main_mem_addr_b = FF(gen_ctx_read.direct_address), - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U32)), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(input_length_read.is_indirect)), - .main_sel_resolve_ind_addr_b = FF(static_cast(gen_ctx_read.is_indirect)), - }); - clk++; + auto input_length_read = unconstrained_read_from_memory(resolved_input_size_offset); + auto gen_ctx_read = unconstrained_read_from_memory(resolved_gen_ctx_offset); std::vector inputs; - auto num_rows = read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::FF, - AvmMemoryTag::U0, - FF(internal_return_ptr), - uint32_t(input_length_read.val), - inputs); - clk += num_rows; - - grumpkin::g1::affine_element result = - crypto::pedersen_commitment::commit_native(inputs, uint32_t(gen_ctx_read.val)); + read_slice_from_memory(resolved_input_offset, uint32_t(input_length_read), inputs); - auto write_x = constrained_write_to_memory( - call_ptr, clk, resolved_output_offset, result.x, AvmMemoryTag::U0, AvmMemoryTag::FF, IntermRegister::IA); - - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IB, write_x.direct_address + 1, result.y, AvmMemoryTag::U0, AvmMemoryTag::FF); + grumpkin::g1::affine_element result = crypto::pedersen_commitment::commit_native(inputs, uint32_t(gen_ctx_read)); main_trace.push_back(Row{ .main_clk = clk, - .main_ia = result.x, - .main_ib = result.y, - .main_ind_addr_a = FF(write_x.indirect_address), .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address), - .main_mem_addr_b = FF(write_x.direct_address + 1), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_rwb = FF(1), - .main_sel_mem_op_a = FF(1), - .main_sel_mem_op_b = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(write_x.is_indirect)), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), + .main_pc = FF(pc++), + .main_tag_err = FF(0), }); - clk++; - mem_trace_builder.write_into_memory(call_ptr, - clk, - IntermRegister::IA, - write_x.direct_address + 2, - result.is_point_at_infinity(), - AvmMemoryTag::U0, - AvmMemoryTag::U8); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = static_cast(result.is_point_at_infinity()), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(write_x.direct_address + 2), - .main_pc = FF(pc), - .main_rwa = FF(1), - .main_sel_mem_op_a = FF(1), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::U8)), - }); - pc++; + gas_trace_builder.constrain_gas(clk, OpCode::PEDERSENCOMMITMENT); + + // Write the result back to memory [x, y, inf] with tags [FF, FF, U8] + AddressWithMode output_offset_direct = + resolved_output_offset.mode == AddressingMode::DIRECT + ? resolved_output_offset + : static_cast(mem_trace_builder.unconstrained_read(call_ptr, resolved_output_offset.offset)); + write_to_memory(output_offset_direct, result.x, AvmMemoryTag::FF); + write_to_memory(output_offset_direct + 1, result.y, AvmMemoryTag::FF); + write_to_memory(output_offset_direct + 2, result.is_point_at_infinity(), AvmMemoryTag::U8); } /************************************************************************************************** @@ -3617,7 +3240,7 @@ void AvmTraceBuilder::op_to_radix_le( : std::vector(num_limbs, 0); // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::TORADIXLE); + gas_trace_builder.constrain_gas(clk, OpCode::TORADIXLE, num_limbs); // This is the row that contains the selector to trigger the sel_op_radix_le // In this row, we read the input value and the destination address into register A and B respectively @@ -3642,18 +3265,8 @@ void AvmTraceBuilder::op_to_radix_le( .main_sel_resolve_ind_addr_b = FF(static_cast(read_dst.is_indirect)), .main_w_in_tag = FF(static_cast(AvmMemoryTag::U8)), }); - // Increment the clock so we dont write at the same clock cycle - // Instead we temporarily encode the writes into the subsequent rows of the main trace - clk++; - // MemTrace, write into memory value b from intermediate register ib. - std::vector ff_res = {}; - ff_res.reserve(res.size()); - for (auto const& limb : res) { - ff_res.emplace_back(limb); - } - write_slice_to_memory( - call_ptr, clk, resolved_dst_offset, AvmMemoryTag::FF, AvmMemoryTag::U8, FF(internal_return_ptr), ff_res); + write_slice_to_memory(resolved_dst_offset, AvmMemoryTag::U8, res); } /************************************************************************************************** @@ -3691,7 +3304,7 @@ void AvmTraceBuilder::op_sha256_compression(uint8_t indirect, bool tag_match = read_a.tag_match && read_b.tag_match; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::SHA256COMPRESSION); + gas_trace_builder.constrain_gas(clk, OpCode::SHA256COMPRESSION); // Since the above adds mem_reads in the mem_trace_builder at clk, we need to follow up resolving the reads in // the main trace at the same clk cycle to preserve the cross-table permutation @@ -3729,28 +3342,9 @@ void AvmTraceBuilder::op_sha256_compression(uint8_t indirect, // Input for hash is expanded to 512 bits std::vector input_vec; // Read results are written to h_init array. - read_slice_to_memory(call_ptr, - clk, - resolved_h_init_offset, - AvmMemoryTag::U32, - AvmMemoryTag::U32, - FF(internal_return_ptr), - 8, - h_init_vec); - - // Increment the clock by 2 since (8 reads / 4 reads per row = 2) - clk += 2; + read_slice_from_memory(resolved_h_init_offset, 8, h_init_vec); // Read results are written to input array - read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::U32, - AvmMemoryTag::U32, - FF(internal_return_ptr), - 16, - input_vec); - // Increment the clock by 4 since (16 / 4 = 4) - clk += 4; + read_slice_from_memory(resolved_input_offset, 16, input_vec); // Now that we have read all the values, we can perform the operation to get the resulting witness. // Note: We use the sha_op_clk to ensure that the sha256 operation is performed at the same clock cycle as the @@ -3766,13 +3360,7 @@ void AvmTraceBuilder::op_sha256_compression(uint8_t indirect, } // Write the result to memory after - write_slice_to_memory(call_ptr, - clk, - resolved_output_offset, - AvmMemoryTag::U32, - AvmMemoryTag::U32, - FF(internal_return_ptr), - ff_result); + write_slice_to_memory(resolved_output_offset, AvmMemoryTag::U32, ff_result); } /** @@ -3791,7 +3379,7 @@ void AvmTraceBuilder::op_sha256_compression(uint8_t indirect, void AvmTraceBuilder::op_keccakf1600(uint8_t indirect, uint32_t output_offset, uint32_t input_offset, - uint32_t input_size_offset) + [[maybe_unused]] uint32_t input_size_offset) { // What happens if the input_size_offset is > 25 when the state is more that that? auto clk = static_cast(main_trace.size()) + 1; @@ -3804,7 +3392,7 @@ void AvmTraceBuilder::op_keccakf1600(uint8_t indirect, bool tag_match = input_read.tag_match && output_read.tag_match; // Constrain gas cost - gas_trace_builder.constrain_gas_lookup(clk, OpCode::KECCAKF1600); + gas_trace_builder.constrain_gas(clk, OpCode::KECCAKF1600); main_trace.push_back(Row{ .main_clk = clk, @@ -3824,53 +3412,19 @@ void AvmTraceBuilder::op_keccakf1600(uint8_t indirect, .main_sel_resolve_ind_addr_c = FF(static_cast(output_read.is_indirect)), .main_tag_err = FF(static_cast(!tag_match)), }); - // We store the current clk this main trace row occurred so that we can line up the keccak gadget operation - // at the same clk later. - auto keccak_op_clk = clk; - // We need to increment the clk - clk++; - auto input_length_read = mem_trace_builder.read_and_load_from_memory( - call_ptr, clk, IntermRegister::IB, input_size_offset, AvmMemoryTag::U32, AvmMemoryTag::U0); - main_trace.push_back(Row{ - .main_clk = clk, - .main_ib = input_length_read.val, // Message Length - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_b = FF(input_size_offset), // length - .main_pc = FF(pc), - .main_r_in_tag = FF(static_cast(AvmMemoryTag::U32)), - .main_sel_mem_op_b = FF(1), - .main_tag_err = FF(static_cast(!input_length_read.tag_match)), - }); - clk++; + // Array input is fixed to 1600 bits std::vector input_vec; // Read results are written to input array - uint32_t num_main_rows = read_slice_to_memory(call_ptr, - clk, - resolved_input_offset, - AvmMemoryTag::U64, - AvmMemoryTag::U0, - FF(internal_return_ptr), - 25, - input_vec); - + read_slice_from_memory(resolved_input_offset, 25, input_vec); std::array input = vec_to_arr(input_vec); - // Increment the clock by 7 since (25 reads / 4 reads per row = 7) - clk += num_main_rows; // Now that we have read all the values, we can perform the operation to get the resulting witness. // Note: We use the keccak_op_clk to ensure that the keccakf1600 operation is performed at the same clock cycle // as the main trace that has the selector - std::array result = keccak_trace_builder.keccakf1600(keccak_op_clk, input); - // We convert the results to field elements here - std::vector ff_result; - for (uint32_t i = 0; i < 25; i++) { - ff_result.emplace_back(result[i]); - } - + std::array result = keccak_trace_builder.keccakf1600(clk, input); // Write the result to memory after - write_slice_to_memory( - call_ptr, clk, resolved_output_offset, AvmMemoryTag::U0, AvmMemoryTag::U64, FF(internal_return_ptr), ff_result); + write_slice_to_memory(resolved_output_offset, AvmMemoryTag::U64, result); } /************************************************************************************************** @@ -3919,8 +3473,8 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c // If the bin_trace_size has entries, we need the main_trace to be as big as our byte lookup table (3 * // 2**16 long) size_t const lookup_table_size = (bin_trace_size > 0 && range_check_required) ? 3 * (1 << 16) : 0; - // Range check size is 1 less than it needs to be since we insert a "first row" at the top of the trace at the end, - // with clk 0 (this doubles as our range check) + // Range check size is 1 less than it needs to be since we insert a "first row" at the top of the trace at the + // end, with clk 0 (this doubles as our range check) size_t const range_check_size = range_check_required ? UINT16_MAX : 0; std::vector trace_sizes = { mem_trace_size, main_trace_size, alu_trace_size, range_check_size, conv_trace_size, lookup_table_size, @@ -4266,9 +3820,8 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c for (size_t i = 0; i < poseidon2_trace_size; i++) { auto& dest = main_trace.at(i); auto const& src = poseidon2_trace.at(i); - auto canonical_trace_row = bb::avm_trace::AvmPoseidon2TraceBuilder::into_canonical(src); dest.poseidon2_clk = FF(src.clk); - poseidon2_trace_builder.merge_into(dest, canonical_trace_row); + merge_into(dest, src); } // Add KeccakF1600 Gadget table @@ -4398,14 +3951,9 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c // Assume that gas_trace entries are ordered by a strictly increasing clk sequence. for (auto const& gas_entry : gas_trace) { - // Filling potential gap between two gas_trace entries - // Remaining gas values remain unchanged. - while (gas_entry.clk > current_clk) { - auto& next = main_trace.at(current_clk); - next.main_l2_gas_remaining = current_l2_gas_remaining; - next.main_da_gas_remaining = current_da_gas_remaining; - current_clk++; - } + // There should be no gaps in the gas_trace. + ASSERT(gas_entry.clk == current_clk); + // << "No gas entry for opcode" << next.main_opcode_val << "at clk" << current_clk; auto& dest = main_trace.at(gas_entry.clk - 1); auto& next = main_trace.at(gas_entry.clk); @@ -4426,17 +3974,13 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c dest.main_abs_da_rem_gas_hi = abs_da_gas_remaining >> 16; dest.main_abs_l2_rem_gas_lo = static_cast(abs_l2_gas_remaining); dest.main_abs_da_rem_gas_lo = static_cast(abs_da_gas_remaining); + dest.main_sel_gas_accounting_active = FF(1); - // TODO: gas is not constrained for external call at this time - if (gas_entry.opcode != OpCode::CALL) { - dest.main_sel_gas_accounting_active = FF(1); - - // lookups counting - rem_gas_rng_check_counts[L2_HI_GAS_COUNTS_IDX][static_cast(dest.main_abs_l2_rem_gas_hi)]++; - rem_gas_rng_check_counts[L2_LO_GAS_COUNTS_IDX][static_cast(dest.main_abs_l2_rem_gas_lo)]++; - rem_gas_rng_check_counts[DA_HI_GAS_COUNTS_IDX][static_cast(dest.main_abs_da_rem_gas_hi)]++; - rem_gas_rng_check_counts[DA_LO_GAS_COUNTS_IDX][static_cast(dest.main_abs_da_rem_gas_lo)]++; - } + // lookups counting + rem_gas_rng_check_counts[L2_HI_GAS_COUNTS_IDX][static_cast(dest.main_abs_l2_rem_gas_hi)]++; + rem_gas_rng_check_counts[L2_LO_GAS_COUNTS_IDX][static_cast(dest.main_abs_l2_rem_gas_lo)]++; + rem_gas_rng_check_counts[DA_HI_GAS_COUNTS_IDX][static_cast(dest.main_abs_da_rem_gas_hi)]++; + rem_gas_rng_check_counts[DA_LO_GAS_COUNTS_IDX][static_cast(dest.main_abs_da_rem_gas_lo)]++; dest.main_l2_out_of_gas = static_cast(l2_out_of_gas); dest.main_da_out_of_gas = static_cast(da_out_of_gas); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp index ff06295cc39..c5404ec1a03 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp @@ -29,8 +29,18 @@ struct AddressWithMode { AddressingMode mode; uint32_t offset; + AddressWithMode() = default; + AddressWithMode(uint32_t offset) + : mode(AddressingMode::DIRECT) + , offset(offset) + {} + AddressWithMode(AddressingMode mode, uint32_t offset) + : mode(mode) + , offset(offset) + {} + // Dont mutate - AddressWithMode operator+(uint val) { return { mode, offset + val }; } + AddressWithMode operator+(uint val) const noexcept { return { mode, offset + val }; } }; // This is the internal context that we keep along the lifecycle of bytecode execution @@ -102,6 +112,8 @@ class AvmTraceBuilder { // Machine State - Memory void op_set(uint8_t indirect, uint128_t val, uint32_t dst_offset, AvmMemoryTag in_tag); + // TODO: only used for write_slice_to_memory. Remove. + void op_set_internal(uint8_t indirect, FF val_ff, uint32_t dst_offset, AvmMemoryTag in_tag); void op_mov(uint8_t indirect, uint32_t src_offset, uint32_t dst_offset); void op_cmov(uint8_t indirect, uint32_t a_offset, uint32_t b_offset, uint32_t cond_offset, uint32_t dst_offset); @@ -256,23 +268,11 @@ class AvmTraceBuilder { IntermRegister reg, AvmMemTraceBuilder::MemOpOwner mem_op_owner = AvmMemTraceBuilder::MAIN); - // TODO(ilyas: #6383): Temporary way to bulk read slices - template - uint32_t read_slice_to_memory(uint8_t space_id, - uint32_t clk, - AddressWithMode addr, - AvmMemoryTag r_tag, - AvmMemoryTag w_tag, - FF internal_return_ptr, - size_t slice_len, - std::vector& slice); - uint32_t write_slice_to_memory(uint8_t space_id, - uint32_t clk, - AddressWithMode addr, - AvmMemoryTag r_tag, - AvmMemoryTag w_tag, - FF internal_return_ptr, - std::vector const& slice); + // TODO: remove these once everything is constrained. + FF unconstrained_read_from_memory(AddressWithMode addr); + template void read_slice_from_memory(AddressWithMode addr, size_t slice_len, std::vector& slice); + void write_to_memory(AddressWithMode addr, FF val, AvmMemoryTag w_tag); + template void write_slice_to_memory(AddressWithMode addr, AvmMemoryTag w_tag, const T& slice); }; } // namespace bb::avm_trace diff --git a/barretenberg/ts/scripts/build_wasm.sh b/barretenberg/ts/scripts/build_wasm.sh index 77a9fa8a314..d7aa1e0dee0 100755 --- a/barretenberg/ts/scripts/build_wasm.sh +++ b/barretenberg/ts/scripts/build_wasm.sh @@ -14,7 +14,7 @@ fi # We only need the threads wasm, as node always uses threads. # We need to take two copies for both esm and cjs builds. You can't use symlinks when publishing. # This probably isn't a big deal however due to compression. -# When building the the browser bundle, both wasms are inlined directly. +# When building the browser bundle, both wasms are inlined directly. mkdir -p ./dest/node/barretenberg_wasm mkdir -p ./dest/node-cjs/barretenberg_wasm cp ../cpp/build-wasm-threads/bin/barretenberg.wasm ./dest/node/barretenberg_wasm/barretenberg-threads.wasm diff --git a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs index 41508fd371b..eb3ad699576 100644 --- a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs @@ -1,18 +1,9 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use handlebars::Handlebars; use serde_json::json; pub trait CircuitBuilder { - fn create_circuit_builder_hpp( - &mut self, - name: &str, - relations: &[String], - permutations: &[String], - all_cols_without_inverses: &[String], - all_cols: &[String], - to_be_shifted: &[String], - ); - + fn create_circuit_builder_hpp(&mut self, name: &str); fn create_circuit_builder_cpp(&mut self, name: &str, all_cols_without_inverses: &[String]); fn create_full_row_hpp(&mut self, name: &str, all_cols: &[String]); @@ -20,24 +11,11 @@ pub trait CircuitBuilder { } impl CircuitBuilder for BBFiles { - fn create_circuit_builder_hpp( - &mut self, - name: &str, - relations: &[String], - permutations: &[String], - all_cols_without_inverses: &[String], - all_cols: &[String], - to_be_shifted: &[String], - ) { + fn create_circuit_builder_hpp(&mut self, name: &str) { let mut handlebars = Handlebars::new(); let data = &json!({ "name": name, - "relations": relations, - "permutations": permutations, - "all_cols_without_inverses": all_cols_without_inverses, - "all_cols": all_cols, - "to_be_shifted": to_be_shifted, }); handlebars diff --git a/bb-pilcom/bb-pil-backend/src/composer_builder.rs b/bb-pilcom/bb-pil-backend/src/composer_builder.rs index f913327a9e8..5e12155afe6 100644 --- a/bb-pilcom/bb-pil-backend/src/composer_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/composer_builder.rs @@ -1,4 +1,4 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use handlebars::Handlebars; use serde_json::json; diff --git a/bb-pilcom/bb-pil-backend/src/expression_evaluation.rs b/bb-pilcom/bb-pil-backend/src/expression_evaluation.rs new file mode 100644 index 00000000000..1b96943a01e --- /dev/null +++ b/bb-pilcom/bb-pil-backend/src/expression_evaluation.rs @@ -0,0 +1,134 @@ +use crate::utils::{format_field, sanitize_name}; +use itertools::Itertools; + +use std::collections::{HashMap, HashSet}; + +use powdr_ast::analyzed::{ + AlgebraicBinaryOperation, AlgebraicBinaryOperator, AlgebraicExpression, + AlgebraicUnaryOperation, AlgebraicUnaryOperator, Analyzed, Symbol, +}; +use powdr_number::FieldElement; + +pub fn get_alias_expressions_in_order( + alias_polys_in_order: &Vec<(&Symbol, &AlgebraicExpression)>, +) -> Vec<(String, u64, String)> { + let aliases_hash = alias_polys_in_order + .iter() + .map(|(sym, expr)| (&sym.absolute_name, *expr)) + .collect::>(); + + alias_polys_in_order + .iter() + .map(|(sym, _)| { + let (degree, expr) = + get_alias_expression_and_degree(sym.absolute_name.as_str(), &aliases_hash); + (sanitize_name(&sym.absolute_name), degree, expr) + }) + .collect_vec() +} + +pub fn get_alias_polys_in_order( + analyzed: &Analyzed, +) -> Vec<(&Symbol, &AlgebraicExpression)> { + analyzed + .intermediate_polys_in_source_order() + .iter() + .map(|(s, exprs)| { + ( + s, + // Only support the first expression for now. + // I don't even know what more than one means. + exprs.first().unwrap(), + ) + }) + .collect_vec() +} + +pub fn get_alias_expression_and_degree( + alias_name: &str, + aliases: &HashMap<&String, &AlgebraicExpression>, +) -> (u64, String) { + let (degree, expression, _) = + recurse_expression(aliases.get(&alias_name.to_owned()).unwrap(), aliases, false); + (degree, expression) +} + +// Returns (degree, expression, transitive aliases) +// Will always return all the used aliases. +// Aliases are sanitized. +pub fn recurse_expression( + top_expr: &AlgebraicExpression, + aliases: &HashMap<&String, &AlgebraicExpression>, + inline_aliases: bool, +) -> (u64, String, HashSet) { + match top_expr { + AlgebraicExpression::Number(n) => (0, format_field(n), HashSet::new()), + AlgebraicExpression::Reference(polyref) => { + if aliases.contains_key(&polyref.name) { + let alias_expr = aliases.get(&polyref.name).unwrap(); + let (d, expr, mut rec_aliases) = + recurse_expression(alias_expr, aliases, inline_aliases); + let sanitized_name = sanitize_name(&polyref.name); + rec_aliases.insert(sanitized_name.clone()); + if inline_aliases { + (d, expr, rec_aliases) + } else { + (d, sanitized_name, rec_aliases) + } + } else { + let mut poly_name = sanitize_name(&polyref.name); + if polyref.next { + poly_name = format!("{}_shift", poly_name); + } + (1, format!("new_term.{}", poly_name), HashSet::new()) + } + } + AlgebraicExpression::BinaryOperation(AlgebraicBinaryOperation { + left: lhe, + op, + right: rhe, + }) => { + let (ld, lhs, lhs_aliases) = recurse_expression(lhe, aliases, inline_aliases); + let (rd, rhs, rhs_aliases) = recurse_expression(rhe, aliases, inline_aliases); + let joined_aliases = lhs_aliases.union(&rhs_aliases).cloned().collect(); + + match op { + AlgebraicBinaryOperator::Add => ( + std::cmp::max(ld, rd), + format!("({} + {})", lhs, rhs), + joined_aliases, + ), + AlgebraicBinaryOperator::Sub => + // There seem to be many cases where the rhs is a 0, try to avoid it. + { + if **rhe == AlgebraicExpression::Number(F::zero()) { + (ld, lhs, joined_aliases) + } else { + ( + std::cmp::max(ld, rd), + format!("({} - {})", lhs, rhs), + joined_aliases, + ) + } + } + AlgebraicBinaryOperator::Mul => { + (ld + rd, format!("({} * {})", lhs, rhs), joined_aliases) + } + _ => unimplemented!("{:?}", op), + } + } + AlgebraicExpression::UnaryOperation(AlgebraicUnaryOperation { + op: operator, + expr: rec_expr, + }) => match operator { + AlgebraicUnaryOperator::Minus => { + let (d, e, rec_aliases) = recurse_expression(rec_expr, aliases, inline_aliases); + (d, format!("-{}", e), rec_aliases) + } + }, + // Not currently used + AlgebraicExpression::PublicReference(_) => unimplemented!("{:?}", top_expr), + // Challenges are not being used in our current pil construction + AlgebraicExpression::Challenge(_) => unimplemented!("{:?}", top_expr), + } +} diff --git a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs index e193f05d3f9..9c72c957256 100644 --- a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs @@ -9,6 +9,7 @@ pub trait FlavorBuilder { &mut self, name: &str, relation_file_names: &[String], + inverses: &[String], lookups: &[String], fixed: &[String], witness: &[String], @@ -23,7 +24,7 @@ pub trait FlavorBuilder { &mut self, name: &str, relation_file_names: &[String], - lookups: &[String], + inverses: &[String], fixed: &[String], witness: &[String], witness_without_inverses: &[String], @@ -43,6 +44,7 @@ impl FlavorBuilder for BBFiles { name: &str, relation_file_names: &[String], lookups: &[String], + inverses: &[String], fixed: &[String], witness: &[String], witness_without_inverses: &[String], @@ -57,6 +59,7 @@ impl FlavorBuilder for BBFiles { "name": name, "relation_file_names": relation_file_names, "lookups": lookups, + "inverses": inverses, "fixed": fixed, "witness": witness, "all_cols": all_cols, @@ -87,7 +90,7 @@ impl FlavorBuilder for BBFiles { &mut self, name: &str, relation_file_names: &[String], - lookups: &[String], + inverses: &[String], fixed: &[String], witness: &[String], witness_without_inverses: &[String], @@ -101,7 +104,7 @@ impl FlavorBuilder for BBFiles { let data = &json!({ "name": name, "relation_file_names": relation_file_names, - "lookups": lookups, + "inverses": inverses, "fixed": fixed, "witness": witness, "all_cols": all_cols, diff --git a/bb-pilcom/bb-pil-backend/src/lib.rs b/bb-pilcom/bb-pil-backend/src/lib.rs index 7644c13d1b5..cdea9b8fe6c 100644 --- a/bb-pilcom/bb-pil-backend/src/lib.rs +++ b/bb-pilcom/bb-pil-backend/src/lib.rs @@ -1,5 +1,6 @@ mod circuit_builder; mod composer_builder; +mod expression_evaluation; mod file_writer; mod flavor_builder; pub mod lookup_builder; diff --git a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs index bc54a32fa3c..b67d8528f81 100644 --- a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs @@ -1,4 +1,4 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use itertools::Itertools; use powdr_ast::{ analyzed::{AlgebraicExpression, Analyzed, IdentityKind}, @@ -18,8 +18,10 @@ use crate::utils::sanitize_name; /// Lookup object and lookup side object are very similar in structure, however they are duplicated for /// readability. pub struct Lookup { - /// the name given to the inverse helper column - pub attribute: Option, + /// The name of the lookup + pub name: String, + /// The inverse column name + pub inverse: String, /// The name of the counts polynomial that stores the number of times a lookup is read pub counts_poly: String, /// the left side of the lookup @@ -42,31 +44,30 @@ pub struct LookupSide { pub trait LookupBuilder { /// Takes in an AST and works out what lookup relations are needed /// Note: returns the name of the inverse columns, such that they can be added to the prover in subsequent steps - fn create_lookup_files( - &self, - name: &str, - analyzed: &Analyzed, - ) -> Vec; + fn create_lookup_files(&self, analyzed: &Analyzed) -> Vec; } impl LookupBuilder for BBFiles { - fn create_lookup_files( - &self, - project_name: &str, - analyzed: &Analyzed, - ) -> Vec { + fn create_lookup_files(&self, analyzed: &Analyzed) -> Vec { let lookups = analyzed .identities .iter() .filter(|identity| matches!(identity.kind, IdentityKind::Plookup)) - .map(|lookup| Lookup { - attribute: lookup.attribute.clone().map(|att| att.to_lowercase()), - counts_poly: format!( - "{}_counts", - lookup.attribute.clone().unwrap().to_lowercase() - ), - left: get_lookup_side(&lookup.left), - right: get_lookup_side(&lookup.right), + .map(|lookup| { + let name = lookup + .attribute + .clone() + .expect( + "Inverse column name must be provided within lookup attribute - #[]", + ) + .to_lowercase(); + Lookup { + name: name.clone(), + inverse: format!("{}_inv", &name), + counts_poly: format!("{}_counts", &name), + left: get_lookup_side(&lookup.left), + right: get_lookup_side(&lookup.right), + } }) .collect_vec(); @@ -83,11 +84,7 @@ impl LookupBuilder for BBFiles { let data = create_lookup_settings_data(lookup); let lookup_settings = handlebars.render("lookup.hpp", &data).unwrap(); - let file_name = format!( - "{}{}", - lookup.attribute.clone().unwrap_or("NONAME".to_owned()), - ".hpp".to_owned() - ); + let file_name = format!("{}.hpp", lookup.name); self.write_file(Some(&self.relations), &file_name, &lookup_settings); } @@ -99,7 +96,7 @@ impl LookupBuilder for BBFiles { pub fn get_inverses_from_lookups(lookups: &[Lookup]) -> Vec { lookups .iter() - .map(|lookup| lookup.attribute.clone().unwrap()) + .map(|lookup| lookup.inverse.clone()) .collect() } @@ -112,11 +109,6 @@ pub fn get_counts_from_lookups(lookups: &[Lookup]) -> Vec { fn create_lookup_settings_data(lookup: &Lookup) -> Json { let columns_per_set = lookup.left.cols.len(); - let lookup_name = lookup - .attribute - .clone() - .expect("Inverse column name must be provided within lookup attribute - #[]"); - let counts_poly_name = lookup.counts_poly.to_owned(); // NOTE: https://github.com/AztecProtocol/aztec-packages/issues/3879 // Settings are not flexible enough to combine inverses @@ -145,8 +137,8 @@ fn create_lookup_settings_data(lookup: &Lookup) -> Json { // 4.. + columns per set. lhs cols // 4 + columns per set.. . rhs cols let mut lookup_entities: Vec = [ - lookup_name.clone(), - counts_poly_name.clone(), + lookup.inverse.clone(), + lookup.counts_poly.clone(), lhs_selector.clone(), rhs_selector.clone(), ] @@ -168,7 +160,7 @@ fn create_lookup_settings_data(lookup: &Lookup) -> Json { let write_term_types = "{0}".to_owned(); json!({ - "lookup_name": lookup_name, + "lookup_name": lookup.name, "lhs_selector": lhs_selector, "rhs_selector": rhs_selector, "read_terms": read_terms, diff --git a/bb-pilcom/bb-pil-backend/src/permutation_builder.rs b/bb-pilcom/bb-pil-backend/src/permutation_builder.rs index 2486b66f162..5a77a8a2883 100644 --- a/bb-pilcom/bb-pil-backend/src/permutation_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/permutation_builder.rs @@ -1,4 +1,4 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use itertools::Itertools; use powdr_ast::{ analyzed::{AlgebraicExpression, Analyzed, IdentityKind}, @@ -16,8 +16,10 @@ use crate::utils::sanitize_name; /// /// Contains the information required to produce a permutation relation pub struct Permutation { - /// -> Attribute - the name given to the inverse helper column - pub attribute: Option, + /// The name of the lookup + pub name: String, + /// The inverse column name + pub inverse: String, /// -> PermSide - the left side of the permutation pub left: PermutationSide, /// -> PermSide - the right side of the permutation @@ -38,27 +40,31 @@ pub struct PermutationSide { pub trait PermutationBuilder { /// Takes in an AST and works out what permutation relations are needed /// Note: returns the name of the inverse columns, such that they can be added to he prover in subsequent steps - fn create_permutation_files( - &self, - name: &str, - analyzed: &Analyzed, - ) -> Vec; + fn create_permutation_files(&self, analyzed: &Analyzed) + -> Vec; } impl PermutationBuilder for BBFiles { fn create_permutation_files( &self, - project_name: &str, analyzed: &Analyzed, ) -> Vec { let permutations = analyzed .identities .iter() .filter(|identity| matches!(identity.kind, IdentityKind::Permutation)) - .map(|perm| Permutation { - attribute: perm.attribute.clone().map(|att| att.to_lowercase()), - left: get_perm_side(&perm.left), - right: get_perm_side(&perm.right), + .map(|perm| { + let name = perm + .attribute + .clone() + .expect("Permutation name must be provided using attribute syntax") + .to_lowercase(); + Permutation { + name: name.clone(), + inverse: format!("{}_inv", &name), + left: get_perm_side(&perm.left), + right: get_perm_side(&perm.right), + } }) .collect_vec(); @@ -75,11 +81,7 @@ impl PermutationBuilder for BBFiles { let data = create_permutation_settings_data(permutation); let perm_settings = handlebars.render("permutation.hpp", &data).unwrap(); - let file_name = format!( - "{}{}", - permutation.attribute.clone().unwrap_or("NONAME".to_owned()), - ".hpp".to_owned() - ); + let file_name = format!("{}.hpp", permutation.name); self.write_file(Some(&self.relations), &file_name, &perm_settings); } @@ -91,17 +93,12 @@ impl PermutationBuilder for BBFiles { pub fn get_inverses_from_permutations(permutations: &[Permutation]) -> Vec { permutations .iter() - .map(|perm| perm.attribute.clone().unwrap()) + .map(|perm| perm.inverse.clone()) .collect() } fn create_permutation_settings_data(permutation: &Permutation) -> Json { let columns_per_set = permutation.left.cols.len(); - // TODO(md): In the future we will need to condense off the back of this - combining those with the same inverse column - let permutation_name = permutation - .attribute - .clone() - .expect("Inverse column name must be provided using attribute syntax"); // This also will need to work for both sides of this ! let lhs_selector = permutation @@ -126,7 +123,7 @@ fn create_permutation_settings_data(permutation: &Permutation) -> Json { // 4.. + columns per set. lhs cols // 4 + columns per set.. . rhs cols let mut perm_entities: Vec = [ - permutation_name.clone(), + permutation.inverse.clone(), lhs_selector.clone(), lhs_selector.clone(), rhs_selector.clone(), @@ -137,7 +134,7 @@ fn create_permutation_settings_data(permutation: &Permutation) -> Json { perm_entities.extend(rhs_cols); json!({ - "perm_name": permutation_name, + "perm_name": permutation.name, "columns_per_set": columns_per_set, "lhs_selector": lhs_selector, "rhs_selector": rhs_selector, diff --git a/bb-pilcom/bb-pil-backend/src/prover_builder.rs b/bb-pilcom/bb-pil-backend/src/prover_builder.rs index ea2be4cbabe..3590722a209 100644 --- a/bb-pilcom/bb-pil-backend/src/prover_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/prover_builder.rs @@ -1,11 +1,11 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use handlebars::Handlebars; use serde_json::json; pub trait ProverBuilder { fn create_prover_hpp(&mut self, name: &str); - fn create_prover_cpp(&mut self, name: &str, lookup_names: &[String]); + fn create_prover_cpp(&mut self, name: &str); } impl ProverBuilder for BBFiles { @@ -28,12 +28,11 @@ impl ProverBuilder for BBFiles { self.write_file(None, "prover.hpp", &prover_hpp); } - fn create_prover_cpp(&mut self, name: &str, lookup_names: &[String]) { + fn create_prover_cpp(&mut self, name: &str) { let mut handlebars = Handlebars::new(); let data = &json!({ "name": name, - "lookups": lookup_names, }); handlebars diff --git a/bb-pilcom/bb-pil-backend/src/relation_builder.rs b/bb-pilcom/bb-pil-backend/src/relation_builder.rs index f1be69f0ba8..513d44c95fe 100644 --- a/bb-pilcom/bb-pil-backend/src/relation_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/relation_builder.rs @@ -1,33 +1,25 @@ use itertools::Itertools; use powdr_ast::analyzed::AlgebraicBinaryOperation; -use powdr_ast::analyzed::AlgebraicExpression; use powdr_ast::analyzed::AlgebraicUnaryOperation; +use powdr_ast::analyzed::Analyzed; use powdr_ast::analyzed::Identity; -use powdr_ast::analyzed::{ - AlgebraicBinaryOperator, AlgebraicExpression as Expression, AlgebraicUnaryOperator, - IdentityKind, -}; +use powdr_ast::analyzed::{AlgebraicExpression, IdentityKind}; use powdr_ast::parsed::SelectedExpressions; use std::collections::HashMap; use std::collections::HashSet; use std::path::Path; -use powdr_number::{BigUint, DegreeType, FieldElement}; +use powdr_number::{DegreeType, FieldElement}; use handlebars::Handlebars; use serde_json::json; +use crate::expression_evaluation::get_alias_expressions_in_order; +use crate::expression_evaluation::get_alias_polys_in_order; +use crate::expression_evaluation::recurse_expression; use crate::file_writer::BBFiles; use crate::utils::snake_case; -/// Returned back to the vm builder from the create_relations call -pub struct RelationOutput { - /// A list of the names of the created relations - pub relations: Vec, - /// A list of the names of all of the 'used' shifted polys - pub shifted_polys: Vec, -} - /// Each created bb Identity is passed around with its degree so as needs to be manually /// provided for sumcheck #[derive(Debug)] @@ -49,8 +41,8 @@ pub trait RelationBuilder { fn create_relations( &self, root_name: &str, - identities: &[Identity>], - ) -> RelationOutput; + analyzed: &Analyzed, + ) -> Vec; /// Create Relation /// @@ -67,7 +59,7 @@ pub trait RelationBuilder { name: &str, identities: &[BBIdentity], skippable_if: &Option, - all_cols: &[String], + alias_polys_in_order: &Vec<(String, u64, String)>, ); } @@ -75,45 +67,52 @@ impl RelationBuilder for BBFiles { fn create_relations( &self, file_name: &str, - analyzed_identities: &[Identity>], - ) -> RelationOutput { + analyzed: &Analyzed, + ) -> Vec { + // These identities' terminal objects are either fields, columns, or alias expressions. + let mut analyzed_identities = analyzed.identities.clone(); + analyzed_identities.sort_by(|a, b| a.id.cmp(&b.id)); + + let alias_polys_in_order = get_alias_polys_in_order(analyzed); + let alias_expressions_in_order = get_alias_expressions_in_order(&alias_polys_in_order); + let indexed_aliases = alias_polys_in_order + .into_iter() + .map(|(sym, expr)| (&sym.absolute_name, expr)) + .collect::>(); + // Group relations per file let grouped_relations: HashMap>>> = - group_relations_per_file(analyzed_identities); + group_relations_per_file(&analyzed_identities); let mut relations = grouped_relations.keys().cloned().collect_vec(); relations.sort(); - // Contains all of the rows in each relation, will be useful for creating composite builder types - let mut shifted_polys: Vec = Vec::new(); - // ----------------------- Create the relation files ----------------------- for (relation_name, analyzed_idents) in grouped_relations.iter() { let IdentitiesOutput { identities, skippable_if, - collected_cols, - collected_shifts, - } = create_identities(file_name, analyzed_idents); + // These are the aliases used in the identities in this file. + collected_aliases, + } = create_identities(analyzed_idents, &indexed_aliases); - // Aggregate all shifted polys - shifted_polys.extend(collected_shifts); + let used_alias_defs_in_order = alias_expressions_in_order + .iter() + .filter(|(name, _, _)| collected_aliases.contains(name)) + .cloned() + .collect_vec(); self.create_relation( file_name, relation_name, &identities, &skippable_if, - &collected_cols, + &used_alias_defs_in_order, ); } - shifted_polys.sort(); relations.sort(); - RelationOutput { - relations, - shifted_polys, - } + relations } fn create_relation( @@ -122,15 +121,19 @@ impl RelationBuilder for BBFiles { name: &str, identities: &[BBIdentity], skippable_if: &Option, - all_cols: &[String], + alias_defs_in_order: &Vec<(String, u64, String)>, ) { let mut handlebars = Handlebars::new(); + handlebars.register_escape_fn(|s| s.to_string()); // No escaping + let degrees: Vec<_> = identities.iter().map(|id| id.degree + 1).collect(); let sorted_labels = identities .iter() .enumerate() .filter(|(_, id)| id.label.is_some()) .map(|(idx, id)| (idx, id.label.clone().unwrap())) + // Useful for debugging + // .map(|(idx, id)| (idx, id.label.as_ref().unwrap_or(&id.identity).clone())) .collect_vec(); let data = &json!({ @@ -142,9 +145,15 @@ impl RelationBuilder for BBFiles { "identity": id.identity, }) }).collect_vec(), + "alias_defs": alias_defs_in_order.iter().map(|(name, degree, expr)| { + json!({ + "name": name, + "degree": degree, + "expr": expr, + }) + }).collect_vec(), "skippable_if": skippable_if.as_ref().map(|id| id.identity.clone()), "degrees": degrees, - "all_cols": all_cols, "labels": sorted_labels, }); @@ -200,15 +209,16 @@ fn group_relations_per_file( }) } -fn create_identity( - expression: &SelectedExpressions>, - collected_cols: &mut HashSet, - collected_public_identities: &mut HashSet, +fn create_identity( + expression: &SelectedExpressions>, + collected_aliases: &mut HashSet, label: &Option, + indexed_aliases: &HashMap<&String, &AlgebraicExpression>, ) -> Option { // We want to read the types of operators and then create the appropiate code if let Some(expr) = &expression.selector { - let (degree, id) = craft_expression(expr, collected_cols, collected_public_identities); + let (degree, id, col_aliases) = recurse_expression(expr, indexed_aliases, false); + collected_aliases.extend(col_aliases); log::trace!("expression {:?}, {:?}", degree, id); Some(BBIdentity { degree: degree, @@ -220,125 +230,15 @@ fn create_identity( } } -fn craft_expression( - expr: &Expression, - // TODO: maybe make state? - collected_cols: &mut HashSet, - collected_public_identities: &mut HashSet, -) -> (u64, String) { - let var_name = match expr { - Expression::Number(n) => { - let number: BigUint = n.to_arbitrary_integer(); - if number.bit_len() < 32 { - return (1, format!("FF({})", number)); - } - if number.bit_len() < 64 { - return (1, format!("FF({}UL)", number)); - } - if number.bit_len() < 256 { - let bytes = number.to_be_bytes(); - let padding_len = 32 - bytes.len(); - - let mut padded_bytes = vec![0; padding_len]; - padded_bytes.extend_from_slice(&bytes); - - let mut chunks: Vec = padded_bytes - .chunks(8) - .map(|chunk| u64::from_be_bytes(chunk.try_into().unwrap())) - .collect(); - - chunks.resize(4, 0); - return ( - 1, - format!( - "FF(uint256_t{{{}UL, {}UL, {}UL, {}UL}})", - chunks[3], chunks[2], chunks[1], chunks[0], - ), - ); - } - unimplemented!("{:?}", expr); - } - Expression::Reference(polyref) => { - let mut poly_name = polyref.name.replace('.', "_").to_string(); - if polyref.next { - // NOTE: Naive algorithm to collect all shifted polys - poly_name = format!("{}_shift", poly_name); - } - collected_cols.insert(poly_name.clone()); - (1, format!("new_term.{}", poly_name)) - } - Expression::BinaryOperation(AlgebraicBinaryOperation { - left: lhe, - op, - right: rhe, - }) => { - let (ld, lhs) = craft_expression(lhe, collected_cols, collected_public_identities); - let (rd, rhs) = craft_expression(rhe, collected_cols, collected_public_identities); - - let degree = std::cmp::max(ld, rd); - match op { - AlgebraicBinaryOperator::Add => match lhe.as_ref() { - // BBerg hack, we do not want a field on the lhs of an expression - Expression::Number(_) => (degree, format!("({} + {})", rhs, lhs)), - _ => (degree, format!("({} + {})", lhs, rhs)), - }, - AlgebraicBinaryOperator::Sub => { - // BBerg hack here, to make sure we dont have a trivial (- FF(0)) - if let Expression::Number(rhe) = rhe.as_ref() { - // If the binary operation is a sub and the rhs expression is 0, we can just - // return the lhs - if rhe.to_arbitrary_integer() == 0u64.into() { - return (degree, lhs); - } - } - // Otherwise continue with the match - match lhe.as_ref() { - // BBerg hack, we do not want a field on the lhs of an expression - Expression::Number(_) => (degree, format!("(-{} + {})", rhs, lhs)), - _ => (degree, format!("({} - {})", lhs, rhs)), - } - } - AlgebraicBinaryOperator::Mul => match lhe.as_ref() { - // BBerg hack, we do not want a field on the lhs of an expression - Expression::Number(_) => (ld + rd, format!("({} * {})", rhs, lhs)), - _ => (ld + rd, format!("({} * {})", lhs, rhs)), - }, - _ => unimplemented!("{:?}", expr), - } - } - Expression::UnaryOperation(AlgebraicUnaryOperation { - op: operator, - expr: expression, - }) => match operator { - AlgebraicUnaryOperator::Minus => { - let (d, e) = - craft_expression(expression, collected_cols, collected_public_identities); - (d, format!("-{}", e)) - } - }, - // TODO: for now we do nothing with calls to public identities - // These probably can be implemented as some form of copy, however im not sure how we are going to process these down the line - Expression::PublicReference(name) => { - // We collect them for now to warn the user what is going on - collected_public_identities.insert(name.clone()); - (1, "FF(0)".to_string()) - } - // Note: challenges are not being used in our current pil construction - Expression::Challenge(_) => unimplemented!("{:?}", expr), - }; - var_name -} - pub struct IdentitiesOutput { identities: Vec, skippable_if: Option, - collected_cols: Vec, - collected_shifts: Vec, + collected_aliases: HashSet, } pub(crate) fn create_identities( - file_name: &str, - identities: &[Identity>], + identities: &[Identity>], + indexed_aliases: &HashMap<&String, &AlgebraicExpression>, ) -> IdentitiesOutput { // We only want the expressions for now // When we have a poly type, we only need the left side of it @@ -349,15 +249,14 @@ pub(crate) fn create_identities( let mut identities = Vec::new(); let mut skippable_if_identity = None; - let mut collected_cols: HashSet = HashSet::new(); - let mut collected_public_identities: HashSet = HashSet::new(); + let mut collected_aliases: HashSet = HashSet::new(); - for (i, expression) in ids.iter().enumerate() { + for expression in ids.iter() { let identity = create_identity( &expression.left, - &mut collected_cols, - &mut collected_public_identities, + &mut collected_aliases, &expression.attribute, + indexed_aliases, ) .unwrap(); @@ -369,34 +268,35 @@ pub(crate) fn create_identities( } } - // Print a warning to the user about usage of public identities - if !collected_public_identities.is_empty() { - log::warn!( - "Public Identities are not supported yet in codegen, however some were collected" - ); - log::warn!("Public Identities: {:?}", collected_public_identities); - } - - let mut collected_cols: Vec = collected_cols.drain().collect(); - let mut collected_shifts: Vec = collected_cols - .clone() - .iter() - .filter_map(|col| { - if col.ends_with("shift") { - Some(col.clone()) - } else { - None - } - }) - .collect(); - - collected_cols.sort(); - collected_shifts.sort(); - IdentitiesOutput { identities, skippable_if: skippable_if_identity, - collected_cols, - collected_shifts, + collected_aliases, + } +} + +pub fn get_shifted_polys(expressions: Vec>) -> Vec { + let mut shifted_polys = HashSet::::new(); + for expr in expressions { + match expr { + AlgebraicExpression::Reference(polyref) => { + if polyref.next { + shifted_polys.insert(polyref.name.clone()); + } + } + AlgebraicExpression::BinaryOperation(AlgebraicBinaryOperation { + left: lhe, + right: rhe, + .. + }) => { + shifted_polys.extend(get_shifted_polys(vec![*lhe])); + shifted_polys.extend(get_shifted_polys(vec![*rhe])); + } + AlgebraicExpression::UnaryOperation(AlgebraicUnaryOperation { expr, .. }) => { + shifted_polys.extend(get_shifted_polys(vec![*expr])); + } + _ => continue, + } } + shifted_polys.into_iter().collect() } diff --git a/bb-pilcom/bb-pil-backend/src/utils.rs b/bb-pilcom/bb-pil-backend/src/utils.rs index a4d221d0efa..25fb1214ae0 100644 --- a/bb-pilcom/bb-pil-backend/src/utils.rs +++ b/bb-pilcom/bb-pil-backend/src/utils.rs @@ -1,3 +1,6 @@ +use num_bigint::BigInt; +use powdr_number::FieldElement; + /// Sanitize Names /// /// Column titles that we get from pil contain . to distinguish which pil namespace they belong to @@ -6,28 +9,6 @@ pub fn sanitize_name(string: &str) -> String { string.replace(['.', '[', ']'], "_") } -/// Collect Col -/// -/// Transforms columns from powdr representation ( where the witnesses are linked ) -/// Into a version where we just keep the columns -/// As this is all we are about -pub fn collect_col(list: &[String], op: Func) -> Vec -where - Func: Fn(&String) -> String, -{ - list.iter().map(op).collect::>() -} - -/// Transform Map -/// -/// Apply a transformation to a list of strings -pub fn transform_map(list: &[String], op: Func) -> Vec -where - Func: Fn(&String) -> String, -{ - list.iter().map(op).collect::>() -} - /// Flatten /// /// Returns a flattened concatenation of the input arrays @@ -70,3 +51,32 @@ pub fn sort_cols(cols: &[String]) -> Vec { cols.sort(); cols } + +pub fn format_field(n: &F) -> String { + let number: BigInt = BigInt::from_bytes_le(num_bigint::Sign::Plus, &n.to_bytes_le()); + if number.bits() < 32 { + format!("FF({})", number) + } else if number.bits() < 64 { + format!("FF({}UL)", number) + } else { + // It's ok to use a string here since the constructor is constexpr. + // I.e., things will get resolved efficiently at compile-time. + // format!("FF(\"{:0>64}\")", number.to_str_radix(16)) + let bytes = n.to_arbitrary_integer().to_be_bytes(); + let padding_len = 32 - bytes.len(); + + let mut padded_bytes = vec![0; padding_len]; + padded_bytes.extend_from_slice(&bytes); + + let mut chunks: Vec = padded_bytes + .chunks(8) + .map(|chunk| u64::from_be_bytes(chunk.try_into().unwrap())) + .collect(); + + chunks.resize(4, 0); + format!( + "FF(uint256_t{{{}UL, {}UL, {}UL, {}UL}})", + chunks[3], chunks[2], chunks[1], chunks[0] + ) + } +} diff --git a/bb-pilcom/bb-pil-backend/src/verifier_builder.rs b/bb-pilcom/bb-pil-backend/src/verifier_builder.rs index a74c092006e..9de8b15fad5 100644 --- a/bb-pilcom/bb-pil-backend/src/verifier_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/verifier_builder.rs @@ -1,31 +1,20 @@ -use crate::{file_writer::BBFiles, utils::snake_case}; +use crate::file_writer::BBFiles; use handlebars::Handlebars; use serde_json::json; pub trait VerifierBuilder { - fn create_verifier_cpp( - &mut self, - name: &str, - inverses: &[String], - public_cols: &[(String, usize)], - ); + fn create_verifier_cpp(&mut self, name: &str, public_cols: &[(usize, String)]); - fn create_verifier_hpp(&mut self, name: &str, public_cols: &[(String, usize)]); + fn create_verifier_hpp(&mut self, name: &str); } impl VerifierBuilder for BBFiles { - fn create_verifier_cpp( - &mut self, - name: &str, - inverses: &[String], - public_cols: &[(String, usize)], - ) { + fn create_verifier_cpp(&mut self, name: &str, public_cols: &[(usize, String)]) { let mut handlebars = Handlebars::new(); let data = &json!({ "name": name, - "inverses": inverses, - "public_cols": public_cols.iter().map(|(name, idx)| { + "public_cols": public_cols.iter().map(|(idx, name)| { json!({ "col": name, "idx": idx, @@ -45,12 +34,11 @@ impl VerifierBuilder for BBFiles { self.write_file(None, "verifier.cpp", &verifier_cpp); } - fn create_verifier_hpp(&mut self, name: &str, public_cols: &[(String, usize)]) { + fn create_verifier_hpp(&mut self, name: &str) { let mut handlebars = Handlebars::new(); let data = &json!({ "name": name, - "public_cols": public_cols, }); handlebars diff --git a/bb-pilcom/bb-pil-backend/src/vm_builder.rs b/bb-pilcom/bb-pil-backend/src/vm_builder.rs index 331787fb8e6..360f28867c7 100644 --- a/bb-pilcom/bb-pil-backend/src/vm_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/vm_builder.rs @@ -1,31 +1,21 @@ -use dialoguer::Confirm; - -use itertools::Itertools; -use powdr_ast::analyzed::Analyzed; -use powdr_number::FieldElement; - use crate::circuit_builder::CircuitBuilder; use crate::composer_builder::ComposerBuilder; use crate::file_writer::BBFiles; use crate::flavor_builder::FlavorBuilder; -use crate::lookup_builder::get_counts_from_lookups; -use crate::lookup_builder::get_inverses_from_lookups; -use crate::lookup_builder::Lookup; -use crate::lookup_builder::LookupBuilder; -use crate::permutation_builder::get_inverses_from_permutations; -use crate::permutation_builder::Permutation; -use crate::permutation_builder::PermutationBuilder; +use crate::lookup_builder::{ + get_counts_from_lookups, get_inverses_from_lookups, Lookup, LookupBuilder, +}; +use crate::permutation_builder::{get_inverses_from_permutations, Permutation, PermutationBuilder}; use crate::prover_builder::ProverBuilder; -use crate::relation_builder::RelationBuilder; -use crate::relation_builder::RelationOutput; -use crate::utils::collect_col; -use crate::utils::flatten; -use crate::utils::sanitize_name; -use crate::utils::snake_case; -use crate::utils::sort_cols; -use crate::utils::transform_map; +use crate::relation_builder::{get_shifted_polys, RelationBuilder}; +use crate::utils::{flatten, sanitize_name, snake_case, sort_cols}; use crate::verifier_builder::VerifierBuilder; +use dialoguer::Confirm; +use itertools::Itertools; +use powdr_ast::analyzed::Analyzed; +use powdr_number::FieldElement; + /// All of the combinations of columns that are used in a bberg flavor file struct ColumnGroups { /// fixed or constant columns in pil -> will be found in vk @@ -48,32 +38,17 @@ struct ColumnGroups { all_cols_with_shifts: Vec, /// Inverses from lookups and permuations inverses: Vec, + /// Public inputs (in source order) + public_inputs: Vec<(usize, String)>, } /// Analyzed to cpp /// /// Converts an analyzed pil AST into a set of cpp files that can be used to generate a proof -pub fn analyzed_to_cpp( - analyzed: &Analyzed, - fixed: &[String], - witness: &[String], - public: &[String], - vm_name: &str, - delete_dir: bool, -) { - // Extract public inputs information. - let mut public_inputs: Vec<(String, usize)> = public - .iter() - .enumerate() - .map(|(i, name)| (sanitize_name(name), i)) - .collect(); - public_inputs.sort_by(|a, b| a.1.cmp(&b.1)); - - // Sort fixed and witness to ensure consistent ordering - let fixed = &sort_cols(fixed); - let witness = &sort_cols(witness); - +pub fn analyzed_to_cpp(analyzed: &Analyzed, vm_name: &str, delete_dir: bool) { let mut bb_files = BBFiles::default(&snake_case(&vm_name)); + + // Remove the generated directory if it exists. // Pass `-y` as parameter if you want to skip the confirmation prompt. let confirmation = delete_dir || Confirm::new() @@ -86,29 +61,18 @@ pub fn analyzed_to_cpp( bb_files.remove_generated_dir(); } - // Inlining step to remove the intermediate poly definitions - let mut analyzed_identities = analyzed.identities_with_inlined_intermediate_polynomials(); - analyzed_identities.sort_by(|a, b| a.id.cmp(&b.id)); - // ----------------------- Handle Standard Relation Identities ----------------------- - // We collect all references to shifts as we traverse all identities and create relation files - let RelationOutput { - relations, - shifted_polys, - } = bb_files.create_relations(vm_name, &analyzed_identities); + let relations = bb_files.create_relations(vm_name, analyzed); // ----------------------- Handle Lookup / Permutation Relation Identities ----------------------- - let permutations = bb_files.create_permutation_files(vm_name, analyzed); - let lookups = bb_files.create_lookup_files(vm_name, analyzed); - - // TODO: hack - this can be removed with some restructuring - let shifted_polys: Vec = shifted_polys - .clone() - .iter() - .map(|s| s.replace("_shift", "")) - .collect(); - - // Collect all column names and determine if they need a shift or not + let permutations = bb_files.create_permutation_files(analyzed); + let lookups = bb_files.create_lookup_files(analyzed); + let lookup_and_permutations_names = sort_cols(&flatten(&[ + permutations.iter().map(|p| p.name.clone()).collect_vec(), + lookups.iter().map(|l| l.name.clone()).collect_vec(), + ])); + + // Collect all column names let ColumnGroups { fixed, witness, @@ -120,34 +84,22 @@ pub fn analyzed_to_cpp( shifted, all_cols_with_shifts, inverses, - } = get_all_col_names( - fixed, - witness, - public, - &shifted_polys, - &permutations, - &lookups, - ); + public_inputs, + } = get_all_col_names(analyzed, &permutations, &lookups); // ----------------------- Create the full row files ----------------------- bb_files.create_full_row_hpp(vm_name, &all_cols); bb_files.create_full_row_cpp(vm_name, &all_cols); // ----------------------- Create the circuit builder files ----------------------- - bb_files.create_circuit_builder_hpp( - vm_name, - &relations, - &inverses, - &all_cols_without_inverses, - &all_cols, - &to_be_shifted, - ); + bb_files.create_circuit_builder_hpp(vm_name); bb_files.create_circuit_builder_cpp(vm_name, &all_cols_without_inverses); // ----------------------- Create the flavor files ----------------------- bb_files.create_flavor_hpp( vm_name, &relations, + &lookup_and_permutations_names, &inverses, &fixed, &witness, @@ -178,87 +130,98 @@ pub fn analyzed_to_cpp( bb_files.create_composer_hpp(vm_name); // ----------------------- Create the Verifier files ----------------------- - bb_files.create_verifier_cpp(vm_name, &inverses, &public_inputs); - bb_files.create_verifier_hpp(vm_name, &public_inputs); + bb_files.create_verifier_cpp(vm_name, &public_inputs); + bb_files.create_verifier_hpp(vm_name); // ----------------------- Create the Prover files ----------------------- - bb_files.create_prover_cpp(vm_name, &inverses); + bb_files.create_prover_cpp(vm_name); bb_files.create_prover_hpp(vm_name); println!("Done with generation."); } -/// Get all col names -/// -/// In the flavor file, there are a number of different groups of columns that we need to keep track of -/// This function will return all of the columns in the following groups: -/// - fixed -/// - witness -/// - all_cols -/// - unshifted -/// - to_be_shifted -/// - all_cols_with_shifts -fn get_all_col_names( - fixed: &[String], - witness: &[String], - public: &[String], - to_be_shifted: &[String], +fn get_all_col_names( + analyzed: &Analyzed, permutations: &[Permutation], lookups: &[Lookup], ) -> ColumnGroups { - log::info!("Getting all column names"); - - // Transformations - let sanitize = |name: &String| sanitize_name(name).to_owned(); - let append_shift = |name: &String| format!("{}_shift", *name); + let constant = sort_cols( + &analyzed + .constant_polys_in_source_order() + .iter() + .map(|(sym, _)| sym.absolute_name.clone()) + .map(|n| sanitize_name(&n)) + .collect_vec(), + ); + let committed = sort_cols( + &analyzed + .committed_polys_in_source_order() + .iter() + .map(|(sym, _)| sym.absolute_name.clone()) + .map(|n| sanitize_name(&n)) + .collect_vec(), + ); + let public = analyzed + .public_polys_in_source_order() + .iter() + .map(|(sym, _)| sym.absolute_name.clone()) + .map(|n| sanitize_name(&n)) + .collect_vec(); + let to_be_shifted = get_shifted_polys( + analyzed + .identities_with_inlined_intermediate_polynomials() + .iter() + .map(|i| i.left.selector.clone().unwrap()) + .collect_vec(), + ) + .iter() + .map(|n| sanitize_name(&n)) + .collect_vec(); + let shifted = to_be_shifted + .iter() + .map(|n| format!("{}_shift", n)) + .collect_vec(); - let perm_inverses = get_inverses_from_permutations(permutations); - let lookup_inverses = get_inverses_from_lookups(lookups); + let inverses = flatten(&[ + get_inverses_from_permutations(permutations), + get_inverses_from_lookups(lookups), + ]); let lookup_counts = get_counts_from_lookups(lookups); - // Gather sanitized column names - let fixed_names = collect_col(fixed, sanitize); - let witness_names = collect_col(witness, sanitize); - let public_names = collect_col(public, sanitize); - let inverses = flatten(&[perm_inverses, lookup_inverses]); - let witnesses_without_inverses = flatten(&[ - public_names.clone(), - witness_names.clone(), - lookup_counts.clone(), - ]); + let witnesses_without_inverses = + flatten(&[public.clone(), committed.clone(), lookup_counts.clone()]); let witnesses_with_inverses = flatten(&[ - public_names.clone(), - witness_names, + public.clone(), + committed.clone(), inverses.clone(), lookup_counts, ]); // Group columns by properties - let shifted = transform_map(to_be_shifted, append_shift); - let all_cols_without_inverses: Vec = - flatten(&[fixed_names.clone(), witnesses_without_inverses.clone()]); - let all_cols: Vec = flatten(&[fixed_names.clone(), witnesses_with_inverses.clone()]); - let unshifted: Vec = flatten(&[fixed_names.clone(), witnesses_with_inverses.clone()]) + let all_cols_without_inverses = + flatten(&[constant.clone(), witnesses_without_inverses.clone()]); + let all_cols = flatten(&[constant.clone(), witnesses_with_inverses.clone()]); + let unshifted = flatten(&[constant.clone(), witnesses_with_inverses.clone()]) .into_iter() .filter(|name| !shifted.contains(name)) - .collect(); - - let all_cols_with_shifts: Vec = flatten(&[ - fixed_names.clone(), + .collect_vec(); + let all_cols_with_shifts = flatten(&[ + constant.clone(), witnesses_with_inverses.clone(), shifted.clone(), ]); ColumnGroups { - fixed: fixed_names, + fixed: constant, witness: witnesses_with_inverses, - all_cols_without_inverses, - witnesses_without_inverses, - all_cols, - unshifted, - to_be_shifted: to_be_shifted.to_vec(), - shifted, - all_cols_with_shifts, - inverses, + all_cols_without_inverses: all_cols_without_inverses, + witnesses_without_inverses: witnesses_without_inverses, + all_cols: all_cols, + unshifted: unshifted, + to_be_shifted: to_be_shifted, + shifted: shifted, + all_cols_with_shifts: all_cols_with_shifts, + inverses: inverses, + public_inputs: public.iter().cloned().enumerate().collect_vec(), } } diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs index 23b0cc80efe..4be6ec2eccd 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs @@ -20,8 +20,6 @@ class {{name}}CircuitBuilder { using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; - static constexpr size_t num_fixed_columns = {{len all_cols}}; - static constexpr size_t num_polys = {{len all_cols}} + {{len to_be_shifted}}; std::vector rows; void set_trace(std::vector&& trace) { rows = std::move(trace); } diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs index 936e81c80d2..dc04e8c37d5 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs @@ -4,9 +4,7 @@ namespace bb { {{name}}Flavor::AllConstRefValues::AllConstRefValues(const RefArray<{{name}}Flavor::AllConstRefValues::BaseDataType, {{name}}Flavor::NUM_ALL_ENTITIES>& il) : - {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} - {{item}}(il[{{@index}}]){{#unless @last}},{{/unless}} - {{/each}} + {{#each (join fixed witness_without_inverses inverses shifted) as |item|}}{{item}}(il[{{@index}}]){{#unless @last}},{{/unless}}{{/each}} {} {{name}}Flavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -34,11 +32,11 @@ namespace bb { // Note: the order of the constructor must match the order of the columns in `get_all()`! return AllConstRefValues(refs); --}} - return AllConstRefValues(RefArray{ - {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} + return RefArray{ + {{#each (join fixed witness_without_inverses inverses shifted) as |item|}} {{item}}[row_idx]{{#unless @last}},{{/unless}} {{/each}} - }); + }; } {{name}}Flavor::CommitmentLabels::CommitmentLabels() diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index b55fc902214..02d7f75d2e2 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -32,7 +32,7 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // clang-format off #define PRECOMPUTED_ENTITIES {{#each fixed as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} #define WIRE_ENTITIES {{#each witness_without_inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} -#define DERIVED_WITNESS_ENTITIES {{#each lookups as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} +#define DERIVED_WITNESS_ENTITIES {{#each inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} #define SHIFTED_ENTITIES {{#each shifted as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} #define TO_BE_SHIFTED(e) {{#each to_be_shifted as |item|}}{{#if @index}}, {{/if}}e.{{item}}{{/each}} #define ALL_ENTITIES {{#if (len fixed)}}PRECOMPUTED_ENTITIES{{/if}}{{#if (len witness_without_inverses)}}, WIRE_ENTITIES{{/if}}{{#if (len lookups)}}, DERIVED_WITNESS_ENTITIES{{/if}}{{#if (len shifted)}}, SHIFTED_ENTITIES{{/if}} @@ -58,6 +58,7 @@ class {{name}}Flavor { static constexpr size_t NUM_PRECOMPUTED_ENTITIES = {{len fixed}}; static constexpr size_t NUM_WITNESS_ENTITIES = {{len witness}}; + static constexpr size_t NUM_SHIFTED_ENTITIES = {{len shifted}}; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for the unshifted and one for the shifted static constexpr size_t NUM_ALL_ENTITIES = {{len all_cols_and_shifts}}; @@ -121,7 +122,7 @@ class {{name}}Flavor { template static auto get_to_be_shifted([[maybe_unused]] PrecomputedAndWitnessEntitiesSuperset& entities) { - return RefArray::value>{ TO_BE_SHIFTED(entities) }; + return RefArray{ TO_BE_SHIFTED(entities) }; } template diff --git a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs index aff8f2c7937..efa7d204f62 100644 --- a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs @@ -6,11 +6,13 @@ namespace bb::{{root_name}}_vm { +{{!-- template struct {{upperCamelCase name}}Row { {{#each all_cols as |col|}} FF {{col}}{}; {{/each}} }; +--}} template class {{name}}Impl { public: @@ -35,6 +37,10 @@ template class {{name}}Impl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor ){ + {{#each alias_defs as |alias|}} + const auto {{alias.name}} = {{alias.expr}}; + {{/each}} + {{#each identities}} { using Accumulator = typename std::tuple_element_t<{{@index}}, ContainerOverSubrelations>; diff --git a/bb-pilcom/cli/src/main.rs b/bb-pilcom/cli/src/main.rs index b6b1f83916c..0cb70cb2624 100644 --- a/bb-pilcom/cli/src/main.rs +++ b/bb-pilcom/cli/src/main.rs @@ -2,7 +2,7 @@ use std::{io, path::Path}; use bb_pil_backend::vm_builder::analyzed_to_cpp; use clap::Parser; -use powdr_ast::analyzed::{Analyzed, FunctionValueDefinition, Symbol}; +use powdr_ast::analyzed::Analyzed; use powdr_number::Bn254Field; use powdr_pil_analyzer::analyze_file; @@ -27,32 +27,14 @@ struct Cli { yes: bool, } -fn extract_col_name(cols: Vec<&(Symbol, Option)>) -> Vec { - // Note that function val def should be none - cols.iter() - .map(|(sym, _def)| sym.absolute_name.replace(".", "_")) - .collect() -} - fn main() -> Result<(), io::Error> { let args = Cli::parse(); let file_name = args.file; let name = args.name.unwrap(); - let analyzed: Analyzed = analyze_file(Path::new(&file_name)); - let fixed = analyzed.constant_polys_in_source_order(); - let witness = analyzed.committed_polys_in_source_order(); - let public = analyzed.public_polys_in_source_order(); - - analyzed_to_cpp( - &analyzed, - &extract_col_name(fixed), - &extract_col_name(witness), - &extract_col_name(public), - &name, - args.yes, - ); + analyzed_to_cpp(&analyzed, &name, args.yes); + Ok(()) } diff --git a/bootstrap.sh b/bootstrap.sh index a1c1a4b623d..9b6cc7d073b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -103,7 +103,8 @@ if [ "$CMD" = "clean" ]; then echo "WARNING: This will erase *all* untracked files, including hooks and submodules." echo -n "Continue? [y/n] " read user_input - if [ "$user_input" != "y" ] && [ "$user_input" != "Y" ]; then + if [ "$user_input" != "y" ] && [ "$user_input" != "yes" ] && [ "$user_input" != "Y" ] && [ "$user_input" != "YES" ]; then + echo "Exiting without cleaning" exit 1 fi @@ -117,6 +118,7 @@ if [ "$CMD" = "clean" ]; then # Remove all untracked files, directories, nested repos, and .gitignore files. git clean -ffdx + echo "Cleaning complete" exit 0 elif [ "$CMD" = "full" ]; then if can_use_ci_cache; then diff --git a/boxes/boxes/react/src/contracts/src/main.nr b/boxes/boxes/react/src/contracts/src/main.nr index 7a3c6578afe..39984e28df7 100644 --- a/boxes/boxes/react/src/contracts/src/main.nr +++ b/boxes/boxes/react/src/contracts/src/main.nr @@ -1,6 +1,5 @@ contract BoxReact { - use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; - use dep::aztec::protocol_types::point::Point; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point}; use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/boxes/boxes/vanilla/src/contracts/src/main.nr b/boxes/boxes/vanilla/src/contracts/src/main.nr index 73be92a5b01..9d08c789e32 100644 --- a/boxes/boxes/vanilla/src/contracts/src/main.nr +++ b/boxes/boxes/vanilla/src/contracts/src/main.nr @@ -1,6 +1,5 @@ contract Vanilla { - use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; - use dep::aztec::protocol_types::point::Point; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point}; use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/cspell.json b/cspell.json index dda4954485e..c4ae01a32e5 100644 --- a/cspell.json +++ b/cspell.json @@ -5,6 +5,7 @@ "acir", "acvm", "addrs", + "alphanet", "archiver", "assignement", "asyncify", diff --git a/docker-compose.provernet.yml b/docker-compose.provernet.yml new file mode 100644 index 00000000000..b8554b1c8fe --- /dev/null +++ b/docker-compose.provernet.yml @@ -0,0 +1,140 @@ +# Template for simulating a provernet-like setup using docker-compose, currently unused except for development or testing. +# Spins up an aztec node with a sequencer, a transactions bot, and a prover node with a separate prover agent. +# Logs latest block numbers every 10 seconds. +name: aztec-provernet +services: + ethereum: + image: ghcr.io/foundry-rs/foundry@sha256:29ba6e34379e79c342ec02d437beb7929c9e254261e8032b17e187be71a2609f + command: > + 'anvil --host 0.0.0.0 --chain-id 31337 --port 8545 --silent' + ports: + - 8545:8545 + + aztec-node: + image: "aztecprotocol/aztec:${VERSION:-master}" + ports: + - "8080:80" + environment: + LOG_LEVEL: info + ETHEREUM_HOST: http://ethereum:8545 + L1_CHAIN_ID: 31337 + AZTEC_PORT: 80 + DEPLOY_AZTEC_CONTRACTS: true + ARCHIVER_POLLING_INTERVAL: 10000 + SEQ_MAX_TX_PER_BLOCK: 4 + SEQ_MIN_TX_PER_BLOCK: 1 + SEQ_MAX_SECONDS_BETWEEN_BLOCKS: 120 + SEQ_MIN_SECONDS_BETWEEN_BLOCKS: 5 + SEQ_RETRY_INTERVAL: 10000 + SEQ_PUBLISHER_PRIVATE_KEY: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a" + SEQ_SKIP_SUBMIT_PROOFS: true + P2P_ENABLED: false + IS_DEV_NET: true + volumes: + - ./log/aztec-node/:/usr/src/yarn-project/aztec/log:rw + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost/status" ] + interval: 3s + timeout: 30s + start_period: 10s + depends_on: + - ethereum + command: + - "start" + - "--node" + - "--archiver" + - "--sequencer" + - "--prover" + + aztec-bot: + image: "aztecprotocol/aztec:${VERSION:-master}" + ports: + - "8081:80" + environment: + LOG_LEVEL: info + ETHEREUM_HOST: http://ethereum:8545 + AZTEC_NODE_URL: http://aztec-node + L1_CHAIN_ID: 31337 + AZTEC_PORT: 80 + PXE_PROVER_ENABLED: false + BOT_PRIVATE_KEY: 0xcafe + BOT_TX_INTERVAL_SECONDS: 10 + BOT_PRIVATE_TRANSFERS_PER_TX: 1 + BOT_PUBLIC_TRANSFERS_PER_TX: 0 + BOT_NO_WAIT_FOR_TRANSFERS: true + BOT_NO_START: false + IS_DEV_NET: true + volumes: + - ./log/aztec-bot/:/usr/src/yarn-project/aztec/log:rw + depends_on: + aztec-node: + condition: service_healthy + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost/status" ] + interval: 3s + timeout: 30s + start_period: 10s + restart: on-failure:5 + command: [ "start", "--bot", "--pxe" ] + + aztec-prover: + image: "aztecprotocol/aztec:${VERSION:-master}" + ports: + - "8082:80" + environment: + LOG_LEVEL: verbose + ETHEREUM_HOST: http://ethereum:8545 + TX_PROVIDER_NODE_URL: http://aztec-node + L1_CHAIN_ID: 31337 + AZTEC_PORT: 80 + PROVER_AGENT_ENABLED: false + PROVER_PUBLISHER_PRIVATE_KEY: "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" + PROVER_REAL_PROOFS: false + IS_DEV_NET: true + volumes: + - ./log/aztec-prover/:/usr/src/yarn-project/aztec/log:rw + depends_on: + aztec-node: + condition: service_healthy + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost/status" ] + interval: 3s + timeout: 30s + start_period: 10s + command: [ "start", "--prover-node", "--archiver" ] + restart: on-failure:5 + + aztec-prover-agent: + image: "aztecprotocol/aztec:${VERSION:-master}" + ports: + - "8083:80" + environment: + LOG_LEVEL: verbose + ETHEREUM_HOST: http://ethereum:8545 + AZTEC_NODE_URL: http://aztec-prover + L1_CHAIN_ID: 31337 + AZTEC_PORT: 80 + PROVER_REAL_PROOFS: false + PROVER_TEST_DELAY_MS: 200 + IS_DEV_NET: true + volumes: + - ./log/aztec-prover-agent/:/usr/src/yarn-project/aztec/log:rw + depends_on: + aztec-prover: + condition: service_healthy + command: [ "start", "--prover" ] + restart: on-failure:5 + + aztec-block-watcher: + image: "aztecprotocol/aztec:${VERSION:-master}" + environment: + ETHEREUM_HOST: http://ethereum:8545 + L1_CHAIN_ID: 31337 + depends_on: + aztec-bot: + condition: service_healthy + entrypoint: '/bin/bash -c' + command: > + 'while true; do node --no-warnings ./node_modules/.bin/aztec block-number -u http://aztec-bot | head -n2; sleep 10; done' + restart: on-failure:5 + stop_grace_period: 1s diff --git a/docker-compose.yml b/docker-compose.yml index 09ad44729ad..82a33648b5a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: PXE_DATA_DIRECTORY: /var/lib/aztec/pxe NODE_NO_WARNINGS: 1 AZTEC_PORT: 8080 + MNEMONIC: "test test test test test test test test test test test junk" entrypoint: > sh -c ' export AZTEC_NODE_URL=$$(cat /var/run/secrets/aztec-node-url); @@ -50,8 +51,8 @@ services: INBOX_CONTRACT_ADDRESS: "0x12d9b5effc69bf5c0c29c8258c6b6fa95a08de74" OUTBOX_CONTRACT_ADDRESS: "0x3ec4b6c68a8c2ce4c78cdd465b3019b11a568d1d" AVAILABILITY_ORACLE_CONTRACT_ADDRESS: "0x98a4089127f3f5d555656f1c9b1801342c9d6bce" - GAS_TOKEN_CONTRACT_ADDRESS: "0x73c43b919973711e096bfc04c9d4b3be511ffc0b" - GAS_PORTAL_CONTRACT_ADDRESS: "0xdf25b0a34dbee9f25518f7a4d63bab8b3bb3e496" + FEE_JUICE_CONTRACT_ADDRESS: "0x73c43b919973711e096bfc04c9d4b3be511ffc0b" + FEE_JUICE_PORTAL_CONTRACT_ADDRESS: "0xdf25b0a34dbee9f25518f7a4d63bab8b3bb3e496" ETHEREUM_HOST: P2P_TCP_LISTEN_ADDR: "0.0.0.0:9000" P2P_UDP_LISTEN_ADDR: "0.0.0.0:9001" @@ -61,7 +62,7 @@ services: P2P_ENABLED: true PEER_ID_PRIVATE_KEY: AZTEC_PORT: 8999 - TEL_COLLECTOR_BASE_URL: ${TEL_COLLECTOR_BASE_URL:-http://otel-collector:4318} + OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318} secrets: - ethereum-host - p2p-boot-node @@ -76,13 +77,13 @@ services: # if the stack is started with --profile metrics --profile node, give the collector a chance to start before the node i=0 max=3 - while ! curl --head --silent $$TEL_COLLECTOR_BASE_URL > /dev/null; do + while ! curl --head --silent $$OTEL_EXPORTER_OTLP_ENDPOINT > /dev/null; do echo "OpenTelemetry collector not up. Retrying after 1s"; sleep 1; i=$$((i+1)); if [ $$i -eq $$max ]; then - echo "OpenTelemetry collector at $$TEL_COLLECTOR_BASE_URL not up after $${max}s. Running without metrics"; - unset TEL_COLLECTOR_BASE_URL; + echo "OpenTelemetry collector at $$OTEL_EXPORTER_OTLP_ENDPOINT not up after $${max}s. Running without metrics"; + unset OTEL_EXPORTER_OTLP_ENDPOINT; break fi; done; diff --git a/docs/.gitignore b/docs/.gitignore index bfd44418b7d..2b2fad56010 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -22,6 +22,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -docs/reference/aztecjs -docs/reference/smart_contract_reference/aztec-nr +/docs/reference/developer_references/aztecjs +/docs/reference/developer_references/smart_contract_reference/aztec-nr test-results diff --git a/docs/.yarn/install-state.gz b/docs/.yarn/install-state.gz new file mode 100644 index 00000000000..c89d944a5b6 Binary files /dev/null and b/docs/.yarn/install-state.gz differ diff --git a/docs/docs/aztec.md b/docs/docs/aztec.md index 16b1ab227e2..d3abe381171 100644 --- a/docs/docs/aztec.md +++ b/docs/docs/aztec.md @@ -1,5 +1,5 @@ --- -title: Programmable Privacy +title: Building in Public sidebar_position: 0 --- @@ -22,7 +22,7 @@ Aztec is inspired on Ethereum. We believe in transparency for the protocol, but To allow for this, we focus on two main components: -- **Noir** - We started developing Noir long before Aztec came into being. As an easy, open-source domain specific programming language for writing zero-knowledge circuits, it became the perfect language for writing [Aztec Smart Contracts](aztec/concepts/smart_contracts/index.md). Read about standalone Noir in the [Noir Lang Documentation](https://noir-lang.org). +- **Noir** - We started developing Noir long before Aztec came into being. As an easy, open-source domain specific programming language for writing zero-knowledge circuits, it became the perfect language for writing [Aztec Smart Contracts](aztec/smart_contracts_overview.md). Read about standalone Noir in the [Noir Lang Documentation](https://noir-lang.org). - **Honk** - A collection of cutting-edge cryptography, from proving systems, to compilers, and other sidecars. These will support Aztec's rollup and allow for fast, private, client-side proving. ## Media diff --git a/docs/docs/aztec/concepts/_category_.json b/docs/docs/aztec/concepts/_category_.json new file mode 100644 index 00000000000..88de50877b4 --- /dev/null +++ b/docs/docs/aztec/concepts/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Concepts", + "position": 1, + "collapsible": true, + "collapsed": true +} diff --git a/docs/docs/aztec/concepts/accounts/authwit.md b/docs/docs/aztec/concepts/accounts/authwit.md index d416abfd4ed..182f0ee4bc2 100644 --- a/docs/docs/aztec/concepts/accounts/authwit.md +++ b/docs/docs/aztec/concepts/accounts/authwit.md @@ -1,5 +1,6 @@ --- title: Authentication Witness +tags: [accounts, authwit] --- Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties (eg protocols or other users) to execute an action on their behalf. @@ -56,7 +57,7 @@ Adopting ERC20 for Aztec is not as simple as it might seem because of private st If you recall from the [Hybrid State model](../state_model/index.md), private state is generally only known by its owner and those they have shared it with. Because it relies on secrets, private state might be "owned" by a contract, but it needs someone with knowledge of these secrets to actually spend it. You might see where this is going. -If we were to implement the `approve` with an allowance in private, you might know the allowance, but unless you also know about the individual notes that make up the user's balances, it would be of no use to you! It is private after all. To spend the user's funds you would need to know the decryption key, see [keys for more](keys.md). +If we were to implement the `approve` with an allowance in private, you might know the allowance, but unless you also know about the individual notes that make up the user's balances, it would be of no use to you! It is private after all. To spend the user's funds you would need to know the decryption key, see [keys for more](./keys.md). While this might sound limiting in what we can actually do, the main use of approvals have been for simplifying contract interactions that the user is doing. In the case of private transactions, this is executed on the user device, so it is not a blocker that the user need to tell the executor a secret - the user is the executor! ### So what can we do? @@ -183,7 +184,7 @@ For the transfer, this could be done simply by appending a nonce to the argument action = H(defi, token, transfer_selector, H(alice_account, defi, 1000, nonce)); ``` -Beware that the account contract will be unable to emit the nullifier since it is checked with a static call, so the calling contract must do it. This is similar to nonces in ERC20 tokens today. We provide a small library that handles this which we will see in the [developer documentation](../../../guides/smart_contracts/writing_contracts/authwit.md). +Beware that the account contract will be unable to emit the nullifier since it is checked with a static call, so the calling contract must do it. This is similar to nonces in ERC20 tokens today. We provide a small library that handles this. ### Differences to approval @@ -197,4 +198,4 @@ We don't need to limit ourselves to the `transfer` function, we can use the same ### Next Steps -Check out the [developer documentation](../../../guides/smart_contracts/writing_contracts/authwit.md) to see how to implement this in your own contracts. +Check out the [developer documentation](../../../guides/developer_guides/smart_contracts/writing_contracts/authwit.md) to see how to implement this in your own contracts. diff --git a/docs/docs/aztec/concepts/accounts/index.md b/docs/docs/aztec/concepts/accounts/index.md index 027427f9bf3..07bb6295451 100644 --- a/docs/docs/aztec/concepts/accounts/index.md +++ b/docs/docs/aztec/concepts/accounts/index.md @@ -1,6 +1,6 @@ --- title: Accounts -sidebar_position: 0 +sidebar_position: 1 tags: [accounts] --- @@ -72,7 +72,7 @@ def entryPoint(payload): enqueueCall(to, data, value, gasLimit); ``` -Read more about how to write an account contract [here](../../../tutorials/contract_tutorials/write_accounts_contract.md). +Read more about how to write an account contract [here](../../../tutorials/codealong/contract_tutorials/write_accounts_contract.md). ### Account contracts and wallets @@ -117,7 +117,7 @@ However, this is not required when sitting on the receiving end. A user can dete ### Account contract deployment -Users will need to pay transaction fees in order to deploy their account contract. This can be done by sending a fee paying asset to their account contract address (which can be derived deterministically, as mentioned above), so they have funds to pay for the deployment. Alternatively, the fee can be paid for by another account, using [fee abstraction](#fee-management). +Users will need to pay transaction fees in order to deploy their account contract. This can be done by sending Fee Juice to their account contract address (which can be derived deterministically, as mentioned above), so they have funds to pay for the deployment. Alternatively, the fee can be paid for by another account, using [fee abstraction](#fee-management). ### Authorizing actions @@ -135,7 +135,7 @@ These two patterns combined allow an account contract to answer whether an actio Aztec requires users to define [encryption and nullifying keys](./keys.md) that are needed for receiving and spending private notes. Unlike transaction signing, encryption and nullifying is enshrined at the protocol. This means that there is a single scheme used for encryption and nullifying. These keys are derived from a master public key. This master public key, in turn, is used when deterministically deriving the account's address. -A side effect of committing to a master public key as part of the address is that _this key cannot be rotated_. While an account contract implementation could include methods for rotating the signing key, this is unfortunately not possible for encryption and nullifying keys (note that rotating nullifying keys also creates other challenges such as preventing double spends). We are exploring usage of [`SharedMutable`](../../../reference/smart_contract_reference/storage/shared_state.md#sharedmutable) to enable rotating these keys. +A side effect of committing to a master public key as part of the address is that _this key cannot be rotated_. While an account contract implementation could include methods for rotating the signing key, this is unfortunately not possible for encryption and nullifying keys (note that rotating nullifying keys also creates other challenges such as preventing double spends). We are exploring usage of [`SharedMutable`](../../../reference/developer_references/smart_contract_reference/storage/shared_state.md#sharedmutable) to enable rotating these keys. NOTE: While we entertained the idea of abstracting note encryption, where account contracts would define an `encrypt` method that would use a user-defined scheme, there are two main reasons we decided against this. First is that this entailed that, in order to receive funds, a user had to first deploy their account contract, which is a major UX issue. Second, users could define malicious `encrypt` methods that failed in certain circumstances, breaking application flows that required them to receive a private note. While this issue already exists in Ethereum when transferring ETH (see the [king of the hill](https://coinsbench.com/27-king-ethernaut-da5021cd4aa6)), its impact is made worse in Aztec since any execution failure in a private function makes the entire transaction unprovable (ie it is not possible to catch errors in calls to other private functions), and furthermore because encryption is required for any private state (not just for transferring ETH). Nevertheless, both of these problems are solvable. Initialization can be worked around by embedding a commitment to the bytecode in the address and removing the need for actually deploying contracts before interacting with them, and the king of the hill issue can be mitigated by introducing a full private VM that allows catching reverts. As such, we may be able to abstract encryption in the future as well. diff --git a/docs/docs/aztec/concepts/accounts/keys.md b/docs/docs/aztec/concepts/accounts/keys.md index 5d6a6135267..bb2c7340225 100644 --- a/docs/docs/aztec/concepts/accounts/keys.md +++ b/docs/docs/aztec/concepts/accounts/keys.md @@ -1,16 +1,20 @@ -# Keys +--- +title: Keys +tags: [accounts, keys] +--- + The goal of this section is to give app developer a good idea what keys there are used in the system. -For a detailed description head over to the [protocol specification](../../../protocol-specs/addresses-and-keys/keys#cheat-sheet). +For a detailed description head over to the [protocol specification](../../../protocol-specs/addresses-and-keys/index.md). Each account in Aztec is backed by 4 key pairs: - A **nullifier key pair** used for note nullifier computation, comprising the master nullifier secret key (`nsk_m`) and master nullifier public key (`Npk_m`). - A **incoming viewing key pair** used to encrypt a note for the recipient, consisting of the master incoming viewing secret key (`ivsk_m`) and master incoming viewing public key (`Ivpk_m`). - A **outgoing viewing key pair** used to encrypt a note for the sender, includes the master outgoing viewing secret key (`ovsk_m`) and master outgoing viewing public key (`Ovpk_m`). -- A **tagging key pair** used to compute tags in a [tagging note discovery scheme](../../../protocol-specs/private-message-delivery/private-msg-delivery#note-tagging), comprising the master tagging secret key (`tsk_m`) and master tagging public key (`Tpk_m`). +- A **tagging key pair** used to compute tags in a [tagging note discovery scheme](../../../protocol-specs/private-message-delivery/private-msg-delivery.md#note-tagging), comprising the master tagging secret key (`tsk_m`) and master tagging public key (`Tpk_m`). :::info -All key pairs above are derived from a secret using a ZCash inspired scheme defined in [protocol specification](../../../protocol-specs/addresses-and-keys/keys#cheat-sheet). +All key pairs above are derived from a secret using a ZCash inspired scheme defined in [protocol specification](../../../protocol-specs/addresses-and-keys/keys.md#cheat-sheet). ::: :::note @@ -40,7 +44,7 @@ Below are some ways how we could instantiate it after getting the information in #include_code instantiate-complete-address /yarn-project/circuits.js/src/structs/complete_address.test.ts rust -Then to register the recipient's [complete address](#complete-address) in PXE we would call `registerRecipient` PXE endpoint using [Aztec.js](../../core_components.md#aztecjs): +Then to register the recipient's [complete address](#complete-address) in PXE we would call `registerRecipient` PXE endpoint using Aztec.js. #include_code register-recipient /yarn-project/aztec.js/src/wallet/create_recipient.ts rust @@ -116,7 +120,7 @@ This is a snippet of our Schnorr Account contract implementation, which uses Sch #include_code entrypoint /noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr rust -Still, different accounts may use different signing schemes, may require multi-factor authentication, or _may not even use signing keys_ and instead rely on other authentication mechanisms. Read [how to write an account contract](../../../tutorials/contract_tutorials/write_accounts_contract.md) for a full example of how to manage authentication. +Still, different accounts may use different signing schemes, may require multi-factor authentication, or _may not even use signing keys_ and instead rely on other authentication mechanisms. Read [how to write an account contract](../../../tutorials/codealong/contract_tutorials/write_accounts_contract.md) for a full example of how to manage authentication. Furthermore, and since signatures are fully abstracted, how the key is stored in the contract is abstracted as well and left to the developer of the account contract. In the following section we describe a few ways how an account contract could be architected to store signing keys. @@ -133,7 +137,7 @@ Similar to using a private note, but using an immutable private note removes the #### Using shared state -A compromise between the two solutions above is to use [shared state](../../../reference/smart_contract_reference/storage/shared_state.md). This would not generate additional nullifiers and commitments for each transaction while allowing the user to rotate their key. However, this causes every transaction to now have a time-to-live determined by the frequency of the mutable shared state, as well as imposing restrictions on how fast keys can be rotated due to minimum delays. +A compromise between the two solutions above is to use shared state. This would not generate additional nullifiers and commitments for each transaction while allowing the user to rotate their key. However, this causes every transaction to now have a time-to-live determined by the frequency of the mutable shared state, as well as imposing restrictions on how fast keys can be rotated due to minimum delays. #### Reusing some of the in-protocol keys diff --git a/docs/docs/aztec/concepts/circuits/index.md b/docs/docs/aztec/concepts/circuits/index.md index 34bd5d74f2b..aad4f994459 100644 --- a/docs/docs/aztec/concepts/circuits/index.md +++ b/docs/docs/aztec/concepts/circuits/index.md @@ -1,6 +1,7 @@ --- title: Circuits sidebar_position: 7 +tags: [protocol, circuits] --- Central to Aztec's operations are 'circuits' derived both from the core protocol and the developer-written Aztec.nr contracts. @@ -62,11 +63,11 @@ So what kinds of core protocol circuits does Aztec have? ### Kernel Circuits -Read more about the Kernel circuits in the protocol specs [here](../../../protocol-specs/circuits/high-level-topology). +Read more about the Kernel circuits in the protocol specs [here](../../../protocol-specs/circuits/high-level-topology.md). ### Rollup Circuits -- [Rollup Circuits](../../../protocol-specs/rollup-circuits) +- [Rollup Circuits](../../../protocol-specs/rollup-circuits/index.md) #### Squisher Circuits diff --git a/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md b/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md index 177c18c3351..9bdba98cb8a 100644 --- a/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md +++ b/docs/docs/aztec/concepts/circuits/kernels/private_kernel.md @@ -1,10 +1,11 @@ --- title: Private Kernel Circuit +tags: [protocol, circuits] --- This circuit is executed by the user, on their own device. This is to ensure private inputs to the circuit remain private! -Read the latest information about the Aztec Private Kernel Circuit in the [protocol specs section](../../../../protocol-specs/circuits/private-kernel-initial). +Read the latest information about the Aztec Private Kernel Circuit in the [protocol specs section](../../../../protocol-specs/circuits/private-kernel-tail.md). :::note diff --git a/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md b/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md index 2cac4594568..e7f139f8662 100644 --- a/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md +++ b/docs/docs/aztec/concepts/circuits/kernels/public_kernel.md @@ -1,7 +1,8 @@ --- title: Public Kernel Circuit +tags: [protocol, circuits] --- -This circuit is executed by a Sequencer, since only a Sequencer knows the current state of the [public data tree](../../storage/trees/index.md#public-state-tree) at any time. A Sequencer might choose to delegate proof generation to the Prover pool. +This circuit is executed by a Sequencer, since only a Sequencer knows the current state of the [public data tree](../../storage/trees/index.md) at any time. A Sequencer might choose to delegate proof generation to the Prover pool. -Read more about the public kernel circuits in the protocol specs [here](../../../../protocol-specs/circuits/private-kernel-tail). +Read more about the public kernel circuits in the protocol specs [here](../../../../protocol-specs/circuits/public-kernel-initial.md). diff --git a/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md b/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md index a0d3a606782..72f08e093d3 100644 --- a/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md +++ b/docs/docs/aztec/concepts/circuits/rollup_circuits/index.md @@ -1,5 +1,6 @@ --- title: Rollup Circuits +tags: [protocol, circuits] --- The primary purpose of the Rollup Circuits is to 'squish' all of the many thousands of transactions in a rollup into a single SNARK, which can then be efficiently and verified on Ethereum. @@ -15,4 +16,4 @@ The way we 'squish' all this data is in a 'binary tree of proofs' topology. Some of the Rollup Circuits also do some protocol checks and computations, for efficiency reasons. We might rearrange which circuit does what computation, as we discover opportunities for efficiency. -Read more about the rollup circuits in the protocol spec [here](../../../../protocol-specs/rollup-circuits). +Read more about the rollup circuits in the protocol spec [here](../../../../protocol-specs/rollup-circuits/index.md). diff --git a/docs/docs/aztec/concepts/index.md b/docs/docs/aztec/concepts/index.md deleted file mode 100644 index f1920549acb..00000000000 --- a/docs/docs/aztec/concepts/index.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: Concepts -sidebar_position: 2 ---- - -import Image from "@theme/IdealImage"; -import DocCardList from "@theme/DocCardList"; - -This page outlines Aztec's fundamental technical concepts. - -## Aztec Overview - - - -1. A user interacts with Aztec through Aztec.js (like web3js or ethersjs) -2. Private functions are executed in the PXE, which is client-side -3. They are rolled up and sent to the Public VM (running on an Aztec node) -4. Public functions are executed in the Public VM -5. The Public VM rolls up the private & public transaction rollups -6. These rollups are submitted to Ethereum - -The PXE is unaware of the Public VM. And the Public VM is unaware of the PXE. They are completely separate execution environments. This means: - -- The PXE and the Public VM cannot directly communicate with each other -- Private transactions in the PXE are executed first, followed by public transactions - -### Private and public state - -Private state works with UTXOs, or what we call notes. To keep things private, everything is stored in an [append-only UTXO tree](storage/trees/index.md#note-hash-tree), and a nullifier is created when notes are invalidated. Nullifiers are then stored in their own [nullifier tree](storage/trees/indexed_merkle_tree.mdx#primer-on-nullifier-trees). - -Public state works similarly to other chains like Ethereum, behaving like a public ledger. Public data is stored in a [public data tree](storage/trees/index.md#public-state-tree). - -Aztec [smart contract](smart_contracts/index.md) developers should keep in mind that different types are used when manipulating private or public state. Working with private state is creating commitments and nullifiers to state, whereas working with public state is directly updating state. - -## Accounts - -Every account in Aztec is a smart contract (account abstraction). This allows implementing different schemes for transaction signing, nonce management, and fee payments. - -Developers can write their own account contract to define the rules by which user transactions are authorized and paid for, as well as how user keys are managed. - -Learn more about account contracts [here](index.md). - -## Smart contracts - -Developers can write [smart contracts](smart_contracts/index.md) that manipulate both public and private state. They are written in a framework on top of Noir, the zero-knowledge domain-specific language developed specifically for Aztec. Outside of Aztec, Noir is used for writing circuits that can be verified on EVM chains. - -Noir has its own doc site that you can find [here](https://noir-lang.org). - -## Communication with Ethereum - -Aztec allows private communications with Ethereum - ie no-one knows where the transaction is coming from, just that it is coming from somewhere on Aztec. - -This is achieved through portals - these are smart contracts deployed on an EVM that are related to the Ethereum smart contract you want to interact with. - -Learn more about portals [here](../../protocol-specs/l1-smart-contracts/index.md). - -## Circuits - -Aztec operates on three types of circuits: - -- [Private kernel circuits](circuits/kernels/private_kernel.md), which are executed by the user on their own device and prove correct execution of a function -- [Public kernel circuits](./circuits/kernels/public_kernel.md), which are executed by the [sequencer](nodes_clients/sequencer/index.md) and ensure the stack trace of transactions adheres to function execution rules -- [Rollup circuits](circuits/index.md), which bundle all of the Aztec transactions into a proof that can be efficiently verified on Ethereum - -## What's next? - -### Dive deeper into how Aztec works - -Explore the Concepts for a deeper understanding into the components that make up Aztec: - - - -### Start coding - -Follow the [developer getting started guide](../../getting_started.md). diff --git a/docs/docs/aztec/concepts/pxe/acir_simulator.md b/docs/docs/aztec/concepts/pxe/acir_simulator.md index 5413fba5d81..020dbdb812a 100644 --- a/docs/docs/aztec/concepts/pxe/acir_simulator.md +++ b/docs/docs/aztec/concepts/pxe/acir_simulator.md @@ -14,13 +14,13 @@ It simulates three types of functions: Private functions are simulated and proved client-side, and verified client-side in the private kernel circuit. -They are run with the assistance of a DB oracle that provides any private data requested by the function. You can read more about oracle functions in the smart contract section [here](../smart_contracts/oracles/index.md). +They are run with the assistance of a DB oracle that provides any private data requested by the function. You can read more about oracle functions in the smart contract section [here](../../smart_contracts/oracles/index.md). Private functions can call other private functions and can request to call a public function. The public function execution will be performed by the sequencer asynchronously, so private functions don't have direct access to the return values of public functions. ### Public Functions -Public functions are simulated and proved on the [sequencer](../nodes_clients/sequencer) side, and verified by the [public kernel circuit](../circuits/kernels/public_kernel.md). +Public functions are simulated and proved on the [sequencer](../../network/sequencer/index.md) side, and verified by the [public kernel circuit](../../concepts/circuits/kernels/public_kernel.md). They are run with the assistance of an oracle that provides any value read from the public state tree. diff --git a/docs/docs/aztec/concepts/pxe/index.md b/docs/docs/aztec/concepts/pxe/index.md index 151ceb89787..0018caecd50 100644 --- a/docs/docs/aztec/concepts/pxe/index.md +++ b/docs/docs/aztec/concepts/pxe/index.md @@ -1,6 +1,7 @@ --- title: Private Execution Environment (PXE) sidebar_position: 6 +tags: [PXE] --- The Private Execution Environment (or PXE, pronounced 'pixie') is a client-side library for the execution of private operations. It is a TypeScript library and can be run within Node, such as when you run the sandbox. In the future it could be run inside wallet software or a browser. @@ -63,11 +64,11 @@ The keystore is a secure storage for private and public keys. ## Oracles -Oracles are pieces of data that are injected into a smart contract function from the client side. You can read more about why and how they work in the [functions section](../smart_contracts/oracles/index.md). +Oracles are pieces of data that are injected into a smart contract function from the client side. You can read more about why and how they work in the [smart contracts section](../../smart_contracts/oracles/index.md). ## For developers To learn how to develop on top of the PXE, refer to these guides: -- [Run more than one PXE on your local machine](../../../guides/local_env/run_more_than_one_pxe_sandbox.md) -- [Use in-built oracles including oracles for arbitrary data](guides/smart_contracts/writing_contracts/how_to_pop_capsules.md) +- [Run more than one PXE on your local machine](../../../guides/developer_guides/local_env/run_more_than_one_pxe_sandbox.md) +- [Use in-built oracles including oracles for arbitrary data](../../../guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md) diff --git a/docs/docs/aztec/concepts/smart_contracts/contract_creation.md b/docs/docs/aztec/concepts/smart_contracts/contract_creation.md deleted file mode 100644 index f77aa94d58d..00000000000 --- a/docs/docs/aztec/concepts/smart_contracts/contract_creation.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Contract Deployment ---- - -The latest information about contract deployment has moved to the protocol specification. You can find it [here](../../../protocol-specs/contract-deployment/index.md). - -## Further reading - -To see how to deploy a contract in practice, check out the [dapp development tutorial](../../../tutorials/simple_dapp). diff --git a/docs/docs/aztec/concepts/state_model/index.md b/docs/docs/aztec/concepts/state_model/index.md index 406d1adf41f..914ccf51ae5 100644 --- a/docs/docs/aztec/concepts/state_model/index.md +++ b/docs/docs/aztec/concepts/state_model/index.md @@ -1,6 +1,7 @@ --- title: State Model sidebar_position: 4 +tags: [state] --- Aztec has a hybrid public/private state model. Aztec contract developers can specify which data is public and which data is private, as well as the functions that can operate on that data. diff --git a/docs/docs/aztec/concepts/state_model/public_vm.md b/docs/docs/aztec/concepts/state_model/public_vm.md index dc02f375932..d5c26f1d33d 100644 --- a/docs/docs/aztec/concepts/state_model/public_vm.md +++ b/docs/docs/aztec/concepts/state_model/public_vm.md @@ -2,4 +2,4 @@ title: Public VM --- -Refer to the [protocol specs section](../../../protocol-specs/public-vm/intro.md) for the latest information about the Aztec Public VM. +Refer to the [protocol specs section](../../../protocol-specs/public-vm/index.md) for the latest information about the Aztec Public VM. diff --git a/docs/docs/aztec/concepts/storage/index.md b/docs/docs/aztec/concepts/storage/index.md index de69d7fdf3e..9b3987f901f 100644 --- a/docs/docs/aztec/concepts/storage/index.md +++ b/docs/docs/aztec/concepts/storage/index.md @@ -2,6 +2,7 @@ title: Storage description: How are storage slots derived for public and private state sidebar_position: 2 +tags: [protocol, storage] --- In Aztec, private data and public data are stored in two trees; a public data tree and a note hashes tree. @@ -61,4 +62,4 @@ By doing this address-siloing at the kernel circuit we _force_ the inserted comm To ensure that nullifiers don't collide across contracts we also force this contract siloing at the kernel level. ::: -For an example of this see [developer documentation storage slots](../../../guides/smart_contracts/writing_contracts/storage/storage_slots). +For an example of this see [developer documentation on storage](../../../reference/developer_references/smart_contract_reference/storage/index.md). diff --git a/docs/docs/aztec/concepts/transactions.md b/docs/docs/aztec/concepts/transactions.md index dc7980c9c4e..fee7a8a0cd5 100644 --- a/docs/docs/aztec/concepts/transactions.md +++ b/docs/docs/aztec/concepts/transactions.md @@ -1,6 +1,7 @@ --- title: Transactions sidebar_position: 3 +tags: [protocol] --- import Image from '@theme/IdealImage'; @@ -48,7 +49,7 @@ Transactions on Aztec start with a call from Aztec.js, which creates a request c See [this diagram](https://raw.githubusercontent.com/AztecProtocol/aztec-packages/2fa143e4d88b3089ebbe2a9e53645edf66157dc8/docs/static/img/sandbox_sending_a_tx.svg) for a more detailed overview of the transaction execution process. It highlights 3 different types of transaction execution: contract deployments, private transactions and public transactions. -See the page on [contract communication](smart_contracts/communication/index.md) for more context on transaction execution. +See the page on [contract communication](../smart_contracts/communication/index.md) for more context on transaction execution. ### Enabling Transaction Semantics: The Aztec Kernel diff --git a/docs/docs/aztec/concepts/wallets/architecture.md b/docs/docs/aztec/concepts/wallets/architecture.md index 4d0c60229cf..fcab210d5ab 100644 --- a/docs/docs/aztec/concepts/wallets/architecture.md +++ b/docs/docs/aztec/concepts/wallets/architecture.md @@ -1,5 +1,6 @@ --- title: Wallet Architecture +tags: [protocol, accounts] --- This page talks about the architecture of a wallet in Aztec. Wallets expose to dapps an interface that allows them to act on behalf of the user, such as querying private state or sending transactions. Bear mind that, as in Ethereum, wallets should require user confirmation whenever carrying out a potentially sensitive action requested by a dapp. @@ -10,7 +11,7 @@ Architecture-wise, a wallet is an instance of an **Private Execution Environment The PXE also communicates with an **Aztec Node** for retrieving public information or broadcasting transactions. Note that the PXE requires a local database for keeping private state, and is also expected to be continuously syncing new blocks for trial-decryption of user notes. -Additionally, a wallet must be able to handle one or more [account contract implementations](../accounts/index.md#account-contracts-and-wallets). When a user creates a new account, the account is represented on-chain by an account contract. The wallet is responsible for deploying and interacting with this contract. A wallet may support multiple flavours of accounts, such as an account that uses ECDSA signatures, or one that relies on WebAuthn, or one that requires multi-factor authentication. For a user, the choice of what account implementation to use is then determined by the wallet they interact with. +Additionally, a wallet must be able to handle one or more account contract implementation. When a user creates a new account, the account is represented on-chain by an account contract. The wallet is responsible for deploying and interacting with this contract. A wallet may support multiple flavours of accounts, such as an account that uses ECDSA signatures, or one that relies on WebAuthn, or one that requires multi-factor authentication. For a user, the choice of what account implementation to use is then determined by the wallet they interact with. In code, this translates to a wallet implementing an **AccountInterface** interface that defines [how to create an _execution request_ out of an array of _function calls_](./index.md#transaction-lifecycle) for the specific implementation of an account contract and [how to generate an _auth witness_](./index.md#authorizing-actions) for authorizing actions on behalf of the user. Think of this interface as the Javascript counterpart of an account contract, or the piece of code that knows how to format a transaction and authenticate an action based on the rules defined by the user's account contract implementation. diff --git a/docs/docs/aztec/concepts/wallets/index.md b/docs/docs/aztec/concepts/wallets/index.md index 7c47de34b7e..c8550e418c0 100644 --- a/docs/docs/aztec/concepts/wallets/index.md +++ b/docs/docs/aztec/concepts/wallets/index.md @@ -6,7 +6,7 @@ tags: [accounts] In this page we will cover the main responsibilities of a wallet in the Aztec network. -Refer to [writing an account contract](../../../tutorials/contract_tutorials/write_accounts_contract.md) for a tutorial on how to write a contract to back a user's account. +Refer to [writing an account contract](../../../tutorials/codealong/contract_tutorials/write_accounts_contract.md) for a tutorial on how to write a contract to back a user's account. Go to [wallet architecture](./architecture.md) for an overview of its architecture and a reference on the interface a wallet must implement. @@ -20,7 +20,7 @@ In addition to these usual responsibilities, wallets in Aztec also need to track The first step for any wallet is to let the user set up their [accounts](../accounts/index.md). An account in Aztec is represented on-chain by its corresponding account contract that the user must deploy to begin interacting with the network. This account contract dictates how transactions are authenticated and executed. -A wallet must support at least one specific [account contract implementation](../../../tutorials/contract_tutorials/write_accounts_contract.md), which means being able to deploy such a contract, as well as interacting with it when sending transactions. Code-wise, this requires [implementing the `AccountContract` interface](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/account_contract/index.ts). +A wallet must support at least one specific account contract implementation, which means being able to deploy such a contract, as well as interacting with it when sending transactions. Code-wise, this requires [implementing the `AccountContract` interface](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/account_contract/index.ts). Note that users must be able to receive funds in Aztec before deploying their account. A wallet should let a user generate a [deterministic complete address](../accounts/keys.md#complete-address) without having to interact with the network, so they can share it with others to receive funds. This requires that the wallet pins a specific contract implementation, its initialization arguments, a deployment salt, and a privacy key. These values yield a deterministic address, so when the account contract is actually deployed, it is available at the precalculated address. Once the account contract is deployed, the user can start sending transactions using it as the transaction origin. @@ -28,7 +28,7 @@ Note that users must be able to receive funds in Aztec before deploying their ac Every transaction in Aztec is broadcast to the network as a zero-knowledge proof of correct execution, in order to preserve privacy. This means that transaction proofs are generated on the wallet and not on a remote node. This is one of the biggest differences with regard to EVM chain wallets. -A wallet is responsible for **creating** an _execution request_ out of one or more _function calls_ requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet [turns that into an execution request](../../../protocol-specs/transactions/local-execution#execution-request) with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. +A wallet is responsible for **creating** an _execution request_ out of one or more _function calls_ requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet [turns that into an execution request](../../../protocol-specs/transactions/local-execution.md#execution-request) with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. Once the _execution request_ is created, the wallet is responsible for **simulating** and **proving** the execution of its private functions. The simulation yields an execution trace, which can be used to provide the user with a list of side effects of the private execution of the transaction. During this simulation, the wallet is responsible of providing data to the virtual machine, such as private notes, encryption keys, or nullifier secrets. This execution trace is fed into the prover, which returns a zero-knowledge proof that guarantees correct execution and hides all private information. The output of this process is a [_transaction object_](../../../protocol-specs/transactions/tx-object.md). diff --git a/docs/docs/aztec/core_components.md b/docs/docs/aztec/core_components.md deleted file mode 100644 index 91c0da1f686..00000000000 --- a/docs/docs/aztec/core_components.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Core Components -sidebar_position: 1 ---- - -## Private Smart Contracts - -A smart contract on Aztec is a collection of functions, written as ZK-SNARK circuits. These circuits can have different modes of execution: - -1. Private Functions -- can read and write private state, read historical public state, consume or send messages to / from Ethereum, and read Ethereum state. They can call other private functions in the same contract, or other contracts, and can call public functions. -2. Public Functions -- can read and write public state, write private state, consume or send messages to / from Ethereum and read Ethereum state. They can call other public functions on the same or other contracts. -3. Portal Contracts -- these are contracts on Ethereum that can receive messages from Aztec or send messages to Aztec from Ethereum contracts. - -Using these different modes of execution, developers can build applications with user privacy, data privacy and code privacy. - -- User privacy - transactions may not reveal information about the sender or the recipient. -- Data privacy - transactions may not reveal information about the payload of the transaction, e.g., the asset or value being transacted. -- Code privacy - transactions may not reveal the program logic. - -## High level network architecture - -An overview of the Aztec network architecture will help contextualize the concepts introduced in this section. - -network architecture - -### Aztec.js - -A user of the Aztec network will interact with the network through Aztec.js. Aztec.js is a library that provides APIs for managing accounts and interacting with smart contracts (including account contracts) on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](concepts/pxe/index.md) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions. - -### Private Execution Environment - -The PXE provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. It hides the details of the [state model](concepts/state_model/index.md) from end users, but the state model is important for Aztec developers to understand as it has implications for [private/public execution](concepts/smart_contracts/communication/public_private_calls.md) and [L1/L2 communication](../protocol-specs/l1-smart-contracts/index.md). The PXE also includes the [ACIR Simulator](concepts/pxe/acir_simulator.md) for private executions and the KeyStore for secure key management. - -Procedurally, the PXE sends results of private function execution and requests for public function executions to the [sequencer](concepts/nodes_clients/sequencer/index.md), which will update the state of the rollup. - -### Sequencer - -The sequencer aggregates transactions into a block, generates proofs of the state updates (or delegates proof generate to the prover network) and posts it to the rollup contract on Ethereum, along with any required public data for data availability. - -## Further Reading - -- [The state model](concepts/state_model/index.md) -- [Accounts](concepts/accounts/index.md) -- [Aztec Smart Contracts](concepts/smart_contracts/index.md) -- [Transactions](concepts/transactions.md) -- [Communication between network components](concepts/smart_contracts/communication/index.md) diff --git a/docs/docs/aztec/glossary/call_types.md b/docs/docs/aztec/glossary/call_types.md index d121c607f12..1f1b3cd8008 100644 --- a/docs/docs/aztec/glossary/call_types.md +++ b/docs/docs/aztec/glossary/call_types.md @@ -121,7 +121,7 @@ A common pattern is to enqueue public calls to check some validity condition on #include_code deadline /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr rust :::warning -Calling public functions privately leaks some privacy! The caller of the function and all arguments will be revelead, so exercise care when mixing the private and public domains. To learn about alternative ways to access public state privately, look into [Shared State](../../reference/smart_contract_reference/storage/shared_state.md). +Calling public functions privately leaks some privacy! The caller of the function and all arguments will be revelead, so exercise care when mixing the private and public domains. To learn about alternative ways to access public state privately, look into [Shared State](../../reference/developer_references/smart_contract_reference/storage/shared_state.md). ::: ### Public Execution diff --git a/docs/docs/aztec/glossary/index.md b/docs/docs/aztec/glossary/index.md index 8a4d155744a..efe652c62af 100644 --- a/docs/docs/aztec/glossary/index.md +++ b/docs/docs/aztec/glossary/index.md @@ -64,7 +64,7 @@ Previously in [Aztec Connect](https://medium.com/aztec-protocol/sunsetting-aztec Programs that run on the Aztec network are called smart contracts, similar to [programs](https://ethereum.org/en/developers/docs/smart-contracts/) that run on Ethereum. -However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](../../aztec/core_components.md). +However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include private state and private functions. ### Proving Key diff --git a/docs/docs/aztec/concepts/nodes_clients/_category_.json b/docs/docs/aztec/network/_category_.json similarity index 100% rename from docs/docs/aztec/concepts/nodes_clients/_category_.json rename to docs/docs/aztec/network/_category_.json diff --git a/docs/docs/aztec/concepts/nodes_clients/sequencer/index.md b/docs/docs/aztec/network/sequencer/index.md similarity index 99% rename from docs/docs/aztec/concepts/nodes_clients/sequencer/index.md rename to docs/docs/aztec/network/sequencer/index.md index 36f49a24a95..614f405daad 100644 --- a/docs/docs/aztec/concepts/nodes_clients/sequencer/index.md +++ b/docs/docs/aztec/network/sequencer/index.md @@ -1,5 +1,6 @@ --- title: Sequencer +tags: [protocol] --- The sequencer is a module responsible for creating and publishing new rollup blocks. This involves fetching txs from the P2P pool, ordering them, executing any public functions, running them through the rollup circuits, assembling the L2 block, and posting it to the L1 rollup contract along with any contract deployment public data. diff --git a/docs/docs/aztec/concepts/nodes_clients/sequencer/sequencer_selection.md b/docs/docs/aztec/network/sequencer/sequencer_selection.md similarity index 99% rename from docs/docs/aztec/concepts/nodes_clients/sequencer/sequencer_selection.md rename to docs/docs/aztec/network/sequencer/sequencer_selection.md index 72937391468..9feb7710294 100644 --- a/docs/docs/aztec/concepts/nodes_clients/sequencer/sequencer_selection.md +++ b/docs/docs/aztec/network/sequencer/sequencer_selection.md @@ -1,5 +1,6 @@ --- title: Sequencer Selection +tags: [protocol] --- ## Fernet diff --git a/docs/docs/aztec/network_overview.md b/docs/docs/aztec/network_overview.md new file mode 100644 index 00000000000..787a59d2a96 --- /dev/null +++ b/docs/docs/aztec/network_overview.md @@ -0,0 +1,12 @@ +--- +title: Overview +sidebar_position: 0 +tags: [protocol] +draft: true +--- + +# Aztec Network Infrastructure + +Explore this section to learn about [sequencers](../aztec/network/sequencer/index.md) and the [sequencer selection process](../aztec/network/sequencer/sequencer_selection.md). + +More information will be added here as we develop the protocol. \ No newline at end of file diff --git a/docs/docs/aztec/overview.md b/docs/docs/aztec/overview.md new file mode 100644 index 00000000000..06150ec4ded --- /dev/null +++ b/docs/docs/aztec/overview.md @@ -0,0 +1,141 @@ +--- +title: What is Aztec? +sidebar_position: 0 +id: overview +tags: [protocol] +--- + +import Image from "@theme/IdealImage"; + +This page outlines Aztec's fundamental technical concepts. + +## Aztec Overview + + + +1. A user interacts with Aztec through Aztec.js (like web3js or ethersjs) +2. Private functions are executed in the PXE, which is client-side +3. They are rolled up and sent to the Public VM (running on an Aztec node) +4. Public functions are executed in the Public VM +5. The Public VM rolls up the private & public transaction rollups +6. These rollups are submitted to Ethereum + +The PXE is unaware of the Public VM. And the Public VM is unaware of the PXE. They are completely separate execution environments. This means: + +- The PXE and the Public VM cannot directly communicate with each other +- Private transactions in the PXE are executed first, followed by public transactions + +### Private and public state + +Private state works with UTXOs, or what we call notes. To keep things private, everything is stored in an [append-only UTXO tree](./concepts/storage/trees/index.md), and a nullifier is created when notes are invalidated. Nullifiers are then stored in their own [nullifier tree](./concepts/storage/trees/index.md). + +Public state works similarly to other chains like Ethereum, behaving like a public ledger. Public data is stored in a [public data tree](./concepts/storage/trees/index.md#public-state-tree). + +Aztec [smart contract](./smart_contracts_overview.md) developers should keep in mind that different types are used when manipulating private or public state. Working with private state is creating commitments and nullifiers to state, whereas working with public state is directly updating state. + +## Accounts + +Every account in Aztec is a smart contract (account abstraction). This allows implementing different schemes for transaction signing, nonce management, and fee payments. + +Developers can write their own account contract to define the rules by which user transactions are authorized and paid for, as well as how user keys are managed. + +Learn more about account contracts [here](./concepts/accounts/index.md). + +## Smart contracts + +Developers can write [smart contracts](./smart_contracts_overview.md) that manipulate both public and private state. They are written in a framework on top of Noir, the zero-knowledge domain-specific language developed specifically for Aztec. Outside of Aztec, Noir is used for writing circuits that can be verified on EVM chains. + +Noir has its own doc site that you can find [here](https://noir-lang.org). + +## Communication with Ethereum + +Aztec allows private communications with Ethereum - ie no-one knows where the transaction is coming from, just that it is coming from somewhere on Aztec. + +This is achieved through portals - these are smart contracts deployed on an EVM that are related to the Ethereum smart contract you want to interact with. + +Learn more about portals [here](../protocol-specs/l1-smart-contracts/index.md). + +## Circuits + +Aztec operates on three types of circuits: + +- [Private kernel circuits](../aztec/concepts/circuits/kernels/private_kernel.md), which are executed by the user on their own device and prove correct execution of a function +- [Public kernel circuits](../aztec/concepts/circuits/kernels/public_kernel.md), which are executed by the [sequencer](./network/sequencer/index.md) and ensure the stack trace of transactions adheres to function execution rules +- [Rollup circuits](../aztec/concepts/circuits/index.md), which bundle all of the Aztec transactions into a proof that can be efficiently verified on Ethereum + +## What's next? + +### Dive deeper into how Aztec works + +Explore the Concepts for a deeper understanding into the components that make up Aztec: + +
+ + + +

Accounts

+
+ + Learn about Aztec's native account abstraction - every account in Aztec is a smart contract which defines the rules for whether a transaction is or is not valid + +
+ + + +

Circuits

+
+ + Central to Aztec's operations are circuits in the core protocol and the developer-written Aztec.nr contracts + +
+ + + +

PXE (pronounced 'pixie')

+
+ + The Private Execution Environment (or PXE) is a client-side library for the execution of private operations + +
+ + + +

State model

+
+ + Aztec has a hybrid public/private state model + +
+ + + +

Storage

+
+ + In Aztec, private data and public data are stored in two trees: a public data tree and a note hashes tree + +
+ + + +

Wallets

+
+ + Wallets expose to dapps an interface that allows them to act on behalf of the user, such as querying private state or sending transactions + +
+ +
+ +### Start coding + +
+ + +

Developer quickstart

+
+ + Follow the getting started guide to start developing with the Aztec Sandbox + +
+
\ No newline at end of file diff --git a/docs/docs/aztec/roadmap/_category_.json b/docs/docs/aztec/roadmap/_category_.json new file mode 100644 index 00000000000..231aa372f13 --- /dev/null +++ b/docs/docs/aztec/roadmap/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Roadmap", + "collapsible": true, + "collapsed": true, + "link": { "type": "doc", "id": "roadmap/index" } + +} diff --git a/docs/docs/aztec/roadmap/cryptography_roadmap.md b/docs/docs/aztec/roadmap/cryptography_roadmap.md index 9b455aa4bb1..4b732f0aa9a 100644 --- a/docs/docs/aztec/roadmap/cryptography_roadmap.md +++ b/docs/docs/aztec/roadmap/cryptography_roadmap.md @@ -2,7 +2,7 @@ title: Cryptography Roadmap sidebar_position: 2 --- ---- + The cryptography team is currently working on [Barretenberg here.](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg) diff --git a/docs/docs/aztec/roadmap/engineering_roadmap.md b/docs/docs/aztec/roadmap/engineering_roadmap.md index 7f62da58857..14b1431f6b1 100644 --- a/docs/docs/aztec/roadmap/engineering_roadmap.md +++ b/docs/docs/aztec/roadmap/engineering_roadmap.md @@ -124,7 +124,7 @@ CI takes up a significant amount of time. It gets its own section here, so we re ## Shared Mutable State -We _need_ a way to read mutable public data from a private function. We are moving away from the old Slow Updates Tree in favor of [Shared Mutable](../../reference/smart_contract_reference/storage/shared_state.md). +We _need_ a way to read mutable public data from a private function. We are moving away from the old Slow Updates Tree in favor of [Shared Mutable](../../reference/developer_references/smart_contract_reference/storage/shared_state.md#sharedmutable). ## Contract classes and instances? diff --git a/docs/docs/aztec/roadmap/features_initial_ldt.md b/docs/docs/aztec/roadmap/features_initial_ldt.md index 3dcacfb76f8..9a43cb3dbd1 100644 --- a/docs/docs/aztec/roadmap/features_initial_ldt.md +++ b/docs/docs/aztec/roadmap/features_initial_ldt.md @@ -1,11 +1,12 @@ --- -title: Sandbox +title: Sandbox Features Roadmap sidebar_position: 0 +tags: [sandbox] --- The Aztec Sandbox is intended to provide developers with a lightweight and fast local node, running alongside a PXE. -You can learn more about running the Sandbox [here](../../reference/sandbox_reference/sandbox-reference.md). +You can learn more about running the Sandbox [here](../../reference/developer_references/sandbox_reference/index.md). Developers should be able to quickly spin up local, emulated instances of an Ethereum blockchain and an Aztec encrypted rollup, and start deploying private contracts and submitting private txs. diff --git a/docs/docs/aztec/roadmap/index.md b/docs/docs/aztec/roadmap/index.md deleted file mode 100644 index 1bc67b5ad4b..00000000000 --- a/docs/docs/aztec/roadmap/index.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: Roadmap -sidebar_position: 3 ---- - -import DocCardList from '@theme/DocCardList'; -import Image from '@theme/IdealImage'; - -The next major milestone on the journey to mainnet is launching our testnet. - - - -## Read more - - diff --git a/docs/docs/aztec/concepts/smart_contracts/communication/index.md b/docs/docs/aztec/smart_contracts/communication/index.md similarity index 79% rename from docs/docs/aztec/concepts/smart_contracts/communication/index.md rename to docs/docs/aztec/smart_contracts/communication/index.md index d2815095610..1b1aa003d7f 100644 --- a/docs/docs/aztec/concepts/smart_contracts/communication/index.md +++ b/docs/docs/aztec/smart_contracts/communication/index.md @@ -9,4 +9,4 @@ See [Private \<--\> Public execution](./public_private_calls.md) for information ## Cross-chain communication -Read the protocol specification about Cross-chain communication between Aztec and Ethereum [here](../../../../protocol-specs/l1-smart-contracts/index.md). +Read the protocol specification about Cross-chain communication between Aztec and Ethereum [here](../communication/index.md). diff --git a/docs/docs/aztec/concepts/smart_contracts/communication/public_private_calls.md b/docs/docs/aztec/smart_contracts/communication/public_private_calls.md similarity index 94% rename from docs/docs/aztec/concepts/smart_contracts/communication/public_private_calls.md rename to docs/docs/aztec/smart_contracts/communication/public_private_calls.md index 6841f7ec071..027c5d17b01 100644 --- a/docs/docs/aztec/concepts/smart_contracts/communication/public_private_calls.md +++ b/docs/docs/aztec/smart_contracts/communication/public_private_calls.md @@ -84,6 +84,6 @@ Many applications rely on some form of access control to function well. USDC hav Access control like this cannot easily be enforced in the private domain, as reading is also nullifying (to ensure data is up to date). However, as it is possible to read historical public state, one can combine private and public functions to get the desired effect. -This concept is known as [shared state](../../../../reference/smart_contract_reference/storage/shared_state.md), and relies on using delays when changing public data so that it can also be read in private with currentness guarantees. Since values cannot be immediately modified but instead require delays to elapse, it is possible to privately prove that an application is using the current value _as long as the transaction gets included before some time in the future_, which would be the earliest the value could possibly change. +This concept is known as shared state, and relies on using delays when changing public data so that it can also be read in private with currentness guarantees. Since values cannot be immediately modified but instead require delays to elapse, it is possible to privately prove that an application is using the current value _as long as the transaction gets included before some time in the future_, which would be the earliest the value could possibly change. If the public state is only changed infrequently, and it is acceptable to have delays when doing so, then shared state is a good solution to this problem. diff --git a/docs/docs/aztec/smart_contracts/contract_creation.md b/docs/docs/aztec/smart_contracts/contract_creation.md new file mode 100644 index 00000000000..b648178e14e --- /dev/null +++ b/docs/docs/aztec/smart_contracts/contract_creation.md @@ -0,0 +1,10 @@ +--- +title: Contract Deployment +tags: [contracts, protocol] +--- + +The latest information about contract deployment has moved to the protocol specification. You can find it [here](../../protocol-specs/contract-deployment/index.md). + +## Further reading + +To see how to deploy a contract in practice, check out the [dapp development tutorial](../../tutorials/codealong/simple_dapp/index.md). diff --git a/docs/docs/aztec/concepts/smart_contracts/contract_structure.md b/docs/docs/aztec/smart_contracts/contract_structure.md similarity index 63% rename from docs/docs/aztec/concepts/smart_contracts/contract_structure.md rename to docs/docs/aztec/smart_contracts/contract_structure.md index d62ca2acfeb..b625256ee56 100644 --- a/docs/docs/aztec/concepts/smart_contracts/contract_structure.md +++ b/docs/docs/aztec/smart_contracts/contract_structure.md @@ -1,8 +1,9 @@ --- title: Contract Structure +tags: [contracts] --- -A contract is a collection of persistent [state variables](../storage/index.md), and [functions](functions) which may manipulate these variables. Functions and state variables within a contract's scope are said to belong to that contract. A contract can only access and modify its own state. If a contract wishes to access or modify another contract's state, it must make a call to an external function of the other contract. For anything to happen on the Aztec network, an external function of a contract needs to be called. +A contract is a collection of persistent state varibles and [functions](./functions/index.md) which may manipulate these variables. Functions and state variables within a contract's scope are said to belong to that contract. A contract can only access and modify its own state. If a contract wishes to access or modify another contract's state, it must make a call to an external function of the other contract. For anything to happen on the Aztec network, an external function of a contract needs to be called. ## Contract @@ -36,4 +37,4 @@ Here's a common layout for a basic Aztec.nr Contract project: ``` - See the vanilla Noir docs for [more info on packages](https://noir-lang.org/docs/noir/modules_packages_crates/crates_and_packages). -- You can review the structure of a complete contract in the token contract tutorial [here](../../../tutorials/contract_tutorials/token_contract.md). +- You can review the structure of a complete contract in the token contract tutorial [here](../../tutorials/codealong/contract_tutorials/token_contract.md). diff --git a/docs/docs/aztec/concepts/smart_contracts/functions/context.md b/docs/docs/aztec/smart_contracts/functions/context.md similarity index 91% rename from docs/docs/aztec/concepts/smart_contracts/functions/context.md rename to docs/docs/aztec/smart_contracts/functions/context.md index a105d246acc..d7383a7924e 100644 --- a/docs/docs/aztec/concepts/smart_contracts/functions/context.md +++ b/docs/docs/aztec/smart_contracts/functions/context.md @@ -6,7 +6,7 @@ tags: [functions, context] ## What is the context -The context is an object that is made available within every function in `Aztec.nr`. As mentioned in the [kernel circuit documentation](../../circuits/kernels/private_kernel.md). At the beginning of a function's execution, the context contains all of the kernel information that application needs to execute. During the lifecycle of a transaction, the function will update the context with each of it's side effects (created notes, nullifiers etc.). At the end of a function's execution the mutated context is returned to the kernel to be checked for validity. +The context is an object that is made available within every function in `Aztec.nr`. As mentioned in the [kernel circuit documentation](../../concepts/circuits/kernels/private_kernel.md). At the beginning of a function's execution, the context contains all of the kernel information that application needs to execute. During the lifecycle of a transaction, the function will update the context with each of it's side effects (created notes, nullifiers etc.). At the end of a function's execution the mutated context is returned to the kernel to be checked for validity. Behind the scenes, Aztec.nr will pass data the kernel needs to and from a circuit, this is abstracted away from the developer. In an developer's eyes; the context is a useful structure that allows access and mutate the state of the `Aztec` blockchain. @@ -20,7 +20,7 @@ On this page, you'll learn ## Two contexts, one API -The `Aztec` blockchain contains two environments [public and private](../../state_model/index.md). +The `Aztec` blockchain contains two environments - public and private. - Private, for private transactions taking place on user's devices. - Public, for public transactions taking place on the network's sequencers. @@ -88,7 +88,7 @@ The `args_hash` is the result of pedersen hashing all of a function's inputs. ### Return Values -The return values are a set of values that are returned from an applications execution to be passed to other functions through the kernel. Developers do not need to worry about passing their function return values to the `context` directly as `Aztec.nr` takes care of it for you. See the documentation surrounding `Aztec.nr` [macro expansion](./inner_workings.md#after-expansion) for more details. +The return values are a set of values that are returned from an applications execution to be passed to other functions through the kernel. Developers do not need to worry about passing their function return values to the `context` directly as `Aztec.nr` takes care of it for you. See the documentation surrounding `Aztec.nr` [macro expansion](./inner_workings.md) for more details. return_values : BoundedVec\, @@ -128,7 +128,7 @@ The public call stack contains all of the external function calls that are creat ### New L2 to L1 msgs -New L2 to L1 messages contains messages that are delivered to the [l1 outbox](../../../../protocol-specs/l1-smart-contracts/index.md) on the execution of each rollup. +New L2 to L1 messages contains messages that are delivered to the [l1 outbox](../../../protocol-specs/l1-smart-contracts/index.md) on the execution of each rollup. ## Public Context diff --git a/docs/docs/aztec/concepts/smart_contracts/functions/index.md b/docs/docs/aztec/smart_contracts/functions/index.md similarity index 69% rename from docs/docs/aztec/concepts/smart_contracts/functions/index.md rename to docs/docs/aztec/smart_contracts/functions/index.md index edc475c13d0..e991e14ad5e 100644 --- a/docs/docs/aztec/concepts/smart_contracts/functions/index.md +++ b/docs/docs/aztec/smart_contracts/functions/index.md @@ -1,10 +1,11 @@ --- title: Defining Functions +tags: [functions] --- -Functions serve as the building blocks of smart contracts. Functions can be either **public**, ie they are publicly available for anyone to see and can directly interact with public state, or **private**, meaning they are executed completely client-side in the [PXE](../../pxe/index.md). Read more about how private functions work [here](./inner_workings.md#private-functions). +Functions serve as the building blocks of smart contracts. Functions can be either **public**, ie they are publicly available for anyone to see and can directly interact with public state, or **private**, meaning they are executed completely client-side in the [PXE](../../concepts/pxe/index.md). Read more about how private functions work [here](./inner_workings.md#private-functions). -For a more practical guide of using multiple types of functions, follow the [token tutorial](../../../../tutorials/contract_tutorials/token_contract.md). +For a more practical guide of using multiple types of functions, follow the [token tutorial](../../../tutorials/codealong/contract_tutorials/token_contract.md). Currently, any function is "mutable" in the sense that it might alter state. However, we also support support static calls, similarly to EVM. A static call is essentially a call that does not alter state (it keeps state static). @@ -21,9 +22,8 @@ There are also special oracle functions, which can get data from outside of the ## Learn more about functions - [How function visibility works in Aztec](./visibility.md) -- How to write an [initializer function](../../../../guides/smart_contracts/writing_contracts/initializers.md) -- [Calling functions from within the same smart contract and from different contracts](../../../../guides/smart_contracts/writing_contracts/call_functions.md), including calling private functions from private functions, public from public, and even private from public +- How to write an [initializer function](../../../guides/developer_guides/smart_contracts/writing_contracts/initializers.md) - [Oracles](../oracles/index.md) and how Aztec smart contracts might use them - [How functions work under the hood](./inner_workings.md) -Find a function macros reference [here](../../../../reference/smart_contract_reference/macros.md). \ No newline at end of file +Find a function macros reference [here](../../../reference/developer_references/smart_contract_reference/macros.md) diff --git a/docs/docs/aztec/concepts/smart_contracts/functions/inner_workings.md b/docs/docs/aztec/smart_contracts/functions/inner_workings.md similarity index 91% rename from docs/docs/aztec/concepts/smart_contracts/functions/inner_workings.md rename to docs/docs/aztec/smart_contracts/functions/inner_workings.md index 02e5b0a5984..d4e476085f2 100644 --- a/docs/docs/aztec/concepts/smart_contracts/functions/inner_workings.md +++ b/docs/docs/aztec/smart_contracts/functions/inner_workings.md @@ -6,13 +6,13 @@ tags: [functions] Below, we go more into depth of what is happening under the hood when you create a function in an Aztec contract and what the attributes are really doing. -If you are looking for a reference of function macros, go [here](../../../../reference/smart_contract_reference/macros.md). +If you are looking for a reference of function macros, go [here](../../../reference/developer_references/smart_contract_reference/macros.md). ## Private functions #[aztec(private)] A private function operates on private information, and is executed by the user on their device. Annotate the function with the `#[aztec(private)]` attribute to tell the compiler it's a private function. This will make the [private context](./context.md#the-private-context) available within the function's execution scope. The compiler will create a circuit to define this function. -`#aztec(private)` is just syntactic sugar. At compile time, the Aztec.nr framework inserts code that allows the function to interact with the [kernel](../../circuits/kernels/private_kernel.md). +`#aztec(private)` is just syntactic sugar. At compile time, the Aztec.nr framework inserts code that allows the function to interact with the [kernel](../../../aztec/concepts/circuits/kernels/private_kernel.md). To help illustrate how this interacts with the internals of Aztec and its kernel circuits, we can take an example private function, and explore what it looks like after Aztec.nr's macro expansion. @@ -26,12 +26,12 @@ To help illustrate how this interacts with the internals of Aztec and its kernel #### The expansion broken down -Viewing the expanded Aztec contract uncovers a lot about how Aztec contracts interact with the [kernel](../../circuits/kernels/private_kernel.md). To aid with developing intuition, we will break down each inserted line. +Viewing the expanded Aztec contract uncovers a lot about how Aztec contracts interact with the kernel. To aid with developing intuition, we will break down each inserted line. **Receiving context from the kernel.** #include_code context-example-inputs /noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr rust -Private function calls are able to interact with each other through orchestration from within the [kernel circuit](../../circuits/kernels/private_kernel.md). The kernel circuit forwards information to each contract function (recall each contract function is a circuit). This information then becomes part of the private context. +Private function calls are able to interact with each other through orchestration from within the kernel circuits. The kernel circuit forwards information to each contract function (recall each contract function is a circuit). This information then becomes part of the private context. For example, within each private function we can access some global variables. To access them we can call on the `context`, e.g. `context.chain_id()`. The value of the chain ID comes from the values passed into the circuit from the kernel. The kernel checks that all of the values passed to each circuit in a function call are the same. @@ -66,7 +66,7 @@ We achieve this by pushing return values to the execution context, which we then **Making the contract's storage available** #include_code storage-example-context /noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr rust -When a [`Storage` struct](../../../../guides/smart_contracts/writing_contracts/storage) is declared within a contract, the `storage` keyword is made available. As shown in the macro expansion above, this calls the init function on the storage struct with the current function's context. +When a `Storage` struct is declared within a contract, the `storage` keyword is made available. As shown in the macro expansion above, this calls the init function on the storage struct with the current function's context. Any state variables declared in the `Storage` struct can now be accessed as normal struct members. @@ -79,14 +79,14 @@ This function takes the application context, and converts it into the `PrivateCi Unconstrained functions are an underlying part of Noir. In short, they are functions which are not directly constrained and therefore should be seen as un-trusted. That they are un-trusted means that the developer must make sure to constrain their return values when used. Note: Calling an unconstrained function from a private function means that you are injecting unconstrained values. -Defining a function as `unconstrained` tells Aztec to simulate it completely client-side in the [ACIR simulator](../../pxe/acir_simulator.md) without generating proofs. They are useful for extracting information from a user through an [oracle](../oracles). +Defining a function as `unconstrained` tells Aztec to simulate it completely client-side in the [ACIR simulator](../../../aztec/concepts/pxe/index.md) without generating proofs. They are useful for extracting information from a user through an [oracle](../oracles/index.md). When an unconstrained function is called, it prompts the ACIR simulator to 1. generate the execution environment 2. execute the function within this environment -To generate the environment, the simulator gets the blockheader from the [PXE database](../../pxe/index.md#database) and passes it along with the contract address to `ViewDataOracle`. This creates a context that simulates the state of the blockchain at a specific block, allowing the unconstrained function to access and interact with blockchain data as it would appear in that block, but without affecting the actual blockchain state. +To generate the environment, the simulator gets the blockheader from the [PXE database](../../../aztec/concepts/pxe/index.md#database) and passes it along with the contract address to `ViewDataOracle`. This creates a context that simulates the state of the blockchain at a specific block, allowing the unconstrained function to access and interact with blockchain data as it would appear in that block, but without affecting the actual blockchain state. Once the execution environment is created, `execute_unconstrained_function` is invoked: @@ -97,7 +97,7 @@ This: 1. Prepares the ACIR for execution 2. Converts `args` into a format suitable for the ACVM (Abstract Circuit Virtual Machine), creating an initial witness (witness = set of inputs required to compute the function). `args` might be an oracle to request a user's balance 3. Executes the function in the ACVM, which involves running the ACIR with the initial witness and the context. If requesting a user's balance, this would query the balance from the PXE database -4. Extracts the return values from the `partialWitness` and decodes them based on the artifact to get the final function output. The [artifact](../../../../reference/smart_contract_reference/contract_artifact.md) is the compiled output of the contract, and has information like the function signature, parameter types, and return types +4. Extracts the return values from the `partialWitness` and decodes them based on the artifact to get the final function output. The artifact is the compiled output of the contract, and has information like the function signature, parameter types, and return types Beyond using them inside your other functions, they are convenient for providing an interface that reads storage, applies logic and returns values to a UI or test. Below is a snippet from exposing the `balance_of_private` function from a token implementation, which allows a user to easily read their balance, similar to the `balanceOf` function in the ERC20 standard. @@ -115,7 +115,7 @@ A public function is executed by the sequencer and has access to a state model t All data inserted into private storage from a public function will be publicly viewable (not private). ::: -To create a public function you can annotate it with the `#[aztec(public)]` attribute. This will make the [public context](./context.md) available within the function's execution scope. +To create a public function you can annotate it with the `#[aztec(public)]` attribute. This will make the public context available within the function's execution scope. #include_code set_minter /noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust @@ -183,7 +183,7 @@ assert(context.msg_sender() == context.this_address(), "Function can only be cal ## Custom notes #[aztec(note)] -The `#[aztec(note)]` attribute is used to define custom note types in Aztec contracts. Learn more about notes [here](../../../concepts/storage/index.md). +The `#[aztec(note)]` attribute is used to define custom note types in Aztec contracts. Learn more about notes [here](../../concepts/storage/index.md). When a struct is annotated with `#[aztec(note)]`, the Aztec macro applies a series of transformations and generates implementations to turn it into a note that can be used in contracts to store private data. @@ -361,6 +361,6 @@ Key things to keep in mind: ## Further reading - [How do macros work](./inner_workings.md) -- [Macros reference](../../../../reference/smart_contract_reference/macros.md) +- [Macros reference](../../../reference/developer_references/smart_contract_reference/macros.md) diff --git a/docs/docs/aztec/concepts/smart_contracts/functions/visibility.md b/docs/docs/aztec/smart_contracts/functions/visibility.md similarity index 92% rename from docs/docs/aztec/concepts/smart_contracts/functions/visibility.md rename to docs/docs/aztec/smart_contracts/functions/visibility.md index d534953aa65..84bdcb04f52 100644 --- a/docs/docs/aztec/concepts/smart_contracts/functions/visibility.md +++ b/docs/docs/aztec/smart_contracts/functions/visibility.md @@ -6,7 +6,7 @@ tags: [functions] In Aztec there are multiple different types of visibility that can be applied to functions. Namely we have `data visibility` and `function visibility`. This page explains these types of visibility. -For a practical guide of using multiple types of data and function visibility,follow the [token tutorial](../../../../tutorials/contract_tutorials/token_contract.md). +For a practical guide of using multiple types of data and function visibility,follow the [token tutorial](../../../tutorials/codealong/contract_tutorials/token_contract.md). ### Data Visibility @@ -21,7 +21,7 @@ By default, all functions are callable from other contracts, similarly to the So A good place to use `internal` is when you want a private function to be able to alter public state. As mentioned above, private functions cannot do this directly. They are able to call public functions and by making these internal we can ensure that this state manipulating function is only callable from our private function. :::danger -Note that non-internal functions could be used directly as an entry-point, which currently means that the `msg_sender` would be `0`, so for now, using address `0` as a burn address is not recommended. You can learn more about this in the [Accounts concept page](../../index.md#entrypoint-restrictions). +Note that non-internal functions could be used directly as an entry-point, which currently means that the `msg_sender` would be `0`, so for now, using address `0` as a burn address is not recommended. You can learn more about this in the [Accounts concept page](../../concepts/accounts/keys.md). ::: To understand how visibility works under the hood, check out the [Inner Workings page](./inner_workings.md). diff --git a/docs/docs/aztec/concepts/smart_contracts/oracles/index.md b/docs/docs/aztec/smart_contracts/oracles/index.md similarity index 91% rename from docs/docs/aztec/concepts/smart_contracts/oracles/index.md rename to docs/docs/aztec/smart_contracts/oracles/index.md index fd36f37b706..bd2f2ddc0a5 100644 --- a/docs/docs/aztec/concepts/smart_contracts/oracles/index.md +++ b/docs/docs/aztec/smart_contracts/oracles/index.md @@ -1,10 +1,11 @@ --- title: Oracle Functions +tags: [functions, oracles] --- This page goes over what oracles are in Aztec and how they work. -Looking for a hands-on guide? You can learn how to use oracles in a smart contract [here](../../../../guides/smart_contracts/writing_contracts/how_to_pop_capsules.md). +Looking for a hands-on guide? You can learn how to use oracles in a smart contract [here](../../../guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md). An oracle is something that allows us to get data from the outside world into our contracts. The most widely-known types of oracles in blockchain systems are probably Chainlink price feeds, which allow us to get the price of an asset in USD taking non-blockchain data into account. @@ -13,7 +14,7 @@ While this is one type of oracle, the more general oracle, allows us to get any **Why is this useful? Why don't just pass them as input parameters?** In the world of EVM, you would just read the values directly from storage and call it a day. However, when we are working with circuits for private execution, this becomes more tricky as you cannot just read the storage directly from your state tree, because there are only commitments (e.g. hashes) there. The pre-images (content) of your commitments need to be provided to the function to prove that you actually allowed to modify them. -If we fetch the notes using an oracle call, we can keep the function signature independent of the underlying data and make it easier to use. A similar idea, applied to the authentication mechanism is used for the Authentication Witnesses that allow us to have a single function signature for any wallet implementation, see [AuthWit](../../wallets/index.md#authorizing-actions) for more information on this. +If we fetch the notes using an oracle call, we can keep the function signature independent of the underlying data and make it easier to use. A similar idea, applied to the authentication mechanism is used for the Authentication Witnesses that allow us to have a single function signature for any wallet implementation, see [AuthWit](../../concepts/accounts/authwit.md) for more information on this. Oracles introduce **non-determinism** into a circuit, and thus are `unconstrained`. It is important that any information that is injected into a circuit through an oracle is later constrained for correctness. Otherwise, the circuit will be **under-constrained** and potentially insecure! @@ -22,7 +23,7 @@ Oracles introduce **non-determinism** into a circuit, and thus are `unconstraine ## Inbuilt oracles -- [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) - Provides a couple of debug functions that can be used to log information to the console. Read more about debugging [here](../../../../reference/debugging.md#logging-in-aztecnr). +- [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) - Provides a couple of debug functions that can be used to log information to the console. Read more about debugging [here](../../../reference/developer_references/debugging.md). - [`auth_witness`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/authwit/src/auth_witness.nr) - Provides a way to fetch the authentication witness for a given address. This is useful when building account contracts to support approve-like functionality. - [`get_l1_to_l2_message`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/get_l1_to_l2_message.nr) - Useful for application that receive messages from L1 to be consumed on L2, such as token bridges or other cross-chain applications. - [`notes`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/notes.nr) - Provides a lot of functions related to notes, such as fetches notes from storage etc, used behind the scenes for value notes and other pre-build note implementations. @@ -30,4 +31,4 @@ Oracles introduce **non-determinism** into a circuit, and thus are `unconstraine Find a full list [on GitHub](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/aztec-nr/aztec/src/oracle). -Please note that it is **not** possible to write a custom oracle for your dapp. Oracles are implemented in the PXE, so all users of your dapp would have to use a PXE service with your custom oracle included. If you want to inject some arbitrary data that does not have a dedicated oracle, you can use [popCapsule](../../../../guides/smart_contracts/writing_contracts/how_to_pop_capsules.md). +Please note that it is **not** possible to write a custom oracle for your dapp. Oracles are implemented in the PXE, so all users of your dapp would have to use a PXE service with your custom oracle included. If you want to inject some arbitrary data that does not have a dedicated oracle, you can use [popCapsule](../../../guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md). diff --git a/docs/docs/aztec/concepts/smart_contracts/index.md b/docs/docs/aztec/smart_contracts_overview.md similarity index 92% rename from docs/docs/aztec/concepts/smart_contracts/index.md rename to docs/docs/aztec/smart_contracts_overview.md index 04f1c6ea5d0..2ccb8b76692 100644 --- a/docs/docs/aztec/concepts/smart_contracts/index.md +++ b/docs/docs/aztec/smart_contracts_overview.md @@ -1,6 +1,7 @@ --- title: Smart Contracts sidebar_position: 3 +tags: [contracts] --- Smart contracts in Aztec are privacy-first, and can include both public and private elements. They are written in Noir framework called Aztec.nr, and allow high-level programs to be converted into ZK circuits. @@ -24,4 +25,4 @@ There are no plans for EVM compatibility or to support Solidity in Aztec. The pr ## Further reading -Read more about writing Aztec contracts [here](../../../guides/smart_contracts/writing_contracts/initializers). +Jump in and write your first smart contract [here](../tutorials/codealong/contract_tutorials/counter_contract.md) diff --git a/docs/docs/guides/_category_.json b/docs/docs/guides/_category_.json new file mode 100644 index 00000000000..3d8f3e3bf4c --- /dev/null +++ b/docs/docs/guides/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Guides", + "link": { "type": "doc", "id": "guides/index" } +} diff --git a/docs/docs/guides/developer_guides/getting_started/_category_.json b/docs/docs/guides/developer_guides/getting_started/_category_.json new file mode 100644 index 00000000000..4b7c1cbad3b --- /dev/null +++ b/docs/docs/guides/developer_guides/getting_started/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 1, + "collapsible": true, + "collapsed": false, + "label": "Getting Started" +} diff --git a/docs/docs/getting_started/codespaces.md b/docs/docs/guides/developer_guides/getting_started/codespaces.md similarity index 98% rename from docs/docs/getting_started/codespaces.md rename to docs/docs/guides/developer_guides/getting_started/codespaces.md index bc6d494e7e9..10658c856c2 100644 --- a/docs/docs/getting_started/codespaces.md +++ b/docs/docs/guides/developer_guides/getting_started/codespaces.md @@ -1,6 +1,6 @@ --- title: Codespaces -sidebar_position: 0 +sidebar_position: 1 draft: true --- diff --git a/docs/docs/getting_started.md b/docs/docs/guides/developer_guides/getting_started/quickstart.md similarity index 84% rename from docs/docs/getting_started.md rename to docs/docs/guides/developer_guides/getting_started/quickstart.md index 923d5e303a8..edf15edd5ea 100644 --- a/docs/docs/getting_started.md +++ b/docs/docs/guides/developer_guides/getting_started/quickstart.md @@ -1,5 +1,7 @@ --- title: Quickstart +sidebar_position: 0 +tags: [sandbox] --- You can get started with an Aztec development environment (A.K.A. Sandbox) in less than 5 minutes. @@ -61,7 +63,7 @@ If you wish to run components of the Aztec network stack separately, you can use aztec start --node [nodeOptions] --pxe [pxeOptions] --archiver [archiverOptions] --sequencer [sequencerOptions] --prover [proverOptions] ----p2p-bootstrap [p2pOptions] ``` -Starting the aztec node alongside a PXE, sequencer or archiver, will attach the components to the node. Eg if you want to run a PXE separately to a node, you can [read this guide](./aztec/concepts/pxe/index.md). +Starting the aztec node alongside a PXE, sequencer or archiver, will attach the components to the node. Eg if you want to run a PXE separately to a node, you can [read this guide](../local_env/run_more_than_one_pxe_sandbox.md). ## Update the sandbox @@ -91,7 +93,15 @@ Update the `Noir: Nargo Path` field to point to your desired `aztec-nargo` execu Now you have a development network running, so you're ready to start coding your first app with Aztec.nr and Aztec.js! -To follow the series of tutorials, start with the private voting contract [here](./tutorials/contract_tutorials/private_voting_contract.md). - -If you want to just keep learning, you can read about the high level architecture on the [Core Components page](./aztec/concepts/state_model/index.md) and [the lifecycle of a transaction](./aztec/concepts/transactions.md). - +If you want to start coding, it is recommended to go through the tutorials in order. Click on the link below to dive in! + +
+ + +

Write your first contract

+
+ + Write and deploy a simple private counter smart contract on your local sandbox + +
+
diff --git a/docs/docs/guides/js_apps/_category_.json b/docs/docs/guides/developer_guides/js_apps/_category_.json similarity index 80% rename from docs/docs/guides/js_apps/_category_.json rename to docs/docs/guides/developer_guides/js_apps/_category_.json index f5afa68de01..5e0931f01e5 100644 --- a/docs/docs/guides/js_apps/_category_.json +++ b/docs/docs/guides/developer_guides/js_apps/_category_.json @@ -1,5 +1,5 @@ { - "position": 2, + "position": 3, "collapsible": true, "collapsed": true, "label": "Aztec.js" diff --git a/docs/docs/guides/js_apps/authwit.md b/docs/docs/guides/developer_guides/js_apps/authwit.md similarity index 96% rename from docs/docs/guides/js_apps/authwit.md rename to docs/docs/guides/developer_guides/js_apps/authwit.md index 702a8a29bb4..9dc7dcae0d8 100644 --- a/docs/docs/guides/js_apps/authwit.md +++ b/docs/docs/guides/developer_guides/js_apps/authwit.md @@ -1,11 +1,11 @@ --- title: How to use authentication witnesses (authwit) -tags: [accounts] +tags: [accounts, authwit] --- This page assumes you have authwit set up correctly in your contract. To learn how to do that, [go here](../smart_contracts/writing_contracts/authwit.md). -For an introduction to authentication witnesses on Aztec, [read this explainer](../../aztec/concepts/accounts/authwit.md). +For an introduction to authentication witnesses on Aztec, [read this explainer](../../../aztec/concepts/accounts/authwit.md). ## Import libraries @@ -117,5 +117,5 @@ If you created an arbitrary message, you would replace the first param struct wi ## Further reading -- [An explainer of authentication witnesses](../../aztec/concepts/accounts/authwit.md) +- [An explainer of authentication witnesses](../../../aztec/concepts/accounts/authwit.md) - [Authwits in Aztec.nr](../smart_contracts/writing_contracts/authwit.md) diff --git a/docs/docs/guides/js_apps/call_view_function.md b/docs/docs/guides/developer_guides/js_apps/call_view_function.md similarity index 98% rename from docs/docs/guides/js_apps/call_view_function.md rename to docs/docs/guides/developer_guides/js_apps/call_view_function.md index 0c1232722b7..952464a2327 100644 --- a/docs/docs/guides/js_apps/call_view_function.md +++ b/docs/docs/guides/developer_guides/js_apps/call_view_function.md @@ -1,5 +1,6 @@ --- title: How to Simulate a Function Call +tags: [functions] --- This guide explains how to `simulate` a function call using Aztec.js. diff --git a/docs/docs/guides/js_apps/create_account.md b/docs/docs/guides/developer_guides/js_apps/create_account.md similarity index 100% rename from docs/docs/guides/js_apps/create_account.md rename to docs/docs/guides/developer_guides/js_apps/create_account.md diff --git a/docs/docs/guides/js_apps/deploy_contract.md b/docs/docs/guides/developer_guides/js_apps/deploy_contract.md similarity index 78% rename from docs/docs/guides/js_apps/deploy_contract.md rename to docs/docs/guides/developer_guides/js_apps/deploy_contract.md index 51ddd83c74e..2b59f7588e8 100644 --- a/docs/docs/guides/js_apps/deploy_contract.md +++ b/docs/docs/guides/developer_guides/js_apps/deploy_contract.md @@ -1,5 +1,6 @@ --- title: How to Deploy a Contract +tags: [contracts] --- This guide explains how to deploy a smart contract using Aztec.js. @@ -10,11 +11,11 @@ You should have a wallet to act as the deployer, and a contract artifact ready t You can learn how to create wallets from [this guide](./create_account.md). -You can read about contract artifacts [here](../../aztec/concepts/smart_contracts/contract_structure.md). +You can read about contract artifacts [here](../../../aztec/smart_contracts/contract_structure.md). ## Import the contract artifact -In this guide we are using a Token contract artifact. This comes from the [token contract tutorial](../../tutorials/contract_tutorials/token_contract.md). +In this guide we are using a Token contract artifact. This comes from the [token contract tutorial](../../../tutorials/codealong/contract_tutorials/token_contract.md). #include_code import_token_contract yarn-project/end-to-end/src/composed/docs_examples.test.ts typescript diff --git a/docs/docs/guides/js_apps/rotate_keys.md b/docs/docs/guides/developer_guides/js_apps/rotate_keys.md similarity index 91% rename from docs/docs/guides/js_apps/rotate_keys.md rename to docs/docs/guides/developer_guides/js_apps/rotate_keys.md index 01d240b8dd0..55eba15e4ef 100644 --- a/docs/docs/guides/js_apps/rotate_keys.md +++ b/docs/docs/guides/developer_guides/js_apps/rotate_keys.md @@ -1,8 +1,9 @@ --- title: How to Rotate Nullifier Keys +tags: [accounts, keys] --- -This guide explains how to rotate nullifer secret and public keys using Aztec.js. To learn more about key rotation, read the [concepts section](../../aztec/concepts/accounts/keys.md#key-rotation). +This guide explains how to rotate nullifer secret and public keys using Aztec.js. To learn more about key rotation, read the [concepts section](../../../aztec/concepts/accounts/keys.md#key-rotation) ## Prerequisites diff --git a/docs/docs/guides/js_apps/send_transaction.md b/docs/docs/guides/developer_guides/js_apps/send_transaction.md similarity index 100% rename from docs/docs/guides/js_apps/send_transaction.md rename to docs/docs/guides/developer_guides/js_apps/send_transaction.md diff --git a/docs/docs/guides/js_apps/test.md b/docs/docs/guides/developer_guides/js_apps/test.md similarity index 69% rename from docs/docs/guides/js_apps/test.md rename to docs/docs/guides/developer_guides/js_apps/test.md index 546ce64a8b6..dc1d0b4d0e4 100644 --- a/docs/docs/guides/js_apps/test.md +++ b/docs/docs/guides/developer_guides/js_apps/test.md @@ -1,5 +1,6 @@ --- title: Testing Aztec.nr contracts with TypeScript +tags: [contracts, tests] --- In this guide we will cover how to interact with your Aztec.nr smart contracts in a testing environment to write automated tests for your apps. @@ -7,7 +8,7 @@ In this guide we will cover how to interact with your Aztec.nr smart contracts i ## Prerequisites - A compiled contract with TS interface (read [how to compile](../smart_contracts/how_to_compile_contract.md)) -- Your sandbox running (read [getting started](../../getting_started.md)) +- Your sandbox running (read [getting started](../getting_started/quickstart.md)) ## Create TS file and install libraries @@ -60,7 +61,7 @@ This debug information will be populated in the transaction receipt. You can log #include_code debug /yarn-project/end-to-end/src/e2e_token_contract/minting.test.ts typescript -You can also log directly from Aztec contracts. Read [this guide](/reference/debugging.md##logging-in-aztecnr) for some more information. +You can also log directly from Aztec contracts. Read [this guide](../../../reference/developer_references/debugging.md#logging-in-aztecnr) for some more information. ### Examples @@ -82,7 +83,7 @@ We can have private transactions that work fine locally, but are dropped by the #### A public call fails locally -Public function calls can be caught failing locally similar to how we catch private function calls. For this example, we use a [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) instead of a private one. +Public function calls can be caught failing locally similar to how we catch private function calls. For this example, we use a [`TokenContract` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) instead of a private one. #include_code local-pub-fails /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript @@ -100,25 +101,25 @@ WARN Error processing tx 06dc87c4d64462916ea58426ffcfaf20017880b353c9ec3e0f0ee5f We can check private or public state directly rather than going through view-only methods, as we did in the initial example by calling `token.methods.balance().simulate()`. -To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](../../reference/smart_contract_reference/storage/index.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the [`CheatCodes`](../../reference/sandbox_reference/cheat_codes.md) utility class: +To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](../../../reference/developer_references/smart_contract_reference/storage/index.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the [`CheatCodes`](../../../reference/developer_references/sandbox_reference/cheat_codes.md) utility class: #include_code calc-slot /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript #### Querying private state -Private state in the Aztec is represented via sets of [private notes](../../aztec/concepts/state_model/index.md#private-state). We can query the Private Execution Environment (PXE) for all notes encrypted for a given user in a contract slot. For example, this gets all notes encrypted for the `owner` user that are stored on the token contract address and on the slot that was calculated earlier. To calculate the actual balance, it extracts the `value` of each note, which is the first element, and sums them up. +Private state in the Aztec is represented via sets of [private notes](../../../aztec/concepts/state_model/index.md#private-state). We can query the Private Execution Environment (PXE) for all notes encrypted for a given user in a contract slot. For example, this gets all notes encrypted for the `owner` user that are stored on the token contract address and on the slot that was calculated earlier. To calculate the actual balance, it extracts the `value` of each note, which is the first element, and sums them up. #include_code private-storage /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript #### Querying public state -[Public state](../../aztec/concepts/state_model/index.md#public-state) behaves as a key-value store, much like in the EVM. We can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6. +Public state behaves as a key-value store, much like in the EVM. We can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6. #include_code public-storage /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript ### Logs -You can check the logs of [events](../smart_contracts/writing_contracts/how_to_emit_event.md) emitted by contracts. Contracts in Aztec can emit both [encrypted](../smart_contracts/writing_contracts/how_to_emit_event.md#Encrypted-Events) and [unencrypted](../smart_contracts/writing_contracts/how_to_emit_event.md#Unencrypted-Events) events. +You can check the logs of events emitted by contracts. Contracts in Aztec can emit both encrypted and unencrypted events. #### Querying unencrypted logs @@ -128,17 +129,16 @@ We can query the PXE for the unencrypted logs emitted in the block where our tra ## Cheats -The [`CheatCodes`](../../reference/sandbox_reference/cheat_codes.md) class, which we used for [calculating the storage slot above](#querying-state), also includes a set of cheat methods for modifying the chain state that can be handy for testing. +The [`CheatCodes`](../../../reference/developer_references/sandbox_reference/cheat_codes.md) class, which we used for [calculating the storage slot above](#querying-state), also includes a set of cheat methods for modifying the chain state that can be handy for testing. ### Set next block timestamp -The `warp` method sets the time for next execution, both on L1 and L2. We can test this using an `isTimeEqual` function in a `Test` contract defined like the following: +Since the rollup time is dependent on what "slot" the block is included in, time can be progressed by progressing slots. +The duration of a slot is available by calling `SLOT_DURATION()` on the Rollup (code in Leonidas.sol). -#include_code is-time-equal noir-projects/noir-contracts/contracts/test_contract/src/main.nr rust +You can then use the `warp` function on the EthCheatCodes to progress the underlying chain. -We can then call `warp` and rely on the `isTimeEqual` function to check that the timestamp was properly modified. - -#include_code warp /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript + ## Further reading @@ -146,5 +146,5 @@ We can then call `warp` and rely on the `isTimeEqual` function to check that the - [How to send a transactions in Aztec.js](./send_transaction.md) - [How to deploy a contract in Aztec.js](./deploy_contract.md) - [How to create an account in Aztec.js](./create_account.md) -- [Cheat codes](../../reference/sandbox_reference/cheat_codes.md) +- [Cheat codes](../../../reference/developer_references/sandbox_reference/cheat_codes.md) - [How to compile a contract](../smart_contracts/how_to_compile_contract.md). diff --git a/docs/docs/guides/local_env/_category_.json b/docs/docs/guides/developer_guides/local_env/_category_.json similarity index 82% rename from docs/docs/guides/local_env/_category_.json rename to docs/docs/guides/developer_guides/local_env/_category_.json index 808175f5ff1..5c8df7e68a1 100644 --- a/docs/docs/guides/local_env/_category_.json +++ b/docs/docs/guides/developer_guides/local_env/_category_.json @@ -1,5 +1,5 @@ { - "position": 0, + "position": 2, "collapsible": true, "collapsed": true, "label": "Development Environment" diff --git a/docs/docs/guides/local_env/creating_schnorr_accounts.md b/docs/docs/guides/developer_guides/local_env/creating_schnorr_accounts.md similarity index 89% rename from docs/docs/guides/local_env/creating_schnorr_accounts.md rename to docs/docs/guides/developer_guides/local_env/creating_schnorr_accounts.md index 92c145af408..d9b3837f274 100644 --- a/docs/docs/guides/local_env/creating_schnorr_accounts.md +++ b/docs/docs/guides/developer_guides/local_env/creating_schnorr_accounts.md @@ -2,6 +2,7 @@ title: Creating Schnorr Accounts sidebar_position: 1 draft: true +tags: [accounts] --- @@ -10,14 +11,14 @@ draft: true This section shows how to create schnorr account wallets on the Aztec Sandbox. -An in-depth explaining about accounts on aztec can be found [here](../../aztec/concepts/accounts/index.md). But creating an account on the Sandbox does 2 things: +An in-depth explainer about accounts on aztec can be found [here](../../../aztec/concepts/accounts/index.md). But creating an account on the Sandbox does 2 things: 1. Deploys an account contract -- representing you -- allowing you to perform actions on the network (deploy contracts, call functions etc). 2. Adds your encryption keys to the Private eXecution Environment (PXE) allowing it to decrypt and manage your private state. ## Pre-requisites -Have a running Sandbox and a repository that interacts with it as explained [here](../../getting_started.md). +Have a running Sandbox and a repository that interacts with it as explained [in the quickstart](../getting_started/quickstart.md). Let's assume you have a file `src/index.ts` from the example used in the Sandbox page. @@ -64,4 +65,4 @@ Once this has completed, the L2 block is retrieved and pulled down to the PXE so ## Next Steps -Check out our section on [Writing your own Account Contract](../../tutorials/write_accounts_contract.md) leveraging our account abstraction +Check out our section on [Writing your own Account Contract](../../../tutorials/codealong/contract_tutorials/write_accounts_contract.md) leveraging our account abstraction. diff --git a/docs/docs/guides/local_env/run_more_than_one_pxe_sandbox.md b/docs/docs/guides/developer_guides/local_env/run_more_than_one_pxe_sandbox.md similarity index 92% rename from docs/docs/guides/local_env/run_more_than_one_pxe_sandbox.md rename to docs/docs/guides/developer_guides/local_env/run_more_than_one_pxe_sandbox.md index 0bf2c4f12f3..d8530befc98 100644 --- a/docs/docs/guides/local_env/run_more_than_one_pxe_sandbox.md +++ b/docs/docs/guides/developer_guides/local_env/run_more_than_one_pxe_sandbox.md @@ -1,6 +1,7 @@ --- title: Running Multiple PXEs in the Sandbox sidebar_position: 2 +tags: [PXE] --- :::warning @@ -43,10 +44,10 @@ You should see something like this: pxe_service Added contract ContractClassRegisterer at 0x030c6b23cf81a1c1387674e7d180ef04abc19387eb0ec71eea67c2b602b517b7 pxe_service Added contract ContractInstanceDeployer at 0x2d8e7aedc70b65d49e6aa0794d8d12721896c177e87126701f6e60d184358e74 pxe_service Added contract MultiCallEntrypoint at 0x0325a7874e168991a060b7f54e7324a42f87f48ffa592a903a5ce170b9d99e20 - pxe_service Added contract GasToken at 0x0f0be9c2e88fe0a7baa0823fbf7cfba98a6ba71558d6b5a4ee497e3b38f0aa7c + pxe_service Added contract FeeJuice at 0x0f0be9c2e88fe0a7baa0823fbf7cfba98a6ba71558d6b5a4ee497e3b38f0aa7c pxe_synchronizer Initial sync complete pxe_service Started PXE connected to chain 31337 version 1 Aztec Server listening on port 8080 ``` -You can learn more about custom commands in the [sandbox reference](../../reference/sandbox_reference/sandbox-reference.md). +You can learn more about custom commands in the [sandbox reference](../../../reference/developer_references/sandbox_reference/sandbox-reference.md). diff --git a/docs/docs/guides/local_env/versions-updating.md b/docs/docs/guides/developer_guides/local_env/versions-updating.md similarity index 88% rename from docs/docs/guides/local_env/versions-updating.md rename to docs/docs/guides/developer_guides/local_env/versions-updating.md index b310225bc25..263a00ec5aa 100644 --- a/docs/docs/guides/local_env/versions-updating.md +++ b/docs/docs/guides/developer_guides/local_env/versions-updating.md @@ -1,6 +1,7 @@ --- title: Updating the Sandbox sidebar_position: 0 +tags: [sandbox] --- - Current version: `#include_aztec_version` @@ -55,7 +56,7 @@ diff ~/nargo/github.com/AztecProtocol/aztec-packages-v0.23.0/yarn-project/noir-c ### Language server version (aztec-nargo) -The [Noir LSP](../../getting_started.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`. +The [Noir LSP](../getting_started/quickstart.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`. The path of the former (once installed) can be seen by hovering over "Nargo" in the bottom status bar of VS Code, and the latter via the `which aztec-nargo` command. :::caution @@ -93,11 +94,11 @@ cd your/aztec/project aztec update . --contract src/contract1 --contract src/contract2 ``` -The sandbox must be running for the update command to work. Make sure it is [installed and running](../../reference/sandbox_reference/sandbox-reference.md). +The sandbox must be running for the update command to work. Make sure it is [installed and running](../../../reference/developer_references/sandbox_reference/sandbox-reference.md). Follow [updating Aztec.nr packages](#updating-aztecnr-packages) and [updating JavaScript packages](#updating-aztecjs-packages) guides. -3. Refer to [Migration Notes](../../migration_notes.md) on any breaking changes that might affect your dapp +3. Refer to [Migration Notes](../../../migration_notes.md) on any breaking changes that might affect your dapp --- @@ -139,7 +140,7 @@ cd /your/contract/directory aztec-nargo compile ``` -If the dependencies fail to resolve ensure that the tag matches a tag in the [aztec-packages repository](https://github.com/AztecProtocol/aztec-packages/tags). +If the dependencies fail to resolve ensure that the tag matches a tag in the [aztec-packages repository (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tags). ## Updating Aztec.js packages @@ -161,9 +162,9 @@ As mentioned in the tl;dr, `aztec-nargo` is updated as part of updating the whol aztec-up ``` -The version of aztec-nargo that comes with a particular version of the Aztec sandbox can be seen in the monorepo. Eg tag: aztec-packages-v0.35.0 contains aztec-nargo [v0.27.0](https://github.com/AztecProtocol/aztec-packages/blob/aztec-packages-v0.35.0/noir/noir-repo/Cargo.toml#L44). +The version of aztec-nargo that comes with a particular version of the Aztec sandbox can be seen in the monorepo. Eg tag: aztec-packages-v0.35.0 contains aztec-nargo [v0.27.0 (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/aztec-packages-v0.35.0/noir/noir-repo/Cargo.toml#L44). -Set VERSION to specify the desired Aztec sandbox version, eg monorepo tag suffix [0.35.0](https://github.com/AztecProtocol/aztec-packages/tree/aztec-packages-v0.35.0) (to have `aztec-nargo` v0.27.0). +Set VERSION to specify the desired Aztec sandbox version, eg monorepo tag suffix [0.35.0 (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/aztec-packages-v0.35.0) (to have `aztec-nargo` v0.27.0). ```bash VERSION= aztec-up diff --git a/docs/docs/guides/smart_contracts/_category_.json b/docs/docs/guides/developer_guides/smart_contracts/_category_.json similarity index 80% rename from docs/docs/guides/smart_contracts/_category_.json rename to docs/docs/guides/developer_guides/smart_contracts/_category_.json index e323c74a391..d0bf2983301 100644 --- a/docs/docs/guides/smart_contracts/_category_.json +++ b/docs/docs/guides/developer_guides/smart_contracts/_category_.json @@ -1,5 +1,5 @@ { - "position": 1, + "position": 4, "collapsible": true, "collapsed": true, "label": "Aztec.nr" diff --git a/docs/docs/guides/smart_contracts/how_to_compile_contract.md b/docs/docs/guides/developer_guides/smart_contracts/how_to_compile_contract.md similarity index 88% rename from docs/docs/guides/smart_contracts/how_to_compile_contract.md rename to docs/docs/guides/developer_guides/smart_contracts/how_to_compile_contract.md index c63d7e28876..1bea4c72e2d 100644 --- a/docs/docs/guides/smart_contracts/how_to_compile_contract.md +++ b/docs/docs/guides/developer_guides/smart_contracts/how_to_compile_contract.md @@ -1,9 +1,10 @@ --- title: How to Compile a Contract sidebar_position: 3 +tags: [contracts] --- -Once you have written a contract in Aztec.nr, you will need to compile it into an [artifact](../../aztec/concepts/smart_contracts/contract_structure.md) in order to use it. +Once you have written a contract in Aztec.nr, you will need to compile it into an artifact in order to use it. In this guide we will cover how to do so, both using the `aztec-nargo` command and programmatically. @@ -19,7 +20,7 @@ Run the `aztec-nargo compile` command within your contract project folder (the o aztec-nargo compile ``` -This will output a JSON [artifact](../../aztec/concepts/smart_contracts/contract_structure.md) for each contract in the project to a `target` folder containing the Noir ABI artifacts. +This will output a JSON artifact for each contract in the project to a `target` folder containing the Noir ABI artifacts. :::note This command looks for `Nargo.toml` files by ascending up the parent directories, and will compile the top-most Nargo.toml file it finds. @@ -42,7 +43,7 @@ You can use the code generator to autogenerate type-safe typescript classes for aztec codegen ./aztec-nargo/output/target/path -o src/artifacts ``` -Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract: +Below is typescript code generated from the [Token (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract: ```ts showLineNumbers export class TokenContract extends ContractBase { @@ -222,15 +223,15 @@ export class TokenContract extends ContractBase { } ``` -Read more about interacting with contracts using `aztec.js` [here](../../tutorials/aztecjs-getting-started.md). +Read more about interacting with contracts using `aztec.js` [by following this tutorial](../../../tutorials/codealong/aztecjs-getting-started.md). ### Aztec.nr interfaces -An Aztec.nr contract can [call a function](writing_contracts/call_functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe. +An Aztec.nr contract can [call a function](./writing_contracts/call_functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe. To make this easier, the compiler automatically generates interface structs that expose a convenience method for each function listed in a given contract artifact. These structs are intended to be used from another contract project that calls into the current one. -Below is an example of interface usage generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract, used from the [FPC](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr): +Below is an example of interface usage generated from the [Token (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract, used from the [FPC (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr): ```rust contract FPC { @@ -260,7 +261,7 @@ contract FPC { } ``` -Read more about how to use the Aztec.nr interfaces [here](../../aztec/concepts/smart_contracts/functions/index.md). +Read more about how to use the Aztec.nr interfaces [here](../../../aztec/smart_contracts/functions/index.md). :::info At the moment, the compiler generates these interfaces from already compiled ABIs, and not from source code. This means that you should not import a generated interface from within the same project as its source contract, or you risk circular references. diff --git a/docs/docs/guides/smart_contracts/how_to_deploy_contract.md b/docs/docs/guides/developer_guides/smart_contracts/how_to_deploy_contract.md similarity index 71% rename from docs/docs/guides/smart_contracts/how_to_deploy_contract.md rename to docs/docs/guides/developer_guides/smart_contracts/how_to_deploy_contract.md index eb07475b884..90584a31e08 100644 --- a/docs/docs/guides/smart_contracts/how_to_deploy_contract.md +++ b/docs/docs/guides/developer_guides/smart_contracts/how_to_deploy_contract.md @@ -1,17 +1,18 @@ --- title: How to Deploy a Contract sidebar_position: 4 +tags: [contracts, sandbox] --- # Deploying contracts -Once you have [compiled](how_to_compile_contract.md) your contracts you can proceed to deploying them using aztec.js which is a Typescript client to interact with the sandbox. +Once you have [compiled](./how_to_compile_contract.md) your contracts you can proceed to deploying them using aztec.js which is a Typescript client to interact with the sandbox. ## Prerequisites -- `aztec-nargo` installed (go to [Sandbox section](../../reference/sandbox_reference/index.md) for installation instructions) -- contract artifacts ready (go to [How to Compile Contract](how_to_compile_contract.md) for instructions on how to compile contracts) -- Aztec Sandbox running (go to [Sandbox section](../../getting_started.md) for instructions on how to install and run the sandbox) +- `aztec-nargo` installed (go to [Sandbox section](../../../reference/developer_references/sandbox_reference/sandbox-reference.md) for installation instructions) +- contract artifacts ready (go to [How to Compile Contract](./how_to_compile_contract.md) for instructions on how to compile contracts) +- Aztec Sandbox running (go to [Sandbox section](../getting_started/quickstart.md) for instructions on how to install and run the sandbox) ## Deploy @@ -29,7 +30,7 @@ Generate the typescript class: aztec codegen ./aztec-nargo/output/target/path -o src/artifacts ``` -This would create a typescript file like `Example.ts` in `./src/artifacts`. Read more on the [compiling page](how_to_compile_contract.md). +This would create a typescript file like `Example.ts` in `./src/artifacts`. Read more on the [compiling page](./how_to_compile_contract.md). You can use the `Contract` class to deploy a contract: diff --git a/docs/docs/guides/smart_contracts/testing_contracts/_category_.json b/docs/docs/guides/developer_guides/smart_contracts/testing_contracts/_category_.json similarity index 100% rename from docs/docs/guides/smart_contracts/testing_contracts/_category_.json rename to docs/docs/guides/developer_guides/smart_contracts/testing_contracts/_category_.json diff --git a/docs/docs/guides/smart_contracts/testing_contracts/index.md b/docs/docs/guides/developer_guides/smart_contracts/testing_contracts/testing.md similarity index 91% rename from docs/docs/guides/smart_contracts/testing_contracts/index.md rename to docs/docs/guides/developer_guides/smart_contracts/testing_contracts/testing.md index 187035425ef..b6463a0f222 100644 --- a/docs/docs/guides/smart_contracts/testing_contracts/index.md +++ b/docs/docs/guides/developer_guides/smart_contracts/testing_contracts/testing.md @@ -1,5 +1,6 @@ --- -title: Testing Contracts +title: Testing Contracts in the TXE +tags: [contracts, tests] --- Aztec contracts can be tested in a variety of ways depending on the needs of a particular application and the complexity of the interactions they must support. @@ -26,22 +27,26 @@ TXE is a JSON RPC server much like PXE, but provides an extra set of oracle func End-to-end tests are written in typescripts and use compiled Aztec contracts and generated Typescript interfaces, a private execution environment (PXE) and a simulated execution environment to process transactions, create blocks and apply state updates. This allows for advanced checks on state updates like generation the of logs, cross-chain messages and checking transaction status and also enforce the rules of the protocol (e.g. checks in our rollup circuits). If you need the rules of the protocol to be enforced or require complex interactions (such as with L1 contracts), please refer to [Testing Aztec.nr contracts with Typescript](../../js_apps/test.md). -The TXE is a super fast framework in Noir to quickly test your smart contract code. +The TXE is a super fast framework in Noir to quickly test your smart contract code. So to summarize: -* End-to-end tests are written in Typescript. TXE in Noir. -* End-to-end tests are most similar to using mocha + ethers.js to test Solidity Contracts. TXE is like foundry (fast tests in solidity) -### Running TXE +- End-to-end tests are written in Typescript. TXE in Noir. +- End-to-end tests are most similar to using mocha + ethers.js to test Solidity Contracts. TXE is like foundry (fast tests in solidity) -In order to use the TXE, it must be running on a known address. +### Running TXE -:::tip -If you have [the sandbox](../../../getting_started.md) installed, you can run TXE tests using: +If you have [the sandbox](../../getting_started/quickstart.md) installed, you can run TXE tests using: `aztec test` -::: +The complete process for running tests: + +1. Compile contracts +2. Start the sandbox +3. Run `aztec test` + +In order to use the TXE, it must be running on a known address. :::warning Since TXE tests are written in Noir and executed with `aztec-nargo`, they all run in parallel. This also means every test creates their own isolated environment, so state modifications are local to each one of them. @@ -52,7 +57,7 @@ Since TXE tests are written in Noir and executed with `aztec-nargo`, they all ru `aztec-nr` provides an utility class called `TestEnvironment`, that should take care of the most common operations needed to setup contract testing. Setting up a new test environment with `TestEnvironment::new()` **will reset the current test's TXE state**. :::tip -You can find all of the methods available in the `TestEnvironment` [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr). +You can find all of the methods available in the `TestEnvironment` [here (Github link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr). ::: #include_code txe_test_increment /noir-projects/noir-contracts/contracts/counter_contract/src/main.nr rust @@ -147,6 +152,8 @@ Once accounts have been created, you can impersonate them in your test by callin ```rust env.impersonate(account_address); +// or (these are equivalent) +cheatcodes::set_contract_address(contract_address); ``` ### Checking state @@ -202,3 +209,7 @@ For example: You can also use the `assert_public_call_fails` or `assert_private_call_fails` methods on the `TestEnvironment` to check that a call fails. #include_code assert_public_fail /noir-projects/noir-contracts/contracts/token_contract/src/test/transfer_public.nr rust + +### All Cheatcodes + +You can find the full list of cheatcodes available in the TXE [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/test/helpers/cheatcodes.nr) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/_category_.json b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/_category_.json similarity index 100% rename from docs/docs/guides/smart_contracts/writing_contracts/_category_.json rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/_category_.json diff --git a/docs/docs/guides/smart_contracts/writing_contracts/authwit.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/authwit.md similarity index 93% rename from docs/docs/guides/smart_contracts/writing_contracts/authwit.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/authwit.md index ea5d8f1dae3..dbcfd7e8a05 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/authwit.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/authwit.md @@ -1,6 +1,7 @@ --- title: Authentication Witness description: Developer Documentation to use Authentication Witness for authentication actions on Aztec. +tags: [accounts, authwit] --- This page introduces the authwit library and how you can use it in your Aztec.nr smart contracts. [Skip to the usage](#usage). @@ -9,13 +10,13 @@ For a guide on using authwit in Aztec.js, [read this](../../js_apps/authwit.md). ## Prerequisite reading -- [Authwit](../../../aztec/concepts/accounts/authwit.md) +- [Authwit](../../../../aztec/concepts/accounts/authwit.md) ## Introduction Authentication Witness is a scheme for authentication actions on Aztec, so users can allow third-parties (eg protocols or other users) to execute an action on their behalf. -How it works logically is explained in the [concepts](../../../aztec/concepts/accounts/authwit.md) but we will do a short recap here. +How it works logically is explained in the [concepts](../../../../aztec/concepts/accounts/authwit.md) but we will do a short recap here. An authentication witness is defined for a specific action, such as allowing a Defi protocol to transfer funds on behalf of the user. An action is here something that could be explained as `A is allowed to perform X operation on behalf of B` and we define it as a hash computed as such: @@ -83,19 +84,19 @@ Both return the value `0xabf64ad4` (`IS_VALID` selector) for a successful authen ## The `AuthWit` library. -As part of [Aztec.nr](https://aztec.nr), we are providing a library that can be used to implement authentication witness for your contracts. +As part of Aztec.nr, we are providing a library that can be used to implement authentication witness for your contracts. -This library also provides a basis for account implementations such that these can more easily implement authentication witness. For more on the wallets, see [writing an account contract](../../../tutorials/contract_tutorials/write_accounts_contract.md). +This library also provides a basis for account implementations such that these can more easily implement authentication witness. For our purposes here (not building a wallet), the most important part of the library is the `auth` utility which exposes a couple of helper methods for computing the action hash, retrieving witnesses, validating them and emitting the nullifier. ### General utilities -The primary general utility is the `compute_authwit_message_hash_from_call` function which computes the action hash from its components. This is useful for when you need to generate a hash that is not for the current call, such as when you want to update a public approval state value that is later used for [authentication in public](#updating-approval-state-in-noir). You can view the implementation of this function [here](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/authwit/src/auth.nr). +The primary general utility is the `compute_authwit_message_hash_from_call` function which computes the action hash from its components. This is useful for when you need to generate a hash that is not for the current call, such as when you want to update a public approval state value that is later used for [authentication in public](#updating-approval-state-in-noir). You can view the implementation of this function [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/authwit/src/auth.nr). #### TypeScript utilities -To make it convenient to compute the message hashes in TypeScript, the `aztec.js` package includes a `computeAuthWitMessageHash` function that you can use. Implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/authwit.ts). +To make it convenient to compute the message hashes in TypeScript, the `aztec.js` package includes a `computeAuthWitMessageHash` function that you can use. Implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/authwit.ts). ### Utilities for private calls @@ -166,7 +167,7 @@ With private functions covered, how can we use this in a public function? Well, Authenticating an action in the public domain is slightly different from the private domain, since we are executing a function on the auth registry contract to add the witness flag. As you might recall, this was to ensure that we don't need to call into the account contract from public, which is a potential DOS vector. -In the snippet below, this is done as a separate contract call, but can also be done as part of a batch as mentioned in the [Accounts concepts](../../../aztec/concepts/accounts/authwit.md#what-about-public). +In the snippet below, this is done as a separate contract call, but can also be done as part of a batch as mentioned in the [Accounts concepts](../../../../aztec/concepts/accounts/authwit.md#what-about-public). #include_code authwit_public_transfer_example /yarn-project/end-to-end/src/e2e_token_contract/transfer_public.test.ts typescript diff --git a/docs/docs/guides/smart_contracts/writing_contracts/call_functions.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/call_functions.md similarity index 65% rename from docs/docs/guides/smart_contracts/writing_contracts/call_functions.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/call_functions.md index f67aad33653..fcca446ddad 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/call_functions.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/call_functions.md @@ -1,12 +1,13 @@ --- title: Calling Other Functions sidebar_position: 2 +tags: [functions, contracts] --- -A contract is a collection of persistent [state variables](../../../aztec/concepts/storage/index.md), and [functions](../../../aztec/concepts/smart_contracts/functions/index.md) which may manipulate these variables. +A contract is a collection of persistent state variables and functions which may manipulate these variables. Functions and state variables within a contract's scope are said to belong to that contract. A contract can only access and modify its own state. @@ -28,7 +29,7 @@ contract MyContract { } ``` :::info A note for vanilla Noir devs -There is no [`main()`](https://noir-lang.org/docs/getting_started/project_breakdown/#mainnr) function within a Noir `contract` scope. More than one function can be an entrypoint. +There is no [`main()` (GitHub link)](https://noir-lang.org/docs/getting_started/project_breakdown/#mainnr) function within a Noir `contract` scope. More than one function can be an entrypoint. ::: -To understand how to call a function from another contract, follow the [crowdfunding tutorial](../../../tutorials/contract_tutorials/crowdfunding_contract.md). \ No newline at end of file +To understand how to call a function from another contract, follow the [crowdfunding tutorial](../../../../tutorials/codealong/contract_tutorials/crowdfunding_contract.md). diff --git a/docs/docs/guides/smart_contracts/writing_contracts/common_patterns/index.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/index.md similarity index 87% rename from docs/docs/guides/smart_contracts/writing_contracts/common_patterns/index.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/index.md index a44b376779a..fbf1f9e26f8 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/common_patterns/index.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/index.md @@ -3,7 +3,7 @@ title: Common Patterns sidebar_position: 7 --- -There are many common patterns have been devised by the Aztec core engineering team and the work of the external community as we build Aztec.nr contracts internally (see some of them [here](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts)). +There are many common patterns have been devised by the Aztec core engineering team and the work of the external community as we build Aztec.nr contracts internally (see some of them [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts)). This doc aims to summarize some of them! @@ -41,7 +41,7 @@ Note - you could also create a note and send it to the user. The problem is ther You can't read public storage in private domain. But nevertheless reading public storage is desirable. There are two ways to achieve the desired effect: -1. For public values that change infrequently, you can use [shared state](../../../../reference/smart_contract_reference/storage/shared_state.md). +1. For public values that change infrequently, you can use [shared state](../../../../../reference/developer_references/smart_contract_reference/storage/shared_state.md). 1. You pass the data as a parameter to your private method and later assert in public that the data is correct. E.g.: @@ -84,18 +84,18 @@ Let's say you have some storage in public and want to move them into the private So you have to create a custom note in the public domain that is not encrypted by some owner - we call such notes a "TransparentNote" since it is created in public, anyone can see the amount and the note is not encrypted by some owner. -This pattern is discussed in detail in [writing a token contract section in the shield() method](../../../../tutorials/contract_tutorials/token_contract.md#redeem_shield). +This pattern is discussed in detail in [the codealong token tutorial in the shield() method](../../../../../tutorials/codealong/contract_tutorials/token_contract.md#redeem_shield). ### Discovering my notes -When you send someone a note, the note hash gets added to the [note hash tree](../../../../protocol-specs/state/note-hash-tree.md). To spend the note, the receiver needs to get the note itself (the note hash preimage). There are two ways you can get a hold of your notes: +When you send someone a note, the note hash gets added to the note hash tree. To spend the note, the receiver needs to get the note itself (the note hash preimage). There are two ways you can get a hold of your notes: 1. When sending someone a note, use `encrypt_and_emit_note` (the function encrypts the log in such a way that only a recipient can decrypt it). PXE then tries to decrypt all the encrypted logs, and stores the successfully decrypted one. [More info here](../how_to_emit_event.md) 2. Manually using `pxe.addNote()` - If you choose to not emit logs to save gas or when creating a note in the public domain and want to consume it in private domain (`encrypt_and_emit_note` shouldn't be called in the public domain because everything is public), like in the previous section where we created a TransparentNote in public. #include_code pxe_add_note yarn-project/end-to-end/src/e2e_cheat_codes.test.ts typescript -In the token contract, TransparentNotes are stored in a set called "pending_shields" which is in storage slot 5tutorials/tutorials/contract_tutorials/token_contract.md#contract-storage) +In the token contract, TransparentNotes are stored in a set called "pending_shields" which is in storage slot 5tutorials/tutorials/codealong/contract_tutorials/token_contract.md#contract-storage) ### Revealing encrypted logs conditionally @@ -117,7 +117,7 @@ Hence, it's necessary to add a "randomness" field to your note to prevent such a ### L1 -- L2 interactions -Refer to [Token Portal tutorial on bridging tokens between L1 and L2](../../../../tutorials/contract_tutorials/advanced/token_bridge/index.md) and/or [Uniswap smart contract example that shows how to swap on L1 using funds on L2](../../../../reference/smart_contract_reference/examples/uniswap/index.md). Both examples show how to: +Refer to [Token Portal codealong tutorial on bridging tokens between L1 and L2](../../../../../tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md) and/or [Uniswap smart contract example that shows how to swap on L1 using funds on L2](../../../../../tutorials/examples/uniswap/index.md). Both examples show how to: 1. L1 -> L2 message flow 2. L2 -> L1 message flow @@ -131,7 +131,7 @@ To send a note to someone, they need to have a key which we can encrypt the note There are several patterns here: 1. Give the contract a key and share it amongst all participants. This leaks privacy, as anyone can see all the notes in the contract. -2. `Unshield` funds into the contract - this is used in the [Uniswap smart contract example where a user sends private funds into a Uniswap Portal contract which eventually withdraws to L1 to swap on L1 Uniswap](../../../../reference/smart_contract_reference/examples/uniswap/index.md). This works like Ethereum - to achieve contract composability, you move funds into the public domain. This way the contract doesn't even need keys. +2. `Unshield` funds into the contract - this is used in the [Uniswap smart contract example where a user sends private funds into a Uniswap Portal contract which eventually withdraws to L1 to swap on L1 Uniswap](../../../../../tutorials/examples/uniswap/index.md). This works like Ethereum - to achieve contract composability, you move funds into the public domain. This way the contract doesn't even need keys. There are several other designs we are discussing through [in this discourse post](https://discourse.aztec.network/t/how-to-handle-private-escrows-between-two-parties/2440) but they need some changes in the protocol or in our demo contract. If you are interested in this discussion, please participate in the discourse post! @@ -153,6 +153,6 @@ PS: when calling from private to public, `msg_sender` is the contract address wh In the [Prevent the same user flow from happening twice using nullifier](#prevent-the-same-user-flow-from-happening-twice-using-nullifiers), we recommended using nullifiers. But what you put in the nullifier is also as important. -E.g. for a voting contract, if your nullifier simply emits just the `user_address`, then privacy can easily be leaked as nullifiers are deterministic (have no randomness), especially if there are few users of the contract. So you need some kind of randomness. You can add the user's secret key into the nullifier to add randomness. We call this "nullifier secrets" as explained [here](../../../../aztec/concepts/accounts/keys.md#nullifier-secrets). E.g.: +E.g. for a voting contract, if your nullifier simply emits just the `user_address`, then privacy can easily be leaked as nullifiers are deterministic (have no randomness), especially if there are few users of the contract. So you need some kind of randomness. You can add the user's secret key into the nullifier to add randomness. We call this "nullifier secrets" as explained [here](../../../../../aztec/concepts/accounts/keys.md#nullifier-keys). E.g.: #include_code nullifier /noir-projects/aztec-nr/value-note/src/value_note.nr rust diff --git a/docs/docs/guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md similarity index 76% rename from docs/docs/guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md index 9fb6fdca481..1a8a31e971a 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md @@ -1,10 +1,11 @@ --- title: Key Rotation +tags: [accounts, keys] --- ## Prerequisite reading -- [Keys](../../../../aztec/concepts/accounts/keys.md) +- [Keys Concept](../../../../../aztec/concepts/accounts/keys.md) ## Introduction @@ -22,6 +23,6 @@ It is still possible to nullify the notes with the old nullifier key even after ## Glossary - `npk_m_hash`: master nullifying public key hash -- `nsk_app`: app nullifying secret key - the app-specific NSK (learn more about app-scoped keys [here](../../../../aztec/concepts/accounts/keys.md#scoped-keys)) +- `nsk_app`: app nullifying secret key - the app-specific NSK (learn more about app-scoped keys [here](../../../../../aztec/concepts/accounts/keys.md#scoped-keys)) - `nsk_hash`: nullifying secret key hash -- `ivpk_m`: incoming view public key (master) (learn more about IVPKs [here](../../../../aztec/concepts/accounts/keys.md#keys)) \ No newline at end of file +- `ivpk_m`: incoming view public key (master) (learn more about IVPKs [here](../../../../../aztec/concepts/accounts/keys.md#incoming-viewing-keys)) \ No newline at end of file diff --git a/docs/docs/guides/smart_contracts/writing_contracts/how_to_emit_event.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_emit_event.md similarity index 95% rename from docs/docs/guides/smart_contracts/writing_contracts/how_to_emit_event.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_emit_event.md index ab2a84333f0..97918ab49b5 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/how_to_emit_event.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_emit_event.md @@ -1,6 +1,7 @@ --- title: Emitting Events sidebar_position: 3 +tags: [contracts] --- Events in Aztec work similarly to Ethereum events in the sense that they are a way for contracts to communicate with the outside world. @@ -20,12 +21,12 @@ Unlike on Ethereum, there are 2 types of events supported by Aztec: [encrypted]( Encrypted events can only be emitted by private functions and are encrypted using a public key of a recipient. For this reason it is necessary to register a recipient in the Private Execution Environment (PXE) before encrypting the events for them. -First we need to get a hold of recipient's [complete address](../../../aztec/concepts/accounts/keys#complete-address). +First we need to get a hold of recipient's complete address. Below are some ways how we could instantiate it after getting the information in a string form from a recipient: #include_code instantiate-complete-address /yarn-project/circuits.js/src/structs/complete_address.test.ts rust -Then to register the recipient's complete address in PXE we would call `registerRecipient` PXE endpoint using [Aztec.js](../../../aztec/core_components.md#aztecjs): +Then to register the recipient's complete address in PXE we would call `registerRecipient` PXE endpoint using Aztec.js #include_code register-recipient /yarn-project/aztec.js/src/wallet/create_recipient.ts rust diff --git a/docs/docs/guides/smart_contracts/writing_contracts/how_to_pop_capsules.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md similarity index 97% rename from docs/docs/guides/smart_contracts/writing_contracts/how_to_pop_capsules.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md index 8ac6daa8369..5ba1ba6a226 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/how_to_pop_capsules.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_pop_capsules.md @@ -1,6 +1,7 @@ --- title: Using the popCapsule Oracle sidebar_position: 5 +tags: [functions, oracles] --- `popCapsule` is used for passing artbitrary data. We have not yet included this in Aztec.nr, so it is a bit more complex than the other oracles. You can follow this how-to: diff --git a/docs/docs/guides/smart_contracts/writing_contracts/how_to_prove_history.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_prove_history.md similarity index 91% rename from docs/docs/guides/smart_contracts/writing_contracts/how_to_prove_history.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_prove_history.md index c0805aecab8..45d862b7a39 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/how_to_prove_history.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/how_to_prove_history.md @@ -1,13 +1,14 @@ --- title: Using the Archive Tree sidebar_position: 4 +tags: [contracts] --- -The Aztec Protocol uses an append-only Merkle tree to store hashes of the headers of all previous blocks in the chain as its leaves. This is known as the Archive tree. You can learn more about how it works in the [concepts section](../../../aztec/concepts/storage/trees/index.md#archive-tree). +The Aztec Protocol uses an append-only Merkle tree to store hashes of the headers of all previous blocks in the chain as its leaves. This is known as the Archive tree. You can learn more about how it works in the [concepts section](../../../../aztec/concepts/storage/trees/index.md). This page is a quick introductory guide to creating historical proofs proofs from the archive tree. -For a reference, go [here](https://docs.aztec.network/reference/smart_contract_reference/aztec-nr/aztec/history/contract_inclusion). +For a reference, go [here](../../../../reference/developer_references/smart_contract_reference/aztec-nr/aztec/history/contract_inclusion.md). ## Inclusion and non-inclusion proofs @@ -80,4 +81,4 @@ You can also prove that a note was not nullified in a specified block by using ` ## Prove contract inclusion, public value inclusion, and use current state in lookups -To see what else you can do with historical proofs, check out the [reference](https://docs.aztec.network/reference/smart_contract_reference/aztec-nr/aztec/history/contract_inclusion) \ No newline at end of file +To see what else you can do with historical proofs, check out the [reference](../../../../reference/developer_references/smart_contract_reference/aztec-nr/aztec/history/contract_inclusion.md) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/initializers.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md similarity index 81% rename from docs/docs/guides/smart_contracts/writing_contracts/initializers.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md index 38f6b390fe8..d350301d4f7 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/initializers.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/initializers.md @@ -1,6 +1,7 @@ --- title: Defining Initializer Functions sidebar_position: 1 +tags: [functions, contracts] --- This page explains how to write an initializer function, also known as a constructor. @@ -18,7 +19,7 @@ fn constructor(){ } ``` -## Choose whether your initializer is public or private +## Public or private Aztec supports both public and private initializers. Use the appropriate macro, for example for a private initializer: @@ -44,6 +45,6 @@ You can set multiple functions as an initializer function simply by annotating e Calling any one of the functions annotated with `#[aztec(initializer)]` will mark the contract as initialized. -See [this page of the protocol specs](../../../protocol-specs/contract-deployment/instances.md#initialization) for more info about what marking a function as initialized means. +See [this page of the protocol specs](../../../../protocol-specs/contract-deployment/instances.md#initialization) for more info about what marking a function as initialized means. -To see an initializer in action, check out the [Counter Contract Tutorial](../../../tutorials/contract_tutorials/counter_contract.md). +To see an initializer in action, follow the [Counter codealong tutorial](../../../../tutorials/codealong/contract_tutorials/counter_contract.md). diff --git a/docs/docs/guides/smart_contracts/writing_contracts/notes/address_note.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/address_note.md similarity index 86% rename from docs/docs/guides/smart_contracts/writing_contracts/notes/address_note.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/address_note.md index 2315511a7bc..8a2c8db47fc 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/notes/address_note.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/address_note.md @@ -1,5 +1,6 @@ --- title: Using Address Note in Aztec.nr +tags: [contracts, notes] --- Address notes hold one main property of the type `AztecAddress`. It also holds `npk_m_hash` and `randomness`, similar to other note types. @@ -37,6 +38,6 @@ In this example, `owner` is the `address` and the `npk_m_hash` of the donor was ## Learn more -- [Keys, including nullifier keys and outgoing viewer](../../../../aztec/concepts/accounts/keys.md) +- [Keys, including nullifier keys and outgoing viewer](../../../../../aztec/concepts/accounts/keys.md) - [How to write a custom note](./custom_note.md) -- [AddressNote reference](https://docs.aztec.network/reference/smart_contract_reference/aztec-nr/address-note/address_note) \ No newline at end of file +- [AddressNote reference](../../../../../reference/developer_references/smart_contract_reference/aztec-nr/address-note/address_note.md) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/notes/custom_note.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/custom_note.md similarity index 95% rename from docs/docs/guides/smart_contracts/writing_contracts/notes/custom_note.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/custom_note.md index eb9716608ad..32edb7d5340 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/notes/custom_note.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/custom_note.md @@ -1,5 +1,6 @@ --- title: Using custom note types in Aztec.nr +tags: [contracts, notes] --- It may be useful to write a custom note type if you want to use a specific type of private data or struct that does not have a default implementation in Aztec.nr. If you create a note that uses a custom note type, you are able to nullify that note with one nullifier. This is more secure and less expensive than using multiple separate notes. @@ -42,4 +43,4 @@ If you are also planning to be able to access the data with a note in public sta ## Further reading -- [Macros reference](../../../../reference/smart_contract_reference/macros.md) \ No newline at end of file +- [Macros reference](../../../../../reference/developer_references/smart_contract_reference/macros.md) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/notes/index.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/index.md similarity index 77% rename from docs/docs/guides/smart_contracts/writing_contracts/notes/index.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/index.md index 973156bb15e..b40f4be495e 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/notes/index.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/index.md @@ -1,6 +1,7 @@ --- title: Notes sidebar_position: 6 +tags: [contracts, notes] --- -Notes are the fundamental data structure in Aztec when working with private state. In this section there are guides about how to work with `AddressNote`, `ValueNote`, and custom notes in Aztec.nr. You can learn more about notes in the [concepts section](../../../../aztec/concepts/state_model/index.md). \ No newline at end of file +Notes are the fundamental data structure in Aztec when working with private state. In this section there are guides about how to work with `AddressNote`, `ValueNote`, and custom notes in Aztec.nr. You can learn more about notes in the [concepts section](../../../../../aztec/concepts/state_model/index.md#private-state). \ No newline at end of file diff --git a/docs/docs/guides/smart_contracts/writing_contracts/notes/value_note.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/value_note.md similarity index 92% rename from docs/docs/guides/smart_contracts/writing_contracts/notes/value_note.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/value_note.md index 47d4d1eb8c5..6cd82547c1a 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/notes/value_note.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/notes/value_note.md @@ -1,5 +1,6 @@ --- title: Using Value Notes in Aztec.nr +tags: [contracts, notes] --- ValueNotes hold one main property - a `value` - and have utils useful for manipulating this value, such as incrementing and decrementing it similarly to an integer. @@ -59,6 +60,6 @@ The `decrement` function works similarly except the `amount` is the number that ## Learn more -- [Keys, including nullifier keys and outgoing viewer](../../../../aztec/concepts/accounts/keys.md) +- [Keys, including nullifier keys and outgoing viewer](../../../../../aztec/concepts/accounts/keys.md) - [How to write a custom note](./custom_note.md) -- [ValueNote reference](https://docs.aztec.network/reference/smart_contract_reference/aztec-nr/value-note/value_note) \ No newline at end of file +- [ValueNote reference](../../../../../reference/developer_references/smart_contract_reference/aztec-nr/value-note/value_note.md) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md similarity index 92% rename from docs/docs/guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md index 8a1594d05e2..8c497e3f41c 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/communicate_with_portal.md @@ -1,10 +1,11 @@ --- title: Communicating with L1 +tags: [contracts, portals] --- -Is this your first time hearing the word `Portal`? Check out the [protocol spec](../../../../protocol-specs/l1-smart-contracts/index.md). +Is this your first time hearing the word `Portal`? You might want to check out the [protocol specs](../../../../../protocol-specs/l1-smart-contracts/index.md). -Follow the [token bridge tutorial](../../../../tutorials/contract_tutorials/advanced/token_bridge/index.md) for hands-on experience writing and deploying a Portal contract. +Follow the [token bridge tutorial](../../../../../tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md) for hands-on experience writing and deploying a Portal contract. ## Passing data to the rollup @@ -18,7 +19,7 @@ When sending messages, we need to specify quite a bit of information beyond just | ----------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Recipient | `L2Actor` | The message recipient. This **MUST** match the rollup version and an Aztec contract that is **attached** to the contract making this call. If the recipient is not attached to the caller, the message cannot be consumed by it. | | Secret Hash | `field` (~254 bits) | A hash of a secret that is used when consuming the message on L2. Keep this preimage a secret to make the consumption private. To consume the message the caller must know the pre-image (the value that was hashed) - so make sure your app keeps track of the pre-images! Use `computeSecretHash` to compute it from a secret. | -| Content | `field` (~254 bits) | The content of the message. This is the data that will be passed to the recipient. The content is limited to be a single field. If the content is small enough it can just be passed along, otherwise it should be hashed and the hash passed along (you can use our [`Hash`](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Hash.sol) utilities with `sha256ToField` functions) | +| Content | `field` (~254 bits) | The content of the message. This is the data that will be passed to the recipient. The content is limited to be a single field. If the content is small enough it can just be passed along, otherwise it should be hashed and the hash passed along (you can use our [`Hash` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Hash.sol) utilities with `sha256ToField` functions) | With all that information at hand, we can call the `sendL2Message` function on the Inbox. The function will return a `field` (inside `bytes32`) that is the hash of the message. This hash can be used as an identifier to spot when your message has been included in a rollup block. @@ -42,7 +43,7 @@ Note that while the `secret` and the `content` are both hashed, they are actuall ### Token bridge example -Computing the `content` must currently be done manually, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example](../../../../tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md#consume-the-l1-message). +Computing the `content` must currently be done manually, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example (codealong tutorial)](../../../../../tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md). #include_code claim_public /noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr rust @@ -182,5 +183,5 @@ Designated callers are enforced at the contract level for contracts that are not ## Examples of portals - Token bridge (Portal contract built for L1 -> L2, i.e., a non-native L2 asset) - - [Portal contract](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/test/portals/TokenPortal.sol) - - [Aztec contract](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr) + - [Portal contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/test/portals/TokenPortal.sol) + - [Aztec contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/portals/index.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/index.md similarity index 100% rename from docs/docs/guides/smart_contracts/writing_contracts/portals/index.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/portals/index.md diff --git a/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/index.md similarity index 73% rename from docs/docs/guides/smart_contracts/writing_contracts/storage/index.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/index.md index c747ef508ef..022c0bbbe0d 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/index.md @@ -1,12 +1,13 @@ --- title: Declaring Storage +tags: [contracts, storage] --- On this page, you will learn how to define storage in your smart contract. -To learn more about how storage works in Aztec, read [the concepts](storage_slots.md). +To learn more about how storage works in Aztec, read [the concepts](./storage_slots.md). -[See the storage reference](../../../../aztec/concepts/storage/index.md). +[See the storage reference](../../../../../reference/developer_references/smart_contract_reference/storage/index.md). ```rust #[aztec(storage)] diff --git a/docs/docs/guides/smart_contracts/writing_contracts/storage/notes.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/notes.md similarity index 71% rename from docs/docs/guides/smart_contracts/writing_contracts/storage/notes.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/notes.md index 0a08f39705e..bea6aa7461b 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/storage/notes.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/notes.md @@ -2,6 +2,7 @@ title: Writing Notes description: Core knowledge of Notes and how they work useful-for: dev +tags: [contracts, storage, notes] --- Most prominent blockchain networks don't have privacy at the protocol level. Aztec contracts can define public and private functions, that can read/write public and private state. @@ -21,11 +22,11 @@ This page will focus on how private variables are implemented with Notes and sto #### Side-note about execution Under the hood, the Aztec protocol handles some important details around public and private function calls. Calls between them are asynchronous due to different execution contexts (local execution vs. node execution). -A detailed explanation of the transaction lifecycle can be found [here](../../../../aztec/concepts/transactions.md#simple-example-of-the-private-transaction-lifecycle). +A detailed explanation of the transaction lifecycle can be found [here](../../../../../aztec/concepts/transactions.md#simple-example-of-the-private-transaction-lifecycle). ## Private state variables in Aztec -State variables in an Aztec contract are defined inside a struct specifically named `Storage`, and must satisfy the [Note Interface](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_interface.nr) and contain a [Note header](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_header.nr). +State variables in an Aztec contract are defined inside a struct specifically named `Storage`, and must satisfy the [Note Interface (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_interface.nr) and contain a [Note header (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_header.nr). The Note header struct contains the contract address which the value is effectively siloed to, a nonce to ensure unique Note hashes, and a storage "slot" (or ID) to associate multiple notes. @@ -33,7 +34,7 @@ A couple of things to unpack here: #### Storage "slot" -Storage slots are more literal for public storage, a place where a value is stored. For private storage, a storage slot is logical (more [here](../../../../aztec/concepts/storage/index.md#private-state-slots---slots-arent-real)). +Storage slots are more literal for public storage, a place where a value is stored. For private storage, a storage slot is logical (more [here](../../../../../aztec/concepts/storage/index.md#private-state-slots---slots-arent-real)). #### Silos @@ -52,7 +53,7 @@ A hash of a note is stored in the append-only note hash tree on the network so a #### Note Hash Tree -By virtue of being append only, notes are not edited. If two transactions amend a private value, multiple notes will be inserted into the tree (to the note hash tree and the [nullifier tree](../../../../protocol-specs/state/nullifier-tree.md)). The header will contain the same logical storage slot. +By virtue of being append only, notes are not edited. If two transactions amend a private value, multiple notes will be inserted into the tree to the note hash tree and the nullifier tree. The header will contain the same logical storage slot. ### Reading Notes @@ -82,9 +83,9 @@ To update a value, its previous note hash(es) are nullified. The new note value Some optional background resources on notes can be found here: -- [High level network architecture](../../../../aztec/core_components.md#high-level-network-architecture), specifically the Private Execution Environment -- [Transaction lifecycle (simple diagram)](../../../../aztec/concepts/transactions.md#simple-example-of-the-private-transaction-lifecycle) -- [Public and Private state](../../../../aztec/concepts/state_model/index.md) +- [High level network architecture](../../../../../aztec/overview.md), specifically the Private Execution Environment +- [Transaction lifecycle (simple diagram)](../../../../../aztec/concepts/transactions.md#simple-example-of-the-private-transaction-lifecycle) +- [Public and Private state](../../../../../aztec/concepts/state_model/index.md) Notes touch several core components of the protocol, but we will focus on a the essentials first. @@ -96,19 +97,19 @@ The way Aztec benefits from the Noir language is via three important components: - `noir contracts` - example Aztec contracts - `noir-protocol-circuits` - a crate containing essential circuits for the protocol (public circuits and private wrappers) -A lot of what we will look at will be in [aztec-nr/aztec/src/note](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note), specifically the lifecycle and note interface. +A lot of what we will look at will be in [aztec-nr/aztec/src/note (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note), specifically the lifecycle and note interface. Looking at the noir circuits in these components, you will see references to the distinction between public/private execution and state. ### Lifecycle functions -Inside the [lifecycle](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr) circuits we see the functions to create and destroy a note, implemented as insertions of note hashes and nullifiers respectively. This is helpful for regular private variables. +Inside the [lifecycle (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/lifecycle.nr) circuits we see the functions to create and destroy a note, implemented as insertions of note hashes and nullifiers respectively. This is helpful for regular private variables. We also see a function to create a note hash from the public context, a way of creating a private variable from a public call (run in the sequencer). This could be used in application contracts to give private digital assets to users. ### Note Interface functions -To see a [note_interface](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_interface.nr) implementation, we will look at a simple [ValueNote](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). +To see a [note_interface (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_interface.nr) implementation, we will look at a simple [ValueNote GitHub link](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). The interface is required to work within an Aztec contract's storage, and a ValueNote is a specific type of note to hold a number (as a `Field`). @@ -118,7 +119,7 @@ A few key functions in the note interface are around computing the note hash and In the ValueNote implementation you'll notice that it uses the `pedersen_hash` function. This is currently required by the protocol, but may be updated to another hashing function, like poseidon. -As a convenience, the outer [note/utils.nr](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/utils.nr) contains implementations of functions that may be needed in Aztec contracts, for example computing note hashes. +As a convenience, the outer [note/utils.nr (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/utils.nr) contains implementations of functions that may be needed in Aztec contracts, for example computing note hashes. #### Serialization and deserialization @@ -130,7 +131,7 @@ For example in ValueNote, the `serialize_content` function simply returns: the v ### Value as a sum of Notes We recall that multiple notes are associated with a "slot" (or ID), and so the value of a numerical note (like ValueNote) is the sum of each note's value. -The helper function in [balance_utils](https://github.com/AztecProtocol/aztec-packages/blob/#include_/noir-projects/aztec-nr/value-note/src/balance_utils.nr) implements this logic taking a `PrivateSet` of `ValueNotes`. +The helper function in [balance_utils (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_/noir-projects/aztec-nr/value-note/src/balance_utils.nr) implements this logic taking a `PrivateSet` of `ValueNotes`. A couple of things worth clarifying: @@ -139,7 +140,7 @@ A couple of things worth clarifying: ### Example - Notes in action -The Aztec.nr framework includes examples of high-level states [easy_private_uint](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr) for use in contracts. +The Aztec.nr framework includes examples of high-level states [easy_private_uint (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr) for use in contracts. The struct (`EasyPrivateUint`) contains a Context, Set of ValueNotes, and storage_slot (used when setting the Set). @@ -149,11 +150,11 @@ Notice how the `add` function shows the simplicity of appending a new note to al ### Apply -Try the [Token tutorial](../../../../tutorials/contract_tutorials/token_contract.md) to see what notes can achieve. In this section you will also find other tutorials using notes in different ways. +Try the [Token tutorial](../../../../../tutorials/codealong/contract_tutorials/token_contract.md) to see what notes can achieve. In this section you will also find other tutorials using notes in different ways. ### Further reading -- [Storage Trees](../../../../aztec/concepts/storage/trees/index.md) +- [Storage Trees](../../../../../aztec/concepts/storage/trees/index.md) - [Proof of prior notes](../how_to_prove_history.md) - public/private reading of public/private proof of state (public or private) If you're curious about any of the following related topics, search the documentation for... @@ -165,5 +166,5 @@ If you're curious about any of the following related topics, search the document ### References -- ["Stable" state variable](https://github.com/AztecProtocol/aztec-packages/issues/4130) -- [Code: Aztec-Patterns](https://github.com/defi-wonderland/aztec-patterns) +- ["Stable" state variable (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/4130) +- [Code: Aztec-Patterns (GitHub link)](https://github.com/defi-wonderland/aztec-patterns) diff --git a/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/storage_slots.md similarity index 87% rename from docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md rename to docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/storage_slots.md index f8ae4561bf2..ba3c45fe4c6 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md +++ b/docs/docs/guides/developer_guides/smart_contracts/writing_contracts/storage/storage_slots.md @@ -1,8 +1,9 @@ --- title: Storage slots +tags: [contracts, storage] --- -From the description of storage slots [in the Concepts](storage_slots.md) you will get an idea around the logic of storage slots. In this section we will go into more detail and walk through an entire example of how storage slots are computed for private state to improve our storage slot intuition. Recall, that storage slots in the private domain is just a logical construct, and are not "actually" used for lookups, but rather just as a value to constrain against. +From the description of storage slots [in the Concepts](../../../../../aztec/concepts/storage/index.md#private-state-slots---slots-arent-real) you will get an idea around the logic of storage slots. In this section we will go into more detail and walk through an entire example of how storage slots are computed for private state to improve our storage slot intuition. Recall, that storage slots in the private domain is just a logical construct, and are not "actually" used for lookups, but rather just as a value to constrain against. For the case of the example, we will look at what is inserted into the note hashes tree when adding a note in the Token contract. Specifically, we are looking at the last part of the `transfer` function: diff --git a/docs/docs/guides/index.md b/docs/docs/guides/index.md new file mode 100644 index 00000000000..cf5cd9c93b6 --- /dev/null +++ b/docs/docs/guides/index.md @@ -0,0 +1,118 @@ +--- +id: index +sidebar_position: 0 +title: Guides +--- + +# Popular Guides + +Guides are step-by-step how-tos to achieve a specific goal. On this page you can find the most popular ones. You can also explore them all by checking out the sidebar. + +## Getting Started + +
+ + +

Quickstart

+
+ + Get started on Aztec by installing the sandbox and playing with it + +
+
+ +## Building smart contracts + +
+ + +

Compile a contract

+
+ + Learn how to compile a smart contract and generate TypeScript bindings + +
+ + + +

Deploy a contract

+
+ + Deploy a contract to a local Aztec sandbox + +
+ + + +

Testing Contracts

+
+ + Write tests for your contracts and run them in the TXE + +
+ + + +

Communicate with L1

+
+ + How to use portals to communicate with L1 from your contract + +
+
+ + + +## JavaScript + +
+ + +

Send a transaction

+
+ + Use Aztec.JS to send a transaction by calling a function on a smart contract + +
+ + + +

Testing

+
+ + Write end-to-end tests in Javascript using Aztec.JS + +
+
+ + + +## Local environment + +
+ + +

Update your environment

+
+ + Update all aspects of your Aztec environment, including the sandbox, aztec-nargo, Aztec.nr packages, and Aztec.js packages + +
+ + + +

Run more than one PXE

+
+ + Test that your contracts can work with multiple interactions by running a second PXE + +
+
+ + \ No newline at end of file diff --git a/docs/docs/reference/privacy_considerations.md b/docs/docs/guides/privacy_considerations.md similarity index 94% rename from docs/docs/reference/privacy_considerations.md rename to docs/docs/guides/privacy_considerations.md index d8b053ac169..059d230bd7f 100644 --- a/docs/docs/reference/privacy_considerations.md +++ b/docs/docs/guides/privacy_considerations.md @@ -1,6 +1,7 @@ --- title: Privacy Considerations sidebar_position: 5 +tags: [protocol, PXE] --- Privacy is important. @@ -52,7 +53,7 @@ Any time a private function makes a call to a public function, information is le ### Crossing the public -> private boundary -If a public function sends a message to be consumed by a private function, the act of consuming that message might be leaked if not following recommended patterns. See [here](smart_contract_reference/portals/inbox.md) for more details. +If a public function sends a message to be consumed by a private function, the act of consuming that message might be leaked if not following recommended patterns. ### Timing of transactions @@ -90,7 +91,7 @@ A 'Function Fingerprint' is any data which is exposed by a function to the outsi > Note: many of these were mentioned in the ["Crossing the private -> public boundary"](#crossing-the-private---public-boundary) section. -> Note: the transaction effects submitted to L1 is [encoded](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Decoder.sol) but not garbled with other transactions: the distinct Tx Fingerprint of each tx can is publicly visible when a tx is submitted to the L2 tx pool. +> Note: the transaction effects submitted to L1 is [encoded (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Decoder.sol) but not garbled with other transactions: the distinct Tx Fingerprint of each tx can is publicly visible when a tx is submitted to the L2 tx pool. #### Standardizing Fingerprints @@ -136,4 +137,4 @@ We're researching cryptographic ways to enable users to query any data privately Footnotes -[^1]: All txs should set the kernel circuit public inputs for all roots to _valid_, _up-to-date_ nonzero values, so as to mask which trees have _actually_ been read from. The Sandbox will eventually automate this (see this [issue](https://github.com/AztecProtocol/aztec-packages/issues/1676)). +[^1]: All txs should set the kernel circuit public inputs for all roots to _valid_, _up-to-date_ nonzero values, so as to mask which trees have _actually_ been read from. The Sandbox will eventually automate this (see this [issue (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/1676)). diff --git a/docs/docs/index.mdx b/docs/docs/index.mdx index df74423358a..b7a9e01a97b 100644 --- a/docs/docs/index.mdx +++ b/docs/docs/index.mdx @@ -5,9 +5,9 @@ displayed_sidebar: sidebar sidebar_position: 0 --- -# The World's Encrypted Ledger +# Aztec Documentation -## A Privacy-First L2 on Ethereum +## Aztec is a Privacy-First L2 on Ethereum On Ethereum today, everything is publicly visible, by everyone. In the real world, people enjoy privacy. Aztec brings privacy to Ethereum. @@ -36,11 +36,11 @@ Aztec is: ### Learn 📚 -Start on the [Technical Overview page](aztec/core_components.md) to read about how Aztec works. +Start on the [Technical Overview page](aztec/overview.md) to read about how Aztec works. ### Build 🧑‍💻 -Go to the [Getting Started section](getting_started.md) of the developer docs to get your hands dirty and start developing on Aztec. +Go to the [Getting Started section](guides/developer_guides/getting_started/quickstart.md) of the developer docs to get your hands dirty and start developing on Aztec. #### Go deeper 🔬 @@ -48,4 +48,4 @@ Check out the [Awesome Aztec repo](https://github.com/AztecProtocol/awesome-azte Clone the [Aztec Starter repo](https://github.com/AztecProtocol/aztec-starter) to get a minimal project set up with Sandbox (local developer network), a simple contract and a test suite. -Jump into one of the [tutorials](tutorials/contract_tutorials/private_voting_contract.md) to learn how to build more complex applications on Aztec. +Jump into one of the [tutorials](tutorials/index.md) to learn how to build more complex applications on Aztec. diff --git a/docs/docs/migration_notes.md b/docs/docs/migration_notes.md index 685ba62b85c..6b12658a854 100644 --- a/docs/docs/migration_notes.md +++ b/docs/docs/migration_notes.md @@ -6,6 +6,55 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading] Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them. +## 0.48.0 + +### Fee Juice rename + +The name of the canonical Gas contract has changed to Fee Juice. Update noir code: + +```diff +-GasToken::at(contract_address) ++FeeJuice::at(contract_address) +``` + +Additionally, `NativePaymentMethod` and `NativePaymentMethodWithClaim` have been renamed to `FeeJuicePaymentMethod` and `FeeJuicePaymentMethodWithClaim`. + +### PrivateSet::pop_notes(...) + +The most common flow when working with notes is obtaining them from a `PrivateSet` via `get_notes(...)` and then removing them via `PrivateSet::remove(...)`. +This is cumbersome and it results in unnecessary constraints due to a redundant note read request checks in the remove function. + +For this reason we've implemented `pop_notes(...)` which gets the notes, removes them from the set and returns them. +This tight coupling of getting notes and removing them allowed us to safely remove the redundant read request check. + +Token contract diff: + +```diff +-let options = NoteGetterOptions::with_filter(filter_notes_min_sum, target_amount).set_limit(max_notes); +-let notes = self.map.at(owner).get_notes(options); +-let mut subtracted = U128::from_integer(0); +-for i in 0..options.limit { +- if i < notes.len() { +- let note = notes.get_unchecked(i); +- self.map.at(owner).remove(note); +- subtracted = subtracted + note.get_amount(); +- } +-} +-assert(minuend >= subtrahend, "Balance too low"); ++let options = NoteGetterOptions::with_filter(filter_notes_min_sum, target_amount).set_limit(max_notes); ++let notes = self.map.at(owner).pop_notes(options); ++let mut subtracted = U128::from_integer(0); ++for i in 0..options.limit { ++ if i < notes.len() { ++ let note = notes.get_unchecked(i); ++ subtracted = subtracted + note.get_amount(); ++ } ++} ++assert(minuend >= subtrahend, "Balance too low"); +``` + +Note that `pop_notes` may not have obtained and removed any notes! The caller must place checks on the returned notes, e.g. in the example above by checking a sum of balances, or by checking the number of returned notes (`assert_eq(notes.len(), expected_num_notes)`). + ## 0.47.0 # [Aztec sandbox] TXE deployment changes @@ -38,19 +87,23 @@ Sandbox commands have been cleaned up and simplified. Doing `aztec-up` now gets **REMOVED/RENAMED**: -* `aztec-sandbox` and `aztec sandbox`: now `aztec start --sandbox` -* `aztec-builder`: now `aztec codegen` and `aztec update` +- `aztec-sandbox` and `aztec sandbox`: now `aztec start --sandbox` +- `aztec-builder`: now `aztec codegen` and `aztec update` **ADDED**: -* `aztec test [options]`: runs `aztec start --txe && aztec-nargo test --oracle-resolver http://aztec:8081 --silence-warnings [options]` via docker-compose allowing users to easily run contract tests using TXE +- `aztec test [options]`: runs `aztec start --txe && aztec-nargo test --oracle-resolver http://aztec:8081 --silence-warnings [options]` via docker-compose allowing users to easily run contract tests using TXE ## 0.45.0 + ### [Aztec.nr] Remove unencrypted logs from private + They leak privacy so is a footgun! ## 0.44.0 + ### [Aztec.nr] Autogenerate Serialize methods for events + ```diff #[aztec(event)] struct WithdrawalProcessed { @@ -66,10 +119,11 @@ struct WithdrawalProcessed { ``` ### [Aztec.nr] rename `encode_and_encrypt_with_keys` to `encode_and_encrypt_note_with_keys` -```diff + +````diff contract XYZ { - use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_with_keys; -+ use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys; ++ use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys; .... - numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m)); @@ -129,7 +183,7 @@ These changes were done because having the note hash exposed allowed us to not h + (note_hash_for_nullify, nullifier) + } + } -``` +```` ### [Aztec.nr] `note_getter` returns `BoundedVec` @@ -1708,4 +1762,4 @@ Now, just remove the `src` folder,: ```rust easy_private_token_contract = {git = "https://github.com/AztecProtocol/aztec-packages/", tag ="v0.17.0", directory = "noir-projects/noir-contracts/contracts/easy_private_token_contract"} -``` \ No newline at end of file +``` diff --git a/docs/docs/protocol-specs/gas-and-fees/fee-payment-asset.md b/docs/docs/protocol-specs/gas-and-fees/fee-juice.md similarity index 59% rename from docs/docs/protocol-specs/gas-and-fees/fee-payment-asset.md rename to docs/docs/protocol-specs/gas-and-fees/fee-juice.md index d5dfb648f4b..175042f6f02 100644 --- a/docs/docs/protocol-specs/gas-and-fees/fee-payment-asset.md +++ b/docs/docs/protocol-specs/gas-and-fees/fee-juice.md @@ -1,22 +1,22 @@ --- -title: Fee Payment Asset +title: Fee Juice --- -# Fee Payment Asset +# Fee Juice -The Fee Payment Asset (FPA) is an enshrined asset in the Aztec network that is used to pay fees. +Fee Juice is an enshrined asset in the Aztec network that is used to pay fees. -The FPA has several important properties: +It has several important properties: - It is fungible - It cannot be transferred between accounts on the Aztec network - It is obtained on Aztec via a bridge from Ethereum - It only has public balances -All transactions on the Aztec network have a [non-zero transaction_fee](./fee-schedule.md#da-gas), denominated in FPA, which must be paid for the transaction to be included in the block. +All transactions on the Aztec network have a [non-zero transaction_fee](./fee-schedule.md#da-gas), denominated in FPA, which must be paid for the transaction to be included in the block. When a block is successfully published on L1, the sequencer is paid on L1 the sum of all transaction fees in the block, denominated in FPA. -:::danger -We need a definition of the L1 fee payment asset. +:::danger +We need a definition of the L1 fee juice. ::: diff --git a/docs/docs/protocol-specs/gas-and-fees/fee-schedule.md b/docs/docs/protocol-specs/gas-and-fees/fee-schedule.md index 3bb448e906d..a548bd540f8 100644 --- a/docs/docs/protocol-specs/gas-and-fees/fee-schedule.md +++ b/docs/docs/protocol-specs/gas-and-fees/fee-schedule.md @@ -1,18 +1,19 @@ # Fee Schedule -The [transaction fee](./specifying-gas-fee-info.md#transaction-fee) is comprised of a DA component, an L2 component, and an inclusion fee. The DA and L2 components are calculated by multiplying the gas consumed in each dimension by the respective `feePerGas` value. The inclusion fee is a fixed cost associated with the transaction, which is used to cover the cost of verifying the encompassing rollup proof on L1. +The [transaction fee](./specifying-gas-fee-info.md#transaction-fee) is comprised of a DA component, an L2 component, and an inclusion fee. The DA and L2 components are calculated by multiplying the gas consumed in each dimension by the respective `feePerGas` value. The inclusion fee is a fixed cost associated with the transaction, which is used to cover the cost of verifying the encompassing rollup proof on L1. ## DA Gas DA gas is consumed to cover the costs associated with publishing data associated with a transaction. These data include: - - new note hashes - - new nullifiers - - new l2 -> l1 message hashes - - new public data writes - - new logs - - protocol metadata (e.g. the amount of gas consumed, revert code, etc.) + +- new note hashes +- new nullifiers +- new l2 -> l1 message hashes +- new public data writes +- new logs +- protocol metadata (e.g. the amount of gas consumed, revert code, etc.) The DA gas used is then calculated as: @@ -75,16 +76,19 @@ l2_gas_used = FIXED_L2_GAS ``` ### L2 Gas from Private + Private execution also consumes L2 gas, because there is still work that needs to be performed by the sequencer correspondent to the private outputs, which is effectively L2 gas. The following operations performed in private execution will consume L2 gas: + - 32 L2 gas per note hash - 64 L2 gas per nullifier - 4 L2 gas per byte of logs (note encrypted, encrypted, and unencrypted) ## Max Inclusion Fee -Each transaction, and each block, has inescapable overhead costs associated with it which are not directly related to the amount of data or computation performed. +Each transaction, and each block, has inescapable overhead costs associated with it which are not directly related to the amount of data or computation performed. These costs include: + - verifying the private kernel proof of each transaction - executing/proving the base/merge/root rollup circuits - includes verifying that every new nullifier is unique across the tx/block @@ -99,12 +103,11 @@ These costs include: See [the l1 contracts section](../l1-smart-contracts/index.md) for more information on the L1 Inbox and Outbox. -Users cover these costs by [specifying an inclusion fee](./specifying-gas-fee-info.md#specifying-gas--fee-info), which is different from other parameters specified in that it is a fixed fee offered to the sequencer, denominated in [FPA](./fee-payment-asset.md). +Users cover these costs by [specifying an inclusion fee](./specifying-gas-fee-info.md#specifying-gas--fee-info), which is different from other parameters specified in that it is a fixed fee offered to the sequencer, denominated in [Fee Juice](./fee-juice.md). Even though these line items will be the same for every transaction in a block, the **cost** to the sequencer will vary, particularly based on: + - congestion on L1 - prevailing price of proof generation A price discovery mechanism is being developed to help users set the inclusion fee appropriately. - - diff --git a/docs/docs/protocol-specs/gas-and-fees/index.md b/docs/docs/protocol-specs/gas-and-fees/index.md index 55e2808eeef..469f6974504 100644 --- a/docs/docs/protocol-specs/gas-and-fees/index.md +++ b/docs/docs/protocol-specs/gas-and-fees/index.md @@ -7,7 +7,8 @@ title: Gas & Fees The Aztec network uses a fee system to incentivize sequencers to process transactions and publish blocks. This section breaks down: -- [the fee payment asset](./fee-payment-asset.md) + +- [fee juice](./fee-juice.md) - [how users specify gas/fee parameters in their transactions](./specifying-gas-fee-info.md) - [fee abstraction](./tx-setup-and-teardown.md) - [tracking gas/fee information in the kernel circuits](./kernel-tracking.md) diff --git a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md index 3aaa83f7d8d..738c4ba5ffe 100644 --- a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md +++ b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md @@ -256,7 +256,7 @@ Regardless, it has a `fee_payer` set. When a node receives a transaction, it must check that: 1. the `fee_payer` is set -2. the `fee_payer` has a balance of [FPA](./fee-payment-asset.md) greater than the computed [transaction fee](./specifying-gas-fee-info.md#transaction-fee) if the transaction has no public component +2. the `fee_payer` has a balance of [Fee Juice](./fee-juice.md) greater than the computed [transaction fee](./specifying-gas-fee-info.md#transaction-fee) if the transaction has no public component 3. the `fee_payer` has a balance of FPA greater than the computed [max transaction fee](./specifying-gas-fee-info.md#maximum-transaction-fee) if the transaction has a public component See other [validity conditions](../transactions/validity.md). @@ -547,4 +547,4 @@ Additionally, it verifies that the max fees per gas specified by the user are gr After the public data writes specific to this transaction have been processed, and a new tree root is produced, the kernel circuit injects an additional public data write based upon that root which deducts the transaction fee from the `fee_payer`'s balance. -The calculated trasaction fee is set as output on the base rollup as `accumulated_fees`. Each subsequent merge rollup circuit sums this value from both of its inputs. The root rollup circuit then uses this value to set the `total_fees` in the `Header`. \ No newline at end of file +The calculated trasaction fee is set as output on the base rollup as `accumulated_fees`. Each subsequent merge rollup circuit sums this value from both of its inputs. The root rollup circuit then uses this value to set the `total_fees` in the `Header`. diff --git a/docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md b/docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md index 3c69c036214..1aded7d8a3e 100644 --- a/docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md +++ b/docs/docs/protocol-specs/gas-and-fees/published-gas-and-fee-data.md @@ -9,10 +9,11 @@ When a block is published to L1, it includes information about the gas and fees ## Block-level Data The block header contains a `GlobalVariables`, which contains a `GasFees` object. This object contains the following fields: -- `feePerDaGas`: The fee in [FPA](./fee-payment-asset.md) per unit of DA gas consumed for transactions in the block. + +- `feePerDaGas`: The fee in [Fee Juice](./fee-juice.md) per unit of DA gas consumed for transactions in the block. - `feePerL2Gas`: The fee in FPA per unit of L2 gas consumed for transactions in the block. -`GlobalVariables` also includes a `coinbase` field, which is the L1 address that receives the fees. +`GlobalVariables` also includes a `coinbase` field, which is the L1 address that receives the fees. The block header also contains a `totalFees` field, which is the total fees collected in the block in FPA. @@ -29,6 +30,5 @@ Should we move to a 1559-style fee market with block-level gas targets, there is ## Transaction-level Data The transaction data which is published to L1 is a `TxEffects` object, which includes -- `transaction_fee`: the fee paid by the transaction in FPA - +- `transaction_fee`: the fee paid by the transaction in FPA diff --git a/docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md b/docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md index 30a8a97d83d..936559390ec 100644 --- a/docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md +++ b/docs/docs/protocol-specs/gas-and-fees/specifying-gas-fee-info.md @@ -40,8 +40,8 @@ GasSettings --> Gas GasSettings --> GasFees ``` -:::note -All fees are denominated in the [Fee Payment Asset (FPA)](./fee-payment-asset.md). +:::note +All fees are denominated in [Fee Juice](./fee-juice.md). ::: ## Gas Dimensions and Max Inclusion Fee @@ -57,7 +57,6 @@ Separately, every transaction has overhead costs associated with it, e.g. verify See the [Fee Schedule](./fee-schedule.md) for a detailed breakdown of costs associated with different actions. - ## `gasLimits` and `teardownGasLimits` Transactions can optionally have a "teardown" phase as part of their public execution, during which the "transaction fee" is available to public functions. This is useful to transactions/contracts that need to compute a "refund", e.g. contracts that facilitate [fee abstraction](./tx-setup-and-teardown.md). @@ -129,7 +128,7 @@ This is useful for imposing [validity conditions](./kernel-tracking.md#mempoolno ## `fee_payer` -The `fee_payer` is the entity that pays the transaction fee. +The `fee_payer` is the entity that pays the transaction fee. It is effectively set in private by the contract that calls `context.set_as_fee_payer()`. diff --git a/docs/docs/protocol-specs/l1-smart-contracts/index.md b/docs/docs/protocol-specs/l1-smart-contracts/index.md index de32098a4eb..19dc8f05140 100644 --- a/docs/docs/protocol-specs/l1-smart-contracts/index.md +++ b/docs/docs/protocol-specs/l1-smart-contracts/index.md @@ -98,23 +98,33 @@ The state transitioner is the heart of the validating light node for the L2. The contract keeps track of the current state of the L2 and progresses this state when a valid L2 block is received. It also facilitates cross-chain communication (communication between the L1 inbox and outbox contracts). +:::info +The following example shows a simplified case where proof and block are provided in the same transaction. +::: + ```python class StateTransitioner: + struct BlockLog: + archive: bytes32 + slot_number: uint128 + VERIFIER: immutable(IVerifier) AVAILABILITY_ORACLE: immutable(IAvailabilityOracle) INBOX: immutable(IInbox) OUTBOX: immutable(IOutbox) VERSION: immutable(uint256) + GENESIS_TIME: immutable(uint256) + SLOT_DURATION: immutable(uint256) - archive: TreeSnapshot - block_number: uint256 - last_block_ts: uint256 + blocks: BlockLog[] def __init__(self, ...): ''' Initialize the state transitioner ''' + self.blocks.append(BlockLog({archive: bytes32(0), slot_number: 0})) + self.GENESIS_TIME = block.timestamp def process( self, @@ -131,6 +141,10 @@ class StateTransitioner: header.content_commitment.out_hash, header.content_commitment.tx_tree_height + math.ceil(log2(MAX_L2_TO_L1_MSGS_PER_TX)) ) + self.blocks.append(BlockLog({ + archive: archive, + slot_number: header.global_variables.slot_number + })) self.archive = archive emit BlockProcessed(block_number) @@ -138,12 +152,13 @@ class StateTransitioner: self, header: Header ) -> bool: - assert header.global_variables.block_number = self.block_number + 1 + assert header.global_variables.block_number = len(self.blocks) assert header.global_variables.chain_id == block.chain_id - assert header.global_variables.version == self.version - assert header.global_variables.timestamp < block.timestamp - assert header.global_variables.timestamp > self.last_block_ts - assert header.archive == self.archive + assert header.global_variables.version == self.VERSION + assert header.global_variables.timestamp == self.GENESIS_TIME + self.SLOT_DURATION * header.global_variables.slot_number + last_block = self.blocks[-1] + assert header.global_variables.slot_number > last_block.slot_number + assert header.archive == last_block.archive return True ``` diff --git a/docs/docs/reference/common_errors/_category_.json b/docs/docs/reference/developer_references/common_errors/_category_.json similarity index 100% rename from docs/docs/reference/common_errors/_category_.json rename to docs/docs/reference/developer_references/common_errors/_category_.json diff --git a/docs/docs/reference/common_errors/aztecnr-errors.md b/docs/docs/reference/developer_references/common_errors/aztecnr-errors.md similarity index 87% rename from docs/docs/reference/common_errors/aztecnr-errors.md rename to docs/docs/reference/developer_references/common_errors/aztecnr-errors.md index 093e0c0ffd7..e76d9206355 100644 --- a/docs/docs/reference/common_errors/aztecnr-errors.md +++ b/docs/docs/reference/developer_references/common_errors/aztecnr-errors.md @@ -1,8 +1,9 @@ --- title: Aztec.nr Errors +tags: [contracts] --- -This section contains some errors that you may encounter when writing and compiling contracts in Aztec.nr. If you run into an error that is not listed here, please [create an issue](https://github.com/AztecProtocol/aztec-packages/issues/new). +This section contains some errors that you may encounter when writing and compiling contracts in Aztec.nr. If you run into an error that is not listed here, please [create an issue (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/new). #### `Aztec dependency not found. Please add aztec as a dependency in your Nargo.toml` @@ -16,7 +17,7 @@ You can learn more about dependencies and their paths [here](../smart_contract_r #### `backend has encountered an error` -This is likely due to a version mismatch or bad install of barretenberg. Try [reinstalling nargo](guides/local_env/versions-updating.md#updating) or uninstalling barretenberg: +This is likely due to a version mismatch or bad install of barretenberg. Try [reinstalling nargo](../../../guides/developer_guides/local_env/versions-updating.md#updating-aztec-nargo) or uninstalling barretenberg: ```bash nargo backend uninstall acvm-backend-barretenberg @@ -26,7 +27,7 @@ It will then reinstall when you compile. #### `Oracle callback {} not found` & `Oracle callback pedersenHash not found` -This can occasionally happen when there are breaking releases. Make sure that your dependencies in `Nargo.toml` are [updated to the latest release](../smart_contract_reference/dependencies.md). +This can occasionally happen when there are breaking releases. Make sure that your dependencies in `Nargo.toml` are [updated to the latest release](../../../guides/developer_guides/local_env/versions-updating.md#dependency-versions). #### `error: Failed constraint: 'Public state writes only supported in public functions` @@ -47,7 +48,7 @@ This error occurs when you are trying to interact with a smart contract via an P To execute a transaction, the PXE needs to know the complete address of a contract and contract artifacts. -To address the error, add the contract to the PXE by calling [`pxe.addContracts(...)`](../../aztec/concepts/pxe/index.md#addcontracts). +To address the error, add the contract to the PXE by calling [`pxe.addContracts(...)`](../../../aztec/concepts/pxe/index.md). #### `Simulation error: No public key registered for address 0x0. Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...)` @@ -71,4 +72,4 @@ To address the error, register the account by calling `server.registerAccount(.. You may encounter this error when trying to send a transaction that is using an invalid contract. The contract may compile without errors and you only encounter this when sending the transaction. -This error may arise when function parameters are not properly formatted, when trying to "double-spend" a note, or it may indicate that there is a bug deeper in the stack (e.g. a bug in the Aztec.nr library or deeper). If you hit this error, double check your contract implementation, but also consider [opening an issue](https://github.com/AztecProtocol/aztec-packages/issues/new). +This error may arise when function parameters are not properly formatted, when trying to "double-spend" a note, or it may indicate that there is a bug deeper in the stack (e.g. a bug in the Aztec.nr library or deeper). If you hit this error, double check your contract implementation, but also consider [opening an issue (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/new). diff --git a/docs/docs/reference/common_errors/sandbox-errors.md b/docs/docs/reference/developer_references/common_errors/sandbox-errors.md similarity index 81% rename from docs/docs/reference/common_errors/sandbox-errors.md rename to docs/docs/reference/developer_references/common_errors/sandbox-errors.md index 16f9930de57..2e9aed08ee5 100644 --- a/docs/docs/reference/common_errors/sandbox-errors.md +++ b/docs/docs/reference/developer_references/common_errors/sandbox-errors.md @@ -1,5 +1,6 @@ --- title: Aztec Sandbox Errors +tags: [sandbox] --- import Disclaimer from '@site/src/components/Disclaimers/\_wip_disclaimer.mdx'; @@ -14,7 +15,7 @@ This section contains a list of errors you may encounter when using Aztec Sandbo ### Kernel Circuits -We have several versions of public and private kernels as explained in [our circuits section](../../aztec/concepts/circuits/index.md). Certain things are only possible in certain versions of the circuits. So always ensure that the right version is being used for proof generation. For example, there is a specific version of the public kernel that only works if the previous kernel iteration was a private kernel. Similarly there is one that only works if the previous kernel was public. +We have several versions of public and private kernels as explained in [the circuits section in the concepts](../../../aztec/concepts/circuits/index.md). Certain things are only possible in certain versions of the circuits. So always ensure that the right version is being used for proof generation. For example, there is a specific version of the public kernel that only works if the previous kernel iteration was a private kernel. Similarly there is one that only works if the previous kernel was public. Remember that for each function call (i.e. each item in the call stack), there is a new kernel iteration that gets run. @@ -37,7 +38,7 @@ You cannot execute a public Aztec.nr function in the private kernel #### 2011 - PRIVATE_KERNEL\_\_UNSUPPORTED_OP -You are trying to do something that is currently unsupported in the private kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec3-packages](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord +You are trying to do something that is currently unsupported in the private kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec-packages (GitHub link)](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord Note that certain operations are unsupported on certain versions of the private kernel. Eg static calls are allowed for all but the initial iteration of the private kernel (which initializes the kernel for subsequent function calls). @@ -79,7 +80,7 @@ But for non transient reads, we do a merkle membership check. Reads are done at #### 3001 - PUBLIC_KERNEL\_\_UNSUPPORTED_OP -You are trying to do something that is currently unsupported in the public kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec3-packages](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord +You are trying to do something that is currently unsupported in the public kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec-packages (GitHub link)](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord #### 3002 - PUBLIC_KERNEL\_\_PRIVATE_FUNCTION_NOT_ALLOWED @@ -87,7 +88,7 @@ Calling a private Aztec.nr function in a public kernel is not allowed. #### 3005 - PUBLIC_KERNEL\_\_NON_EMPTY_PRIVATE_CALL_STACK -Public functions are executed after all the private functions are (see [private-public execution](../../aztec/concepts/smart_contracts/communication/public_private_calls.md)). As such, private call stack must be empty when executing in the public kernel. +Public functions are executed after all the private functions are (see [private-public execution](../../../aztec/smart_contracts/communication/public_private_calls.md)). As such, private call stack must be empty when executing in the public kernel. #### 3011 - PUBLIC_KERNEL\_\_CALCULATED_PRIVATE_CALL_HASH_AND_PROVIDED_PRIVATE_CALL_HASH_MISMATCH @@ -131,17 +132,17 @@ For static calls, no new note hashes or nullifiers can be added to the state. ### Rollup circuit errors -These are errors that occur when kernel proofs (transaction proofs) are sent to the rollup circuits to create an L2 block. See [rollup circuits](../../aztec/concepts/circuits/index.md) for more information. +These are errors that occur when kernel proofs (transaction proofs) are sent to the rollup circuits to create an L2 block. See [rollup circuits](../../../aztec/concepts/circuits/rollup_circuits/index.md) for more information. #### 4007 - BASE\_\_INVALID_CHAIN_ID -The L1 chain ID you used in your proof generation (for your private transaction) is different to what the rollup circuits expected. Double check against the global variables passed to noir and the config set in [Aztec's rollup contract](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/Rollup.sol) which are [read in by sequencer](https://github.com/AztecProtocol/aztec3-packages/blob/master/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts#L32) and subsequently passed in as inputs to the base rollup. When the sequencer submits the block to the rollup contracts, this is again sanity checked so ensure this is the same everywhere. +The L1 chain ID you used in your proof generation (for your private transaction) is different to what the rollup circuits expected. Double check against the global variables passed to noir and the config set in [Aztec's rollup contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/Rollup.sol) which are [read in by sequencer GitHub link](https://github.com/AztecProtocol/aztec3-packages/blob/master/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts#L32) and subsequently passed in as inputs to the base rollup. When the sequencer submits the block to the rollup contracts, this is again sanity checked so ensure this is the same everywhere. #### 4008 - BASE\_\_INVALID_VERSION Same as [section 4007](#4007---base__invalid_chain_id) except the `version` refers to the version of the Aztec L2 instance. -Some scary bugs like `4003 - BASE__INVALID_NULLIFIER_SUBTREE` and `4004 - BASE__INVALID_NULLIFIER_RANGE` which are to do malformed nullifier trees (see [Indexed Merkle Trees](../../aztec/concepts/storage/trees/indexed_merkle_tree.mdx)) etc may seem unrelated at a glance, but at a closer look may be because of some bug in an application's Aztec.nr code. Same is true for certain instances of `7008 - MEMBERSHIP_CHECK_FAILED`. +Some scary bugs like `4003 - BASE__INVALID_NULLIFIER_SUBTREE` and `4004 - BASE__INVALID_NULLIFIER_RANGE` which are to do malformed nullifier trees (see [Indexed Merkle Trees](../../../aztec/concepts/storage/trees/indexed_merkle_tree.mdx)) etc may seem unrelated at a glance, but at a closer look may be because of some bug in an application's Aztec.nr code. Same is true for certain instances of `7008 - MEMBERSHIP_CHECK_FAILED`. ### Generic circuit errors @@ -161,7 +162,7 @@ Circuits work by having a fixed size array. As such, we have limits on how many - too many transient read requests in one tx - too many transient read request membership witnesses in one tx -You can have a look at our current constants/limitations in [constants.nr](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr) +You can have a look at our current constants/limitations in [constants.nr (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr) #### 7008 - MEMBERSHIP_CHECK_FAILED @@ -172,7 +173,7 @@ Users may create a proof against a historical state in Aztec. The rollup circuit - using invalid historical L1 to L2 message data tree state - inserting a subtree into the greater tree - we make a smaller merkle tree of all the new note hashes/nullifiers etc that were created in a transaction or in a rollup and add it to the bigger state tree. Before inserting, we do a merkle membership check to ensure that the index to insert at is indeed an empty subtree (otherwise we would be overwriting state). This can happen when `next_available_leaf_index` in the state tree's snapshot is wrong (it is fetched by the sequencer from the archiver). The error message should reveal which tree is causing this issue - - nullifier tree related errors - The nullifier tree uses an [Indexed Merkle Tree](../../aztec/concepts/storage/trees/indexed_merkle_tree.mdx). It requires additional data from the archiver to know which is the nullifier in the tree that is just below the current nullifier before it can perform batch insertion. If the low nullifier is wrong, or the nullifier is in incorrect range, you may receive this error. + - nullifier tree related errors - The nullifier tree uses an [Indexed Merkle Tree](../../../aztec/concepts/storage/trees/indexed_merkle_tree.mdx). It requires additional data from the archiver to know which is the nullifier in the tree that is just below the current nullifier before it can perform batch insertion. If the low nullifier is wrong, or the nullifier is in incorrect range, you may receive this error. --- @@ -190,7 +191,7 @@ Users may create a proof against a historical state in Aztec. The rollup circuit - "\$\{treeName\} tree next available leaf index mismatch" - validating a tree's root is not enough. It also checks that the `next_available_leaf_index` is as expected. This is the next index we can insert new values into. Note that for the public data tree, this test is skipped since as it is a sparse tree unlike the others. -- "Public call stack size exceeded" - In Aztec, the sequencer executes all enqueued public functions in a transaction (to prevent race conditions - see [private-public execution](../../aztec/concepts/smart_contracts/communication/public_private_calls.md)). This error says there are too many public functions requested. +- "Public call stack size exceeded" - In Aztec, the sequencer executes all enqueued public functions in a transaction (to prevent race conditions - see [private-public execution](../../../aztec/smart_contracts/communication/public_private_calls.md)). This error says there are too many public functions requested. - "Array size exceeds target length" - happens if you add more items than allowed by the constants set due to our circuit limitations (eg sending too many L2 to L1 messages or creating a function that exceeds the call stack length or returns more values than what Aztec.nr functions allow) @@ -198,4 +199,4 @@ Users may create a proof against a historical state in Aztec. The rollup circuit ## L1 Aztec Contract Errors -Aztec's L1 contracts use custom errors in solidity. While it saves gas, it has a side effect of making it harder to decode when things go wrong. If you get an error when submitting an L2Block into our rollup contract or when interacting with our Inbox/Outbox contracts, you can use the [Errors.sol library](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Errors.sol) to match the hex encoded error to the error name. +Aztec's L1 contracts use custom errors in solidity. While it saves gas, it has a side effect of making it harder to decode when things go wrong. If you get an error when submitting an L2Block into our rollup contract or when interacting with our Inbox/Outbox contracts, you can use the [Errors.sol library (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Errors.sol) to match the hex encoded error to the error name. diff --git a/docs/docs/reference/debugging.md b/docs/docs/reference/developer_references/debugging.md similarity index 87% rename from docs/docs/reference/debugging.md rename to docs/docs/reference/developer_references/debugging.md index e3d23b37404..12fab8f69ba 100644 --- a/docs/docs/reference/debugging.md +++ b/docs/docs/reference/developer_references/debugging.md @@ -11,7 +11,7 @@ You can log statements from Aztec.nr contracts that will show ups in the Sandbox ### Import `debug_log` -Import the [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) dependency from Aztec oracles: +Import the [`debug_log` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) dependency from Aztec oracles: ```rust use dep::aztec::oracle::debug_log::{ debug_log }; diff --git a/docs/docs/aztec/limitations.md b/docs/docs/reference/developer_references/limitations.md similarity index 88% rename from docs/docs/aztec/limitations.md rename to docs/docs/reference/developer_references/limitations.md index f38e7084c15..cb13ddf4779 100644 --- a/docs/docs/aztec/limitations.md +++ b/docs/docs/reference/developer_references/limitations.md @@ -1,6 +1,7 @@ --- title: Limitations sidebar_position: 6 +tags: [sandbox] --- The Aztec Sandbox and the Aztec Smart Contract Library are **prototypes**, and should be treated as such. They've been released early, to gather feedback on the capabilities of the protocol and user experiences. @@ -30,11 +31,11 @@ Help shape and define: - It is a testing environment, it is insecure, unaudited and does not generate any proofs, its only for testing purposes; - Constructors can not call nor alter public state - - The constructor is executed exclusively in private domain, WITHOUT the ability to call public functions or alter public state. This means to set initial storage values, you need to follow a pattern similar to [proxies in Ethereum](https://blog.openzeppelin.com/proxy-patterns), where you `initialize` the contract with values after it have been deployed, see [initializer functions](../guides/smart_contracts/writing_contracts/initializers.md). + - The constructor is executed exclusively in private domain, WITHOUT the ability to call public functions or alter public state. This means to set initial storage values, you need to follow a pattern similar to [proxies in Ethereum](https://blog.openzeppelin.com/proxy-patterns), where you `initialize` the contract with values after it have been deployed. - Beware that what you think of as a `view` could alter state ATM! Notably the account could alter state or re-enter whenever the account contract's `is_valid` function is called. - `msg_sender` is currently leaking when doing private -> public calls - - The `msg_sender` will always be set, if you call a public function from the private world, the `msg_sender` will be set to the private caller's address. See [function context](concepts/smart_contracts/functions/context). -- The initial `msg_sender` is 0, which can be problematic for some contracts, see [function visibility](concepts/smart_contracts/functions/visibility.md). + - The `msg_sender` will always be set, if you call a public function from the private world, the `msg_sender` will be set to the private caller's address. +- The initial `msg_sender` is 0, which can be problematic for some contracts. - Unencrypted logs don't link to the contract that emitted it, so essentially just a `debug_log`` that you can match values against. - A note that is created and nullified in the same transaction will still emit an encrypted log. - A limited amount of new note hashes, nullifiers and calls that are supported by a transaction, see [circuit limitations](#circuit-limitations). @@ -53,7 +54,7 @@ That's right, the Sandbox doesn't actually generate or verify any zk-SNARKs yet! The main goal of the Sandbox is to enable developers to experiment with building apps, and hopefully to provide feedback. We want the developer experience to be as fast as possible, much like how Ethereum developers use Ganache or Anvil to get super-fast block times, instead of the slow-but-realistic 12-second block times that they'll encounter in production. A fast Sandbox enables fast testing, which enables developers to iterate quickly. -That's not to say a super-fast proving system isn't being worked on [as we speak](roadmap/cryptography_roadmap.md). +That's not to say a super-fast proving system isn't being worked on [as we speak](../../aztec/roadmap/cryptography_roadmap.md). #### What are the consequences? @@ -172,11 +173,11 @@ This will be patched in the near future, but unfortunately, app developers might ### New Privacy Standards are required -There are many [patterns](../reference/privacy_considerations.md) which can leak privacy, even on Aztec. Standards haven't been developed yet, to encourage best practices when designing private smart contracts. +There are many [patterns](../../guides/privacy_considerations.md) which can leak privacy, even on Aztec. Standards haven't been developed yet, to encourage best practices when designing private smart contracts. #### What are the consequences? -For example, until community standards are developed to reduce the uniqueness of ['Tx Fingerprints'](../reference/privacy_considerations.md#function-fingerprints-and-tx-fingerprints) app developers might accidentally forfeit some function privacy. +For example, until community standards are developed to reduce the uniqueness of ['Tx Fingerprints'](../../guides/privacy_considerations.md#function-fingerprints-and-tx-fingerprints) app developers might accidentally forfeit some function privacy. ## Circuit limitations @@ -192,7 +193,7 @@ Here are the current constants: #### What are the consequences? -When you write an Aztec.nr [function](concepts/smart_contracts/functions), there will be upper bounds on the following: +When you write an Aztec.nr function, there will be upper bounds on the following: - The number of public state reads and writes; - The number of note reads and nullifications; @@ -208,13 +209,13 @@ Not only are there limits on a _per function_ basis, there are also limits on a **In particular, these _per-transaction_ limits will limit transaction call stack depths** in the Sandbox. That means if a function call results in a cascade of nested function calls, and each of those function calls outputs lots of state reads and writes, or logs (etc.), then all of that accumulated output data might exceed the per-transaction limits that we currently have. This would cause such transactions to fail. -There are plans to relax all of this rigidity, by providing many 'sizes' of [kernel circuit](concepts/circuits), and introducing a 'bus' to ferry varying lengths of data between kernel iterations. But that'll all take some time. +There are plans to relax all of this rigidity, by providing many 'sizes' of kernel circuit, and introducing a 'bus' to ferry varying lengths of data between kernel iterations. But that'll all take some time. > **In the mean time**, if you encounter a per-transaction limit when testing, and you're feeling adventurous, you could 'hack' the Sandbox to increase the limits. See here (TODO: link) for a guide. **However**, the limits cannot be increased indefinitely. So although we do anticipate that we'll be able to increase them a little bit, don't go mad and provide yourself with 1 million state transitions per transaction. That would be as unrealistic as artificially increasing Ethereum gas limits to 1 trillion. ### Circuits Processing Order Differs from Execution Order -Each function call is represented by a circuit with a dedicated zero-knowledge proof of its execution. The [private kernel circuit](concepts/circuits/kernels/private_kernel.md) is in charge of stitching all these proofs together to produce a zero-knowledge proof that the whole execution of all function calls within a transaction is correct. In doing so, the processing order differs from the execution order. Firstly, the private kernel has to handle one function call in its entirety at a time because a zk proof cannot be verified partially. This property alone makes it impossible for the ordering of kernel circuit validation to match the order in which the functions of the transaction were executed. Secondly, the private kernel processes function calls in a stack-based order, i.e., after having processed a function call, it processes all direct child function calls in an order which is the reverse of the execution order. +Each function call is represented by a circuit with a dedicated zero-knowledge proof of its execution. The private kernel circuit is in charge of stitching all these proofs together to produce a zero-knowledge proof that the whole execution of all function calls within a transaction is correct. In doing so, the processing order differs from the execution order. Firstly, the private kernel has to handle one function call in its entirety at a time because a zk proof cannot be verified partially. This property alone makes it impossible for the ordering of kernel circuit validation to match the order in which the functions of the transaction were executed. Secondly, the private kernel processes function calls in a stack-based order, i.e., after having processed a function call, it processes all direct child function calls in an order which is the reverse of the execution order. Note that there is no plan to change this in the future. @@ -242,10 +243,10 @@ Transaction output elements such as notes in encrypted logs, note hashes (commit ### Chopped Transient Notes are still Emitted in Logs -A note which is created and nullified during the very same transaction is called transient. Such a note is chopped by the [private kernel circuit](concepts/circuits/kernels/private_kernel.md) and is never stored in any persistent data tree. +A note which is created and nullified during the very same transaction is called transient. Such a note is chopped by the private kernel circuit and is never stored in any persistent data tree. -For the time being, such chopped notes are still emitted through encrypted logs (which is the communication channel to transmit notes). When a log containing a chopped note is processed, a warning will be logged about a decrypted note which does not exist in data tree. We [improved](https://github.com/AztecProtocol/aztec-packages/issues/1603) error logging to help identify such an occurrence. However, this might be a source of confusion. -This issue is tracked in ticket [#1641](https://github.com/AztecProtocol/aztec-packages/issues/1641). +For the time being, such chopped notes are still emitted through encrypted logs (which is the communication channel to transmit notes). When a log containing a chopped note is processed, a warning will be logged about a decrypted note which does not exist in data tree. We [improved (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/1603) error logging to help identify such an occurrence. However, this might be a source of confusion. +This issue is tracked in ticket [#1641 (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues/1641). ### Note Terminology: Note Commitments and Note Hashes @@ -253,4 +254,4 @@ The notes or UTXOs in Aztec need to be compressed before they are added to the t ## There's more -See the [GitHub issues](https://github.com/AztecProtocol/aztec-packages/issues) for all known bugs fixes and features currently being worked on. +See the [GitHub issues (GitHub link)](https://github.com/AztecProtocol/aztec-packages/issues) for all known bugs fixes and features currently being worked on. diff --git a/docs/docs/reference/sandbox_reference/cheat_codes.md b/docs/docs/reference/developer_references/sandbox_reference/cheat_codes.md similarity index 98% rename from docs/docs/reference/sandbox_reference/cheat_codes.md rename to docs/docs/reference/developer_references/sandbox_reference/cheat_codes.md index 00c408bda8d..ccf52eddb82 100644 --- a/docs/docs/reference/sandbox_reference/cheat_codes.md +++ b/docs/docs/reference/developer_references/sandbox_reference/cheat_codes.md @@ -1,5 +1,6 @@ --- title: Cheat Codes +tags: [sandbox] --- import Disclaimer from "@site/src/components/Disclaimers/\_wip_disclaimer.mdx"; @@ -10,7 +11,7 @@ To help with testing, the sandbox is shipped with a set of cheatcodes. Cheatcodes allow you to change the time of the Aztec block, load certain state or more easily manipulate Ethereum instead of having to write dedicated RPC calls to anvil or hardhat. :::info Prerequisites -If you aren't familiar with [Anvil](https://book.getfoundry.sh/anvil/), we recommend reading up on that since Aztec Sandbox uses Anvil as the local Ethereum instance. +If you aren't familiar with [Anvil (Foundry)](https://book.getfoundry.sh/anvil/), we recommend reading up on that since Aztec Sandbox uses Anvil as the local Ethereum instance. ::: ### Aims diff --git a/docs/docs/reference/sandbox_reference/cli_reference.md b/docs/docs/reference/developer_references/sandbox_reference/cli_reference.md similarity index 97% rename from docs/docs/reference/sandbox_reference/cli_reference.md rename to docs/docs/reference/developer_references/sandbox_reference/cli_reference.md index 808e83ea9c2..dd5200742bc 100644 --- a/docs/docs/reference/sandbox_reference/cli_reference.md +++ b/docs/docs/reference/developer_references/sandbox_reference/cli_reference.md @@ -1,5 +1,6 @@ --- title: CLI Reference +tags: [sandbox] --- :::warning @@ -301,18 +302,18 @@ Required options: - `-pk, --private-key `: The private key to use for deployment. - `--verifier `: Either 'mock' or 'real'. -### bridge-l1-gas -Mints L1 gas tokens and pushes them to L2. +### bridge-fee-juice +Bridges (and optionally mints) L1 Fee Juice and pushes them to L2. ``` -aztec bridge-l1-gas [options] +aztec bridge-fee-juice [options] ``` Required option: - `--l1-rpc-url `: URL of the Ethereum host. ### get-l1-balance -Gets the balance of gas tokens in L1 for a given Ethereum address. +Gets the balance of ETH or an ERC20 token on L1 for a given Ethereum address. ``` aztec get-l1-balance [options] diff --git a/docs/docs/reference/sandbox_reference/index.md b/docs/docs/reference/developer_references/sandbox_reference/index.md similarity index 85% rename from docs/docs/reference/sandbox_reference/index.md rename to docs/docs/reference/developer_references/sandbox_reference/index.md index 8511fb8bc58..b67c867d7b5 100644 --- a/docs/docs/reference/sandbox_reference/index.md +++ b/docs/docs/reference/developer_references/sandbox_reference/index.md @@ -1,5 +1,6 @@ --- title: Sandbox Reference +tags: [sandbox] sidebar_position: 0 --- @@ -15,4 +16,4 @@ The current sandbox does not generate or verify proofs, but provides a working e ## Command line tools -Aztec-nargo and aztec CLI are command-line tool allowing you to compile smart contracts. See the [compiling contracts](../../guides/smart_contracts/how_to_compile_contract.md) page for more information. \ No newline at end of file +Aztec-nargo and aztec CLI are command-line tool allowing you to compile smart contracts. See the [compiling contracts guide](../../../guides/developer_guides/smart_contracts/how_to_compile_contract.md) for more information. diff --git a/docs/docs/reference/sandbox_reference/sandbox-reference.md b/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md similarity index 94% rename from docs/docs/reference/sandbox_reference/sandbox-reference.md rename to docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md index 00496d916f5..999bd18c7c4 100644 --- a/docs/docs/reference/sandbox_reference/sandbox-reference.md +++ b/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md @@ -1,10 +1,11 @@ --- title: Sandbox Reference +tags: [sandbox] --- :::tip -For a quick start, follow the [guide](../../getting_started.md) to install the sandbox. +For a quick start, follow the [guide](../../../guides/developer_guides/getting_started/quickstart.md) to install the sandbox. ::: @@ -106,7 +107,7 @@ To help with testing, the sandbox is shipped with a set of cheatcodes. Cheatcodes allow you to change the time of the Aztec block, load certain state or more easily manipulate Ethereum instead of having to write dedicated RPC calls to anvil or hardhat. -You can find the cheat code reference [here](cheat_codes.md). +You can find the cheat code reference [here](./cheat_codes.md). ## Contracts @@ -131,7 +132,7 @@ EasyPrivateVotingContractArtifact EcdsaAccountContractArtifact EscrowContractArtifact FPCContractArtifact -GasTokenContractArtifact +FeeJuiceContractArtifact ImportTestContractArtifact InclusionProofsContractArtifact LendingContractArtifact @@ -154,4 +155,4 @@ UniswapContractArtifact > Source code: /yarn-project/end-to-end/src/composed/cli_docs_sandbox.test.ts#L95-L118 -You can see all of our example contracts in the monorepo [here](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts). +You can see all of our example contracts in the monorepo [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts). diff --git a/docs/docs/reference/smart_contract_reference/_category_.json b/docs/docs/reference/developer_references/smart_contract_reference/_category_.json similarity index 100% rename from docs/docs/reference/smart_contract_reference/_category_.json rename to docs/docs/reference/developer_references/smart_contract_reference/_category_.json diff --git a/docs/docs/reference/smart_contract_reference/contract_artifact.md b/docs/docs/reference/developer_references/smart_contract_reference/contract_artifact.md similarity index 99% rename from docs/docs/reference/smart_contract_reference/contract_artifact.md rename to docs/docs/reference/developer_references/smart_contract_reference/contract_artifact.md index 8c47f55d714..9c9fbbce73c 100644 --- a/docs/docs/reference/smart_contract_reference/contract_artifact.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/contract_artifact.md @@ -1,5 +1,6 @@ --- title: "Contract Artifact Reference" +tags: [contracts] --- After compiling a contract you'll get a Contract Artifact file, that contains the data needed to interact with a specific contract, including its name, functions that can be executed, and the interface and code of those functions. Since private functions are not published in the Aztec network, you'll need this artifact file to be able to call private functions of contracts. diff --git a/docs/docs/reference/smart_contract_reference/dependencies.md b/docs/docs/reference/developer_references/smart_contract_reference/dependencies.md similarity index 82% rename from docs/docs/reference/smart_contract_reference/dependencies.md rename to docs/docs/reference/developer_references/smart_contract_reference/dependencies.md index 95232193a9f..d2d7842ca61 100644 --- a/docs/docs/reference/smart_contract_reference/dependencies.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/dependencies.md @@ -1,5 +1,6 @@ --- title: Importing Aztec.nr +tags: [contracts] sidebar_position: 5 --- @@ -19,7 +20,7 @@ This is the core Aztec library that is required for every Aztec.nr smart contrac authwit = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/aztec-nr/authwit"} ``` -This allows you to use authentication witnesses in your contract. Find more about its usage [here](../../guides/smart_contracts/writing_contracts/authwit.md). +This allows you to use authentication witnesses in your contract. Read a guide of how to use it [here](../../../guides/developer_guides/smart_contracts/writing_contracts/authwit.md). ## Address note @@ -35,7 +36,7 @@ This is a library for utilizing notes that hold addresses. Find it on [GitHub](h easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/aztec-nr/easy-private-state" } ``` -This is an abstraction library for using private variables like [`EasyPrivateUint`](https://github.com/AztecProtocol/aztec-packages/blob/6c20b45993ee9cbd319ab8351e2722e0c912f427/noir-projects/aztec-nr/easy-private-state/src/easy_private_state.nr#L17). +This is an abstraction library for using private variables like [`EasyPrivateUint` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/6c20b45993ee9cbd319ab8351e2722e0c912f427/noir-projects/aztec-nr/easy-private-state/src/easy_private_state.nr#L17). ## Protocol Types @@ -51,4 +52,4 @@ This library contains types that are used in the Aztec protocol. Find it on [Git value_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/aztec-nr/value-note" } ``` -This is a library for a note that stores one arbitrary value. You can see an example of how it might be used in the [token contract tutorial](../../tutorials/contract_tutorials/token_contract.md). +This is a library for a note that stores one arbitrary value. You can see an example of how it might be used in the [token contract codealong tutorial](../../../tutorials/codealong/contract_tutorials/token_contract.md). diff --git a/docs/docs/reference/smart_contract_reference/globals.md b/docs/docs/reference/developer_references/smart_contract_reference/globals.md similarity index 100% rename from docs/docs/reference/smart_contract_reference/globals.md rename to docs/docs/reference/developer_references/smart_contract_reference/globals.md diff --git a/docs/docs/reference/smart_contract_reference/macros.md b/docs/docs/reference/developer_references/smart_contract_reference/macros.md similarity index 75% rename from docs/docs/reference/smart_contract_reference/macros.md rename to docs/docs/reference/developer_references/smart_contract_reference/macros.md index 91798ffbcd2..a68b305ddc0 100644 --- a/docs/docs/reference/smart_contract_reference/macros.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/macros.md @@ -1,19 +1,20 @@ --- title: Aztec macros sidebar_position: 6 +tags: [contracts, functions] --- ## All Aztec macros In addition to the function macros in Noir, Aztec also has its own macros for specific functions. An Aztec contract function can be annotated with more than 1 macro. -It is also worth mentioning Noir's `unconstrained` function type [here](https://noir-lang.org/docs/noir/concepts/unconstrained/). +It is also worth mentioning Noir's `unconstrained` function type [here (Noir docs page)](https://noir-lang.org/docs/noir/concepts/unconstrained/). - `#[aztec(public)]` or `#[aztec(private)]` - Whether the function is to be executed from a public or private context (see Further Reading) - `#[aztec(initializer)]` - If one or more functions are marked as an initializer, then one of them must be called before any non-initilizer functions - `#[aztec(noinitcheck)]` - The function is able to be called before an initializer (if one exists) -- `#[aztec(view)]` - Makes calls to the function static (see also [Static calls](../../../../protocol-specs/calls/static-calls)) +- `#[aztec(view)]` - Makes calls to the function static (see also [Static calls in the protocol spec](../../../protocol-specs/calls/static-calls.md)) - `#[aztec(internal)]` - Function can only be called from within the contract - `#[aztec(note)]` - Creates a custom note ## Further reading -[How do Aztec macros work?](../../aztec/concepts/smart_contracts/functions/inner_workings.md) +[How do Aztec macros work? (Concepts)](../../../aztec/smart_contracts/functions/inner_workings.md) diff --git a/docs/docs/reference/smart_contract_reference/portals/_category_.json b/docs/docs/reference/developer_references/smart_contract_reference/portals/_category_.json similarity index 100% rename from docs/docs/reference/smart_contract_reference/portals/_category_.json rename to docs/docs/reference/developer_references/smart_contract_reference/portals/_category_.json diff --git a/docs/docs/reference/smart_contract_reference/portals/data_structures.md b/docs/docs/reference/developer_references/smart_contract_reference/portals/data_structures.md similarity index 89% rename from docs/docs/reference/smart_contract_reference/portals/data_structures.md rename to docs/docs/reference/developer_references/smart_contract_reference/portals/data_structures.md index f7a87619edb..662e409c124 100644 --- a/docs/docs/reference/smart_contract_reference/portals/data_structures.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/portals/data_structures.md @@ -4,7 +4,7 @@ title: Data Structures The `DataStructures` are structs that we are using throughout the message infrastructure and registry. -**Links**: [Implementation](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/DataStructures.sol). +**Links**: [Implementation (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/DataStructures.sol). ## `L1Actor` @@ -40,7 +40,7 @@ A message that is sent from L1 to L2. | `sender` | `L1Actor` | The actor on L1 that is sending the message. | | `recipient` | `L2Actor` | The actor on L2 that is to receive the message. | | `content` | `field (~254 bits)` | The field element containing the content to be sent to L2. | -| `secretHash` | `field (~254 bits)` | The hash of a secret pre-image that must be known to consume the message on L2. Use [`computeSecretHash`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/secrets.ts) to compute it from a secret. | +| `secretHash` | `field (~254 bits)` | The hash of a secret pre-image that must be known to consume the message on L2. Use [`computeSecretHash` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/secrets.ts) to compute it from a secret. | ## `L2ToL1Message` diff --git a/docs/docs/reference/smart_contract_reference/portals/inbox.md b/docs/docs/reference/developer_references/smart_contract_reference/portals/inbox.md similarity index 77% rename from docs/docs/reference/smart_contract_reference/portals/inbox.md rename to docs/docs/reference/developer_references/smart_contract_reference/portals/inbox.md index 3a33a1dbf06..d742d17578b 100644 --- a/docs/docs/reference/smart_contract_reference/portals/inbox.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/portals/inbox.md @@ -1,10 +1,11 @@ --- title: Inbox +tags: [portals, contracts] --- The `Inbox` is a contract deployed on L1 that handles message passing from L1 to the rollup (L2) -**Links**: [Interface](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IInbox.sol), [Implementation](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Inbox.sol). +**Links**: [Interface (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IInbox.sol), [Implementation (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Inbox.sol). ## `sendL2Message()` @@ -16,8 +17,8 @@ Sends a message from L1 to L2. | Name | Type | Description | | -------------- | ------- | ----------- | | Recipient | `L2Actor` | The recipient of the message. This **MUST** match the rollup version and an Aztec contract that is **attached** to the contract making this call. If the recipient is not attached to the caller, the message cannot be consumed by it. | -| Content | `field` (~254 bits) | The content of the message. This is the data that will be passed to the recipient. The content is limited to be a single field for rollup purposes. If the content is small enough it can just be passed along, otherwise it should be hashed and the hash passed along (you can use our [`Hash`](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Hash.sol) utilities with `sha256ToField` functions) | -| Secret Hash | `field` (~254 bits) | A hash of a secret that is used when consuming the message on L2. Keep this preimage a secret to make the consumption private. To consume the message the caller must know the pre-image (the value that was hashed) - so make sure your app keeps track of the pre-images! Use [`computeSecretHash`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/secrets.ts) to compute it from a secret. | +| Content | `field` (~254 bits) | The content of the message. This is the data that will be passed to the recipient. The content is limited to be a single field for rollup purposes. If the content is small enough it can just be passed along, otherwise it should be hashed and the hash passed along (you can use our [`Hash` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/Hash.sol) utilities with `sha256ToField` functions) | +| Secret Hash | `field` (~254 bits) | A hash of a secret that is used when consuming the message on L2. Keep this preimage a secret to make the consumption private. To consume the message the caller must know the pre-image (the value that was hashed) - so make sure your app keeps track of the pre-images! Use [`computeSecretHash` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/utils/secrets.ts) to compute it from a secret. | | ReturnValue | `bytes32` | The message hash, used as an identifier | #### Edge cases diff --git a/docs/docs/reference/smart_contract_reference/portals/outbox.md b/docs/docs/reference/developer_references/smart_contract_reference/portals/outbox.md similarity index 86% rename from docs/docs/reference/smart_contract_reference/portals/outbox.md rename to docs/docs/reference/developer_references/smart_contract_reference/portals/outbox.md index 80de81ffaa1..2c0e1b9b1f1 100644 --- a/docs/docs/reference/smart_contract_reference/portals/outbox.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/portals/outbox.md @@ -1,10 +1,11 @@ --- title: Outbox +tags: [portals, contracts] --- The `Outbox` is a contract deployed on L1 that handles message passing from the rollup and to L1. -**Links**: [Interface](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IOutbox.sol), [Implementation](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Outbox.sol). +**Links**: [Interface (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IOutbox.sol), [Implementation (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Outbox.sol). ## `insert()` @@ -45,7 +46,7 @@ Allows a recipient to consume a message from the `Outbox`. - Will revert with `Outbox__InvalidChainId()` if `block.chainid != _message.recipient.chainId`. - Will revert with `Outbox__NothingToConsumeAtBlock(uint256 l2BlockNumber)` if the root for the block has not been set yet. - Will revert with `Outbox__AlreadyNullified(uint256 l2BlockNumber, uint256 leafIndex)` if the message at leafIndex for the block has already been consumed. -- Will revert with `Outbox__InvalidPathLength(uint256 expected, uint256 actual)` if the the supplied height is less than the existing minimum height of the L2 to L1 message tree, or the supplied height is greater than the maximum (minimum height + log2(maximum messages)). +- Will revert with `Outbox__InvalidPathLength(uint256 expected, uint256 actual)` if the supplied height is less than the existing minimum height of the L2 to L1 message tree, or the supplied height is greater than the maximum (minimum height + log2(maximum messages)). - Will revert with `MerkleLib__InvalidRoot(bytes32 expected, bytes32 actual, bytes32 leaf, uint256 leafIndex)` if unable to verify the message existence in the tree. It returns the message as a leaf, as well as the index of the leaf to expose more info about the error. diff --git a/docs/docs/reference/smart_contract_reference/portals/registry.md b/docs/docs/reference/developer_references/smart_contract_reference/portals/registry.md similarity index 90% rename from docs/docs/reference/smart_contract_reference/portals/registry.md rename to docs/docs/reference/developer_references/smart_contract_reference/portals/registry.md index 2c1b561ba7a..7de03b9354f 100644 --- a/docs/docs/reference/smart_contract_reference/portals/registry.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/portals/registry.md @@ -1,10 +1,11 @@ --- title: Registry +tags: [portals, contracts] --- The registry is a contract deployed on L1, that contains addresses for the `Rollup`, `Inbox` and `Outbox`. It also keeps track of the different versions that have been deployed and let you query prior deployments easily. -**Links**: [Interface](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol), [Implementation](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Registry.sol). +**Links**: [Interface (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol), [Implementation (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/messagebridge/Registry.sol). ## `numberOfVersions()` diff --git a/docs/docs/reference/smart_contract_reference/storage/_category_.json b/docs/docs/reference/developer_references/smart_contract_reference/storage/_category_.json similarity index 100% rename from docs/docs/reference/smart_contract_reference/storage/_category_.json rename to docs/docs/reference/developer_references/smart_contract_reference/storage/_category_.json diff --git a/docs/docs/reference/smart_contract_reference/storage/index.md b/docs/docs/reference/developer_references/smart_contract_reference/storage/index.md similarity index 80% rename from docs/docs/reference/smart_contract_reference/storage/index.md rename to docs/docs/reference/developer_references/smart_contract_reference/storage/index.md index f0a436c2e66..1ca6e302063 100644 --- a/docs/docs/reference/smart_contract_reference/storage/index.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/storage/index.md @@ -4,8 +4,8 @@ title: Storage Smart contracts rely on storage, acting as the persistent memory on the blockchain. In Aztec, because of its hybrid, privacy-first architecture, the management of this storage is more complex than other blockchains like Ethereum. -To learn how to define a storage struct, read [this guide](../../../guides/smart_contracts/writing_contracts/storage/index.md). -To learn more about storage slots, read [this explainer](../../../guides/smart_contracts/writing_contracts/storage/storage_slots.md). +To learn how to define a storage struct, read [this guide](../../../../guides/developer_guides/smart_contracts/writing_contracts/storage/index.md). +To learn more about storage slots, read [this explainer in the Concepts section](../../../../aztec/concepts/storage/index.md). You control this storage in Aztec using a struct annotated with `#[aztec(storage)]`. This struct serves as the housing unit for all your smart contract's state variables - the data it needs to keep track of and maintain. @@ -24,7 +24,7 @@ On this and the following pages in this section, you’ll learn: ## The `Context` parameter -Aztec contracts have three different modes of execution: [private](../../../aztec/glossary/call_types.md#private-execution), [public](../../../aztec/glossary/call_types.md#public-execution) and [top-level unconstrained](../../../aztec/glossary/call_types.md#top-level-unconstrained). How storage is accessed depends on the execution mode: for example, `PublicImmutable` can be read in all execution modes but only initialized in public, while `PrivateMutable` is entirely unavailable in public. +Aztec contracts have three different modes of execution: private, public, and top-level unconstrained. How storage is accessed depends on the execution mode: for example, `PublicImmutable` can be read in all execution modes but only initialized in public, while `PrivateMutable` is entirely unavailable in public. Aztec.nr prevents developers from calling functions unavailable in the current execution mode via the `context` variable that is injected into all contract functions. Its type indicates the current execution mode: @@ -57,15 +57,15 @@ A `map` is a state variable that "maps" a key to a value. It can be used with pr In Aztec.nr, keys are always `Field`s, or types that can be serialized as Fields, and values can be any type - even other maps. `Field`s are finite field elements, but you can think of them as integers. ::: -It includes a [`Context`](../../../aztec/concepts/smart_contracts/functions/context.md) to specify the private or public domain, a `storage_slot` to specify where in storage the map is stored, and a `start_var_constructor` which tells the map how it should operate on the underlying type. This includes how to serialize and deserialize the type, as well as how commitments and nullifiers are computed for the type if it's private. +It includes a `Context` to specify the private or public domain, a `storage_slot` to specify where in storage the map is stored, and a `start_var_constructor` which tells the map how it should operate on the underlying type. This includes how to serialize and deserialize the type, as well as how commitments and nullifiers are computed for the type if it's private. -You can view the implementation in the Aztec.nr library [here](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/aztec-nr). +You can view the implementation in the Aztec.nr library [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/aztec-nr). You can have multiple `map`s in your contract that each have a different underlying note type, due to note type IDs. These are identifiers for each note type that are unique within a contract. ### `new` -When declaring the storage for a map, we use the `Map::new()` constructor. As seen below, this takes the `storage_slot` and the `start_var_constructor` along with the [`Context`](../../../aztec/concepts/smart_contracts/functions/context.md). +When declaring the storage for a map, we use the `Map::new()` constructor. As seen below, this takes the `storage_slot` and the `start_var_constructor` along with the `Context`. We will see examples of map constructors for public and private variables in later sections. @@ -105,6 +105,6 @@ require(minters[msg.sender], "caller is not minter"); ## Concepts mentioned -- [State Model](../../../aztec/concepts/state_model/index.md) -- [Public-private execution](../../../aztec/concepts/smart_contracts/communication/public_private_calls.md) -- [Function Contexts](../../../aztec/concepts/smart_contracts/functions/context.md) +- [State Model](../../../../aztec/concepts/state_model/index.md) +- [Public-private execution](../../../../aztec/smart_contracts/communication/public_private_calls.md) +- [Function Contexts](../../../../aztec/smart_contracts/functions/context.md) diff --git a/docs/docs/reference/smart_contract_reference/storage/private_state.md b/docs/docs/reference/developer_references/smart_contract_reference/storage/private_state.md similarity index 82% rename from docs/docs/reference/smart_contract_reference/storage/private_state.md rename to docs/docs/reference/developer_references/smart_contract_reference/storage/private_state.md index 7560e14f03d..19e803910ba 100644 --- a/docs/docs/reference/smart_contract_reference/storage/private_state.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/storage/private_state.md @@ -4,15 +4,15 @@ title: Private State On this page we will look at how to manage private state in Aztec contracts. We will look at how to declare private state, how to read and write to it, and how to use it in your contracts. -For a higher level overview of the state model in Aztec, see the [hybrid state model](../../../aztec/concepts/state_model/index.md) page. +For a higher level overview of the state model in Aztec, see the [hybrid state model](../../../../aztec/concepts/state_model/index.md) page. ## Overview In contrast to public state, private state is persistent state that is **not** visible to the whole world. Depending on the logic of the smart contract, a private state variable's current value will only be known to one entity, or a closed group of entities. -The value of a private state variable can either be shared via an [encrypted log](../../../guides/smart_contracts/writing_contracts/how_to_emit_event.md#encrypted-events), or offchain via web2, or completely offline: it's up to the app developer. +The value of a private state variable can either be shared via an encrypted log, or offchain via web2, or completely offline: it's up to the app developer. -Aztec private state follows a [utxo](https://en.wikipedia.org/wiki/Unspent_transaction_output)-based model. That is, a private state's current value is represented as one or many [notes](../../../aztec/concepts/storage/trees/index.md). +Aztec private state follows a [UTXO](https://en.wikipedia.org/wiki/Unspent_transaction_output)-based model. That is, a private state's current value is represented as one or many notes. To greatly simplify the experience of writing private state, Aztec.nr provides three different types of private state variable: @@ -70,7 +70,7 @@ Interestingly, if a developer requires a private state to be modifiable by users PrivateMutable (formerly known as `Singleton`) is a private state variable that is unique in a way. When a PrivateMutable is initialized, a note is created to represent its value. And the way to update the value is to destroy the current note, and create a new one with the updated value. -Like for public state, we define the struct to have context and a storage slot. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr). +Like for public state, we define the struct to have context and a storage slot. You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr). An example of `PrivateMutable` usage in the account contracts is keeping track of public keys. The `PrivateMutable` is added to the `Storage` struct as follows: @@ -102,7 +102,7 @@ Extend on what happens if you try to use non-initialized state. ### `is_initialized` -An unconstrained method to check whether the PrivateMutable has been initialized or not. It takes an optional owner and returns a boolean. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr). +An unconstrained method to check whether the PrivateMutable has been initialized or not. It takes an optional owner and returns a boolean. You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr). #include_code private_mutable_is_initialized /noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr rust @@ -134,7 +134,7 @@ Functionally similar to [`get_note`](#get_note), but executed in unconstrained f ## `PrivateImmutable` -`PrivateImmutable` (formerly known as `ImmutableSingleton`) represents a unique private state variable that, as the name suggests, is immutable. Once initialized, its value cannot be altered. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). +`PrivateImmutable` (formerly known as `ImmutableSingleton`) represents a unique private state variable that, as the name suggests, is immutable. Once initialized, its value cannot be altered. You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). ### `new` @@ -160,7 +160,7 @@ Once initialized, an PrivateImmutable's value remains unchangeable. This method ### `is_initialized` -An unconstrained method to check if the PrivateImmutable has been initialized. Takes an optional owner and returns a boolean. You can find the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). +An unconstrained method to check if the PrivateImmutable has been initialized. Takes an optional owner and returns a boolean. You can find the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr). ### `get_note` @@ -182,9 +182,9 @@ Functionally similar to `get_note`, but executed unconstrained and can be used b `PrivateSet` is used for managing a collection of notes. All notes in a `PrivateSet` are of the same `NoteType`. But whether these notes all belong to one entity, or are accessible and editable by different entities, is up to the developer. The set is a collection of notes inserted into the data-tree, but notes are never removed from the tree itself, they are only nullified. -You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/set.nr). +You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/set.nr). -And can be added to the `Storage` struct as follows. Here adding a set for a custom note, the TransparentNote (useful for [public -> private communication](../../../guides/smart_contracts/writing_contracts/call_functions.md). +And can be added to the `Storage` struct as follows. Here adding a set for a custom note, the TransparentNote (useful for public -> private communication). #include_code storage-set-declaration /noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr rust @@ -200,39 +200,40 @@ We can initialize the set as follows: Allows us to modify the storage by inserting a note into the `PrivateSet`. -A hash of the note will be generated, and inserted into the note hash tree, allowing us to later use in contract interactions. Recall that the content of the note should be shared with the owner to allow them to use it, as mentioned this can be done via an [encrypted log](../../../guides/smart_contracts/writing_contracts/how_to_emit_event.md#encrypted-events), or offchain via web2, or completely offline. +A hash of the note will be generated, and inserted into the note hash tree, allowing us to later use in contract interactions. Recall that the content of the note should be shared with the owner to allow them to use it, as mentioned this can be done via an encrypted log or offchain via web2, or completely offline. #include_code insert /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust ### `insert_from_public` -The `insert_from_public` allow public function to insert notes into private storage. This is very useful when we want to support private function calls that have been initiated in public, such as shielding in the [example token contract](../../../tutorials/contract_tutorials/token_contract.md#shield). +The `insert_from_public` allow public function to insert notes into private storage. This is very useful when we want to support private function calls that have been initiated in public, such as shielding in the [token contract codealong tutorial](../../../../tutorials/codealong/contract_tutorials/token_contract.md). The usage is similar to using the `insert` method with the difference that this one is called in public functions. #include_code insert_from_public /noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust -### `remove` +### `pop_notes` -Will remove a note from the `PrivateSet` if it previously has been read from storage, e.g. you have fetched it through a `get_notes` call. This is useful when you want to remove a note that you have previously read from storage and do not have to read it again. +This function pops (gets, removes and returns) the notes the account has access to based on the provided filter. + +The kernel circuits are constrained to a maximum number of notes this function can return at a time. Check [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr) and look for `MAX_NOTE_HASH_READ_REQUESTS_PER_CALL` for the up-to-date number. -Nullifiers are emitted when reading values to make sure that they are up to date. +Because of this limit, we should always consider using the second argument `NoteGetterOptions` to limit the number of notes we need to read and constrain in our programs. This is quite important as every extra call increases the time used to prove the program and we don't want to spend more time than necessary. -An example of how to use this operation is visible in the `easy_private_state`: +An example of such options is using the [filter_notes_min_sum (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/filter.nr) to get "enough" notes to cover a given value. Essentially, this function will return just enough notes to cover the amount specified such that we don't need to read all our notes. For users with a lot of notes, this becomes increasingly important. -#include_code remove /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust +#include_code pop_notes /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust ### `get_notes` -This function returns the notes the account has access to. +This function has the same behavior as `pop_notes` above but it does not delete the notes. -The kernel circuits are constrained to a maximum number of notes this function can return at a time. Check [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr) and look for `MAX_NOTE_HASH_READ_REQUESTS_PER_CALL` for the up-to-date number. -Because of this limit, we should always consider using the second argument `NoteGetterOptions` to limit the number of notes we need to read and constrain in our programs. This is quite important as every extra call increases the time used to prove the program and we don't want to spend more time than necessary. +### `remove` -An example of such options is using the [filter_notes_min_sum](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/filter.nr) to get "enough" notes to cover a given value. Essentially, this function will return just enough notes to cover the amount specified such that we don't need to read all our notes. For users with a lot of notes, this becomes increasingly important. +Will remove a note from the `PrivateSet` if it previously has been read from storage, e.g. you have fetched it through a `get_notes` call. This is useful when you want to remove a note that you have previously read from storage and do not have to read it again. -#include_code get_notes /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust +Note that if you obtained the note you are about to remove via `get_notes` it's much better to use `pop_notes` as `pop_notes` results in significantly fewer constraints since it doesn't need to check that the note has been previously read, as it reads and deletes at once. ### `view_notes` @@ -240,7 +241,7 @@ Functionally similar to [`get_notes`](#get_notes), but executed unconstrained an #include_code view_notes /noir-projects/aztec-nr/value-note/src/balance_utils.nr rust -There's also a limit on the maximum number of notes that can be returned in one go. To find the current limit, refer to [this file](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/constants.nr) and look for `MAX_NOTES_PER_PAGE`. +There's also a limit on the maximum number of notes that can be returned in one go. To find the current limit, refer to [this file (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/constants.nr) and look for `MAX_NOTES_PER_PAGE`. The key distinction is that this method is unconstrained. It does not perform a check to verify if the notes actually exist, which is something the [`get_notes`](#get_notes) method does under the hood. Therefore, it should only be used in an unconstrained contract function. @@ -248,9 +249,9 @@ This function requires a `NoteViewerOptions`. The `NoteViewerOptions` is essenti ## `NoteGetterOptions` -`NoteGetterOptions` encapsulates a set of configurable options for filtering and retrieving a selection of notes from a [data oracle](../../../aztec/concepts/smart_contracts/oracles/index.md). Developers can design instances of `NoteGetterOptions`, to determine how notes should be filtered and returned to the functions of their smart contracts. +`NoteGetterOptions` encapsulates a set of configurable options for filtering and retrieving a selection of notes from a data oracle. Developers can design instances of `NoteGetterOptions`, to determine how notes should be filtered and returned to the functions of their smart contracts. -You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr). +You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr). ### `selects: BoundedVec, N>` @@ -268,9 +269,21 @@ When the `limit` is set to a non-zero value, the data oracle will return a maxim This setting enables us to skip the first `offset` notes. It's particularly useful for pagination. +### `preprocessor: fn ([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], PREPROCESSOR_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL]` + +Developers have the option to provide a custom preprocessor. +This allows specific logic to be applied to notes that meet the criteria outlined above. +The preprocessor takes the notes returned from the oracle and `preprocessor_args` as its parameters. + +An important distinction from the filter function described below is that preprocessor is applied first and unlike filter it is applied in an unconstrained context. + +### `preprocessor_args: PREPROCESSOR_ARGS` + +`preprocessor_args` provides a means to furnish additional data or context to the custom preprocessor. + ### `filter: fn ([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], FILTER_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL]` -Developers have the option to provide a custom filter. This allows specific logic to be applied to notes that meet the criteria outlined above. The filter takes the notes returned from the oracle and `filter_args` as its parameters. +Just like preprocessor just applied in a constrained context (correct execution is proven) and applied after the preprocessor. ### `filter_args: FILTER_ARGS` diff --git a/docs/docs/reference/smart_contract_reference/storage/public_state.md b/docs/docs/reference/developer_references/smart_contract_reference/storage/public_state.md similarity index 77% rename from docs/docs/reference/smart_contract_reference/storage/public_state.md rename to docs/docs/reference/developer_references/smart_contract_reference/storage/public_state.md index 69b5a960fb8..61208e17cc2 100644 --- a/docs/docs/reference/smart_contract_reference/storage/public_state.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/storage/public_state.md @@ -4,7 +4,7 @@ title: Public State On this page we will look at how to manage public state in Aztec contracts. We will look at how to declare public state, how to read and write to it, and how to use it in your contracts. -For a higher level overview of the state model in Aztec, see the [state model](../../../aztec/concepts/state_model/index.md) page. +For a higher level overview of the state model in Aztec, see the [state model](../../../../aztec/concepts/state_model/index.md) concepts page. ## `PublicMutable` @@ -13,19 +13,19 @@ The `PublicMutable` (formerly known as `PublicState`) struct is generic over the #include_code serialize /noir-projects/noir-protocol-circuits/crates/types/src/traits.nr rust #include_code deserialize /noir-projects/noir-protocol-circuits/crates/types/src/traits.nr rust -The struct contains a `storage_slot` which, similar to Ethereum, is used to figure out _where_ in storage the variable is located. Notice that while we don't have the exact same [state model](../../../aztec/concepts/state_model/index.md) as EVM chains it will look similar from the contract developers point of view. +The struct contains a `storage_slot` which, similar to Ethereum, is used to figure out _where_ in storage the variable is located. Notice that while we don't have the exact same state model as EVM chains it will look similar from the contract developers point of view. -You can find the details of `PublicMutable` in the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr). +You can find the details of `PublicMutable` in the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr). For a version of `PublicMutable` that can also be read in private, head to [`SharedMutable`](./shared_state.md#sharedmutable). :::info -An example using a larger struct can be found in the [lending example](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts/lending_contract)'s use of an [`Asset`](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr). +An example using a larger struct can be found in the [lending example (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts/lending_contract)'s use of an [`Asset` (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr). ::: ### `new` -When declaring the storage for `T` as a persistent public storage variable, we use the `PublicMutable::new()` constructor. As seen below, this takes the `storage_slot` and the `serialization_methods` as arguments along with the [`Context`](../../../aztec/concepts/smart_contracts/functions/context.md), which in this case is used to share interface with other structures. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr). +When declaring the storage for `T` as a persistent public storage variable, we use the `PublicMutable::new()` constructor. As seen below, this takes the `storage_slot` and the `serialization_methods` as arguments along with the `Context`, which in this case is used to share interface with other structures. You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr). #### Single value example @@ -75,7 +75,7 @@ We have a `write` method on the `PublicMutable` struct that takes the value to w Just like the `PublicMutable` it is generic over the variable type `T`. The type `MUST` implement Serialize and Deserialize traits. -You can find the details of `PublicImmutable` in the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_immutable.nr). +You can find the details of `PublicImmutable` in the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/public_immutable.nr). ### `new` diff --git a/docs/docs/reference/smart_contract_reference/storage/shared_state.md b/docs/docs/reference/developer_references/smart_contract_reference/storage/shared_state.md similarity index 97% rename from docs/docs/reference/smart_contract_reference/storage/shared_state.md rename to docs/docs/reference/developer_references/smart_contract_reference/storage/shared_state.md index a981de01ddd..d30597935f0 100644 --- a/docs/docs/reference/smart_contract_reference/storage/shared_state.md +++ b/docs/docs/reference/developer_references/smart_contract_reference/storage/shared_state.md @@ -54,7 +54,7 @@ This prevents the network-wide privacy set from being split between transactions ## `SharedMutable` -`SharedMutable` is a shared state variable for mutable state. It provides capabilities to read the same state both in private and public, and to schedule value changes after a delay. You can view the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/shared_mutable/shared_mutable.nr). +`SharedMutable` is a shared state variable for mutable state. It provides capabilities to read the same state both in private and public, and to schedule value changes after a delay. You can view the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/shared_mutable/shared_mutable.nr). Unlike other state variables, `SharedMutable` receives not only a type parameter for the underlying datatype, but also a `DELAY` type parameter with the value change delay as a number of blocks. @@ -110,7 +110,7 @@ Like most state variables, `SharedImmutable` is generic over the variable type ` #include_code storage-shared-immutable-declaration /noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr rust -You can find the details of `SharedImmutable` in the implementation [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/shared_immutable.nr). +You can find the details of `SharedImmutable` in the implementation [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/aztec/src/state_vars/shared_immutable.nr). ### `initialize` diff --git a/docs/docs/reference/index.md b/docs/docs/reference/index.md new file mode 100644 index 00000000000..714e945f3b9 --- /dev/null +++ b/docs/docs/reference/index.md @@ -0,0 +1,64 @@ +--- +title: References +sidebar_position: 0 +--- + +# References + +Welcome to the References section! In this section you will find reference material for developing on Aztec Protocol. + +This page lists popular references. Please see the sidebar for them all. + + +## Popular + +### Smart contracts + +
+ + + +

Storage

+
+ + A detailed reference for storage types + +
+ + + +

Portals

+
+ + A detailed reference for working with portals and L1/L2 communication + +
+ +
+ +### Others + +
+ + + +

Common Sandbox Errors

+
+ + Help debug your sandbox environment + +
+ + + +

CLI reference

+
+ + A full list of commands for working with the Aztec CLI + +
+
+ + diff --git a/docs/docs/tutorials/aztecjs-getting-started.md b/docs/docs/tutorials/codealong/aztecjs-getting-started.md similarity index 95% rename from docs/docs/tutorials/aztecjs-getting-started.md rename to docs/docs/tutorials/codealong/aztecjs-getting-started.md index ff99ce941f8..d4b9966e08a 100644 --- a/docs/docs/tutorials/aztecjs-getting-started.md +++ b/docs/docs/tutorials/codealong/aztecjs-getting-started.md @@ -7,7 +7,7 @@ import Image from "@theme/IdealImage"; In this guide, we will retrieving the Sandbox and deploy a pre-written contract to it using Aztec.js. -This guide assumes you have followed the [quickstart](../getting_started.md). +This guide assumes you have followed the [quickstart](../../guides/developer_guides/getting_started/quickstart.md). ## Prerequisites @@ -131,7 +131,7 @@ The sandbox is preloaded with multiple accounts so you don't have to sit and cre #include_code load_accounts /yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts typescript -An explanation on accounts on Aztec can be found [here](../aztec/concepts/index.md). +An explanation on accounts on Aztec can be found [here](../../aztec/concepts/accounts/index.md). ## Deploy a contract @@ -239,7 +239,7 @@ Now lets transfer some funds from Alice to Bob by calling the `transfer` functio 1. The sender. 2. The recipient. 3. The quantity of tokens to be transferred. -4. The nonce for the [authentication witness](../aztec/concepts/index.md#authorizing-actions), or 0 if msg.sender equal sender. +4. The nonce for the [authentication witness](../../aztec/concepts/accounts/index.md#authorizing-actions), or 0 if msg.sender equal sender. Here is the Typescript code to call the `transfer` function, add this to your `index.ts` at the bottom of the `main` function: @@ -336,15 +336,15 @@ Our complete output should now be something like: token Bob's balance 10543 +43ms ``` -That's it! We have successfully deployed a token contract to an instance of the Aztec network and mined private state-transitioning transactions. We have also queried the resulting state all via the interfaces provided by the contract. To see exactly what has happened here, you can learn about the transaction flow [on the Concepts page here](../aztec/concepts/transactions.md). +That's it! We have successfully deployed a token contract to an instance of the Aztec network and mined private state-transitioning transactions. We have also queried the resulting state all via the interfaces provided by the contract. To see exactly what has happened here, you can learn about the transaction flow [on the Concepts page here](../../aztec/concepts/transactions.md). ## Next Steps ### Build a fullstack Aztec project -Follow the dapp tutorial on the [next page](./simple_dapp/index.md). +Follow the [dapp tutorial](./simple_dapp/index.md). ### Optional: Learn more about concepts mentioned here -- [Authentication witness](../aztec/concepts/accounts/authwit.md) -- [Functions under the hood](../aztec/concepts/smart_contracts/functions/inner_workings.md) \ No newline at end of file +- [Authentication witness](../../aztec/concepts/accounts/authwit.md) +- [Functions under the hood](../../aztec/smart_contracts/functions/inner_workings.md) diff --git a/docs/docs/tutorials/contract_tutorials/_category_.json b/docs/docs/tutorials/codealong/contract_tutorials/_category_.json similarity index 81% rename from docs/docs/tutorials/contract_tutorials/_category_.json rename to docs/docs/tutorials/codealong/contract_tutorials/_category_.json index a9fa3a1b962..852419cf559 100644 --- a/docs/docs/tutorials/contract_tutorials/_category_.json +++ b/docs/docs/tutorials/codealong/contract_tutorials/_category_.json @@ -1,6 +1,6 @@ { "label": "Contract Tutorials", - "position": 0, + "position": 1, "collapsible": true, "collapsed": true } diff --git a/docs/docs/tutorials/contract_tutorials/advanced/_category_.json b/docs/docs/tutorials/codealong/contract_tutorials/advanced/_category_.json similarity index 100% rename from docs/docs/tutorials/contract_tutorials/advanced/_category_.json rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/_category_.json diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/0_setup.md similarity index 97% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/0_setup.md index 42a082ffdce..0af6c030071 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/0_setup.md @@ -15,9 +15,9 @@ We recommend going through this setup to fully understand where things live. ## Prerequisites -- [node v18+](https://github.com/tj/n) +- [node v18+ (GitHub link)](https://github.com/tj/n) - [docker](https://docs.docker.com/) -- [Aztec sandbox](../../../../getting_started.md) - you should have this running before starting the tutorial +- [Aztec sandbox](../../../../../guides/developer_guides/getting_started/quickstart.md) - you should have this running before starting the tutorial Start the sandbox diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/1_depositing_to_aztec.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/1_depositing_to_aztec.md similarity index 100% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/1_depositing_to_aztec.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/1_depositing_to_aztec.md diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md similarity index 99% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md index a9897a29979..aa7a7e4ac2d 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md @@ -52,6 +52,6 @@ If the content hashes were constructed similarly for `mint_private` and `mint_pu While we mint the tokens on L2, we _still don’t actually mint them to a certain address_. Instead we continue to pass the `secret_hash_for_redeeming_minted_notes` like we did on L1. This means that a user could reveal their secret for L2 message consumption for anyone to mint tokens on L2 but they can redeem these notes at a later time. **This enables a paradigm where an app can manage user’s secrets for L2 message consumption on their behalf**. **The app or any external party can also mint tokens on the user’s behalf should they be comfortable with leaking the secret for L2 Message consumption.** This doesn’t leak any new information to the app because their smart contract on L1 knew that a user wanted to move some amount of tokens to L2. The app still doesn’t know which address on L2 the user wants these notes to be in, but they can mint tokens nevertheless on their behalf. -To mint tokens privately, `claim_private` calls an internal function `_call_mint_on_token()` which then calls [token.mint_private()](../../token_contract.md#redeem_shield). +To mint tokens privately, `claim_private` calls an internal function `_call_mint_on_token()` which then calls [token.mint_private()](../../token_contract.md#mint_private). In the next step we will see how we can cancel a message. diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md similarity index 97% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md index 6d66f2a1bef..a0c1b508212 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md @@ -17,7 +17,7 @@ For this to work we import the `get_withdraw_content_hash` helper function from The `exit_to_l1_public` function enables anyone to withdraw their L2 tokens back to L1 publicly. This is done by burning tokens on L2 and then creating an L2->L1 message. 1. Like with our deposit function, we need to create the L2 to L1 message. The content is the _amount_ to burn, the recipient address, and who can execute the withdraw on the L1 portal on behalf of the user. It can be `0x0` for anyone, or a specified address. -2. `context.message_portal()` passes this content to the [kernel circuit](../../../../aztec/concepts/circuits/kernels/public_kernel.md) which creates the proof for the transaction. The kernel circuit then adds the sender (the L2 address of the bridge + version of aztec) and the recipient (the portal to the L2 address + the chain ID of L1) under the hood, to create the message which gets added as part of the transaction data published by the sequencer and is stored in the outbox for consumption. +2. `context.message_portal()` passes this content to the kernel circuit which creates the proof for the transaction. The kernel circuit then adds the sender (the L2 address of the bridge + version of aztec) and the recipient (the portal to the L2 address + the chain ID of L1) under the hood, to create the message which gets added as part of the transaction data published by the sequencer and is stored in the outbox for consumption. 3. The `context.message_portal()` takes the recipient and content as input, and will insert a message into the outbox. We set the recipient to be the portal address read from storage of the contract. 4. Finally, you also burn the tokens on L2! Note that it burning is done at the end to follow the check effects interaction pattern. Note that the caller has to first approve the bridge contract to burn tokens on its behalf. Refer to [burn_public function on the token contract](../../token_contract.md#authorizing-token-spends). - We burn the tokens from the `msg_sender()`. Otherwise, a malicious user could burn someone else’s tokens and mint tokens on L1 to themselves. One could add another approval flow on the bridge but that might make it complex for other applications to call the bridge. diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md similarity index 95% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md index 7d0a03592a7..674be65f37d 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/4_typescript_glue_code.md @@ -168,9 +168,9 @@ Note - you might have a jest error at the end of each test saying "expected 1-2 ### Follow a more detailed Aztec.js tutorial -Follow the tutorial on the [next page](../../../aztecjs-getting-started.md). +Follow the tutorial [here](../../../aztecjs-getting-started.md). ### Optional: Learn more about concepts mentioned here -- [Portals (protocol specs)](../../../../protocol-specs/l1-smart-contracts/index.md) -- [Functions under the hood (concepts)](../../../../aztec/concepts/smart_contracts/functions/inner_workings.md) \ No newline at end of file +- [Portals (protocol specs)](../../../../../protocol-specs/l1-smart-contracts/index.md) +- [Functions under the hood (concepts)](../../../../../aztec/smart_contracts/functions/inner_workings.md) diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/index.md b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md similarity index 98% rename from docs/docs/tutorials/contract_tutorials/advanced/token_bridge/index.md rename to docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md index f38ea62322b..8b3873c5a91 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/index.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/advanced/token_bridge/index.md @@ -5,7 +5,7 @@ sidebar_position: 2 import Image from "@theme/IdealImage"; -In this tutorial, we will learn how to build the entire flow of a cross-chain token using portals. If this is your first time hearing the word portal, you’ll want to read [this page in the protocol specs](../../../../protocol-specs/l1-smart-contracts/index.md). +In this tutorial, we will learn how to build the entire flow of a cross-chain token using portals. If this is your first time hearing the word portal, you’ll want to read [this page in the protocol specs](../../../../../protocol-specs/l1-smart-contracts/index.md). ## A refresher on Portals diff --git a/docs/docs/tutorials/contract_tutorials/counter_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md similarity index 93% rename from docs/docs/tutorials/contract_tutorials/counter_contract.md rename to docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md index 887954c9cba..85109d46668 100644 --- a/docs/docs/tutorials/contract_tutorials/counter_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md @@ -5,11 +5,9 @@ sidebar_position: 0 In this guide, we will create our first Aztec.nr smart contract. We will build a simple private counter. This contract will get you started with the basic setup and syntax of Aztec.nr, but doesn't showcase the awesome stuff Aztec is capable of. -If you already have some experience with Noir and want to build a cooler contract that utilizes both private and public state, you might want to check out the [token contract tutorial instead](../../tutorials/contract_tutorials/token_contract.md). - ## Prerequisites -- You have followed the [quickstart](../../getting_started.md) +- You have followed the [quickstart](../../../guides/developer_guides/getting_started/quickstart.md) - Running Aztec Sandbox ## Set up a project @@ -160,4 +158,4 @@ Follow the private voting contract tutorial on the [next page](./private_voting_ ### Optional: Learn more about concepts mentioned here - - [Functions and annotations like `#[aztec(private)]`](../../aztec/concepts/smart_contracts/functions/index.md) \ No newline at end of file + - [Functions and annotations like `#[aztec(private)]`](../../../aztec/smart_contracts/functions/inner_workings.md) diff --git a/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/crowdfunding_contract.md similarity index 82% rename from docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md rename to docs/docs/tutorials/codealong/contract_tutorials/crowdfunding_contract.md index 9c5dcfd260f..2c7953a8dae 100644 --- a/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/crowdfunding_contract.md @@ -26,9 +26,7 @@ Along the way you will: ### Install tools -Please ensure that the you already have [Installed the Sandbox](../../getting_started.md). - -And if using VSCode, see [here](../../getting_started.md#install-noir-lsp-recommended) to install Noir LSP, where you'll benefit from syntax highlighting, profiling, and more. +Please ensure that the you already have [Installed the Sandbox](../../../guides/developer_guides/getting_started/quickstart.md) ### Create an Aztec project @@ -103,7 +101,7 @@ Inside the Crowdfunding contract definition, use the dependency that defines the use dep::aztec::protocol_types::address::AztecAddress; ``` -The `aztec::protocol_types` can be browsed [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src). And like rust dependencies, the relative path inside the dependency corresponds to `address::AztecAddress`. +The `aztec::protocol_types` can be browsed [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src). And like rust dependencies, the relative path inside the dependency corresponds to `address::AztecAddress`. #### Storage @@ -111,7 +109,7 @@ To retain the initializer parameters in the contract's Storage, we'll need to de #include_code storage /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr rust -The `ValueNote` type is in the top-level of the Aztec.nr framework, namely [noir-projects/aztec-nr](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). Like before, you'll need to add the crate to Nargo.toml +The `ValueNote` type is in the top-level of the Aztec.nr framework, namely [noir-projects/aztec-nr (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). Like before, you'll need to add the crate to Nargo.toml --- @@ -175,10 +173,6 @@ token = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_ With the dependency already `use`d at the start of the contract, the token contract can be called to make the transfer from msg sender to this contract. -:::note -The user must have authorised this action, example use of `createAuthWit` in 'full donor flow' test [here](../../../../yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts). -::: - #### Creating and storing a private receipt note The last thing to do is create a new value note and add it to the `donation_receipts`. So the full donation function is now @@ -208,7 +202,7 @@ You should be able to compile successfully with `aztec-nargo compile`. For comparison, the full Crowdfunding contract can be found [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/crowdfunding_contract). If a new token wishes to honour donors with free tokens based on donation amounts, this is possible via the donation_receipts (a `PrivateSet`). -See [claim_contract](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/claim_contract). +See [claim_contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/claim_contract). ## Next steps @@ -218,9 +212,7 @@ Follow the account contract tutorial on the [next page](./write_accounts_contrac ### Optional: Learn more about concepts mentioned here - - [Initializer functions](../../guides/smart_contracts/writing_contracts/initializers.md) - - [Versions](https://docs.aztec.network/developers/versions-updating). - - [Private Global Variables](https://docs.aztec.network/developers/contracts/references/globals#private-global-variables) - - [Authorizing actions](../../aztec/concepts/accounts/index.md#authorizing-actions) - - [Unencrypted logs](https://docs.aztec.network/developers/contracts/writing_contracts/events/emit_event#unencrypted-events) - - [Common dependencies](https://docs.aztec.network/developers/contracts/resources/dependencies) + - [Initializer functions](../../../guides/developer_guides/smart_contracts/writing_contracts/initializers.md) + - [Versions](../../../guides/developer_guides/local_env/versions-updating.md). + - [Authorizing actions](../../../aztec/concepts/accounts/index.md#authorizing-actions) + - [Unencrypted logs](../../../guides/developer_guides/smart_contracts/writing_contracts/how_to_emit_event.md#call-emit_unencrypted_log) diff --git a/docs/docs/tutorials/contract_tutorials/private_voting_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/private_voting_contract.md similarity index 91% rename from docs/docs/tutorials/contract_tutorials/private_voting_contract.md rename to docs/docs/tutorials/codealong/contract_tutorials/private_voting_contract.md index 8eab842357a..e348f36350d 100644 --- a/docs/docs/tutorials/contract_tutorials/private_voting_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/private_voting_contract.md @@ -21,7 +21,7 @@ To keep things simple, we won't create ballots or allow for delegate voting. ## Prerequisites -- You have followed the [quickstart](../../getting_started.md) to install `aztec-nargo` and `aztec`. +- You have followed the [quickstart](../../../guides/developer_guides/getting_started/quickstart.md) to install `aztec-nargo` and `aztec`. - Running Aztec Sandbox ## Set up a project @@ -129,7 +129,7 @@ The first thing we do here is assert that the vote has not ended. The code after the assertion will only run if the assertion is true. In this snippet, we read the current vote tally at the `candidate`, add 1 to it, and write this new number to the `candidate`. The `Field` element allows us to use `+` to add to an integer. :::warning -Refer to [common patterns](../../guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md) for more information about key rotation and considerations. +Refer to [common patterns (Guides section)](../../../guides/developer_guides/smart_contracts/writing_contracts/common_patterns/key_rotation.md) for more information about key rotation and considerations. ::: ## Getting the number of votes @@ -176,7 +176,7 @@ Follow the crowdfunding contracts tutorial on the [next page](./crowdfunding_con ### Optional: Learn more about concepts mentioned here - - [Unconstrained functions](../../aztec/concepts/pxe/acir_simulator.md#unconstrained-functions). - - [Oracles](../../aztec/concepts/smart_contracts/oracles/index.md) - - [Nullifier secrets](../../aztec/concepts/accounts/keys.md#nullifier-secrets). - - [How to deploy a contract to the sandbox](../../guides/smart_contracts/how_to_deploy_contract.md) \ No newline at end of file + - [Unconstrained functions](../../../aztec/smart_contracts/functions/index.md). + - [Oracles](../../../aztec/smart_contracts/oracles/index.md) + - [Nullifier secrets](../../../aztec/concepts/accounts/keys.md#nullifier-secrets). + - [How to deploy a contract to the sandbox](../../../guides/developer_guides/smart_contracts/how_to_deploy_contract.md) diff --git a/docs/docs/tutorials/contract_tutorials/token_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/token_contract.md similarity index 90% rename from docs/docs/tutorials/contract_tutorials/token_contract.md rename to docs/docs/tutorials/codealong/contract_tutorials/token_contract.md index f3d58d4490f..05920373366 100644 --- a/docs/docs/tutorials/contract_tutorials/token_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/token_contract.md @@ -21,11 +21,7 @@ We are going to start with a blank project and fill in the token contract source ## Requirements -You will need to have `aztec-nargo` installed in order to compile Aztec.nr contracts. See the [sandbox reference](../../reference/sandbox_reference/index.md) for installation instructions. - -You should also install the [Noir Language Support extension](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir) for VS Code. - -Check the [Dev Tools section](https://github.com/noir-lang/awesome-noir#dev-tools) of the awesome-noir repo for language support for additional editors (Vim, emacs, tree-sitter, etc). +You will need to have `aztec-nargo` installed in order to compile Aztec.nr contracts. ## Project setup @@ -142,13 +138,13 @@ We are importing: ### Types files -We are also importing types from a `types.nr` file, which imports types from the `types` folder. You can view them [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src). +We are also importing types from a `types.nr` file, which imports types from the `types` folder. You can view them [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src). The main thing to note from this types folder is the `TransparentNote` definition. This defines how the contract moves value from the public domain into the private domain. It is similar to the `value_note` that we imported, but with some modifications namely, instead of a defined nullifier key, it allows anyone that can produce the pre-image to the stored `secret_hash` to spend the note. ### Note on private state -Private state in Aztec is all [UTXOs](../../aztec/concepts/storage/index.md). +Private state in Aztec is all [UTXOs](../../../aztec/concepts/storage/index.md). ## Contract Storage @@ -212,7 +208,7 @@ The function returns 1 to indicate successful execution. This public function allows an account approved in the public `minters` mapping to create new private tokens that can be claimed by anyone that has the pre-image to the `secret_hash`. -First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `PrivateSet` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution. +First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `PrivateSet` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution. #include_code mint_private /noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust @@ -265,7 +261,7 @@ Storage is referenced as `storage.variable`. This private function enables an account to move tokens from a `TransparentNote` in the `pending_shields` mapping to a `TokenNote` in private `balances`. The `TokenNote` will be associated with a nullifier key, so any account that knows this key can spend this note. -Going through the function logic, first the `secret_hash` is generated from the given secret. This ensures that only the entity possessing the secret can use it to redeem the note. Following this, a `TransparentNote` is retrieved from the set, using the provided amount and secret. The note is subsequently removed from the set, allowing it to be redeemed only once. The recipient's private balance is then increased using the `increment` helper function from the `value_note` [library](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/utils.nr). +Going through the function logic, first the `secret_hash` is generated from the given secret. This ensures that only the entity possessing the secret can use it to redeem the note. Following this, a `TransparentNote` is retrieved from the set, using the provided amount and secret. The note is subsequently removed from the set, allowing it to be redeemed only once. The recipient's private balance is then increased using the `increment` helper function from the `value_note` [library (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/utils.nr). The function returns `1` to indicate successful execution. @@ -355,13 +351,13 @@ Unconstrained functions are similar to `view` functions in Solidity in that they #### `balance_of_private` -A getter function for checking the private balance of the provided Aztec account. Note that the [Private Execution Environment (PXE)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/pxe) must have `ivsk` ([incoming viewing secret key](../../aztec/concepts/accounts/keys.md##incoming-viewing-keys)) in order to decrypt the notes. +A getter function for checking the private balance of the provided Aztec account. Note that the [Private Execution Environment (PXE) (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/pxe) must have `ivsk` ([incoming viewing secret key](../../../aztec/concepts/accounts/keys.md#incoming-viewing-keys)) in order to decrypt the notes. #include_code balance_of_private /noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust ## Compiling -Now that the contract is complete, you can compile it with `aztec-nargo`. See the [Sandbox reference page](../../reference/sandbox_reference/index.md) for instructions on setting it up. +Now that the contract is complete, you can compile it with `aztec-nargo`. See the [Sandbox reference page](../../../reference/developer_references/sandbox_reference/index.md) for instructions on setting it up. Run the following command in the directory where your `Nargo.toml` file is located: @@ -379,7 +375,7 @@ aztec codegen target -o src/artifacts ### Token Bridge Contract -The [token bridge tutorial](advanced/token_bridge/index.md) is a great follow up to this one. +The [token bridge tutorial](./advanced/token_bridge/index.md) is a great follow up to this one. It builds on the Token contract described here and goes into more detail about Aztec contract composability and Ethereum (L1) and Aztec (L2) cross-chain messaging. @@ -387,7 +383,7 @@ It builds on the Token contract described here and goes into more detail about A - Review [the end to end tests (Github link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/end-to-end/src/e2e_token_contract/) for reference. - [Commitments (Wikipedia link)](https://en.wikipedia.org/wiki/Commitment_scheme) -- [Nullifiers](../../aztec/concepts/storage/trees/index.md#nullifier-tree) -- [Contract Communication](../../aztec/concepts/smart_contracts/communication/index.md). -- [Contract Storage](../../aztec/concepts/storage/index.md) -- [Authwit](../../aztec/concepts/accounts/authwit.md) +- [Nullifiers](../../../aztec/concepts/storage/trees/index.md#nullifier-tree) +- [Contract Communication](../../../aztec/smart_contracts/communication/index.md). +- [Contract Storage](../../../aztec/concepts/storage/index.md) +- [Authwit](../../../aztec/concepts/accounts/authwit.md) diff --git a/docs/docs/tutorials/contract_tutorials/write_accounts_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md similarity index 88% rename from docs/docs/tutorials/contract_tutorials/write_accounts_contract.md rename to docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md index 82e32e53173..89e0d382293 100644 --- a/docs/docs/tutorials/contract_tutorials/write_accounts_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/write_accounts_contract.md @@ -17,13 +17,13 @@ You will learn: Writing your own account contract allows you to define the rules by which user transactions are authorized and paid for, as well as how user keys are managed (including key rotation and recovery). In other words, writing an account contract lets you make the most out of account abstraction in the Aztec network. -It is highly recommended that you understand how an [account](../../aztec/concepts/accounts/index.md) is defined in Aztec, as well as the differences between privacy and authentication [keys](../../aztec/concepts/accounts/keys.md). You will also need to know how to write a contract in Noir, as well as some basic [Typescript](https://www.typescriptlang.org/). +It is highly recommended that you understand how an [account](../../../aztec/concepts/accounts/index.md) is defined in Aztec, as well as the differences between privacy and authentication [keys](../../../aztec/concepts/accounts/keys.md). You will also need to know how to write a contract in Noir, as well as some basic [Typescript](https://www.typescriptlang.org/). For this tutorial, we will write an account contract that uses Schnorr signatures for authenticating transaction requests. Every time a transaction payload is passed to this account contract's `entrypoint` function, the account contract requires a valid Schnorr signature, whose signed message matches the transaction payload, and whose signer matches the account contract owner's public key. If the signature fails, the transaction will fail. -For the sake of simplicity, we will hardcode the signing public key into the contract, but you could store it [in a private note](../../aztec/concepts/accounts/keys.md#using-a-private-note), [in an immutable note](../../aztec/concepts/accounts/keys.md#using-an-immutable-private-note), or [on a separate keystore](../../aztec/concepts/accounts/keys.md#using-a-separate-keystore), to mention a few examples. +For the sake of simplicity, we will hardcode the signing public key into the contract, but you could store it [in a private note](../../../aztec/concepts/accounts/keys.md#using-a-private-note), [in an immutable note](../../../aztec/concepts/accounts/keys.md#using-an-immutable-private-note), or [on a separate keystore](../../../aztec/concepts/accounts/keys.md#using-a-separate-keystore), to mention a few examples. ## Contract @@ -51,7 +51,7 @@ For our account contract, we will take the hash of the action to authorize, requ ### Fee Abstraction -The `FeePayload`, being distinct from the `AppPayload`, allows for fee abstraction, meaning the account paying the fee for the transaction can be different than the account that is initiating the transaction. This is also useful for maintaining privacy, as fee payments on the network must be public. For example, Alice could pay a relayer transaction fees in private, and the relayer could pay the transaction fee in public. This also allows for accounts without a fee paying asset to use a non-fee paying asset to pay for fees, provided they can find a relayer willing to accept a non-fee paying asset as payment (or do it for free). +The `FeePayload`, being distinct from the `AppPayload`, allows for fee abstraction, meaning the account paying the fee for the transaction can be different than the account that is initiating the transaction. This is also useful for maintaining privacy, as fee payments on the network must be public. For example, Alice could pay a relayer transaction fees in private, and the relayer could pay the transaction fee in public. This also allows for accounts without Fee Juice to use another asset to pay for fees, provided they can find a relayer willing to accept the asset as payment (or do it for free). ### Nonce Abstraction @@ -85,7 +85,7 @@ More signing schemes are available in case you want to experiment with other typ Let's try creating a new account backed by our account contract, and interact with a simple token contract to test it works. -To create and deploy the account, we will use the `AccountManager` class, which takes an instance of an Private Execution Environment (PXE), a [privacy private key](../../aztec/concepts/accounts/keys.md#incoming-viewing-keys), and an instance of our `AccountContract` class: +To create and deploy the account, we will use the `AccountManager` class, which takes an instance of an Private Execution Environment (PXE), a [privacy private key](../../../aztec/concepts/accounts/keys.md#incoming-viewing-keys), and an instance of our `AccountContract` class: #include_code account-contract-deploy yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts typescript @@ -111,6 +111,6 @@ Follow the token contract tutorial on the [next page](./token_contract.md) and l - [ECDSA signer account contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr) - [Schnorr signer account contract (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/schnorr_account_contract) -- [Account abstraction](../../aztec/concepts/accounts/index.md#what-is-account-abstraction) -- [Authentication witness](../../aztec/concepts/accounts/authwit.md) -- [Fee abstraction](../../protocol-specs/gas-and-fees/tx-setup-and-teardown.md). \ No newline at end of file +- [Account abstraction](../../../aztec/concepts/accounts/index.md#what-is-account-abstraction) +- [Authentication witness](../../../aztec/concepts/accounts/authwit.md) +- [Fee abstraction](../../../protocol-specs/gas-and-fees/tx-setup-and-teardown.md). diff --git a/docs/docs/tutorials/simple_dapp/0_project_setup.md b/docs/docs/tutorials/codealong/simple_dapp/0_project_setup.md similarity index 100% rename from docs/docs/tutorials/simple_dapp/0_project_setup.md rename to docs/docs/tutorials/codealong/simple_dapp/0_project_setup.md diff --git a/docs/docs/tutorials/simple_dapp/1_pxe_service.md b/docs/docs/tutorials/codealong/simple_dapp/1_pxe_service.md similarity index 81% rename from docs/docs/tutorials/simple_dapp/1_pxe_service.md rename to docs/docs/tutorials/codealong/simple_dapp/1_pxe_service.md index 784beaa81e2..43a30472225 100644 --- a/docs/docs/tutorials/simple_dapp/1_pxe_service.md +++ b/docs/docs/tutorials/codealong/simple_dapp/1_pxe_service.md @@ -2,9 +2,9 @@ PXE is a component of the Aztec Protocol that provides a private execution environment for your application. -As an app developer, the [PXE](../../aztec/concepts/pxe/index.md) interface provides you with access to the user's accounts and their private state, as well as a connection to the network for accessing public global state. +As an app developer, the PXE interface provides you with access to the user's accounts and their private state, as well as a connection to the network for accessing public global state. -During the Sandbox phase, this role is fulfilled by the [Aztec Sandbox](../../reference/sandbox_reference/index.md), which runs a local PXE and an Aztec Node, both connected to a local Ethereum development node like Anvil. +During the Sandbox phase, this role is fulfilled by the [Aztec Sandbox](../../../reference/developer_references/sandbox_reference/index.md), which runs a local PXE and an Aztec Node, both connected to a local Ethereum development node like Anvil. The Sandbox also includes a set of pre-initialized accounts that you can use from your app. In this section, we'll connect to the Sandbox from our project. diff --git a/docs/docs/tutorials/simple_dapp/2_contract_deployment.md b/docs/docs/tutorials/codealong/simple_dapp/2_contract_deployment.md similarity index 87% rename from docs/docs/tutorials/simple_dapp/2_contract_deployment.md rename to docs/docs/tutorials/codealong/simple_dapp/2_contract_deployment.md index 34d56026835..4b7738a8ac6 100644 --- a/docs/docs/tutorials/simple_dapp/2_contract_deployment.md +++ b/docs/docs/tutorials/codealong/simple_dapp/2_contract_deployment.md @@ -3,7 +3,7 @@ To add contracts to your application, we'll start by creating a new `aztec-nargo` project. We'll then compile the contracts, and write a simple script to deploy them to our Sandbox. :::info -Follow the instructions [here](../../reference/sandbox_reference/index.md) to install `aztec-nargo` if you haven't done so already. +Follow the instructions [here](../../../reference/developer_references/sandbox_reference/index.md) to install `aztec-nargo` if you haven't done so already. ::: ## Initialize Aztec project @@ -30,7 +30,7 @@ Last, copy-paste the code from the `Token` contract into `contracts/token/main.n ### Helper files -The `Token` contract also requires some helper files. You can view the files [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src). Copy the `types.nr` and the `types` folder into `contracts/token/src`. +The `Token` contract also requires some helper files. You can view the files [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src). Copy the `types.nr` and the `types` folder into `contracts/token/src`. ## Compile your contract @@ -69,7 +69,7 @@ We import the contract artifacts we have generated plus the dependencies we'll n Note that the token's `_initialize()` method expects an `owner` address to mint an initial set of tokens to. We are using the first account from the Sandbox for this. :::info -If you are using the generated typescript classes, you can drop the generic `ContractDeployer` in favor of using the `deploy` method of the generated class, which will automatically load the artifact for you and type-check the constructor arguments. SEe the [How to deploy a contract](../../guides/smart_contracts/how_to_deploy_contract.md) page for more info. +If you are using the generated typescript classes, you can drop the generic `ContractDeployer` in favor of using the `deploy` method of the generated class, which will automatically load the artifact for you and type-check the constructor arguments. SEe the [How to deploy a contract](../../../guides/developer_guides/smart_contracts/how_to_deploy_contract.md) page for more info. ::: Run the snippet above as `node src/deploy.mjs`, and you should see the following output, along with a new `addresses.json` file in your project root: diff --git a/docs/docs/tutorials/simple_dapp/3_contract_interaction.md b/docs/docs/tutorials/codealong/simple_dapp/3_contract_interaction.md similarity index 91% rename from docs/docs/tutorials/simple_dapp/3_contract_interaction.md rename to docs/docs/tutorials/codealong/simple_dapp/3_contract_interaction.md index db1ce5b5964..af7efd5e2b9 100644 --- a/docs/docs/tutorials/simple_dapp/3_contract_interaction.md +++ b/docs/docs/tutorials/codealong/simple_dapp/3_contract_interaction.md @@ -11,7 +11,7 @@ Let's start by showing our user's private balance for the token across their acc #include_code balance_of_private noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust :::info -Note that this function will only return a valid response for accounts registered in the Private eXecution Environment (PXE), since it requires access to the [user's private state](../../aztec/concepts/wallets/index.md#private-state). In other words, you cannot query the private balance of another user for the token contract. +Note that this function will only return a valid response for accounts registered in the Private eXecution Environment (PXE), since it requires access to the [user's private state](../../../aztec/concepts/wallets/index.md#private-state). In other words, you cannot query the private balance of another user for the token contract. ::: To do this, let's first initialize a new `Contract` instance using `aztec.js` that represents our deployed token contracts. Create a new `src/contracts.mjs` file with the imports for our artifacts and other dependencies: @@ -95,12 +95,12 @@ At the time of this writing, there are no events emitted when new private notes ## Working with public state -While [private and public state](../../aztec/concepts/state_model/index.md) are fundamentally different, the API for working with private and public functions and state from `aztec.js` is equivalent. To query the balance in public tokens for our user accounts, we can just call the `balance_of_public` view function in the contract: +While [private and public state](../../../aztec/concepts/state_model/index.md) are fundamentally different, the API for working with private and public functions and state from `aztec.js` is equivalent. To query the balance in public tokens for our user accounts, we can just call the `balance_of_public` view function in the contract: #include_code showPublicBalances yarn-project/end-to-end/src/sample-dapp/index.mjs javascript :::info -Since this we are working with pubic balances, we can now query the balance for any address, not just those registered in our local PXE. We can also send funds to addresses for which we don't know their [public encryption key](../../aztec/concepts/accounts/keys.md#encryption-keys). +Since this we are working with pubic balances, we can now query the balance for any address, not just those registered in our local PXE. We can also send funds to addresses for which we don't know their [public encryption key](../../../aztec/concepts/accounts/keys.md#encryption-keys). ::: Here, since the token contract does not mint any initial funds upon deployment, the balances for all of our user's accounts will be zero. diff --git a/docs/docs/tutorials/simple_dapp/4_testing.md b/docs/docs/tutorials/codealong/simple_dapp/4_testing.md similarity index 90% rename from docs/docs/tutorials/simple_dapp/4_testing.md rename to docs/docs/tutorials/codealong/simple_dapp/4_testing.md index 4261eb8a75b..e6f89bbf86e 100644 --- a/docs/docs/tutorials/simple_dapp/4_testing.md +++ b/docs/docs/tutorials/codealong/simple_dapp/4_testing.md @@ -14,7 +14,7 @@ Start by installing our test runner, in this case jest: yarn add -D jest ``` -We'll need to [install and run the Sandbox](../../reference/sandbox_reference/index.md#installation). +We'll need to [install and run the Sandbox](../../../reference/developer_references/sandbox_reference/sandbox-reference.md). ## Test setup @@ -67,4 +67,4 @@ yarn node --experimental-vm-modules $(yarn bin jest) --testRegex '.*\.test\.mjs$ ## Next steps -Now that you have finished the tutorial, you can learn more about [writing contracts with Noir](../../aztec/concepts/smart_contracts/index.md) or read about the [fundamental concepts behind Aztec Network](../../aztec/core_components.md). +Now that you have finished the tutorial, you can learn more about [writing contracts with Noir](../../../aztec/smart_contracts_overview.md) or read about the [fundamental concepts behind Aztec Network](../../../aztec/overview.md). diff --git a/docs/docs/tutorials/simple_dapp/index.md b/docs/docs/tutorials/codealong/simple_dapp/index.md similarity index 89% rename from docs/docs/tutorials/simple_dapp/index.md rename to docs/docs/tutorials/codealong/simple_dapp/index.md index 82f4b18a583..3300cca55a6 100644 --- a/docs/docs/tutorials/simple_dapp/index.md +++ b/docs/docs/tutorials/codealong/simple_dapp/index.md @@ -4,7 +4,7 @@ title: Dapp Tutorial In this tutorial we'll go through the steps for building a simple application that interacts with the Aztec Sandbox. We'll be building a console application using Javascript and NodeJS, but you may reuse the same concepts here for a web-based app. All Aztec libraries are written in Typescript and fully typed, so you can use Typescript instead of Javascript to make the most out of its type checker. -This tutorial will focus on environment setup, including creating accounts and deployments, as well as interacting with your contracts. It will not cover [how to write contracts in Noir](../../aztec/concepts/smart_contracts/index.md). +This tutorial will focus on environment setup, including creating accounts and deployments, as well as interacting with your contracts. It will not cover [how to write contracts in Noir](../../../aztec/smart_contracts_overview.md). The full code for this tutorial is [available on the `aztec-packages` repository](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/end-to-end/src/sample-dapp). @@ -12,7 +12,7 @@ The full code for this tutorial is [available on the `aztec-packages` repository - Linux or OSX environment - [NodeJS](https://nodejs.org/) 18 or higher -- [Aztec Sandbox](../../getting_started.md) +- [Aztec Sandbox](../../../guides/developer_guides/getting_started/quickstart.md) ## Prerequisites diff --git a/docs/docs/reference/smart_contract_reference/examples/_category_.json b/docs/docs/tutorials/examples/_category_.json similarity index 100% rename from docs/docs/reference/smart_contract_reference/examples/_category_.json rename to docs/docs/tutorials/examples/_category_.json diff --git a/docs/docs/reference/smart_contract_reference/examples/uniswap/_category_.json b/docs/docs/tutorials/examples/uniswap/_category_.json similarity index 100% rename from docs/docs/reference/smart_contract_reference/examples/uniswap/_category_.json rename to docs/docs/tutorials/examples/uniswap/_category_.json diff --git a/docs/docs/reference/smart_contract_reference/examples/uniswap/e2e_tests.md b/docs/docs/tutorials/examples/uniswap/e2e_tests.md similarity index 100% rename from docs/docs/reference/smart_contract_reference/examples/uniswap/e2e_tests.md rename to docs/docs/tutorials/examples/uniswap/e2e_tests.md diff --git a/docs/docs/reference/smart_contract_reference/examples/uniswap/index.md b/docs/docs/tutorials/examples/uniswap/index.md similarity index 88% rename from docs/docs/reference/smart_contract_reference/examples/uniswap/index.md rename to docs/docs/tutorials/examples/uniswap/index.md index 91dd4fe0194..c4fc55b539f 100644 --- a/docs/docs/reference/smart_contract_reference/examples/uniswap/index.md +++ b/docs/docs/tutorials/examples/uniswap/index.md @@ -15,7 +15,7 @@ The flow will be: 2. We create an L2 → L1 message to swap on L1 3. On L1, the user gets their input tokens, consumes the swap message, and executes the swap 4. The user deposits the “output” tokens to the output token portal so it can be deposited into L2 -5. We will assume that token portals and token bridges for the input and output tokens must exist. These are what we built in the [token bridge tutorial](../../../../tutorials/contract_tutorials/advanced/token_bridge/0_setup.md). +5. We will assume that token portals and token bridges for the input and output tokens must exist. These are what we built in the [token bridge tutorial](../../codealong/contract_tutorials/advanced/token_bridge/index.md). The execution of swap on L1 should be designed such that any 3rd party can execute the swap on behalf of the user. This helps maintain user privacy by not requiring links between L1 and L2 activity. @@ -27,5 +27,5 @@ This reference will cover: This diagram describes the private flow. -This code works alongside a token portal that you can learn to build [in this tutorial](../../../../tutorials/contract_tutorials/advanced/token_bridge/0_setup.md). +This code works alongside a token portal that you can learn to build [in this codealong tutorial](../../codealong/contract_tutorials/advanced/token_bridge/index.md). diff --git a/docs/docs/reference/smart_contract_reference/examples/uniswap/l1_contract.md b/docs/docs/tutorials/examples/uniswap/l1_contract.md similarity index 90% rename from docs/docs/reference/smart_contract_reference/examples/uniswap/l1_contract.md rename to docs/docs/tutorials/examples/uniswap/l1_contract.md index cbb164b26f6..6eb246a7c18 100644 --- a/docs/docs/reference/smart_contract_reference/examples/uniswap/l1_contract.md +++ b/docs/docs/tutorials/examples/uniswap/l1_contract.md @@ -3,7 +3,7 @@ title: L1 contracts (EVM) sidebar_position: 2 --- -This page goes over the code in the L1 contract for Uniswap, which works alongside a [token portal](../../../../tutorials/contract_tutorials/advanced/token_bridge/index.md). +This page goes over the code in the L1 contract for Uniswap, which works alongside a [token portal (codealong tutorial)](../../codealong/contract_tutorials/advanced/token_bridge/index.md). ## Setup @@ -26,7 +26,7 @@ This page goes over the code in the L1 contract for Uniswap, which works alongsi To incentivize the sequencer to pick up this message, we pass a fee to the deposit message. -You can find the corresponding function on the [L2 contracts page](l2_contract.md#public-swap). +You can find the corresponding function on the [L2 contracts page](./l2_contract.md#public-swap). ## Private swap @@ -34,4 +34,4 @@ This works very similarly to the public flow. #include_code solidity_uniswap_swap_private l1-contracts/test/portals/UniswapPortal.sol solidity -You can find the corresponding function on the [L2 contracts page](l2_contract.md#private-swap). +You can find the corresponding function on the [L2 contracts page](./l2_contract.md#private-swap). diff --git a/docs/docs/reference/smart_contract_reference/examples/uniswap/l2_contract.md b/docs/docs/tutorials/examples/uniswap/l2_contract.md similarity index 88% rename from docs/docs/reference/smart_contract_reference/examples/uniswap/l2_contract.md rename to docs/docs/tutorials/examples/uniswap/l2_contract.md index 3ead8d76254..da656ec2b2c 100644 --- a/docs/docs/reference/smart_contract_reference/examples/uniswap/l2_contract.md +++ b/docs/docs/tutorials/examples/uniswap/l2_contract.md @@ -3,7 +3,7 @@ title: L2 Contracts (Aztec) sidebar_position: 1 --- -This page goes over the code in the L2 contract for Uniswap, which works alongside a [token bridge](../../../../tutorials/contract_tutorials/advanced/token_bridge/0_setup.md). +This page goes over the code in the L2 contract for Uniswap, which works alongside a [token bridge (codealong tutorial)](../../codealong/contract_tutorials/advanced/token_bridge/index.md). ## Main.nr @@ -17,11 +17,11 @@ We just need to store the portal address for the token that we want to swap. #include_code swap_public noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr rust -1. We check that `msg.sender()` has appropriate approval to call this on behalf of the sender by constructing an authwit message and checking if `from` has given the approval (read more about authwit [here](../../../../aztec/concepts/accounts/authwit.md)). +1. We check that `msg.sender()` has appropriate approval to call this on behalf of the sender by constructing an authwit message and checking if `from` has given the approval (read more about authwit [here](../../../aztec/concepts/accounts/authwit.md)). 2. We fetch the underlying aztec token that needs to be swapped. 3. We transfer the user’s funds to the Uniswap contract. Like with Ethereum, the user must have provided approval to the Uniswap contract to do so. The user must provide the nonce they used in the approval for transfer, so that Uniswap can send it to the token contract, to prove it has appropriate approval. 4. Funds are added to the Uniswap contract. -5. Uniswap must exit the input tokens to L1. For this it has to approve the bridge to burn its tokens on its behalf and then actually exit the funds. We call the [`exit_to_l1_public()` method on the token bridge](../../../../tutorials/contract_tutorials/advanced/token_bridge/index.md). We use the public flow for exiting since we are operating on public state. +5. Uniswap must exit the input tokens to L1. For this it has to approve the bridge to burn its tokens on its behalf and then actually exit the funds. We call the [`exit_to_l1_public()` method on the token bridge](../../codealong/contract_tutorials/advanced/token_bridge/index.md). We use the public flow for exiting since we are operating on public state. 6. It is not enough for us to simply emit a message to withdraw the funds. We also need to emit a message to display our swap intention. If we do not do this, there is nothing stopping a third party from calling the Uniswap portal with their own parameters and consuming our message. So the Uniswap portal (on L1) needs to know: @@ -36,7 +36,7 @@ The Uniswap portal must first withdraw the input tokens, then check that the swa - The address on L2 which must receive the output tokens (remember this is public flow) - The secret hash for consume the L1 to L2 message. Since this is the public flow the preimage doesn’t need to be a secret. -You can find the corresponding function on the [L1 contracts page](l1_contract.md). +You can find the corresponding function on the [L1 contracts page](./l1_contract.md). ### Private swap @@ -84,6 +84,6 @@ So you emitted a message to withdraw input tokens to L1 and a message to swap. T You still need to "claim" these swapped funds on L2. -In the public flow, you can call [`claim_public()`](../../../../tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md) on the output token bridge which consumes the deposit message and mints your assets. +In the public flow, you can call [`claim_public()`](../../codealong/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md) on the output token bridge which consumes the deposit message and mints your assets. -In the private flow, you can choose to leak your secret for L1 → L2 message consumption to let someone mint the notes on L2 (by calling [`claim_private()`](../../../../tutorials/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md) on the output token bridge) and then you can later redeem these notes to yourself by presenting the preimage to `secret_hash_for_redeeming_minted_notes` and calling the `redeem_shield()` method on the token contract. \ No newline at end of file +In the private flow, you can choose to leak your secret for L1 → L2 message consumption to let someone mint the notes on L2 (by calling [`claim_private()`](../../codealong/contract_tutorials/advanced/token_bridge/2_minting_on_aztec.md) on the output token bridge) and then you can later redeem these notes to yourself by presenting the preimage to `secret_hash_for_redeeming_minted_notes` and calling the `redeem_shield()` method on the token contract. diff --git a/docs/docs/tutorials/index.md b/docs/docs/tutorials/index.md new file mode 100644 index 00000000000..541dcee83eb --- /dev/null +++ b/docs/docs/tutorials/index.md @@ -0,0 +1,112 @@ +--- +id: index +sidebar_position: 0 +title: Tutorials and Examples +--- + +# Code-Along Tutorials and Examples + +In this section, you will find two things: code-along tutorials and code examples of Aztec applications. + +Tutorials will teach you how to build a full application or smart contract locally. Examples are not intended for you to replicate locally as they have more complex setups, but can be useful for exploring what you can do with Aztec. + +This page includes the most popular tutorials in order of increasing complexity. Explore the sidebar for more! + +## Code-Along Tutorials + +### Beginner: Write your first smart contract + +
+ + +

Simple counter contract

+
+ + Follow this tutorial to build, compile and deploy your first Aztec smart contract - a simple private counter + +
+
+ + +### Intermediate: Write increasingly more complex contracts + +It is recommended to follow these in order. + +
+ + +

Simple private voting contract

+
+ + Build a contract with hybrid state and calling public functions from private + +
+ + + +

Crowdfunding contract

+
+ + A more complex contract that interacts with other contracts + +
+ + + +

Token contract with hybrid state

+
+ + A very complex contract for a token that can move across public & private state and be transferred to others + +
+ + + +

Accounts contract

+
+ + A simple accounts contract that will teach you about account abstraction in Aztec + +
+
+ + + +## Examples + +
+ + +

Interacting with L1 Uniswap from L2 Aztec

+
+ + An example app inspired by Aztec Connect that allows users to swap publicly & privately on L1 Uniswap from Aztec + +
+ + + + + + +

Card game contract ↗️

+
+ + A set of contracts that allow players to take turns playing cards + +
+
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index be1b316d126..f46a98abadf 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -131,7 +131,7 @@ const config = { entryPoints: ["../yarn-project/circuit-types/src/interfaces/pxe.ts"], tsconfig: "../yarn-project/circuit-types/tsconfig.json", entryPointStrategy: "expand", - out: "reference/aztecjs/pxe", + out: "reference/developer_references/aztecjs/pxe", readme: "none", sidebar: { categoryLabel: "Private Execution Environment (PXE)", @@ -149,7 +149,7 @@ const config = { ], tsconfig: "../yarn-project/aztec.js/tsconfig.json", entryPointStrategy: "resolve", - out: "reference/aztecjs/aztec-js", + out: "reference/developer_references/aztecjs/aztec-js", readme: "none", sidebar: { categoryLabel: "Aztec.js", @@ -170,7 +170,7 @@ const config = { ], tsconfig: "../yarn-project/accounts/tsconfig.json", entryPointStrategy: "resolve", - out: "reference/aztecjs/accounts", + out: "reference/developer_references/aztecjs/accounts", readme: "none", sidebar: { categoryLabel: "Accounts", @@ -219,15 +219,111 @@ const config = { items: [ { type: "doc", - docId: "index", + docId: "aztec/overview", position: "left", - label: "Aztec Protocol", + label: "Concepts", }, { type: "docSidebar", - sidebarId: "protocolSpecSidebar", + sidebarId: "guidesSidebar", position: "left", - label: "Protocol Specification", + label: "Guides", + }, + { + type: "docSidebar", + sidebarId: "tutorialsSidebar", + position: "left", + label: "Examples", + }, + { + type: "docSidebar", + sidebarId: "referenceSidebar", + position: "left", + label: "References", + }, + { + type: "dropdown", + label: "Resources", + position: "left", + items: [ + { + type: "html", + value: 'GitHub', + className: "dropdown-subtitle", + }, + { + to: "https://github.com/AztecProtocol/aztec-packages", + label: "Aztec Monorepo", + target: "_blank", + rel: "noopener noreferrer", + className: "github-item", + }, + { + to: "https://github.com/AztecProtocol/aztec-nr", + label: "Aztec.nr", + target: "_blank", + rel: "noopener noreferrer", + className: "github-item", + }, + { + to: "https://github.com/AztecProtocol/awesome-aztec", + label: "Awesome Aztec", + target: "_blank", + rel: "noopener noreferrer", + className: "github-item", + }, + { + type: "html", + value: 'Other Docs', + className: "dropdown-subtitle", + }, + { + to: "/migration_notes", + label: "Migration Notes", + className: "no-external-icon", + }, + { + to: "/aztec_connect_sunset", + label: "Aztec Connect Sunset", + className: "no-external-icon", + }, + { + type: "docSidebar", + sidebarId: "protocolSpecSidebar", + target: "_blank", + label: "Protocol Specification", + }, + { + type: "docSidebar", + sidebarId: "roadmapSidebar", + target: "_blank", + label: "Roadmap", + }, + { + to: "https://noir-lang.org/docs", + label: "Noir docs", + target: "_blank", + rel: "noopener noreferrer", + }, + { + type: "html", + value: 'Support', + className: "dropdown-subtitle", + }, + { + to: "https://airtable.com/appMhZd7lsZS3v27R/pagxWYAHYYrnrrXmm/form", + label: "Join community", + target: "_blank", + rel: "noopener noreferrer", + }, + { + to: "https://twitter.com/aztecprotocol", + label: "X/Twitter", + target: "_blank", + rel: "noopener noreferrer", + className: "twitter-item", + }, + ], }, ], }, @@ -243,7 +339,7 @@ const config = { }, { label: "Developer Quickstart", - to: "/getting_started", + to: "/guides/developer_guides/getting_started/quickstart", }, { label: "Aztec.nr", @@ -263,7 +359,7 @@ const config = { href: "https://discord.gg/DgWG2DBMyB", }, { - label: "Twitter", + label: "X/Twitter", href: "https://twitter.com/aztecnetwork", }, { @@ -293,8 +389,9 @@ const config = { copyright: `Copyright © ${new Date().getFullYear()} Aztec, built with Docusaurus, powered by Netlify.`, }, prism: { - theme: lightTheme, - darkTheme: darkTheme, + theme: themes.nightOwlLight, + darkTheme: themes.shadesOfPurple, + // darkTheme: themes.dracula, // https://prismjs.com/#supported-languages // Commented-out languages exists in `node_modules/prismjs/components/` so I'm not sure why they don't work. additionalLanguages: [ @@ -306,7 +403,6 @@ const config = { // "typescript", "json", // "bash", - // "solidity", "toml", "markdown", "docker", diff --git a/docs/netlify.toml b/docs/netlify.toml index 60322008128..d1aef404fb3 100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@ -1,18 +1,18 @@ [[redirects]] from = "/developers/tutorials/*" - to = "/tutorials/contract_tutorials/private_voting_contract" + to = "/tutorials/codealong/contract_tutorials/private_voting_contract" [[redirects]] from = "/developers/sandbox/*" - to = "/reference/sandbox_reference" + to = "/reference/developer_references/sandbox_reference" [[redirects]] from = "/developers/contracts/*" - to = "/reference/smart_contract_reference" + to = "/reference/developer_references/smart_contract_reference" [[redirects]] from = "/dev_docs/*" - to = "/getting_started" + to = "/guides/developer_guides/getting_started/quickstart" [[redirects]] from = "/aztec/cryptography/cryptography-roadmap" @@ -56,4 +56,8 @@ [[redirects]] from = "/compliance" - to = "/" \ No newline at end of file + to = "/" + +[[redirects]] + from = "/protocol-specs/gas-and-fees/fee-payment-asset" + to = "/protocol-specs/gas-and-fees/fee-juice" diff --git a/docs/scripts/clean.sh b/docs/scripts/clean.sh index da22dfd276e..8d27b2091b4 100755 --- a/docs/scripts/clean.sh +++ b/docs/scripts/clean.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash rm -rf 'processed-docs' 'processed-docs-cache' -rm -rf docs/reference/aztecjs 'docs/reference/smart_contract_reference/aztec-nr' +rm -rf 'docs/reference/developer_references/aztecjs' 'docs/reference/developer_references/smart_contract_reference/aztec-nr' docusaurus clear diff --git a/docs/scripts/move_processed.sh b/docs/scripts/move_processed.sh index 8a29b13a16e..b841f2e5eb1 100755 --- a/docs/scripts/move_processed.sh +++ b/docs/scripts/move_processed.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -echo "label: \"AztecJS\"" > ./docs/reference/aztecjs/_category_.yml -mv ./docs/reference/aztecjs ./processed-docs/reference/aztecjs -mv ./docs/reference/smart_contract_reference/aztec-nr ./processed-docs/reference/smart_contract_reference/aztec-nr +echo "label: \"AztecJS\"" > ./docs/reference/developer_references/aztecjs/_category_.yml +mv ./docs/reference/developer_references/aztecjs ./processed-docs/reference/developer_references/aztecjs +mv ./docs/reference/developer_references/smart_contract_reference/aztec-nr ./processed-docs/reference/developer_references/smart_contract_reference/aztec-nr diff --git a/docs/sidebars.js b/docs/sidebars.js index 0093b1ab1b0..b6b2d2537c0 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -6,49 +6,154 @@ const path = require("path"); /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ export default { sidebar: [ + + { + type: "html", + value: 'Aztec Protocol', + className: "sidebar-title", + }, + { + type: "doc", + id: "aztec/overview", + label: "What is Aztec?", + }, { type: "category", - label: "Aztec", - link: { type: "doc", id: "aztec" }, - items: [{ type: "autogenerated", dirName: "aztec" }], + label: "Concepts", + items: [{ type: "autogenerated", dirName: "aztec/concepts" }], + }, + { + type: "html", + value: 'Network', + className: "sidebar-title", + }, + { + type: "doc", + id: "aztec/network_overview", + label: "Network Overview", + }, + { + type: "category", + label: "Network Infrastructure", + items: [{ type: "autogenerated", dirName: "aztec/network" }], + }, + { + type: "html", + value: 'Smart Contracts', + className: "sidebar-title", + }, + { + type: "doc", + id: "aztec/smart_contracts_overview", + label: "What are Smart Contracts?", + }, + { + type: "category", + label: "Technical Details", + items: [{ type: "autogenerated", dirName: "aztec/smart_contracts" }], + }, + { + type: "html", + value: '', }, { type: "doc", id: "vision", }, + { + type: "doc", + label: "Building in Public", + id: "aztec" + }, + + ], + + guidesSidebar: [ + { + type: "doc", + label: "Popular Guides", + id: "guides/index" + }, + { + type: "html", + value: 'Developer Guides', + className: "sidebar-title", + }, + { + type: "autogenerated", + dirName: "guides/developer_guides" + }, { type: "html", value: '', }, { - type: "category", - label: "Getting Started", - link: { type: "doc", id: "getting_started" }, - items: [{ type: "autogenerated", dirName: "getting_started" }], + type: "doc", + label: "Privacy Considerations", + id: "guides/privacy_considerations" }, + ], + tutorialsSidebar: [ { - type: "category", - label: "Tutorials", - items: [{ type: "autogenerated", dirName: "tutorials" }], + type: "doc", + label: "Tutorials and Examples", + id: "tutorials/index" }, { - type: "category", - label: "Guides", - items: [{ type: "autogenerated", dirName: "guides" }], + type: "html", + value: 'Code-along Tutorials', + className: "sidebar-title", }, { - type: "category", - label: "Reference", - items: [{ type: "autogenerated", dirName: "reference" }], + type: "autogenerated", + dirName: "tutorials/codealong" + }, + { + type: "html", + value: 'Examples', + className: "sidebar-title", + }, + { + type: "autogenerated", + dirName: "tutorials/examples" + }, + ], + + referenceSidebar: [ + { + type: "doc", + label: "References", + id: "reference/index" + }, + { + type: "html", + value: 'Developer References', + className: "sidebar-title", + }, + { + type: "autogenerated", + dirName: "reference/developer_references" + }, + { + type: "doc", + id: "migration_notes", }, { type: "html", value: '', }, - { type: "doc", id: "migration_notes" }, - { type: "doc", id: "aztec_connect_sunset" }, + { + type: "doc", + id: "aztec_connect_sunset", + }, ], + roadmapSidebar: [ + { + type: "autogenerated", + dirName: "aztec/roadmap" + }, + ], protocolSpecSidebar: [ "protocol-specs/intro", { @@ -199,7 +304,7 @@ export default { type: "category", link: { type: "doc", id: "protocol-specs/gas-and-fees/index" }, items: [ - "protocol-specs/gas-and-fees/fee-payment-asset", + "protocol-specs/gas-and-fees/fee-juice", "protocol-specs/gas-and-fees/specifying-gas-fee-info", "protocol-specs/gas-and-fees/tx-setup-and-teardown", "protocol-specs/gas-and-fees/kernel-tracking", diff --git a/docs/src/components/Disclaimers/_wip_disclaimer.mdx b/docs/src/components/Disclaimers/_wip_disclaimer.mdx index 597f226dc5f..61f31593ea5 100644 --- a/docs/src/components/Disclaimers/_wip_disclaimer.mdx +++ b/docs/src/components/Disclaimers/_wip_disclaimer.mdx @@ -5,7 +5,7 @@ :::caution Disclaimer We are building Aztec as transparently as we can. The documents published here are living documents. The protocol, sandbox, language, and tools are all subject to change over time. -Please see [here](/aztec/limitations) for details of known Aztec protocol and Aztec Sandbox limitations. +Please see [here](/reference/developer_references/limitations) for details of known Aztec protocol and Aztec Sandbox limitations. If you would like to help us build Aztec: diff --git a/docs/src/components/TutorialCard/CardBody/index.js b/docs/src/components/TutorialCard/CardBody/index.js new file mode 100644 index 00000000000..e2ea76c5eef --- /dev/null +++ b/docs/src/components/TutorialCard/CardBody/index.js @@ -0,0 +1,19 @@ +import React from 'react'; +import clsx from 'clsx'; + +const CardBody = ({ + className, + style, + children, +}) => { + return ( +
+ {children} +
+ ); +} + +export default CardBody; \ No newline at end of file diff --git a/docs/src/components/TutorialCard/CardFooter/index.js b/docs/src/components/TutorialCard/CardFooter/index.js new file mode 100644 index 00000000000..2828f610962 --- /dev/null +++ b/docs/src/components/TutorialCard/CardFooter/index.js @@ -0,0 +1,44 @@ +import React, { CSSProperties } from 'react'; +import clsx from 'clsx'; +const CardFooter = ({ + className, + style, + children, + textAlign, + variant, + italic = false , + noDecoration = false, + transform, + breakWord = false, + truncate = false, + weight, +}) => { + const text = textAlign ? `text--${textAlign}` :''; + const textColor = variant ? `text--${variant}` : ''; + const textItalic = italic ? 'text--italic' : ''; + const textDecoration = noDecoration ? 'text-no-decoration' : ''; + const textType = transform ? `text--${transform}` : ''; + const textBreak = breakWord ? 'text--break' : ''; + const textTruncate = truncate ? 'text--truncate' : ''; + const textWeight = weight ? `text--${weight}` : ''; + return ( +
+ {children} +
+ ); +} +export default CardFooter; \ No newline at end of file diff --git a/docs/src/components/TutorialCard/CardHeader/index.js b/docs/src/components/TutorialCard/CardHeader/index.js new file mode 100644 index 00000000000..e8a81543e0e --- /dev/null +++ b/docs/src/components/TutorialCard/CardHeader/index.js @@ -0,0 +1,44 @@ +import React, { CSSProperties } from 'react'; // CSSProperties allows inline styling with better type checking. +import clsx from 'clsx'; // clsx helps manage conditional className names in a clean and concise manner. +const CardHeader = ({ + className, // classNamees for the container card + style, // Custom styles for the container card + children, // Content to be included within the card + textAlign, + variant, + italic = false , + noDecoration = false, + transform, + breakWord = false, + truncate = false, + weight, +}) => { + const text = textAlign ? `text--${textAlign}` :''; + const textColor = variant ? `text--${variant}` : ''; + const textItalic = italic ? 'text--italic' : ''; + const textDecoration = noDecoration ? 'text-no-decoration' : ''; + const textType = transform ? `text--${transform}` : ''; + const textBreak = breakWord ? 'text--break' : ''; + const textTruncate = truncate ? 'text--truncate' : ''; + const textWeight = weight ? `text--${weight}` : ''; + return ( +
+ {children} +
+ ); +} +export default CardHeader; \ No newline at end of file diff --git a/docs/src/components/TutorialCard/CardImage/index.js b/docs/src/components/TutorialCard/CardImage/index.js new file mode 100644 index 00000000000..731fc074d70 --- /dev/null +++ b/docs/src/components/TutorialCard/CardImage/index.js @@ -0,0 +1,20 @@ +import React, { CSSProperties } from 'react'; +import clsx from 'clsx'; +import useBaseUrl from '@docusaurus/useBaseUrl'; // Import the useBaseUrl function from Docusaurus +const CardImage = ({ + className, + style, + cardImageUrl, + alt, + title, +}) => { + const generatedCardImageUrl = useBaseUrl(cardImageUrl); + return ( + {alt} + ) +} +export default CardImage; \ No newline at end of file diff --git a/docs/src/components/TutorialCard/index.js b/docs/src/components/TutorialCard/index.js new file mode 100644 index 00000000000..6fc607772c4 --- /dev/null +++ b/docs/src/components/TutorialCard/index.js @@ -0,0 +1,35 @@ +import React from 'react'; +import clsx from 'clsx'; +import Link from '@docusaurus/Link'; + +const Card = ({ + className, + style, + children, + shadow, + link, +}) => { + const cardShadow = shadow ? `item shadow--${shadow}` : ''; + + const cardContent = ( +
+ {children} +
+ ); + + if (link) { + return ( + + {cardContent} + + ); + } + + return cardContent; +}; + +export default Card; \ No newline at end of file diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index 9b8e22def40..07c07791dfa 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -7,23 +7,99 @@ /* You can override the default Infima variables here. */ :root { --ifm-font-family-base: "Plain-Regular"; + --ifm-color-primary: #8C7EFF; + --ifm-color-primary-dark: #6e5bff; + --ifm-color-primary-darker: #5f4aff; + --ifm-color-primary-darkest: #3216ff; + --ifm-color-primary-light: #aaa1ff; + --ifm-color-primary-lighter: #b9b2ff; + --ifm-color-primary-lightest: #e6e3ff; + --ifm-code-font-size: 95%; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); + --ifm-link-color: #8C7EFF; + --ifm-menu-color-active: #8C7EFF; + --ifm-navbar-link-hover-color: #8C7EFF; } +[data-theme="light"] .alert--danger { + --ifm-alert-background-color: #ffd1cb; + --ifm-alert-background-color-highlight: #ffbab1; + --ifm-alert-foreground-color: rgb(66,69,73); + --ifm-alert-border-color: #ff7764; +} + +[data-theme="dark"] .alert--danger { + --ifm-alert-background-color: #962a1c; + --ifm-alert-background-color-highlight: #cf5545; + --ifm-alert-foreground-color: white; + --ifm-alert-border-color: #cf5545; +} + +[data-theme="light"] .alert--warning { + --ifm-alert-background-color: #ffe2b1; + --ifm-alert-background-color-highlight: #ffd998; + --ifm-alert-foreground-color: rgb(66,69,73); + --ifm-alert-border-color: #ffc564; +} + +[data-theme="dark"] .alert--warning { + --ifm-alert-background-color: #5b4b2f; + --ifm-alert-background-color-highlight: #8a6a32; + --ifm-alert-foreground-color: white; + --ifm-alert-border-color: #8a6a32; +} + +[data-theme="light"] .alert--info { + --ifm-alert-background-color: #d8e0fd; + --ifm-alert-background-color-highlight: #c0cdfc; + --ifm-alert-foreground-color: rgb(66,69,73); + --ifm-alert-border-color: #466CF7; +} + +[data-theme="dark"] .alert--info { + --ifm-alert-background-color: #2d2a55; + --ifm-alert-background-color-highlight: #514b99; + --ifm-alert-foreground-color: white; + --ifm-alert-border-color: #514b99 +} + +[data-theme="light"] .alert--secondary { + --ifm-alert-background-color: #d8e0fd; + --ifm-alert-background-color-highlight: #c0cdfc; + --ifm-alert-foreground-color: rgb(66,69,73); + --ifm-alert-border-color: #466CF7; +} + +[data-theme="dark"] .alert--secondary { + --ifm-alert-background-color: #2d2a55; + --ifm-alert-background-color-highlight: #514b99; + --ifm-alert-foreground-color: white; + --ifm-alert-border-color: #514b99; +} + +[data-theme="light"] .alert--success { + --ifm-alert-background-color: #ccf0e3; + --ifm-alert-background-color-highlight: #b8ead8; + --ifm-alert-foreground-color: rgb(66,69,73); + --ifm-alert-border-color: #31A67B; +} + +[data-theme="dark"] .alert--success { + --ifm-alert-background-color: #34584a; + --ifm-alert-background-color-highlight: #69b799; + --ifm-alert-foreground-color:white; + --ifm-alert-border-color: #69b799; +} + + [data-theme="light"] { - --ifm-color-primary: #9f3fff; - --ifm-color-primary-dark: #8f1fff; - --ifm-color-primary-darker: #870fff; - --ifm-color-primary-darkest: #6f00df; - --ifm-color-primary-light: #af5fff; - --ifm-color-primary-lighter: #b76fff; - --ifm-color-primary-lightest: #cf9eff; - --ifm-breadcrumb-item-background-active: #e9ddf7; + --ifm-background-color: #ffffff; + --ifm-navbar-background-color: #ffffff; + --ifm-footer-background-color: #ffffff; --ifm-menu-color: #2f1f49; - /* --ifm-menu-color-background-active: #e9ddf7; */ - background: #f6fbfc; + --ifm-breadcrumb-item-background-active: #EEEDF1; color: #2f1f49; } -/* For readability concerns, you should choose a lighter palette in dark mode. */ [data-theme="dark"] { --ifm-color-primary: #9ba5e9; --ifm-color-primary-dark: #7b88e2; @@ -52,16 +128,20 @@ } [data-theme="light"] .navbar { - background-color: #f6fbfc; + background-color: #fcfbfc; } [data-theme="light"] .footer { - --ifm-footer-background-color: #f6fbfc; + --ifm-footer-background-color: #fcfbfc; --ifm-footer-color: #2f1f49; --ifm-footer-link-color: #2f1f49; --ifm-footer-title-color: #2f1f49; } +[data-theme="dark"] .card { + background-color: #321E4C; +} + [data-theme="light"] { /* --docusaurus-highlighted-code-line-bg: rgb(72, 77, 91); */ --docusaurus-highlighted-code-line-bg: rgba(230, 211, 238, 0.75); @@ -74,6 +154,40 @@ --docusaurus-highlighted-code-line-bg: rgb(72, 77, 91); } +[data-theme="light"] h1, [data-theme="light"] h2 { + color: #321E4C; +} + +[data-theme="light"] h3, [data-theme="light"] h4, [data-theme="light"] h5, [data-theme="light"] h6 { + color: #514167 +} + +ul li::marker { + color: #8C7EFF; +} + +a { + color: #8C7EFF; +} + +/* Style for tip admonitions */ +.admonition-tip { + background-color: rgba(49, 166, 123, 0.1); + border-left-color: #31A67B; +} + +.admonition-tip .admonition-icon svg { + fill: #31A67B; +} + +.admonition-warning, .admonition-danger { + background-color: rgba(255, 119, 100, 0.1); + border-left-color: #FF7764; +} + +.admonition-warning .admonition-icon svg, .admonition-danger .admonition-icon svg { + fill: #FF7764; +} .code-block-error-line { background-color: #f0000038; display: block; @@ -140,3 +254,154 @@ html[data-theme="dark"] .sidebar-divider { display: flex; justify-content: center; } + +.navbar .dropdown__link { + display: flex; + align-items: center; +} + +.navbar .dropdown__link::after { + content: '\2197'; + margin-left: 5px; +} + +.header-github-link:hover { + opacity: 0.6; +} + +.header-github-link::before { + content: ''; + width: 24px; + height: 24px; + display: flex; + background: url('../../static/img/logos/github_light_mode.svg') no-repeat; +} + +[data-theme='dark'] .header-github-link::before { + background: url('../../static/img/logos/github_dark_mode.svg') no-repeat; +} + +.dropdown-subtitle { + display: block; + padding: 0.5rem 1rem; + font-weight: bold; + color: var(--ifm-color-primary); + font-size: 0.9rem; +} + +.github-item { + display: flex; + align-items: center; +} + +.github-item::before { + content: ''; + width: 16px; + height: 16px; + margin-right: 0.5rem; + background: url('../../static/img/logos/github_light_mode.svg') + no-repeat; +} + +.twitter-item { + display: flex; + align-items: center; +} + +.twitter-item::before { + content: ''; + width: 16px; + height: 16px; + margin-right: 0.5rem; + background: url('../../static/img/logos/x.svg') + no-repeat; +} + +.navbar__item.dropdown .dropdown__menu { + padding: 0.5rem 0; + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); + border-radius: 0.375rem; + min-width: 200px; +} + +.navbar__item.dropdown .dropdown__link { + padding: 0.5rem 1.5rem; +} + +.dropdown-subtitle { + display: block; + padding: 0.5rem 1.5rem; + font-weight: bold; + color: var(--ifm-color-primary); + font-size: 0.9rem; +} + +.twitter-item { + display: flex; + align-items: center; +} + +.navbar .dropdown__link::after { + content: '\2197'; + margin-left: 5px; +} + +.navbar .dropdown__link.no-external-icon::after { + content: none; +} + +.navbar__item.dropdown .dropdown__link:hover { + background-color: var(--ifm-color-emphasis-200); +} + +.sidebar-title { + padding: 0.2rem 0.2rem; + margin-top: 0.2rem; +} + +.card-container { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 1rem; + margin-bottom: 1rem; +} + +.card-container.full-width { + grid-template-columns: 1fr; +} + +@media (min-width: 769px) { + .card-container:not(.full-width) { + grid-template-columns: repeat(2, 1fr); + } +} + +.card-link-wrapper { + display: contents; +} + +.card { + display: flex; + flex-direction: column; + height: 100%; + transition: all 0.3s ease; +} + +.card:hover { + transform: scale(1.02); +} + +.card__body { + flex: 1; +} + +.view-all-link { + text-align: right; + margin-bottom: 2rem; +} + +.view-all-link a { + font-size: 0.9rem; + color: var(--ifm-color-primary); + text-decoration: none; +} \ No newline at end of file diff --git a/docs/src/preprocess/generate_aztecnr_reference.js b/docs/src/preprocess/generate_aztecnr_reference.js index b0902590663..7d0a3396a42 100644 --- a/docs/src/preprocess/generate_aztecnr_reference.js +++ b/docs/src/preprocess/generate_aztecnr_reference.js @@ -323,7 +323,7 @@ function processFiles(baseDir, outputBaseDir) { let baseDir = path.resolve(__dirname, "../../../noir-projects/aztec-nr"); let outputBaseDir = path.resolve( __dirname, - "../../docs/reference/smart_contract_reference/aztec-nr" + "../../docs/reference/developer_references/smart_contract_reference/aztec-nr" ); console.log(outputBaseDir); processFiles(baseDir, outputBaseDir); diff --git a/docs/src/theme/MDXComponents.js b/docs/src/theme/MDXComponents.js index 28e247751f4..3397b1d0a67 100644 --- a/docs/src/theme/MDXComponents.js +++ b/docs/src/theme/MDXComponents.js @@ -2,6 +2,11 @@ import React from "react"; import MDXComponents from "@theme-original/MDXComponents"; import Version, { AztecPackagesVersion } from "@site/src/components/Version"; import CodeBlock from "@theme/CodeBlock"; +import Card from '@site/src/components/TutorialCard'; +import CardBody from '@site/src/components/TutorialCard/CardBody'; +import CardFooter from '@site/src/components/TutorialCard/CardFooter'; +import CardHeader from '@site/src/components/TutorialCard/CardHeader'; +import CardImage from '@site/src/components/TutorialCard/CardImage'; // https://docusaurus.io/docs/markdown-features/react#mdx-component-scope export default { @@ -9,4 +14,11 @@ export default { Version, AztecPackagesVersion, CodeBlock, + Card, + CardHeader, + CardBody, + CardFooter, + CardImage, }; + + diff --git a/docs/static/img/logos/github_dark_mode.svg b/docs/static/img/logos/github_dark_mode.svg new file mode 100644 index 00000000000..09f6f4e86a3 --- /dev/null +++ b/docs/static/img/logos/github_dark_mode.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/docs/static/img/logos/github_light_mode.svg b/docs/static/img/logos/github_light_mode.svg new file mode 100644 index 00000000000..d2219c5a8bb --- /dev/null +++ b/docs/static/img/logos/github_light_mode.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/docs/static/img/logos/x.svg b/docs/static/img/logos/x.svg new file mode 100644 index 00000000000..9a3386346c3 --- /dev/null +++ b/docs/static/img/logos/x.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/grafana_dashboards/aztec/aztec-dashboard-all-in-one.json b/grafana_dashboards/aztec/aztec-dashboard-all-in-one.json index cc8b3a93826..81395d023e0 100644 --- a/grafana_dashboards/aztec/aztec-dashboard-all-in-one.json +++ b/grafana_dashboards/aztec/aztec-dashboard-all-in-one.json @@ -11,12 +11,6 @@ "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, "type": "dashboard" } ] @@ -24,9 +18,8 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 2, + "id": 4, "links": [], - "liveNow": false, "panels": [ { "collapsed": false, @@ -36,9 +29,9 @@ "x": 0, "y": 0 }, - "id": 1, + "id": 2, "panels": [], - "title": "Node", + "title": "Node system resources", "type": "row" }, { @@ -46,14 +39,46 @@ "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "Percentage of total CPU bused", "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } }, - "fieldMinMax": false, "mappings": [], + "max": 1, + "min": 0, "thresholds": { "mode": "absolute", "steps": [ @@ -72,128 +97,50 @@ "overrides": [] }, "gridPos": { - "h": 8, - "w": 6, + "h": 10, + "w": 12, "x": 0, "y": 1 }, - "id": 4, + "id": 1, "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "pluginVersion": "11.1.1", "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "code", - "expr": "sum by(exported_job) (system_cpu_utilization{system_cpu_state=\"user\", exported_job=\"$node\"}) / count by(exported_job) (system_cpu_utilization{system_cpu_state=\"user\", exported_job=\"$node\"})", + "expr": "1 - avg by(exported_job, exported_instance) (system_cpu_utilization{system_cpu_state=\"idle\", exported_instance=~\"$instance\"})", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "__auto", + "legendFormat": "{{exported_job}}-{{exported_instance}}", "range": true, "refId": "A", "useBackend": false } ], "title": "CPU utilization", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "description": "Percentage of total system memory being used", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 6, - "y": 1 - }, - "id": 8, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.1.1", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "system_memory_utilization{exported_job=\"$node\", system_memory_state=\"used\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Memory utilization", - "type": "stat" + "type": "timeseries" }, { "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -232,6 +179,8 @@ } }, "mappings": [], + "max": 1, + "min": 0, "thresholds": { "mode": "absolute", "steps": [ @@ -245,17 +194,17 @@ } ] }, - "unit": "bytes" + "unit": "percentunit" }, "overrides": [] }, "gridPos": { - "h": 8, + "h": 10, "w": 12, "x": 12, "y": 1 }, - "id": 10, + "id": 3, "options": { "legend": { "calcs": [], @@ -272,35 +221,46 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "increase(system_network_io_total{exported_job=\"$node\"}[$__rate_interval])", + "expr": "avg by(exported_job, exported_instance) (system_memory_utilization{exported_instance=~\"$instance\", system_memory_state=\"used\"})", "fullMetaSearch": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "{{exported_job}} - {{network_io_direction}}", + "legendFormat": "{{exported_job}}-{{exported_instance}}", "range": true, "refId": "A", "useBackend": false } ], - "title": "Network IO", + "title": "Memory utilization", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 4, + "panels": [], + "title": "L2 network status", + "type": "row" + }, { "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, - "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -313,62 +273,23 @@ }, "unit": "none" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "false" - }, - "properties": [ - { - "id": "displayName", - "value": "Rejected" - }, - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "true" - }, - "properties": [ - { - "id": "displayName", - "value": "Accepted" - }, - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 8, - "w": 6, + "w": 5, "x": 0, - "y": 9 + "y": 12 }, - "id": 14, + "id": 5, "options": { "colorMode": "value", - "graphMode": "area", - "justifyMode": "center", + "graphMode": "none", + "justifyMode": "auto", "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["sum"], + "calcs": ["lastNotNull"], "fields": "", "values": false }, @@ -381,21 +302,21 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(aztec_node_receive_tx_count{exported_job=\"$node\"}[$__rate_interval])", + "expr": "max(aztec_archiver_block_height{exported_instance=~\"$instance\"})", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "{{aztec_ok}}", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false } ], - "title": "Transactions", + "title": "Last block number", "type": "stat" }, { @@ -408,9 +329,12 @@ "color": { "mode": "thresholds" }, + "decimals": 0, + "fieldMinMax": false, "mappings": [], + "min": 0, "thresholds": { - "mode": "percentage", + "mode": "absolute", "steps": [ { "color": "green", @@ -425,14 +349,14 @@ "gridPos": { "h": 8, "w": 6, - "x": 6, - "y": 9 + "x": 5, + "y": 12 }, - "id": 120, + "id": 7, "options": { "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", + "graphMode": "none", + "justifyMode": "center", "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { @@ -449,21 +373,38 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "aztec_mempool_tx_count{exported_job=\"$node\"}", + "expr": "last_over_time(aztec_archiver_block_size{exported_instance=~\"$instance\"}[$__interval])", "fullMetaSearch": false, - "includeNullMetadata": true, + "includeNullMetadata": false, "instant": false, - "legendFormat": "__auto", + "legendFormat": "Last block size", "range": true, "refId": "A", "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguyxik" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "avg (aztec_archiver_block_size)", + "fullMetaSearch": false, + "hide": true, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "B", + "useBackend": false } ], - "title": "Tx in mempool", + "title": "Block size", "type": "stat" }, { @@ -499,7 +440,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -528,11 +469,11 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 9 + "w": 13, + "x": 11, + "y": 12 }, - "id": 15, + "id": 23, "options": { "legend": { "calcs": [], @@ -549,156 +490,24 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(aztec_node_receive_tx_duration_milliseconds_sum{exported_job=\"$node\"}[$__rate_interval]) / on(aztec_ok) rate(aztec_node_receive_tx_duration_milliseconds_count{exported_job=\"$node\"}[$__rate_interval])", + "editorMode": "code", + "expr": "avg (rate(aztec_archiver_sync_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$interval]) / rate(aztec_archiver_sync_duration_milliseconds_count{exported_instance=~\"$instance\"}[$interval])) by (exported_job, exported_instance)", "fullMetaSearch": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "AVG", + "legendFormat": "AVG - {{exported_job}}-{{exported_instance}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_node_receive_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "95th Perc", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_node_receive_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "50th Perc", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(1, sum by(le) (rate(aztec_node_receive_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "MAX", - "range": true, - "refId": "D", - "useBackend": false } ], - "title": "Tx process time", + "timeShift": "6h", + "title": "Block synch", "type": "timeseries" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 17 - }, - "id": 2, - "panels": [], - "title": "Sequencer", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "description": "Total blocks produced and accepted by the rollup", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 5, - "x": 0, - "y": 18 - }, - "id": 17, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.1.1", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "aztec_sequencer_block_build_ok_count{exported_job=\"$node\", aztec_ok=\"true\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Blocks produced", - "type": "stat" - }, { "datasource": { "type": "prometheus", @@ -732,7 +541,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -754,18 +563,30 @@ "value": 80 } ] - }, - "unit": "ms" + } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "true" + }, + "properties": [ + { + "id": "displayName", + "value": "Accepted" + } + ] + } + ] }, "gridPos": { "h": 8, "w": 7, - "x": 5, - "y": 18 + "x": 0, + "y": 20 }, - "id": 16, + "id": 21, "options": { "legend": { "calcs": [], @@ -782,21 +603,21 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_sequencer_block_build_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "editorMode": "code", + "expr": "increase(aztec_node_receive_tx_count{exported_instance=~\"$instance\"}[$__rate_interval])", "fullMetaSearch": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "95th perc", + "legendFormat": "{{aztec_ok}}", "range": true, "refId": "A", "useBackend": false } ], - "title": "Block building duration", + "title": "Incoming transactions", "type": "timeseries" }, { @@ -804,119 +625,77 @@ "type": "prometheus", "uid": "-qqguYXIk" }, + "description": "", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 30, - "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "decimals": 0, "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, "unit": "none" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 6, - "x": 12, - "y": 18 + "w": 5, + "x": 7, + "y": 20 }, - "id": 99, + "id": 6, "options": { + "displayLabels": ["name", "value"], "legend": { - "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, + "pieType": "pie", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, + "pluginVersion": "11.1.3", "targets": [ { "datasource": { "type": "prometheus", - "uid": "aztec-node-metrics" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "exemplar": false, - "expr": "increase(aztec_l1_publisher_tx_count{aztec_ok=\"true\"}[$__rate_interval])", + "expr": "avg by(aztec_status) (aztec_mempool_tx_count{exported_instance=~\"$instance\"})", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "L1 Tx \"{{aztec_l1_tx_type}}\"", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "aztec-node-metrics" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(increase(aztec_l1_publisher_tx_count{aztec_ok=\"false\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Failed L1 txs", - "range": true, - "refId": "B", - "useBackend": false } ], - "title": "L1 transactions", - "type": "timeseries" + "title": "Mempool status", + "type": "piechart" }, { - "datasource": {}, + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "description": "", "fieldConfig": { "defaults": { "color": { @@ -945,7 +724,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -955,8 +734,6 @@ } }, "mappings": [], - "min": 0, - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ @@ -970,17 +747,18 @@ } ] }, - "unit": "none" + "unit": "ms" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 6, - "x": 18, - "y": 18 + "w": 7, + "x": 12, + "y": 20 }, - "id": 98, + "id": 22, + "interval": "5m", "options": { "legend": { "calcs": [], @@ -997,17 +775,21 @@ { "datasource": { "type": "prometheus", - "uid": "aztec-node-metrics" + "uid": "-qqguyxik" }, - "editorMode": "builder", - "expr": "rate(aztec_l1_publisher_gas_price_gwei_sum[$__rate_interval]) / rate(aztec_l1_publisher_gas_price_gwei_count[$__rate_interval])", + "disableTextWrap": false, + "editorMode": "code", + "expr": "avg (rate(aztec_node_receive_tx_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$__rate_interval]) / rate(aztec_node_receive_tx_duration_milliseconds_count{exported_instance=~\"$instance\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": false, "instant": false, - "legendFormat": "Avg gas price gwei", + "legendFormat": "AVG", "range": true, - "refId": "A" + "refId": "A", + "useBackend": false } ], - "title": "Average gas cost gwei", + "title": "Tx receive time", "type": "timeseries" }, { @@ -1018,39 +800,7 @@ "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "mode": "thresholds" }, "mappings": [], "thresholds": { @@ -1062,143 +812,360 @@ } ] }, - "unit": "ms" + "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 8, - "x": 0, - "y": 26 + "w": 5, + "x": 19, + "y": 20 }, - "id": 96, + "id": 8, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, + "pluginVersion": "11.1.1", "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_public_executor_simulation_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "editorMode": "code", + "expr": "avg(rate(aztec_mempool_tx_size_bytes_sum{exported_instance=~\"$instance\"}[$interval]) / rate(aztec_mempool_tx_size_bytes_count{exported_instance=~\"$instance\"}[$interval]))", "fullMetaSearch": false, + "hide": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "95th Perc", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false + } + ], + "title": "Tx size", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 9, + "panels": [], + "title": "Sequencer", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "0": { + "index": 0, + "text": "Idle" + }, + "1": { + "index": 1, + "text": "Waiting for txs" + }, + "2": { + "index": 2, + "text": "Creating block" + }, + "3": { + "index": 3, + "text": "Publishing contract data" + }, + "4": { + "index": 4, + "text": "Publishing block" + }, + "5": { + "index": 5, + "text": "Stopped" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 29 + }, + "id": 12, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.1.1", + "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "histogram_quantile(1, sum by(le) (rate(aztec_public_executor_simulation_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "exemplar": false, + "expr": "aztec_sequencer_current_state{exported_instance=~\"$instance\"}", + "format": "time_series", "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "MAX", - "range": true, - "refId": "B", + "includeNullMetadata": true, + "instant": true, + "legendFormat": "__auto", + "range": false, + "refId": "A", "useBackend": false + } + ], + "title": "Sequencer state", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 9, + "x": 7, + "y": 29 + }, + "id": 13, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.1", + "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_public_executor_simulation_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "exemplar": false, + "expr": "aztec_sequencer_current_block_number{exported_instance=~\"$instance\"}", "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "50th Perc", - "range": true, - "refId": "C", + "includeNullMetadata": true, + "instant": true, + "legendFormat": "Next block number", + "range": false, + "refId": "A", "useBackend": false }, { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "code", - "expr": "rate(aztec_public_executor_simulation_duration_milliseconds_sum{exported_job=\"$node\"}[$__rate_interval])/rate(aztec_public_executor_simulation_duration_milliseconds_count{exported_job=\"$node\"}[$__rate_interval])", + "editorMode": "builder", + "exemplar": false, + "expr": "aztec_sequencer_current_block_size{exported_instance=~\"$instance\"}", "fullMetaSearch": false, "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "AVG", - "range": true, - "refId": "D", + "includeNullMetadata": true, + "instant": true, + "legendFormat": "Next block size", + "range": false, + "refId": "B", "useBackend": false } ], - "title": "Public function simuation", - "type": "timeseries" + "title": "Next block", + "type": "stat" }, { "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 16, + "y": 29 + }, + "hideTimeOverride": true, + "id": 26, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "/^Time$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "changes(aztec_sequencer_current_block_number{exported_instance=~\"$instance\"}[1h])", + "format": "time_series", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "", + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "timeFrom": "6h", + "title": "Next block started at", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "equal", + "options": { + "value": 0 + } + }, + "fieldName": "{exported_instance=\"22828b91-92ae-4b04-a5e0-56ebf866edef\", exported_job=\"alphanet-aztec-node-1\", instance=\"aztec-otel.local:8889\", job=\"aztec\"}" + } + ], + "match": "any", + "type": "exclude" + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, "mappings": [], "thresholds": { @@ -1207,109 +1174,63 @@ { "color": "green", "value": null + }, + { + "color": "red", + "value": 80 } ] }, - "unit": "ms" + "unit": "bytes" }, "overrides": [] }, "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 26 + "h": 6, + "w": 4, + "x": 20, + "y": 29 }, - "id": 58, + "id": 25, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, + "pluginVersion": "11.1.1", "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_public_processor_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "95th Perc", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_public_processor_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "50th Perc", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_public_processor_tx_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "MAX", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "code", - "expr": "rate(aztec_public_processor_tx_duration_milliseconds_sum{exported_job=\"$node\"}[$__rate_interval]) / rate(aztec_public_processor_tx_duration_milliseconds_count{exported_job=\"$node\"}[$__rate_interval])", + "expr": "avg(rate(aztec_public_processor_deploy_bytecode_size_bytes_sum{exported_instance=~\"$instance\"}[$interval]) / rate(aztec_public_processor_deploy_bytecode_size_bytes_count{exported_instance=~\"$instance\"}[$interval]))", "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, "legendFormat": "AVG", "range": true, - "refId": "E", + "refId": "A", "useBackend": false } ], - "title": "Public processor duration", - "type": "timeseries" + "title": "Deployed bytecode", + "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, + "datasource": {}, "fieldConfig": { "defaults": { "color": { @@ -1323,7 +1244,7 @@ "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", - "fillOpacity": 0, + "fillOpacity": 25, "gradientMode": "none", "hideFrom": { "legend": false, @@ -1338,16 +1259,17 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", - "mode": "none" + "mode": "normal" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], + "min": 0, "thresholds": { "mode": "absolute", "steps": [ @@ -1361,17 +1283,17 @@ } ] }, - "unit": "ms" + "unit": "none" }, "overrides": [] }, "gridPos": { "h": 8, "w": 8, - "x": 16, - "y": 26 + "x": 0, + "y": 35 }, - "id": 57, + "id": 14, "options": { "legend": { "calcs": [], @@ -1388,21 +1310,21 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "code", - "expr": "rate(aztec_public_processor_phase_duration_milliseconds_sum[$__rate_interval]) / rate(aztec_public_processor_phase_duration_milliseconds_count[$__rate_interval])", + "editorMode": "builder", + "expr": "increase(aztec_l1_publisher_tx_count{exported_instance=~\"$instance\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "Avg {{aztec_tx_phase_name}}", + "legendFormat": "{{aztec_l1_tx_type}}", "range": true, "refId": "A", "useBackend": false } ], - "title": "Tx phase duration", + "title": "L1 transactions", "type": "timeseries" }, { @@ -1410,7 +1332,6 @@ "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -1439,7 +1360,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -1462,17 +1383,17 @@ } ] }, - "unit": "bytes" + "unit": "ms" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 12, - "x": 0, - "y": 34 + "w": 13, + "x": 8, + "y": 35 }, - "id": 56, + "id": 11, "options": { "legend": { "calcs": [], @@ -1489,21 +1410,58 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "code", - "expr": "rate(aztec_public_executor_simulation_bytecode_size_bytes_sum[$__rate_interval]) / rate(aztec_public_executor_simulation_bytecode_size_bytes_count[$__rate_interval])", + "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_sequencer_block_build_duration_milliseconds_bucket{exported_instance=~\"$instance\"}[$interval])))", "fullMetaSearch": false, + "hide": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "Avg bytes", + "interval": "", + "legendFormat": "Median", "range": true, "refId": "A", "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguyxik" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_sequencer_block_build_duration_milliseconds_bucket{exported_instance=~\"$instance\"}[$interval])))", + "fullMetaSearch": false, + "hide": true, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "95th percentile", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguyxik" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "histogram_quantile(1, sum by(le) (rate(aztec_sequencer_block_build_duration_milliseconds_bucket{exported_instance=~\"$instance\"}[$interval])))", + "fullMetaSearch": false, + "hide": true, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "MAX", + "range": true, + "refId": "C", + "useBackend": false } ], - "title": "Deployed bytecode ", + "timeShift": "6h", + "title": "Block building duration", "type": "timeseries" }, { @@ -1539,7 +1497,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -1553,8 +1511,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, @@ -1564,11 +1521,11 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 34 + "w": 10, + "x": 0, + "y": 43 }, - "id": 97, + "id": 24, "options": { "legend": { "calcs": [], @@ -1585,16 +1542,16 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "editorMode": "code", + "expr": "avg(rate(aztec_public_processor_tx_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$__rate_interval]) / rate(aztec_public_processor_tx_duration_milliseconds_count{exported_instance=~\"$instance\"}[$__rate_interval]))", "fullMetaSearch": false, - "hide": true, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "95th Perc", + "interval": "5m", + "legendFormat": "AVG - tx", "range": true, "refId": "A", "useBackend": false @@ -1602,16 +1559,17 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(1, sum by(le) (rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", + "editorMode": "code", + "expr": "avg by (aztec_tx_phase_name) (rate(aztec_public_processor_phase_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$__rate_interval]) / rate(aztec_public_processor_phase_duration_milliseconds_count{exported_instance=~\"$instance\"}[$__rate_interval]))", "fullMetaSearch": false, - "hide": true, - "includeNullMetadata": false, + "hide": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "MAX", + "interval": "5m", + "legendFormat": "AVG - {{aztec_tx_phase_name}}", "range": true, "refId": "B", "useBackend": false @@ -1619,39 +1577,23 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_bucket{exported_job=\"$node\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": true, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "50th Perc", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_sum{exported_job=\"$node\"}[$__rate_interval]) / rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_count{exported_job=\"$node\"}[$__rate_interval])", + "editorMode": "code", + "expr": "avg(rate(aztec_public_executor_simulation_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$__rate_interval]) / rate(aztec_public_executor_simulation_duration_milliseconds_count{exported_instance=~\"$instance\"}[$__rate_interval]))", "fullMetaSearch": false, "hide": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "AVG", + "interval": "5m", + "legendFormat": "AVG - fn", "range": true, - "refId": "D", + "refId": "C", "useBackend": false } ], - "title": "Merkle tree insertions before Base Rollup", + "title": "Tx simulation", "type": "timeseries" }, { @@ -1660,11 +1602,11 @@ "h": 1, "w": 24, "x": 0, - "y": 42 + "y": 51 }, - "id": 3, + "id": 16, "panels": [], - "title": "Prover Agent", + "title": "Prover", "type": "row" }, { @@ -1672,19 +1614,49 @@ "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "CPU usage as a percentage of all cores", "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1692,60 +1664,56 @@ } ] }, - "unit": "percentunit" + "unit": "none" }, "overrides": [] }, "gridPos": { - "h": 8, - "w": 6, + "h": 9, + "w": 9, "x": 0, - "y": 43 + "y": 52 }, - "id": 6, + "id": 19, "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } }, "pluginVersion": "11.1.1", "targets": [ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "sum by(exported_job) (system_cpu_utilization{system_cpu_state=\"user\", exported_job=\"$prover\"}) / count by(exported_job) (system_cpu_utilization{system_cpu_state=\"user\", exported_job=\"$prover\"})", + "expr": "aztec_proving_queue_size{exported_instance=~\"$instance\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "__auto", + "legendFormat": "{{__name__}}", "range": true, "refId": "A", "useBackend": false } ], - "title": "CPU utilization", - "type": "stat" + "title": "Queue depth", + "type": "timeseries" }, { "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "Percentage of total system memory being used", "fieldConfig": { "defaults": { "color": { @@ -1756,29 +1724,24 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 + "color": "green" } ] }, - "unit": "percentunit" + "unit": "bytes" }, "overrides": [] }, "gridPos": { - "h": 8, - "w": 6, - "x": 6, - "y": 43 + "h": 9, + "w": 15, + "x": 9, + "y": 52 }, - "id": 11, + "id": 20, "options": { "colorMode": "value", - "graphMode": "area", + "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "percentChangeColorMode": "standard", @@ -1796,21 +1759,22 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "system_memory_utilization{exported_job=\"$prover\", system_memory_state=\"used\"}", + "editorMode": "code", + "expr": "avg by (aztec_proving_job_type) (rate(aztec_proving_queue_job_size_by_sum{exported_instance=~\"$instance\"}[$interval]) / rate(aztec_proving_queue_job_size_by_count{exported_instance=~\"$instance\"}[$interval]))", "fullMetaSearch": false, - "includeNullMetadata": true, + "hide": false, + "includeNullMetadata": false, "instant": false, - "legendFormat": "__auto", + "legendFormat": "{{aztec_proving_job_type}}", "range": true, "refId": "A", "useBackend": false } ], - "title": "Memory utilization", + "title": "Job size", "type": "stat" }, { @@ -1818,7 +1782,6 @@ "type": "prometheus", "uid": "-qqguYXIk" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -1832,7 +1795,7 @@ "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", - "fillOpacity": 10, + "fillOpacity": 0, "gradientMode": "none", "hideFrom": { "legend": false, @@ -1861,8 +1824,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1870,17 +1832,17 @@ } ] }, - "unit": "bytes" + "unit": "ms" }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 43 + "x": 0, + "y": 61 }, - "id": 13, + "id": 15, "options": { "legend": { "calcs": [], @@ -1897,21 +1859,21 @@ { "datasource": { "type": "prometheus", - "uid": "-qqguYXIk" + "uid": "-qqguyxik" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "increase(system_network_io_total{exported_job=\"$prover\"}[$__rate_interval])", + "expr": "rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_sum{exported_instance=~\"$instance\"}[$interval]) / rate(aztec_proving_orchestrator_base_rollup_inputs_duration_milliseconds_count{exported_instance=~\"$instance\"}[$interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "{{exported_job}} - {{network_io_direction}}", + "legendFormat": "AVG", "range": true, "refId": "A", "useBackend": false } ], - "title": "Network IO", + "title": "Tree updates", "type": "timeseries" }, { @@ -1920,13 +1882,128 @@ "h": 1, "w": 24, "x": 0, - "y": 51 + "y": 69 }, - "id": 22, + "id": 17, "panels": [], - "title": "Witness generation", + "repeat": "protocol_circuit", + "repeatDirection": "h", + "title": "Circuits stats - $protocol_circuit", "type": "row" }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + }, + "unit": "bytes" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "aztec_circuit_public_inputs_count" + }, + "properties": [ + { + "id": "unit", + "value": "none" + }, + { + "id": "displayName", + "value": "Public inputs counts" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "aztec_circuit_proving_proof_size_bytes" + }, + "properties": [ + { + "id": "displayName", + "value": "Proof size" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 70 + }, + "id": 47, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "aztec_circuit_proving_proof_size_bytes{exported_instance=~\"$instance\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "-qqguYXIk" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "aztec_circuit_public_inputs_count{exported_instance=~\"$instance\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Stats - $protocol_circuit", + "type": "stat" + }, { "datasource": { "type": "prometheus", @@ -1970,13 +2047,15 @@ } }, "mappings": [], - "min": 0, "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" + }, + { + "color": "red", + "value": 80 } ] }, @@ -1985,13 +2064,12 @@ "overrides": [] }, "gridPos": { - "h": 8, + "h": 7, "w": 8, - "x": 0, - "y": 52 + "x": 6, + "y": 70 }, - "id": 23, - "maxPerRow": 3, + "id": 27, "options": { "legend": { "calcs": [], @@ -2004,8 +2082,6 @@ "sort": "none" } }, - "repeat": "protocol_circuit", - "repeatDirection": "h", "targets": [ { "datasource": { @@ -2014,66 +2090,21 @@ }, "disableTextWrap": false, "editorMode": "code", - "expr": "rate(aztec_circuit_witness_generation_duration_milliseconds_sum{exported_job=\"$prover\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}[$__rate_interval]) / rate(aztec_circuit_witness_generation_duration_milliseconds_count{exported_job=\"$prover\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Avg", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.95, sum by(le) (rate(aztec_circuit_witness_generation_duration_milliseconds_bucket{exported_job=\"$prover\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}[$__rate_interval])))", + "expr": "avg(rate(aztec_circuit_witness_generation_duration_milliseconds_sum{aztec_circuit_protocol_circuit_name=\"$protocol_circuit\", exported_instance=~\"$instance\"}[$interval])/rate(aztec_circuit_witness_generation_duration_milliseconds_count{aztec_circuit_protocol_circuit_name=\"$protocol_circuit\", exported_instance=~\"$instance\"}[$interval]))", "fullMetaSearch": false, "hide": false, - "includeNullMetadata": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "95th Perc", + "interval": "", + "legendFormat": "AVG", "range": true, "refId": "B", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "histogram_quantile(0.5, sum by(le) (rate(aztec_circuit_witness_generation_duration_milliseconds_bucket{exported_job=\"$prover\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}[$__rate_interval])))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "50th Perc", - "range": true, - "refId": "C", - "useBackend": false } ], "title": "Witness generation - $protocol_circuit", "type": "timeseries" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 84 - }, - "id": 30, - "panels": [], - "title": "Proving", - "type": "row" - }, { "datasource": { "type": "prometheus", @@ -2117,13 +2148,15 @@ } }, "mappings": [], - "min": 0, "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" + }, + { + "color": "red", + "value": 80 } ] }, @@ -2132,13 +2165,12 @@ "overrides": [] }, "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 85 + "h": 7, + "w": 10, + "x": 14, + "y": 70 }, - "id": 37, - "maxPerRow": 3, + "id": 46, "options": { "legend": { "calcs": [], @@ -2151,8 +2183,6 @@ "sort": "none" } }, - "repeat": "protocol_circuit", - "repeatDirection": "h", "targets": [ { "datasource": { @@ -2160,18 +2190,20 @@ "uid": "-qqguYXIk" }, "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(aztec_circuit_proving_duration_milliseconds_sum{exported_job=\"$prover\", aztec_circuit_protocol_circuit_name=\"$protocol_circuit\"}[$__rate_interval]) / rate(aztec_circuit_proving_duration_milliseconds_count{exported_job=\"$prover\"}[$__rate_interval])", + "editorMode": "code", + "expr": "avg(rate(aztec_circuit_proving_duration_milliseconds_sum{aztec_circuit_protocol_circuit_name=\"$protocol_circuit\", exported_instance=~\"$instance\"}[$interval])/rate(aztec_circuit_proving_duration_milliseconds_count{aztec_circuit_protocol_circuit_name=\"$protocol_circuit\", exported_instance=~\"$instance\"}[$interval]))", "fullMetaSearch": false, - "includeNullMetadata": false, + "hide": false, + "includeNullMetadata": true, "instant": false, - "legendFormat": "Avg", + "interval": "", + "legendFormat": "AVG", "range": true, "refId": "A", "useBackend": false } ], - "title": "Circuit proving - $protocol_circuit", + "title": "Proving - $protocol_circuit", "type": "timeseries" } ], @@ -2183,15 +2215,14 @@ { "current": { "selected": false, - "text": "devnet", - "value": "devnet" + "text": "alphanet", + "value": "alphanet" }, "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "definition": "label_values(exported_job)", - "description": "The network", + "definition": "label_values(target_info,aztec_network_name)", "hide": 0, "includeAll": false, "label": "Network", @@ -2200,76 +2231,77 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(exported_job)", + "query": "label_values(target_info,aztec_network_name)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, - "regex": "^(?\\w+)-.+", + "regex": "", "skipUrlSync": false, "sort": 0, "type": "query" }, { "current": { - "selected": true, - "text": ["devnet-aztec-node-1"], - "value": ["devnet-aztec-node-1"] + "selected": false, + "text": "All", + "value": "$__all" }, "datasource": { "type": "prometheus", "uid": "-qqguYXIk" }, - "definition": "label_values(exported_job)", - "hide": 2, + "definition": "label_values(target_info{aztec_network_name=\"$network\"},exported_instance)", + "hide": 0, "includeAll": true, - "label": "Node", - "multi": true, - "name": "node", + "multi": false, + "name": "instance", "options": [], "query": { "qryType": 1, - "query": "label_values(exported_job)", + "query": "label_values(target_info{aztec_network_name=\"$network\"},exported_instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, - "regex": "$network-aztec-node-\\d+", + "regex": "", "skipUrlSync": false, - "sort": 7, + "sort": 0, "type": "query" }, { "current": { "selected": true, - "text": ["All"], - "value": ["$__all"] - }, - "datasource": { - "type": "prometheus", - "uid": "-qqguYXIk" - }, - "definition": "label_values(exported_job)", - "description": "The prover agents in the network", - "hide": 2, - "includeAll": true, - "label": "Prover", - "multi": true, - "name": "prover", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(exported_job)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" + "text": "4h", + "value": "4h" }, - "refresh": 1, - "regex": "$network-aztec-proving-agent-group-\\d+", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "interval", + "options": [ + { + "selected": true, + "text": "4h", + "value": "4h" + }, + { + "selected": false, + "text": "12h", + "value": "12h" + }, + { + "selected": false, + "text": "24h", + "value": "24h" + } + ], + "query": "4h, 12h, 24h", + "queryValue": "", "skipUrlSync": false, - "sort": 7, - "type": "query" + "type": "custom" }, { - "allValue": "", "current": { - "selected": false, + "selected": true, "text": "All", "value": "$__all" }, @@ -2278,7 +2310,7 @@ "uid": "-qqguYXIk" }, "definition": "label_values(aztec_circuit_protocol_circuit_name)", - "hide": 2, + "hide": 0, "includeAll": true, "label": "Protocol circuit", "multi": false, @@ -2298,13 +2330,13 @@ ] }, "time": { - "from": "now-5m", + "from": "now-1h", "to": "now" }, "timepicker": {}, - "timezone": "", - "title": "New dashboard", - "uid": "bi4a3LXIz", - "version": 24, + "timezone": "browser", + "title": "New new new dashboard", + "uid": "cdtxao66xa1ogc", + "version": 31, "weekStart": "" } diff --git a/iac/mainnet-fork/redeploy b/iac/mainnet-fork/redeploy index e440e5c8425..00750edc07d 100644 --- a/iac/mainnet-fork/redeploy +++ b/iac/mainnet-fork/redeploy @@ -1 +1 @@ -3 \ No newline at end of file +3 diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index 7d73451658a..db322ece51f 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.18; // Interfaces -import {IRollup} from "./interfaces/IRollup.sol"; +import {IRollup, ITestRollup} from "./interfaces/IRollup.sol"; import {IAvailabilityOracle} from "./interfaces/IAvailabilityOracle.sol"; import {IInbox} from "./interfaces/messagebridge/IInbox.sol"; import {IOutbox} from "./interfaces/messagebridge/IOutbox.sol"; @@ -13,7 +13,6 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Libraries import {HeaderLib} from "./libraries/HeaderLib.sol"; -import {Hash} from "./libraries/Hash.sol"; import {Errors} from "./libraries/Errors.sol"; import {Constants} from "./libraries/ConstantsGen.sol"; import {MerkleLib} from "./libraries/MerkleLib.sol"; @@ -31,9 +30,10 @@ import {Leonidas} from "./sequencer_selection/Leonidas.sol"; * @notice Rollup contract that is concerned about readability and velocity of development * not giving a damn about gas costs. */ -contract Rollup is Leonidas, IRollup { +contract Rollup is Leonidas, IRollup, ITestRollup { struct BlockLog { bytes32 archive; + uint128 slotNumber; bool isProven; } @@ -42,15 +42,10 @@ contract Rollup is Leonidas, IRollup { IInbox public immutable INBOX; IOutbox public immutable OUTBOX; uint256 public immutable VERSION; - IERC20 public immutable GAS_TOKEN; + IERC20 public immutable FEE_JUICE; IVerifier public verifier; - uint256 public lastBlockTs; - // Tracks the last time time was warped on L2 ("warp" is the testing cheatcode). - // See https://github.com/AztecProtocol/aztec-packages/issues/1614 - uint256 public lastWarpedBlockTs; - uint256 public pendingBlockCount; uint256 public provenBlockCount; @@ -63,104 +58,117 @@ contract Rollup is Leonidas, IRollup { bytes32 public vkTreeRoot; + // @note This should not exists, but we have it now to ensure we will not be killing the devnet with our + // timeliness requirements. + bool public isDevNet = Constants.IS_DEV_NET == 1; + + // @note Assume that all blocks up to this value are automatically proven. Speeds up bootstrapping. + // Testing only. This should be removed eventually. + uint256 private assumeProvenUntilBlockNumber; + constructor( IRegistry _registry, IAvailabilityOracle _availabilityOracle, - IERC20 _gasToken, + IERC20 _fpcJuice, bytes32 _vkTreeRoot ) Leonidas(msg.sender) { verifier = new MockVerifier(); REGISTRY = _registry; AVAILABILITY_ORACLE = _availabilityOracle; - GAS_TOKEN = _gasToken; + FEE_JUICE = _fpcJuice; INBOX = new Inbox(address(this), Constants.L1_TO_L2_MSG_SUBTREE_HEIGHT); OUTBOX = new Outbox(address(this)); vkTreeRoot = _vkTreeRoot; VERSION = 1; // Genesis block - blocks[0] = BlockLog(bytes32(0), true); + blocks[0] = BlockLog({archive: bytes32(0), slotNumber: 0, isProven: true}); pendingBlockCount = 1; provenBlockCount = 1; } - function setVerifier(address _verifier) external override(IRollup) { - // TODO remove, only needed for testing - verifier = IVerifier(_verifier); - } - - function setVkTreeRoot(bytes32 _vkTreeRoot) external { - vkTreeRoot = _vkTreeRoot; + /** + * Sets the assumeProvenUntilBlockNumber. Only the contract deployer can set it. + * @param blockNumber - New value. + */ + function setAssumeProvenUntilBlockNumber(uint256 blockNumber) external onlyOwner { + if (blockNumber > provenBlockCount && blockNumber <= pendingBlockCount) { + for (uint256 i = provenBlockCount; i < blockNumber; i++) { + blocks[i].isProven = true; + emit L2ProofVerified(i, "CHEAT"); + } + _progressState(); + } + assumeProvenUntilBlockNumber = blockNumber; } - function archive() public view returns (bytes32) { - return blocks[pendingBlockCount - 1].archive; + /** + * @notice Set the devnet mode + * + * @dev This is only needed for testing, and should be removed + * + * @param _devNet - Whether or not the contract is in devnet mode + */ + function setDevNet(bool _devNet) external override(ITestRollup) { + isDevNet = _devNet; } - function isBlockProven(uint256 _blockNumber) public view returns (bool) { - return blocks[_blockNumber].isProven; + /** + * @notice Set the verifier contract + * + * @dev This is only needed for testing, and should be removed + * + * @param _verifier - The new verifier contract + */ + function setVerifier(address _verifier) external override(ITestRollup) { + verifier = IVerifier(_verifier); } - function archiveAt(uint256 _blockNumber) public view returns (bytes32) { - return blocks[_blockNumber].archive; + /** + * @notice Set the vkTreeRoot + * + * @dev This is only needed for testing, and should be removed + * + * @param _vkTreeRoot - The new vkTreeRoot to be used by proofs + */ + function setVkTreeRoot(bytes32 _vkTreeRoot) external override(ITestRollup) { + vkTreeRoot = _vkTreeRoot; } /** - * @notice Process an incoming L2 block and progress the state + * @notice Published the body and processes the block + * @dev This should likely be purged in the future as it is a convenience method + * @dev `eth_log_handlers` rely on this function + * * @param _header - The L2 block header * @param _archive - A root of the archive tree after the L2 block is applied * @param _signatures - Signatures from the validators + * @param _body - The body of the L2 block */ - function process( + function publishAndProcess( bytes calldata _header, bytes32 _archive, - SignatureLib.Signature[] memory _signatures - ) public { - _processPendingBlock(_signatures, _archive); - - // Decode and validate header - HeaderLib.Header memory header = HeaderLib.decode(_header); - HeaderLib.validate(header, VERSION, getCurrentSlot(), lastBlockTs, archive()); - - if (header.globalVariables.blockNumber != pendingBlockCount) { - revert Errors.Rollup__InvalidBlockNumber( - pendingBlockCount, header.globalVariables.blockNumber - ); - } - - // Check if the data is available using availability oracle (change availability oracle if you want a different DA layer) - if (!AVAILABILITY_ORACLE.isAvailable(header.contentCommitment.txsEffectsHash)) { - revert Errors.Rollup__UnavailableTxs(header.contentCommitment.txsEffectsHash); - } - - blocks[pendingBlockCount++] = BlockLog(_archive, false); - - lastBlockTs = block.timestamp; - - bytes32 inHash = INBOX.consume(); - if (header.contentCommitment.inHash != inHash) { - revert Errors.Rollup__InvalidInHash(inHash, header.contentCommitment.inHash); - } - - // TODO(#7218): Revert to fixed height tree for outbox, currently just providing min as interim - // Min size = smallest path of the rollup tree + 1 - (uint256 min,) = MerkleLib.computeMinMaxPathLength(header.contentCommitment.numTxs); - uint256 l2ToL1TreeMinHeight = min + 1; - OUTBOX.insert( - header.globalVariables.blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight - ); - - // pay the coinbase 1 gas token if it is not empty and header.totalFees is not zero - if (header.globalVariables.coinbase != address(0) && header.totalFees > 0) { - GAS_TOKEN.transfer(address(header.globalVariables.coinbase), header.totalFees); - } - - emit L2BlockProcessed(header.globalVariables.blockNumber); + SignatureLib.Signature[] memory _signatures, + bytes calldata _body + ) external override(IRollup) { + AVAILABILITY_ORACLE.publish(_body); + process(_header, _archive, _signatures); } - function process(bytes calldata _header, bytes32 _archive) external override(IRollup) { - SignatureLib.Signature[] memory emptySignatures = new SignatureLib.Signature[](0); - process(_header, _archive, emptySignatures); + /** + * @notice Published the body and processes the block + * @dev This should likely be purged in the future as it is a convenience method + * @dev `eth_log_handlers` rely on this function + * @param _header - The L2 block header + * @param _archive - A root of the archive tree after the L2 block is applied + * @param _body - The body of the L2 block + */ + function publishAndProcess(bytes calldata _header, bytes32 _archive, bytes calldata _body) + external + override(IRollup) + { + AVAILABILITY_ORACLE.publish(_body); + process(_header, _archive); } /** @@ -201,14 +209,13 @@ contract Rollup is Leonidas, IRollup { } bytes32 expectedLastArchive = blocks[header.globalVariables.blockNumber - 1].archive; - bytes32 expectedArchive = blocks[header.globalVariables.blockNumber].archive; - // We do it this way to provide better error messages than passing along the storage values // TODO(#4148) Proper genesis state. If the state is empty, we allow anything for now. if (expectedLastArchive != bytes32(0) && header.lastArchive.root != expectedLastArchive) { revert Errors.Rollup__InvalidArchive(expectedLastArchive, header.lastArchive.root); } + bytes32 expectedArchive = blocks[header.globalVariables.blockNumber].archive; if (_archive != expectedArchive) { revert Errors.Rollup__InvalidProposedArchive(expectedArchive, _archive); } @@ -254,6 +261,102 @@ contract Rollup is Leonidas, IRollup { emit L2ProofVerified(header.globalVariables.blockNumber, _proverId); } + /** + * @notice Get the `isProven` flag for the block number + * + * @param _blockNumber - The block number to check + * + * @return bool - True if proven, false otherwise + */ + function isBlockProven(uint256 _blockNumber) external view override(IRollup) returns (bool) { + return blocks[_blockNumber].isProven; + } + + /** + * @notice Get the archive root of a specific block + * + * @param _blockNumber - The block number to get the archive root of + * + * @return bytes32 - The archive root of the block + */ + function archiveAt(uint256 _blockNumber) external view override(IRollup) returns (bytes32) { + return blocks[_blockNumber].archive; + } + + /** + * @notice Processes an incoming L2 block with signatures + * + * @param _header - The L2 block header + * @param _archive - A root of the archive tree after the L2 block is applied + * @param _signatures - Signatures from the validators + */ + function process( + bytes calldata _header, + bytes32 _archive, + SignatureLib.Signature[] memory _signatures + ) public override(IRollup) { + // Decode and validate header + HeaderLib.Header memory header = HeaderLib.decode(_header); + _validateHeaderForSubmissionBase(header); + _validateHeaderForSubmissionSequencerSelection(header, _signatures, _archive); + + // As long as the header is passing validity check in `_validateHeaderForSubmissionBase` we can safely cast + // the slot number to uint128 + blocks[pendingBlockCount++] = BlockLog({ + archive: _archive, + slotNumber: uint128(header.globalVariables.slotNumber), + isProven: false + }); + + bytes32 inHash = INBOX.consume(); + if (header.contentCommitment.inHash != inHash) { + revert Errors.Rollup__InvalidInHash(inHash, header.contentCommitment.inHash); + } + + // TODO(#7218): Revert to fixed height tree for outbox, currently just providing min as interim + // Min size = smallest path of the rollup tree + 1 + (uint256 min,) = MerkleLib.computeMinMaxPathLength(header.contentCommitment.numTxs); + uint256 l2ToL1TreeMinHeight = min + 1; + OUTBOX.insert( + header.globalVariables.blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight + ); + + // @todo This should be address at time of proving. Also, this contract should NOT have funds!!! + // pay the coinbase 1 Fee Juice if it is not empty and header.totalFees is not zero + if (header.globalVariables.coinbase != address(0) && header.totalFees > 0) { + FEE_JUICE.transfer(address(header.globalVariables.coinbase), header.totalFees); + } + + emit L2BlockProcessed(header.globalVariables.blockNumber); + + // Automatically flag the block as proven if we have cheated and set assumeProvenUntilBlockNumber. + if (header.globalVariables.blockNumber < assumeProvenUntilBlockNumber) { + blocks[header.globalVariables.blockNumber].isProven = true; + emit L2ProofVerified(header.globalVariables.blockNumber, "CHEAT"); + _progressState(); + } + } + + /** + * @notice Processes an incoming L2 block without signatures + * + * @param _header - The L2 block header + * @param _archive - A root of the archive tree after the L2 block is applied + */ + function process(bytes calldata _header, bytes32 _archive) public override(IRollup) { + SignatureLib.Signature[] memory emptySignatures = new SignatureLib.Signature[](0); + process(_header, _archive, emptySignatures); + } + + /** + * @notice Get the current archive root + * + * @return bytes32 - The current archive root + */ + function archive() public view override(IRollup) returns (bytes32) { + return blocks[pendingBlockCount - 1].archive; + } + /** * @notice Progresses the state of the proven chain as far as possible * @@ -284,4 +387,126 @@ contract Rollup is Leonidas, IRollup { emit ProgressedState(provenBlockCount, pendingBlockCount); } } + + /** + * @notice Validate a header for submission to the pending chain (sequencer selection checks) + * + * These validation checks are directly related to Leonidas. + * Note that while these checks are strict, they can be relaxed with some changes to + * message boxes. + * + * Each of the following validation checks must pass, otherwise an error is thrown and we revert. + * - The slot MUST be the current slot + * This might be relaxed for allow consensus set to better handle short-term bursts of L1 congestion + * - The slot MUST be in the current epoch + * + * @dev While in isDevNet, we allow skipping all of the checks as we simply assume only TRUSTED sequencers + * + * @param _header - The header to validate + * @param _signatures - The signatures to validate + * @param _archive - The archive root of the block + */ + function _validateHeaderForSubmissionSequencerSelection( + HeaderLib.Header memory _header, + SignatureLib.Signature[] memory _signatures, + bytes32 _archive + ) internal { + if (isDevNet) { + // @note If we are running in a devnet, we don't want to perform all the consensus + // checks, we instead simply require that either there are NO validators or + // that the proposer is a validator. + // + // This means that we relaxes the condition that the block must land in the + // correct slot and epoch to make it more fluid for the devnet launch + // or for testing. + if (getValidatorCount() == 0) { + return; + } + + if (!isValidator(msg.sender)) { + revert Errors.Leonidas__InvalidProposer(address(0), msg.sender); + } + return; + } + + uint256 slot = _header.globalVariables.slotNumber; + + // Ensure that the slot proposed is NOT in the future + uint256 currentSlot = getCurrentSlot(); + if (slot != currentSlot) { + revert Errors.HeaderLib__InvalidSlotNumber(currentSlot, slot); + } + + // @note We are currently enforcing that the slot is in the current epoch + // If this is not the case, there could potentially be a weird reorg + // of an entire epoch if no-one from the new epoch committee have seen + // those blocks or behaves as if they did not. + + uint256 epochNumber = getEpochAt(getTimestampForSlot(slot)); + uint256 currentEpoch = getCurrentEpoch(); + if (epochNumber != currentEpoch) { + revert Errors.Rollup__InvalidEpoch(currentEpoch, epochNumber); + } + + _processPendingBlock(epochNumber, slot, _signatures, _archive); + } + + /** + * @notice Validate a header for submission to the pending chain (base checks) + * Base checks here being the checks that we wish to do regardless of the sequencer + * selection mechanism. + * + * Each of the following validation checks must pass, otherwise an error is thrown and we revert. + * - The chain ID MUST match the current chain ID + * - The version MUST match the current version + * - The block id MUST be the next block in the chain + * - The last archive root in the header MUST match the current archive + * - The slot MUST be larger than the slot of the previous block (ensures single block per slot) + * - The timestamp MUST be equal to GENESIS_TIME + slot * SLOT_DURATION + * - The availability oracle MUST return true for availability of txsEffectsHash + * - This can be relaxed to happen at the time of `submitProof` instead + * + * @param _header - The header to validate + */ + function _validateHeaderForSubmissionBase(HeaderLib.Header memory _header) internal view { + if (block.chainid != _header.globalVariables.chainId) { + revert Errors.Rollup__InvalidChainId(block.chainid, _header.globalVariables.chainId); + } + + if (_header.globalVariables.version != VERSION) { + revert Errors.Rollup__InvalidVersion(VERSION, _header.globalVariables.version); + } + + if (_header.globalVariables.blockNumber != pendingBlockCount) { + revert Errors.Rollup__InvalidBlockNumber( + pendingBlockCount, _header.globalVariables.blockNumber + ); + } + + // TODO(#4148) Proper genesis state. If the state is empty, we allow anything for now. + bytes32 tipArchive = archive(); + if (tipArchive != bytes32(0) && tipArchive != _header.lastArchive.root) { + revert Errors.Rollup__InvalidArchive(tipArchive, _header.lastArchive.root); + } + + uint256 slot = _header.globalVariables.slotNumber; + if (slot > type(uint128).max) { + revert Errors.Rollup__SlotValueTooLarge(slot); + } + + uint256 lastSlot = uint256(blocks[pendingBlockCount - 1].slotNumber); + if (slot <= lastSlot) { + revert Errors.Rollup__SlotAlreadyInChain(lastSlot, slot); + } + + uint256 timestamp = getTimestampForSlot(slot); + if (_header.globalVariables.timestamp != timestamp) { + revert Errors.Rollup__InvalidTimestamp(timestamp, _header.globalVariables.timestamp); + } + + // Check if the data is available using availability oracle (change availability oracle if you want a different DA layer) + if (!AVAILABILITY_ORACLE.isAvailable(_header.contentCommitment.txsEffectsHash)) { + revert Errors.Rollup__UnavailableTxs(_header.contentCommitment.txsEffectsHash); + } + } } diff --git a/l1-contracts/src/core/interfaces/IRollup.sol b/l1-contracts/src/core/interfaces/IRollup.sol index 5186bf993cf..a8a9eb947bd 100644 --- a/l1-contracts/src/core/interfaces/IRollup.sol +++ b/l1-contracts/src/core/interfaces/IRollup.sol @@ -2,12 +2,33 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; +import {SignatureLib} from "../sequencer_selection/SignatureLib.sol"; + +interface ITestRollup { + function setDevNet(bool _devNet) external; + function setVerifier(address _verifier) external; + function setVkTreeRoot(bytes32 _vkTreeRoot) external; +} + interface IRollup { event L2BlockProcessed(uint256 indexed blockNumber); event L2ProofVerified(uint256 indexed blockNumber, bytes32 indexed proverId); event ProgressedState(uint256 provenBlockCount, uint256 pendingBlockCount); + function publishAndProcess( + bytes calldata _header, + bytes32 _archive, + SignatureLib.Signature[] memory _signatures, + bytes calldata _body + ) external; + function publishAndProcess(bytes calldata _header, bytes32 _archive, bytes calldata _body) + external; function process(bytes calldata _header, bytes32 _archive) external; + function process( + bytes calldata _header, + bytes32 _archive, + SignatureLib.Signature[] memory _signatures + ) external; function submitProof( bytes calldata _header, @@ -17,5 +38,7 @@ interface IRollup { bytes calldata _proof ) external; - function setVerifier(address _verifier) external; + function archive() external view returns (bytes32); + function isBlockProven(uint256 _blockNumber) external view returns (bool); + function archiveAt(uint256 _blockNumber) external view returns (bytes32); } diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 8f8c1a8c45b..12eb697b578 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -98,6 +98,8 @@ library Constants { uint256 internal constant INITIALIZATION_SLOT_SEPARATOR = 1000000000; uint256 internal constant INITIAL_L2_BLOCK_NUM = 1; uint256 internal constant BLOB_SIZE_IN_BYTES = 126976; + uint256 internal constant ETHEREUM_SLOT_DURATION = 12; + uint256 internal constant IS_DEV_NET = 1; uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000; uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000; uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS = 3000; @@ -131,8 +133,8 @@ library Constants { 19310994760783330368337163480198602393920956587162708699802190083077641908361; uint256 internal constant REGISTERER_CONTRACT_ADDRESS = 2631409926445785927331173506476539962589925110142857699603561302478860342858; - uint256 internal constant GAS_TOKEN_ADDRESS = - 5232557136129983235483007223848855544006161252993804924983404332852577870185; + uint256 internal constant FEE_JUICE_ADDRESS = + 10248142274714515101077825679585135641434041564851038865006795089686437446849; uint256 internal constant AZTEC_ADDRESS_LENGTH = 1; uint256 internal constant GAS_FEES_LENGTH = 2; uint256 internal constant GAS_LENGTH = 2; @@ -184,13 +186,13 @@ library Constants { uint256 internal constant PRIVATE_VALIDATION_REQUESTS_LENGTH = 772; uint256 internal constant PUBLIC_VALIDATION_REQUESTS_LENGTH = 514; uint256 internal constant PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 3; - uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = 364; + uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = 610; uint256 internal constant COMBINED_CONSTANT_DATA_LENGTH = 43; uint256 internal constant PRIVATE_ACCUMULATED_DATA_LENGTH = 1336; uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2167; - uint256 internal constant PUBLIC_ACCUMULATED_DATA_LENGTH = 1279; - uint256 internal constant PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3565; - uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 417; + uint256 internal constant PUBLIC_ACCUMULATED_DATA_LENGTH = 1311; + uint256 internal constant PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3629; + uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 663; uint256 internal constant CONSTANT_ROLLUP_DATA_LENGTH = 12; uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 29; uint256 internal constant GET_NOTES_ORACLE_RETURN_LENGTH = 674; diff --git a/l1-contracts/src/core/libraries/Errors.sol b/l1-contracts/src/core/libraries/Errors.sol index ce8c5723b65..6382b7ac06f 100644 --- a/l1-contracts/src/core/libraries/Errors.sol +++ b/l1-contracts/src/core/libraries/Errors.sol @@ -41,11 +41,15 @@ library Errors { error Rollup__InvalidArchive(bytes32 expected, bytes32 actual); // 0xb682a40e error Rollup__InvalidProposedArchive(bytes32 expected, bytes32 actual); // 0x32532e73 error Rollup__InvalidBlockNumber(uint256 expected, uint256 actual); // 0xe5edf847 + error Rollup__SlotValueTooLarge(uint256 slot); // 0x7234f4fe + error Rollup__SlotAlreadyInChain(uint256 lastSlot, uint256 proposedSlot); // 0x83510bd0 + error Rollup__InvalidEpoch(uint256 expected, uint256 actual); // 0x3c6d65e6 error Rollup__TryingToProveNonExistingBlock(); // 0x34ef4954 error Rollup__InvalidInHash(bytes32 expected, bytes32 actual); // 0xcd6f4233 error Rollup__InvalidProof(); // 0xa5b2ba17 error Rollup__InvalidChainId(uint256 expected, uint256 actual); // 0x37b5bc12 error Rollup__InvalidVersion(uint256 expected, uint256 actual); // 0x9ef30794 + error Rollup__InvalidTimestamp(uint256 expected, uint256 actual); // 0x3132e895 error Rollup__TimestampInFuture(); // 0xbc1ce916 error Rollup__TimestampTooOld(); // 0x72ed9c81 error Rollup__UnavailableTxs(bytes32 txsHash); // 0x414906c3 @@ -60,6 +64,7 @@ library Errors { // HeaderLib error HeaderLib__InvalidHeaderSize(uint256 expected, uint256 actual); // 0xf3ccb247 + error HeaderLib__InvalidSlotNumber(uint256 expected, uint256 actual); // 0x09ba91ff // MerkleLib error MerkleLib__InvalidRoot(bytes32 expected, bytes32 actual, bytes32 leaf, uint256 leafIndex); // 0x5f216bf1 @@ -72,8 +77,8 @@ library Errors { error SampleLib__IndexOutOfBounds(uint256 requested, uint256 bound); // 0xa12fc559 // Sequencer Selection (Leonidas) - error Leonidas__NotGod(); // 0xabc2f815 error Leonidas__EpochNotSetup(); // 0xcf4e597e error Leonidas__InvalidProposer(address expected, address actual); // 0xd02d278e - error Leonidas__InsufficientAttestations(uint256 expected, uint256 actual); // 0xbf1ca4cb + error Leonidas__InsufficientAttestations(uint256 minimumNeeded, uint256 provided); // 0xbf1ca4cb + error Leonidas__InsufficientAttestationsProvided(uint256 minimumNeeded, uint256 provided); // 0x2e7debe9 } diff --git a/l1-contracts/src/core/libraries/HeaderLib.sol b/l1-contracts/src/core/libraries/HeaderLib.sol index da8eb11c6fc..47a222bf86a 100644 --- a/l1-contracts/src/core/libraries/HeaderLib.sol +++ b/l1-contracts/src/core/libraries/HeaderLib.sol @@ -5,7 +5,6 @@ pragma solidity >=0.8.18; // Libraries import {Errors} from "./Errors.sol"; import {Constants} from "./ConstantsGen.sol"; -import {Hash} from "./Hash.sol"; /** * @title Header Library @@ -108,53 +107,6 @@ library HeaderLib { uint256 private constant HEADER_LENGTH = 0x268; // Header byte length - /** - * @notice Validates the header - * @param _header - The decoded header - * @param _version - The expected version - * @param _slot - The expected slot number - * @dev @todo currently unused, but must be constrained and used to - * constrain the timestamp instead of `lastBlockTs` - * @param _lastBlockTs - The timestamp of the last block - * @param _archive - The expected archive root - */ - function validate( - Header memory _header, - uint256 _version, - uint256 _slot, - uint256 _lastBlockTs, - bytes32 _archive - ) internal view { - if (block.chainid != _header.globalVariables.chainId) { - revert Errors.Rollup__InvalidChainId(block.chainid, _header.globalVariables.chainId); - } - - if (_header.globalVariables.version != _version) { - revert Errors.Rollup__InvalidVersion(_version, _header.globalVariables.version); - } - - // block number already constrained by archive root check - - // @todo Constrain slot number + update timestamp to be linked to slot number - - if (_header.globalVariables.timestamp > block.timestamp) { - revert Errors.Rollup__TimestampInFuture(); - } - - // @todo @LHerskind consider if this is too strict - // This will make multiple l2 blocks in the same l1 block impractical. - // e.g., the first block will update timestamp which will make the second fail. - // Could possibly allow multiple blocks if in same l1 block - if (_header.globalVariables.timestamp < _lastBlockTs) { - revert Errors.Rollup__TimestampTooOld(); - } - - // TODO(#4148) Proper genesis state. If the state is empty, we allow anything for now. - if (_archive != bytes32(0) && _archive != _header.lastArchive.root) { - revert Errors.Rollup__InvalidArchive(_archive, _header.lastArchive.root); - } - } - /** * @notice Decodes the header * @param _header - The header calldata diff --git a/l1-contracts/src/core/messagebridge/Registry.sol b/l1-contracts/src/core/messagebridge/Registry.sol index 947597c8b02..44cdf7944a0 100644 --- a/l1-contracts/src/core/messagebridge/Registry.sol +++ b/l1-contracts/src/core/messagebridge/Registry.sol @@ -2,6 +2,8 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; +import {Ownable} from "@oz/access/Ownable.sol"; + // Interfaces import {IRegistry} from "../interfaces/messagebridge/IRegistry.sol"; import {IRollup} from "../interfaces/IRollup.sol"; @@ -19,14 +21,14 @@ import {Errors} from "../libraries/Errors.sol"; * Used as the source of truth for finding the "head" of the rollup chain. Very important information * for L1<->L2 communication. */ -contract Registry is IRegistry { +contract Registry is IRegistry, Ownable { uint256 public override(IRegistry) numberOfVersions; DataStructures.RegistrySnapshot internal currentSnapshot; mapping(uint256 version => DataStructures.RegistrySnapshot snapshot) internal snapshots; mapping(address rollup => uint256 version) internal rollupToVersion; - constructor() { + constructor() Ownable(msg.sender) { // Inserts a "dead" rollup and message boxes at version 0 // This is simply done to make first version 1, which fits better with the rest of the system upgrade(address(0xdead), address(0xdead), address(0xdead)); diff --git a/l1-contracts/src/core/sequencer_selection/ILeonidas.sol b/l1-contracts/src/core/sequencer_selection/ILeonidas.sol index bf06ac2f5fd..24501446da3 100644 --- a/l1-contracts/src/core/sequencer_selection/ILeonidas.sol +++ b/l1-contracts/src/core/sequencer_selection/ILeonidas.sol @@ -10,12 +10,17 @@ interface ILeonidas { // Likely changing to optimize in Pleistarchus function setupEpoch() external; function getCurrentProposer() external view returns (address); + function getProposerAt(uint256 _ts) external view returns (address); // Stable function getCurrentEpoch() external view returns (uint256); function getCurrentSlot() external view returns (uint256); + function isValidator(address _validator) external view returns (bool); + function getValidatorCount() external view returns (uint256); // Consider removing below this point + function getTimestampForSlot(uint256 _slotNumber) external view returns (uint256); + // Likely removal of these to replace with a size and indiviual getter function getEpochCommittee(uint256 _epoch) external view returns (address[] memory); function getValidators() external view returns (address[] memory); diff --git a/l1-contracts/src/core/sequencer_selection/Leonidas.sol b/l1-contracts/src/core/sequencer_selection/Leonidas.sol index 44475c3235a..7f3745d06a8 100644 --- a/l1-contracts/src/core/sequencer_selection/Leonidas.sol +++ b/l1-contracts/src/core/sequencer_selection/Leonidas.sol @@ -7,6 +7,8 @@ import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; import {Ownable} from "@oz/access/Ownable.sol"; import {SignatureLib} from "./SignatureLib.sol"; import {SampleLib} from "./SampleLib.sol"; +import {Constants} from "../libraries/ConstantsGen.sol"; +import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; import {ILeonidas} from "./ILeonidas.sol"; @@ -27,6 +29,7 @@ import {ILeonidas} from "./ILeonidas.sol"; contract Leonidas is Ownable, ILeonidas { using EnumerableSet for EnumerableSet.AddressSet; using SignatureLib for SignatureLib.Signature; + using MessageHashUtils for bytes32; /** * @notice The data structure for an epoch @@ -40,13 +43,22 @@ contract Leonidas is Ownable, ILeonidas { uint256 nextSeed; } - // The size/duration of a slot in seconds, multiple of 12 to align with Ethereum blocks - uint256 public constant SLOT_DURATION = 12 * 5; - - // The size/duration of an epoch in slots + // @note @LHerskind - The multiple cause pain and suffering in the E2E tests as we introduce + // a timeliness requirement into the publication that did not exists before, + // and at the same time have a setup that will impact the time at every tx + // because of auto-mine. By using just 1, we can make our test work + // but anything using an actual working chain would eat dung as simulating + // transactions is slower than an actual ethereum slot. + // + // The value should be a higher multiple for any actual chain + uint256 public constant SLOT_DURATION = Constants.ETHEREUM_SLOT_DURATION * 1; + + // The duration of an epoch in slots + // @todo @LHerskind - This value should be updated when we are not blind. uint256 public constant EPOCH_DURATION = 32; // The target number of validators in a committee + // @todo @LHerskind - This value should be updated when we are not blind. uint256 public constant TARGET_COMMITTEE_SIZE = EPOCH_DURATION; // The time that the contract was deployed @@ -59,7 +71,7 @@ contract Leonidas is Ownable, ILeonidas { mapping(uint256 epochNumber => Epoch epoch) public epochs; // The last stored randao value, same value as `seed` in the last inserted epoch - uint256 internal lastSeed; + uint256 private lastSeed; constructor(address _ares) Ownable(_ares) { GENESIS_TIME = block.timestamp; @@ -129,6 +141,26 @@ contract Leonidas is Ownable, ILeonidas { return validatorSet.values(); } + /** + * @notice Get the number of validators in the validator set + * + * @return The number of validators in the validator set + */ + function getValidatorCount() public view override(ILeonidas) returns (uint256) { + return validatorSet.length(); + } + + /** + * @notice Checks if an address is in the validator set + * + * @param _validator - The address to check + * + * @return True if the address is in the validator set, false otherwise + */ + function isValidator(address _validator) public view override(ILeonidas) returns (bool) { + return validatorSet.contains(_validator); + } + /** * @notice Performs a setup of an epoch if needed. The setup will * - Sample the validator set for the epoch @@ -158,7 +190,7 @@ contract Leonidas is Ownable, ILeonidas { * @return The current epoch number */ function getCurrentEpoch() public view override(ILeonidas) returns (uint256) { - return (block.timestamp - GENESIS_TIME) / (EPOCH_DURATION * SLOT_DURATION); + return getEpochAt(block.timestamp); } /** @@ -167,12 +199,45 @@ contract Leonidas is Ownable, ILeonidas { * @return The current slot number */ function getCurrentSlot() public view override(ILeonidas) returns (uint256) { - return (block.timestamp - GENESIS_TIME) / SLOT_DURATION; + return getSlotAt(block.timestamp); + } + + /** + * @notice Get the timestamp for a given slot + * + * @param _slotNumber - The slot number to get the timestamp for + * + * @return The timestamp for the given slot + */ + function getTimestampForSlot(uint256 _slotNumber) + public + view + override(ILeonidas) + returns (uint256) + { + return _slotNumber * SLOT_DURATION + GENESIS_TIME; } /** * @notice Get the proposer for the current slot * + * @dev Calls `getCurrentProposer(uint256)` with the current timestamp + * + * @return The address of the proposer + */ + function getCurrentProposer() public view override(ILeonidas) returns (address) { + return getProposerAt(block.timestamp); + } + + /** + * @notice Get the proposer for the slot at a specific timestamp + * + * @dev This function is very useful for off-chain usage, as it easily allow a client to + * determine who will be the proposer at the NEXT ethereum block. + * Should not be trusted when moving beyond the current epoch, since changes to the + * validator set might not be reflected when we actually reach that epoch (more changes + * might have happened). + * * @dev The proposer is selected from the validator set of the current epoch. * * @dev Should only be access on-chain if epoch is setup, otherwise very expensive. @@ -185,12 +250,12 @@ contract Leonidas is Ownable, ILeonidas { * * @return The address of the proposer */ - function getCurrentProposer() public view override(ILeonidas) returns (address) { - uint256 epochNumber = getCurrentEpoch(); + function getProposerAt(uint256 _ts) public view override(ILeonidas) returns (address) { + uint256 epochNumber = getEpochAt(_ts); + uint256 slot = getSlotAt(_ts); if (epochNumber == 0) { return address(0); } - uint256 slot = getCurrentSlot(); Epoch storage epoch = epochs[epochNumber]; @@ -219,28 +284,38 @@ contract Leonidas is Ownable, ILeonidas { /** * @notice Process a pending block from the point-of-view of sequencer selection. Will: * - Setup the epoch if needed (if epoch committee is empty skips the rest) - * - Validate that the proposer is the current proposer + * - Validate that the proposer is the proposer of the slot * - Validate that the signatures for attestations are indeed from the validatorset * - Validate that the number of valid attestations is sufficient * * @dev Cases where errors are thrown: * - If the epoch is not setup - * - If the proposer is not the current proposer + * - If the proposer is not the real proposer AND the proposer is not open * - If the number of valid attestations is insufficient + * + * @param _epochNumber - The epoch number of the block + * @param _slot - The slot of the block + * @param _signatures - The signatures of the committee members + * @param _digest - The digest of the block */ - function _processPendingBlock(SignatureLib.Signature[] memory _signatures, bytes32 _digest) - internal - { + function _processPendingBlock( + uint256 _epochNumber, + uint256 _slot, + SignatureLib.Signature[] memory _signatures, + bytes32 _digest + ) internal { + // @note Setup the CURRENT epoch if not already done. + // not necessarily the one we are processing! setupEpoch(); - Epoch storage epoch = epochs[getCurrentEpoch()]; + Epoch storage epoch = epochs[_epochNumber]; // We should never enter this case because of `setupEpoch` if (epoch.sampleSeed == 0) { revert Errors.Leonidas__EpochNotSetup(); } - address proposer = getCurrentProposer(); + address proposer = getProposerAt(getTimestampForSlot(_slot)); // If the proposer is open, we allow anyone to propose without needing any signatures if (proposer == address(0)) { @@ -252,8 +327,16 @@ contract Leonidas is Ownable, ILeonidas { revert Errors.Leonidas__InvalidProposer(proposer, msg.sender); } + uint256 needed = epoch.committee.length * 2 / 3 + 1; + if (_signatures.length < needed) { + revert Errors.Leonidas__InsufficientAttestationsProvided(needed, _signatures.length); + } + // Validate the attestations uint256 validAttestations = 0; + + bytes32 ethSignedDigest = _digest.toEthSignedMessageHash(); + for (uint256 i = 0; i < _signatures.length; i++) { SignatureLib.Signature memory signature = _signatures[i]; if (signature.isEmpty) { @@ -261,10 +344,10 @@ contract Leonidas is Ownable, ILeonidas { } // The verification will throw if invalid - signature.verify(epoch.committee[i], _digest); + signature.verify(epoch.committee[i], ethSignedDigest); validAttestations++; } - uint256 needed = epoch.committee.length * 2 / 3 + 1; + if (validAttestations < needed) { revert Errors.Leonidas__InsufficientAttestations(needed, validAttestations); } @@ -316,6 +399,10 @@ contract Leonidas is Ownable, ILeonidas { /** * @notice Get the sample seed for an epoch * + * @dev This should behave as walking past the line, but it does not currently do that. + * If there are entire skips, e.g., 1, 2, 5 and we then go back and try executing + * for 4 we will get an invalid value because we will read lastSeed which is from 5. + * * @dev The `_epoch` will never be 0 nor in the future * * @dev The return value will be equal to keccak256(n, block.prevrandao) for n being the last epoch @@ -337,6 +424,28 @@ contract Leonidas is Ownable, ILeonidas { return lastSeed; } + /** + * @notice Computes the epoch at a specific time + * + * @param _ts - The timestamp to compute the epoch for + * + * @return The computed epoch + */ + function getEpochAt(uint256 _ts) public view returns (uint256) { + return (_ts - GENESIS_TIME) / (EPOCH_DURATION * SLOT_DURATION); + } + + /** + * @notice Computes the slot at a specific time + * + * @param _ts - The timestamp to compute the slot for + * + * @return The computed slot + */ + function getSlotAt(uint256 _ts) public view returns (uint256) { + return (_ts - GENESIS_TIME) / SLOT_DURATION; + } + /** * @notice Computes the nextSeed for an epoch * diff --git a/l1-contracts/terraform/main.tf b/l1-contracts/terraform/main.tf index b5d237b047e..4b7a1877459 100644 --- a/l1-contracts/terraform/main.tf +++ b/l1-contracts/terraform/main.tf @@ -57,20 +57,20 @@ output "outbox_contract_address" { } -variable "GAS_TOKEN_CONTRACT_ADDRESS" { +variable "FEE_JUICE_CONTRACT_ADDRESS" { type = string default = "" } -output "gas_token_contract_address" { - value = var.GAS_TOKEN_CONTRACT_ADDRESS +output "fee_juice_contract_address" { + value = var.FEE_JUICE_CONTRACT_ADDRESS } -variable "GAS_PORTAL_CONTRACT_ADDRESS" { +variable "FEE_JUICE_PORTAL_CONTRACT_ADDRESS" { type = string default = "" } -output "gas_portal_contract_address" { - value = var.GAS_PORTAL_CONTRACT_ADDRESS +output "FEE_JUICE_PORTAL_CONTRACT_ADDRESS" { + value = var.FEE_JUICE_PORTAL_CONTRACT_ADDRESS } diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index f0f23387c84..f9f1dc06d40 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -14,6 +14,7 @@ import {Inbox} from "../src/core/messagebridge/Inbox.sol"; import {Outbox} from "../src/core/messagebridge/Outbox.sol"; import {Errors} from "../src/core/libraries/Errors.sol"; import {Rollup} from "../src/core/Rollup.sol"; +import {Leonidas} from "../src/core/sequencer_selection/Leonidas.sol"; import {AvailabilityOracle} from "../src/core/availability_oracle/AvailabilityOracle.sol"; import {NaiveMerkle} from "./merkle/Naive.sol"; import {MerkleTestUtil} from "./merkle/TestUtil.sol"; @@ -36,7 +37,19 @@ contract RollupTest is DecoderBase { AvailabilityOracle internal availabilityOracle; - function setUp() public virtual { + /** + * @notice Set up the contracts needed for the tests with time aligned to the provided block name + */ + modifier setUpFor(string memory _name) { + { + Leonidas leo = new Leonidas(address(1)); + DecoderBase.Full memory full = load(_name); + uint256 slotNumber = full.block.decodedHeader.globalVariables.slotNumber; + uint256 initialTime = + full.block.decodedHeader.globalVariables.timestamp - slotNumber * leo.SLOT_DURATION(); + vm.warp(initialTime); + } + registry = new Registry(); availabilityOracle = new AvailabilityOracle(); portalERC20 = new PortalERC20(); @@ -51,16 +64,17 @@ contract RollupTest is DecoderBase { merkleTestUtil = new MerkleTestUtil(); txsHelper = new TxsDecoderHelper(); + _; } - function testMixedBlock(bool _toProve) public { + function testMixedBlock(bool _toProve) public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", _toProve); assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); assertEq(rollup.provenBlockCount(), _toProve ? 2 : 1, "Invalid proven block count"); } - function testConsecutiveMixedBlocks(uint256 _blocksToProve) public { + function testConsecutiveMixedBlocks(uint256 _blocksToProve) public setUpFor("mixed_block_1") { uint256 toProve = bound(_blocksToProve, 0, 2); _testBlock("mixed_block_1", toProve > 0); @@ -70,7 +84,7 @@ contract RollupTest is DecoderBase { assertEq(rollup.provenBlockCount(), 1 + toProve, "Invalid proven block count"); } - function testConsecutiveMixedBlocksNonSequentialProof() public { + function testConsecutiveMixedBlocksNonSequentialProof() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false); _testBlock("mixed_block_2", true); @@ -80,13 +94,13 @@ contract RollupTest is DecoderBase { assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); } - function testEmptyBlock(bool _toProve) public { + function testEmptyBlock(bool _toProve) public setUpFor("empty_block_1") { _testBlock("empty_block_1", _toProve); assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); assertEq(rollup.provenBlockCount(), _toProve ? 2 : 1, "Invalid proven block count"); } - function testConsecutiveEmptyBlocks(uint256 _blocksToProve) public { + function testConsecutiveEmptyBlocks(uint256 _blocksToProve) public setUpFor("empty_block_1") { uint256 toProve = bound(_blocksToProve, 0, 2); _testBlock("empty_block_1", toProve > 0); _testBlock("empty_block_2", toProve > 1); @@ -95,7 +109,7 @@ contract RollupTest is DecoderBase { assertEq(rollup.provenBlockCount(), 1 + toProve, "Invalid proven block count"); } - function testRevertInvalidBlockNumber() public { + function testRevertInvalidBlockNumber() public setUpFor("empty_block_1") { DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; @@ -112,7 +126,7 @@ contract RollupTest is DecoderBase { rollup.process(header, archive); } - function testRevertInvalidChainId() public { + function testRevertInvalidChainId() public setUpFor("empty_block_1") { DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; @@ -129,7 +143,7 @@ contract RollupTest is DecoderBase { rollup.process(header, archive); } - function testRevertInvalidVersion() public { + function testRevertInvalidVersion() public setUpFor("empty_block_1") { DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; @@ -145,40 +159,46 @@ contract RollupTest is DecoderBase { rollup.process(header, archive); } - function testRevertTimestampInFuture() public { + function testRevertInvalidTimestamp() public setUpFor("empty_block_1") { DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; bytes memory body = data.body; - uint256 ts = block.timestamp + 1; + uint256 realTs = data.decodedHeader.globalVariables.timestamp; + uint256 badTs = realTs + 1; + + vm.warp(max(block.timestamp, realTs)); + assembly { - mstore(add(header, add(0x20, 0x01b4)), ts) + mstore(add(header, add(0x20, 0x01b4)), badTs) } availabilityOracle.publish(body); - vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__TimestampInFuture.selector)); + vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__InvalidTimestamp.selector, realTs, badTs)); rollup.process(header, archive); } - function testRevertTimestampTooOld() public { - DecoderBase.Data memory data = load("empty_block_1").block; - bytes memory header = data.header; - bytes32 archive = data.archive; - bytes memory body = data.body; + function testBlocksWithAssumeProven() public setUpFor("mixed_block_1") { + rollup.setAssumeProvenUntilBlockNumber(2); + _testBlock("mixed_block_1", false); + _testBlock("mixed_block_2", false); - // Beware of the store slot below, if the test is failing might be because of the slot - // We overwrite `lastBlockTs` in the rollup - vm.store(address(rollup), bytes32(uint256(6)), bytes32(uint256(block.timestamp))); + assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); + assertEq(rollup.provenBlockCount(), 2, "Invalid proven block count"); + } - availabilityOracle.publish(body); + function testSetAssumeProvenAfterBlocksProcessed() public setUpFor("mixed_block_1") { + _testBlock("mixed_block_1", false); + _testBlock("mixed_block_2", false); + rollup.setAssumeProvenUntilBlockNumber(2); - vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__TimestampTooOld.selector)); - rollup.process(header, archive); + assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); + assertEq(rollup.provenBlockCount(), 2, "Invalid proven block count"); } - function testSubmitProofNonExistantBlock() public { + function testSubmitProofNonExistantBlock() public setUpFor("empty_block_1") { DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; @@ -187,7 +207,7 @@ contract RollupTest is DecoderBase { rollup.submitProof(header, archive, bytes32(0), "", ""); } - function testSubmitProofInvalidArchive() public { + function testSubmitProofInvalidArchive() public setUpFor("empty_block_1") { _testBlock("empty_block_1", false); _testBlock("empty_block_2", false); @@ -208,14 +228,12 @@ contract RollupTest is DecoderBase { rollup.submitProof(header, archive, bytes32(0), "", ""); } - function testSubmitProofInvalidProposedArchive() public { + function testSubmitProofInvalidProposedArchive() public setUpFor("empty_block_1") { + _testBlock("empty_block_1", false); + DecoderBase.Data memory data = load("empty_block_1").block; bytes memory header = data.header; bytes32 archive = data.archive; - bytes memory body = data.body; - - availabilityOracle.publish(body); - rollup.process(header, archive); bytes32 badArchive = keccak256(abi.encode(archive)); diff --git a/l1-contracts/test/fixtures/empty_block_1.json b/l1-contracts/test/fixtures/empty_block_1.json index 1dbf4104dcd..7fd0ef38d59 100644 --- a/l1-contracts/test/fixtures/empty_block_1.json +++ b/l1-contracts/test/fixtures/empty_block_1.json @@ -20,9 +20,9 @@ }, "globalVariables": { "blockNumber": 1, - "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000001", + "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000005", "chainId": 31337, - "timestamp": 0, + "timestamp": 1723019086, "version": 1, "coinbase": "0xdb59aa78df10a886e7987fedcf49ae50541b0f91", "feeRecipient": "0x2eca3f1c9be9eef0c92d6f57fc6283f91d3bb957d4b876d425ba152859fbbf98", diff --git a/l1-contracts/test/fixtures/empty_block_2.json b/l1-contracts/test/fixtures/empty_block_2.json index 7eb7f859cbc..634709d8860 100644 --- a/l1-contracts/test/fixtures/empty_block_2.json +++ b/l1-contracts/test/fixtures/empty_block_2.json @@ -20,7 +20,7 @@ }, "globalVariables": { "blockNumber": 2, - "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000002", + "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000006", "chainId": 31337, "timestamp": 1723020124, "version": 1, diff --git a/l1-contracts/test/fixtures/mixed_block_1.json b/l1-contracts/test/fixtures/mixed_block_1.json index a3996f8ce20..d9c9bc65137 100644 --- a/l1-contracts/test/fixtures/mixed_block_1.json +++ b/l1-contracts/test/fixtures/mixed_block_1.json @@ -70,9 +70,9 @@ }, "globalVariables": { "blockNumber": 1, - "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000001", + "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000015", "chainId": 31337, - "timestamp": 0, + "timestamp": 1723018774, "version": 1, "coinbase": "0xc2925796863f1503f4ac8c407268d4e55fa1dfb3", "feeRecipient": "0x300f77596cc77c8712ad693528d22a8f440eb23cb09e6affa8b3b583b0a2badf", diff --git a/l1-contracts/test/fixtures/mixed_block_2.json b/l1-contracts/test/fixtures/mixed_block_2.json index 2b4fba4e688..7ba2662e7d9 100644 --- a/l1-contracts/test/fixtures/mixed_block_2.json +++ b/l1-contracts/test/fixtures/mixed_block_2.json @@ -70,7 +70,7 @@ }, "globalVariables": { "blockNumber": 2, - "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000002", + "slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000026", "chainId": 31337, "timestamp": 1723020096, "version": 1, diff --git a/l1-contracts/test/portals/GasPortal.sol b/l1-contracts/test/portals/FeeJuicePortal.sol similarity index 98% rename from l1-contracts/test/portals/GasPortal.sol rename to l1-contracts/test/portals/FeeJuicePortal.sol index 5f4eb2dda54..da5e40b5e68 100644 --- a/l1-contracts/test/portals/GasPortal.sol +++ b/l1-contracts/test/portals/FeeJuicePortal.sol @@ -12,7 +12,7 @@ import {Hash} from "../../src/core/libraries/Hash.sol"; // docs:end:content_hash_sol_import // docs:start:init -contract GasPortal { +contract FeeJuicePortal { using SafeERC20 for IERC20; IRegistry public registry; diff --git a/l1-contracts/test/sparta/DevNet.t.sol b/l1-contracts/test/sparta/DevNet.t.sol new file mode 100644 index 00000000000..f9461f42af3 --- /dev/null +++ b/l1-contracts/test/sparta/DevNet.t.sol @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2023 Aztec Labs. +pragma solidity >=0.8.18; + +import {IERC20} from "@oz/token/ERC20/IERC20.sol"; + +import {DecoderBase} from "../decoders/Base.sol"; + +import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; +import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; +import {SignatureLib} from "../../src/core/sequencer_selection/SignatureLib.sol"; + +import {Registry} from "../../src/core/messagebridge/Registry.sol"; +import {Inbox} from "../../src/core/messagebridge/Inbox.sol"; +import {Outbox} from "../../src/core/messagebridge/Outbox.sol"; +import {Errors} from "../../src/core/libraries/Errors.sol"; +import {Rollup} from "../../src/core/Rollup.sol"; +import {Leonidas} from "../../src/core/sequencer_selection/Leonidas.sol"; +import {AvailabilityOracle} from "../../src/core/availability_oracle/AvailabilityOracle.sol"; +import {NaiveMerkle} from "../merkle/Naive.sol"; +import {MerkleTestUtil} from "../merkle/TestUtil.sol"; +import {PortalERC20} from "../portals/PortalERC20.sol"; +import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; + +/** + * We are using the same blocks as from Rollup.t.sol. + * The tests in this file is testing the sequencer selection + * + * We will skip these test if we are running with IS_DEV_NET = true + */ +contract DevNetTest is DecoderBase { + Registry internal registry; + Inbox internal inbox; + Outbox internal outbox; + Rollup internal rollup; + MerkleTestUtil internal merkleTestUtil; + TxsDecoderHelper internal txsHelper; + PortalERC20 internal portalERC20; + + AvailabilityOracle internal availabilityOracle; + + mapping(address validator => uint256 privateKey) internal privateKeys; + + SignatureLib.Signature internal emptySignature; + + /** + * @notice Set up the contracts needed for the tests with time aligned to the provided block name + */ + modifier setup(uint256 _validatorCount) { + string memory _name = "mixed_block_1"; + { + Leonidas leo = new Leonidas(address(1)); + DecoderBase.Full memory full = load(_name); + uint256 slotNumber = full.block.decodedHeader.globalVariables.slotNumber; + uint256 initialTime = + full.block.decodedHeader.globalVariables.timestamp - slotNumber * leo.SLOT_DURATION(); + vm.warp(initialTime); + } + + registry = new Registry(); + availabilityOracle = new AvailabilityOracle(); + portalERC20 = new PortalERC20(); + rollup = new Rollup(registry, availabilityOracle, IERC20(address(portalERC20)), bytes32(0)); + inbox = Inbox(address(rollup.INBOX())); + outbox = Outbox(address(rollup.OUTBOX())); + + registry.upgrade(address(rollup), address(inbox), address(outbox)); + + // mint some tokens to the rollup + portalERC20.mint(address(rollup), 1000000); + + merkleTestUtil = new MerkleTestUtil(); + txsHelper = new TxsDecoderHelper(); + + for (uint256 i = 1; i < _validatorCount + 1; i++) { + uint256 privateKey = uint256(keccak256(abi.encode("validator", i))); + address validator = vm.addr(privateKey); + privateKeys[validator] = privateKey; + rollup.addValidator(validator); + } + _; + } + + function testProposerForNonSetupEpoch(uint8 _epochsToJump) public setup(5) { + if (Constants.IS_DEV_NET == 0) { + return; + } + + uint256 pre = rollup.getCurrentEpoch(); + vm.warp( + block.timestamp + uint256(_epochsToJump) * rollup.EPOCH_DURATION() * rollup.SLOT_DURATION() + ); + uint256 post = rollup.getCurrentEpoch(); + assertEq(pre + _epochsToJump, post, "Invalid epoch"); + + address expectedProposer = rollup.getCurrentProposer(); + + // Add a validator which will also setup the epoch + rollup.addValidator(address(0xdead)); + + address actualProposer = rollup.getCurrentProposer(); + assertEq(expectedProposer, actualProposer, "Invalid proposer"); + } + + function testNoValidators() public setup(0) { + if (Constants.IS_DEV_NET == 0) { + return; + } + + _testBlock("mixed_block_1", false, false); + } + + function testInvalidProposer() public setup(1) { + if (Constants.IS_DEV_NET == 0) { + return; + } + + _testBlock("mixed_block_1", true, true); + } + + struct StructToAvoidDeepStacks { + uint256 needed; + address proposer; + bool shouldRevert; + } + + function _testBlock(string memory _name, bool _expectRevert, bool _invalidProposer) internal { + _testBlock(_name, _expectRevert, _invalidProposer, 0); + } + + function _testBlock(string memory _name, bool _expectRevert, bool _invalidProposer, uint256 _ts) + internal + { + DecoderBase.Full memory full = load(_name); + bytes memory header = full.block.header; + bytes32 archive = full.block.archive; + bytes memory body = full.block.body; + + StructToAvoidDeepStacks memory ree; + + // We jump to the time of the block. (unless it is in the past) + vm.warp(max(block.timestamp, max(full.block.decodedHeader.globalVariables.timestamp, _ts))); + + if (_ts > 0) { + // Update the timestamp and slot in the header + uint256 slotValue = rollup.getCurrentSlot(); + uint256 timestampMemoryPosition = 0x01b4; + uint256 slotMemoryPosition = 0x0194; + assembly { + mstore(add(header, add(0x20, timestampMemoryPosition)), _ts) + mstore(add(header, add(0x20, slotMemoryPosition)), slotValue) + } + } + + _populateInbox(full.populate.sender, full.populate.recipient, full.populate.l1ToL2Content); + + availabilityOracle.publish(body); + + uint256 toConsume = inbox.toConsume(); + ree.proposer = rollup.getCurrentProposer(); + ree.shouldRevert = false; + + rollup.setupEpoch(); + + if (_invalidProposer) { + ree.proposer = address(uint160(uint256(keccak256(abi.encode("invalid", ree.proposer))))); + // Why don't we end up here? + vm.expectRevert( + abi.encodeWithSelector(Errors.Leonidas__InvalidProposer.selector, address(0), ree.proposer) + ); + ree.shouldRevert = true; + } + + vm.prank(ree.proposer); + rollup.process(header, archive); + + assertEq(_expectRevert, ree.shouldRevert, "Invalid revert expectation"); + + if (ree.shouldRevert) { + return; + } + + assertEq(inbox.toConsume(), toConsume + 1, "Message subtree not consumed"); + + bytes32 l2ToL1MessageTreeRoot; + { + uint32 numTxs = full.block.numTxs; + // NB: The below works with full blocks because we require the largest possible subtrees + // for L2 to L1 messages - usually we make variable height subtrees, the roots of which + // form a balanced tree + + // The below is a little janky - we know that this test deals with full txs with equal numbers + // of msgs or txs with no messages, so the division works + // TODO edit full.messages to include information about msgs per tx? + uint256 subTreeHeight = merkleTestUtil.calculateTreeHeightFromSize( + full.messages.l2ToL1Messages.length == 0 ? 0 : full.messages.l2ToL1Messages.length / numTxs + ); + uint256 outHashTreeHeight = merkleTestUtil.calculateTreeHeightFromSize(numTxs); + uint256 numMessagesWithPadding = numTxs * Constants.MAX_L2_TO_L1_MSGS_PER_TX; + + uint256 treeHeight = subTreeHeight + outHashTreeHeight; + NaiveMerkle tree = new NaiveMerkle(treeHeight); + for (uint256 i = 0; i < numMessagesWithPadding; i++) { + if (i < full.messages.l2ToL1Messages.length) { + tree.insertLeaf(full.messages.l2ToL1Messages[i]); + } else { + tree.insertLeaf(bytes32(0)); + } + } + + l2ToL1MessageTreeRoot = tree.computeRoot(); + } + + (bytes32 root,) = outbox.roots(full.block.decodedHeader.globalVariables.blockNumber); + + assertEq(l2ToL1MessageTreeRoot, root, "Invalid l2 to l1 message tree root"); + + assertEq(rollup.archive(), archive, "Invalid archive"); + } + + function _populateInbox(address _sender, bytes32 _recipient, bytes32[] memory _contents) internal { + for (uint256 i = 0; i < _contents.length; i++) { + vm.prank(_sender); + inbox.sendL2Message( + DataStructures.L2Actor({actor: _recipient, version: 1}), _contents[i], bytes32(0) + ); + } + } + + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return a > b ? a : b; + } +} diff --git a/l1-contracts/test/sparta/Sparta.t.sol b/l1-contracts/test/sparta/Sparta.t.sol index 3cea4e115d1..a77651ad31e 100644 --- a/l1-contracts/test/sparta/Sparta.t.sol +++ b/l1-contracts/test/sparta/Sparta.t.sol @@ -9,12 +9,14 @@ import {DecoderBase} from "../decoders/Base.sol"; import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; import {SignatureLib} from "../../src/core/sequencer_selection/SignatureLib.sol"; +import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; import {Registry} from "../../src/core/messagebridge/Registry.sol"; import {Inbox} from "../../src/core/messagebridge/Inbox.sol"; import {Outbox} from "../../src/core/messagebridge/Outbox.sol"; import {Errors} from "../../src/core/libraries/Errors.sol"; import {Rollup} from "../../src/core/Rollup.sol"; +import {Leonidas} from "../../src/core/sequencer_selection/Leonidas.sol"; import {AvailabilityOracle} from "../../src/core/availability_oracle/AvailabilityOracle.sol"; import {NaiveMerkle} from "../merkle/Naive.sol"; import {MerkleTestUtil} from "../merkle/TestUtil.sol"; @@ -24,8 +26,12 @@ import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; /** * We are using the same blocks as from Rollup.t.sol. * The tests in this file is testing the sequencer selection + * + * We will skip these test if we are running with IS_DEV_NET = true */ contract SpartaTest is DecoderBase { + using MessageHashUtils for bytes32; + Registry internal registry; Inbox internal inbox; Outbox internal outbox; @@ -40,7 +46,20 @@ contract SpartaTest is DecoderBase { SignatureLib.Signature internal emptySignature; - function setUp() public virtual { + /** + * @notice Set up the contracts needed for the tests with time aligned to the provided block name + */ + modifier setup(uint256 _validatorCount) { + string memory _name = "mixed_block_1"; + { + Leonidas leonidas = new Leonidas(address(1)); + DecoderBase.Full memory full = load(_name); + uint256 slotNumber = full.block.decodedHeader.globalVariables.slotNumber; + uint256 initialTime = + full.block.decodedHeader.globalVariables.timestamp - slotNumber * leonidas.SLOT_DURATION(); + vm.warp(initialTime); + } + registry = new Registry(); availabilityOracle = new AvailabilityOracle(); portalERC20 = new PortalERC20(); @@ -56,15 +75,20 @@ contract SpartaTest is DecoderBase { merkleTestUtil = new MerkleTestUtil(); txsHelper = new TxsDecoderHelper(); - for (uint256 i = 1; i < 5; i++) { + for (uint256 i = 1; i < _validatorCount + 1; i++) { uint256 privateKey = uint256(keccak256(abi.encode("validator", i))); address validator = vm.addr(privateKey); privateKeys[validator] = privateKey; rollup.addValidator(validator); } + _; } - function testProposerForNonSetupEpoch(uint8 _epochsToJump) public { + function testProposerForNonSetupEpoch(uint8 _epochsToJump) public setup(4) { + if (Constants.IS_DEV_NET == 1) { + return; + } + uint256 pre = rollup.getCurrentEpoch(); vm.warp( block.timestamp + uint256(_epochsToJump) * rollup.EPOCH_DURATION() * rollup.SLOT_DURATION() @@ -81,21 +105,18 @@ contract SpartaTest is DecoderBase { assertEq(expectedProposer, actualProposer, "Invalid proposer"); } - function testValidatorSetLargerThanCommittee(bool _insufficientSigs) public { - _testBlock("mixed_block_1", false, 0, false); // We run a block before the epoch with validators - - // Adding more validators! - for (uint256 i = 5; i < 100; i++) { - uint256 privateKey = uint256(keccak256(abi.encode("validator", i))); - address validator = vm.addr(privateKey); - privateKeys[validator] = privateKey; - rollup.addValidator(validator); + function testValidatorSetLargerThanCommittee(bool _insufficientSigs) public setup(100) { + if (Constants.IS_DEV_NET == 1) { + return; } assertGt(rollup.getValidators().length, rollup.TARGET_COMMITTEE_SIZE(), "Not enough validators"); + _testBlock("mixed_block_1", false, 0, false); // We run a block before the epoch with validators + + uint256 ts = block.timestamp + rollup.EPOCH_DURATION() * rollup.SLOT_DURATION(); uint256 committeSize = rollup.TARGET_COMMITTEE_SIZE() * 2 / 3 + (_insufficientSigs ? 0 : 1); - _testBlock("mixed_block_2", _insufficientSigs, committeSize, false); // We need signatures! + _testBlock("mixed_block_2", _insufficientSigs, committeSize, false, ts); // We need signatures! assertEq( rollup.getEpochCommittee(rollup.getCurrentEpoch()).length, @@ -104,17 +125,29 @@ contract SpartaTest is DecoderBase { ); } - function testHappyPath() public { + function testHappyPath() public setup(4) { + if (Constants.IS_DEV_NET == 1) { + return; + } + _testBlock("mixed_block_1", false, 0, false); // We run a block before the epoch with validators _testBlock("mixed_block_2", false, 3, false); // We need signatures! } - function testInvalidProposer() public { + function testInvalidProposer() public setup(4) { + if (Constants.IS_DEV_NET == 1) { + return; + } + _testBlock("mixed_block_1", false, 0, false); // We run a block before the epoch with validators _testBlock("mixed_block_2", true, 3, true); // We need signatures! } - function testInsufficientSigs() public { + function testInsufficientSigs() public setup(4) { + if (Constants.IS_DEV_NET == 1) { + return; + } + _testBlock("mixed_block_1", false, 0, false); // We run a block before the epoch with validators _testBlock("mixed_block_2", true, 2, false); // We need signatures! } @@ -130,7 +163,17 @@ contract SpartaTest is DecoderBase { bool _expectRevert, uint256 _signatureCount, bool _invalidaProposer - ) public { + ) internal { + _testBlock(_name, _expectRevert, _signatureCount, _invalidaProposer, 0); + } + + function _testBlock( + string memory _name, + bool _expectRevert, + uint256 _signatureCount, + bool _invalidaProposer, + uint256 _ts + ) internal { DecoderBase.Full memory full = load(_name); bytes memory header = full.block.header; bytes32 archive = full.block.archive; @@ -139,7 +182,18 @@ contract SpartaTest is DecoderBase { StructToAvoidDeepStacks memory ree; // We jump to the time of the block. (unless it is in the past) - vm.warp(max(block.timestamp, full.block.decodedHeader.globalVariables.timestamp)); + vm.warp(max(block.timestamp, max(full.block.decodedHeader.globalVariables.timestamp, _ts))); + + if (_ts > 0) { + // Update the timestamp and slot in the header + uint256 slotValue = rollup.getCurrentSlot(); + uint256 timestampMemoryPosition = 0x01b4; + uint256 slotMemoryPosition = 0x0194; + assembly { + mstore(add(header, add(0x20, timestampMemoryPosition)), _ts) + mstore(add(header, add(0x20, slotMemoryPosition)), slotValue) + } + } _populateInbox(full.populate.sender, full.populate.recipient, full.populate.l1ToL2Content); @@ -161,13 +215,19 @@ contract SpartaTest is DecoderBase { signatures[i] = createSignature(validators[i], archive); } - if (_expectRevert && _signatureCount < ree.needed) { - vm.expectRevert( - abi.encodeWithSelector( - Errors.Leonidas__InsufficientAttestations.selector, ree.needed, _signatureCount - ) - ); + if (_expectRevert) { ree.shouldRevert = true; + if (_signatureCount < ree.needed) { + vm.expectRevert( + abi.encodeWithSelector( + Errors.Leonidas__InsufficientAttestationsProvided.selector, + ree.needed, + _signatureCount + ) + ); + } + // @todo Handle SignatureLib__InvalidSignature case + // @todo Handle Leonidas__InsufficientAttestations case } if (_expectRevert && _invalidaProposer) { @@ -191,6 +251,8 @@ contract SpartaTest is DecoderBase { rollup.process(header, archive); } + assertEq(_expectRevert, ree.shouldRevert, "Invalid revert expectation"); + assertEq(inbox.toConsume(), toConsume + 1, "Message subtree not consumed"); bytes32 l2ToL1MessageTreeRoot; @@ -248,7 +310,8 @@ contract SpartaTest is DecoderBase { returns (SignatureLib.Signature memory) { uint256 privateKey = privateKeys[_signer]; - (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, _digest); + bytes32 digestForSig = _digest.toEthSignedMessageHash(); + (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digestForSig); return SignatureLib.Signature({isEmpty: false, v: v, r: r, s: s}); } diff --git a/noir-projects/aztec-nr/.gitrepo b/noir-projects/aztec-nr/.gitrepo index 8674671f2d4..998c1f6741f 100644 --- a/noir-projects/aztec-nr/.gitrepo +++ b/noir-projects/aztec-nr/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/AztecProtocol/aztec-nr branch = master - commit = 13b2a6ab0a435b7cfb09b8862b7ffc17bda16034 + commit = 87eccca7818bf4b9adc270730c404b08794e9a90 method = merge cmdver = 0.4.6 - parent = af9acb9698eaae764435299e7b5e563b0623c3f2 + parent = 532a4cfe76b15938c06941e8fb7c86a4fdbf339f diff --git a/noir-projects/aztec-nr/authwit/src/auth.nr b/noir-projects/aztec-nr/authwit/src/auth.nr index a6c2d91f9cb..dd3cbb900f1 100644 --- a/noir-projects/aztec-nr/authwit/src/auth.nr +++ b/noir-projects/aztec-nr/authwit/src/auth.nr @@ -258,7 +258,7 @@ pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_ * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry. * - * @param on_behalf_of The address that have authorized the the `inner_hash` + * @param on_behalf_of The address that have authorized the `inner_hash` */ pub fn assert_inner_hash_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress, inner_hash: Field) { let result: Field = context.call_public_function( @@ -316,7 +316,7 @@ pub fn compute_inner_authwit_hash(args: [Field; N]) -> Field { * * Using the `on_behalf_of` and the `inner_hash` to ensure that the nullifier is siloed for a specific `on_behalf_of`. * - * @param on_behalf_of The address that have authorized the the `inner_hash` + * @param on_behalf_of The address that have authorized the `inner_hash` * @param inner_hash The hash of the message to authorize */ pub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) -> Field { diff --git a/noir-projects/aztec-nr/aztec/src/initializer.nr b/noir-projects/aztec-nr/aztec/src/initializer.nr index 039abcec656..dc612afc342 100644 --- a/noir-projects/aztec-nr/aztec/src/initializer.nr +++ b/noir-projects/aztec-nr/aztec/src/initializer.nr @@ -24,16 +24,8 @@ pub fn assert_is_initialized_public(context: &mut PublicContext) { } pub fn assert_is_initialized_private(context: &mut PrivateContext) { - let init_nullifier = compute_contract_initialization_nullifier(context.this_address()); - let header = context.get_header(); - header.prove_nullifier_inclusion(init_nullifier); -} - -fn compute_contract_initialization_nullifier(address: AztecAddress) -> Field { - compute_siloed_nullifier( - address, - compute_unsiloed_contract_initialization_nullifier(address) - ) + let init_nullifier = compute_unsiloed_contract_initialization_nullifier(context.this_address()); + context.push_nullifier_read_request(init_nullifier); } fn compute_unsiloed_contract_initialization_nullifier(address: AztecAddress) -> Field { diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter/mod.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter/mod.nr index 22c9857230d..f806dae9d27 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter/mod.nr @@ -103,21 +103,29 @@ pub fn get_note( note } -pub fn get_notes( +pub fn get_notes( context: &mut PrivateContext, storage_slot: Field, - options: NoteGetterOptions + options: NoteGetterOptions ) -> BoundedVec where Note: NoteInterface + Eq { let opt_notes = get_notes_internal(storage_slot, options); constrain_get_notes_internal(context, storage_slot, opt_notes, options) } -fn constrain_get_notes_internal( +unconstrained fn apply_preprocessor( + notes: [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], + preprocessor: fn([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], PREPROCESSOR_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], + preprocessor_args: PREPROCESSOR_ARGS +) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL] { + preprocessor(notes, preprocessor_args) +} + +fn constrain_get_notes_internal( context: &mut PrivateContext, storage_slot: Field, opt_notes: [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], - options: NoteGetterOptions + options: NoteGetterOptions ) -> BoundedVec where Note: NoteInterface + Eq { // The filter is applied first to avoid pushing note read requests for notes we're not interested in. Note that // while the filter function can technically mutate the contents of the notes (as opposed to simply removing some), @@ -181,9 +189,9 @@ unconstrained fn get_note_internal(storage_slot: F )[0].unwrap() // Notice: we don't allow dummies to be returned from get_note (singular). } -unconstrained fn get_notes_internal( +unconstrained fn get_notes_internal( storage_slot: Field, - options: NoteGetterOptions + options: NoteGetterOptions ) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL] where Note: NoteInterface { // This function simply performs some transformations from NoteGetterOptions into the types required by the oracle. @@ -192,7 +200,7 @@ unconstrained fn get_notes_internal( let placeholder_fields = [0; GET_NOTES_ORACLE_RETURN_LENGTH]; let placeholder_note_length = [0; N]; - oracle::notes::get_notes( + let opt_notes = oracle::notes::get_notes( storage_slot, num_selects, select_by_indexes, @@ -210,7 +218,9 @@ unconstrained fn get_notes_internal( placeholder_opt_notes, placeholder_fields, placeholder_note_length - ) + ); + + apply_preprocessor(opt_notes, options.preprocessor, options.preprocessor_args) } unconstrained pub fn view_notes( diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr index 7bc535b052f..61049c8f19e 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr @@ -78,46 +78,77 @@ fn return_all_notes( } // docs:start:NoteGetterOptions -struct NoteGetterOptions { +struct NoteGetterOptions { selects: BoundedVec, N>, sorts: BoundedVec, N>, limit: u32, offset: u32, + // Preprocessor and filter functions are used to filter notes. The preprocessor is applied before the filter and + // unlike filter it is applied in an unconstrained context. + preprocessor: fn ([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], PREPROCESSOR_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], + preprocessor_args: PREPROCESSOR_ARGS, filter: fn ([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], FILTER_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], filter_args: FILTER_ARGS, status: u8, } // docs:end:NoteGetterOptions -// When retrieving notes using the NoteGetterOptions, the configurations are applied in a specific sequence to ensure precise and controlled data retrieval. +// When retrieving notes using the NoteGetterOptions, the configurations are applied in a specific sequence to ensure +// precise and controlled data retrieval. // The database-level configurations are applied first: -// `selects` to specify fields, `sorts` to establish sorting criteria, `offset` to skip items, and `limit` to cap the result size. -// And finally, a custom filter to refine the outcome further. -impl NoteGetterOptions { +// `selects` to specify fields, `sorts` to establish sorting criteria, `offset` to skip items, and `limit` to cap +// the result size. +// And finally, a custom preprocessor and filter to refine the outcome further. +impl NoteGetterOptions { // This function initializes a NoteGetterOptions that simply returns the maximum number of notes allowed in a call. - pub fn new() -> NoteGetterOptions where Note: NoteInterface { + pub fn new() -> NoteGetterOptions where Note: NoteInterface { NoteGetterOptions { selects: BoundedVec::new(), sorts: BoundedVec::new(), limit: MAX_NOTE_HASH_READ_REQUESTS_PER_CALL as u32, offset: 0, + preprocessor: return_all_notes, + preprocessor_args: 0, filter: return_all_notes, filter_args: 0, status: NoteStatus.ACTIVE } } - // This function initializes a NoteGetterOptions with a filter, which takes the notes returned from the database and filter_args as its parameters. + // This function initializes a NoteGetterOptions with a preprocessor, which takes the notes returned from + // the database and preprocessor_args as its parameters. + // `preprocessor_args` allows you to provide additional data or context to the custom preprocessor. + pub fn with_preprocessor( + preprocessor: fn([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], PREPROCESSOR_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], + preprocessor_args: PREPROCESSOR_ARGS + ) -> NoteGetterOptions where Note: NoteInterface { + NoteGetterOptions { + selects: BoundedVec::new(), + sorts: BoundedVec::new(), + limit: MAX_NOTE_HASH_READ_REQUESTS_PER_CALL as u32, + offset: 0, + preprocessor, + preprocessor_args, + filter: return_all_notes, + filter_args: 0, + status: NoteStatus.ACTIVE + } + } + + // This function initializes a NoteGetterOptions with a filter, which takes + // the notes returned from the database and filter_args as its parameters. // `filter_args` allows you to provide additional data or context to the custom filter. pub fn with_filter( filter: fn([Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], FILTER_ARGS) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], filter_args: FILTER_ARGS - ) -> Self where Note: NoteInterface { + ) -> NoteGetterOptions where Note: NoteInterface { NoteGetterOptions { selects: BoundedVec::new(), sorts: BoundedVec::new(), limit: MAX_NOTE_HASH_READ_REQUESTS_PER_CALL as u32, offset: 0, + preprocessor: return_all_notes, + preprocessor_args: 0, filter, filter_args, status: NoteStatus.ACTIVE diff --git a/noir-projects/aztec-nr/aztec/src/prelude.nr b/noir-projects/aztec-nr/aztec/src/prelude.nr index a280ee03154..5b2744d20af 100644 --- a/noir-projects/aztec-nr/aztec/src/prelude.nr +++ b/noir-projects/aztec-nr/aztec/src/prelude.nr @@ -1,6 +1,6 @@ // docs:start:prelude use dep::protocol_types::{ - address::{AztecAddress, EthAddress}, abis::function_selector::FunctionSelector, + address::{AztecAddress, EthAddress}, abis::function_selector::FunctionSelector, point::Point, traits::{Serialize, Deserialize} }; use crate::{ diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr index 7902602ca09..9051cb86f85 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr @@ -41,7 +41,28 @@ impl PrivateSet where N } // docs:end:insert - // docs:start:remove + pub fn pop_notes( + self, + options: NoteGetterOptions + ) -> BoundedVec { + let notes = get_notes(self.context, self.storage_slot, options); + // We iterate in a range 0..options.limit instead of 0..notes.len() because options.limit is known at compile + // time and hence will result in less constraints when set to a lower value than + // MAX_NOTE_HASH_READ_REQUESTS_PER_CALL. + for i in 0..options.limit { + if i < notes.len() { + let note = notes.get_unchecked(i); + // We immediately destroy the note without doing any of the read request checks `remove` typically + // performs because we know that the `get_notes` call has already placed those constraints. + destroy_note(self.context, note); + } + } + + notes + } + + /// Note that if you obtained the note via `get_notes` it's much better to use `pop_notes` as `pop_notes` results + /// in significantly less constrains due to avoiding an extra hash and read request check. pub fn remove(self, note: Note) { let note_hash = compute_note_hash_for_read_request(note); let has_been_read = self.context.note_hash_read_requests.any(|r: ReadRequest| r.value == note_hash); @@ -49,16 +70,15 @@ impl PrivateSet where N destroy_note(self.context, note); } - // docs:end:remove - // docs:start:get_notes - pub fn get_notes( + /// Note that if you later on remove the note it's much better to use `pop_notes` as `pop_notes` results + /// in significantly less constrains due to avoiding 1 read request check. + pub fn get_notes( self, - options: NoteGetterOptions + options: NoteGetterOptions ) -> BoundedVec { get_notes(self.context, self.storage_slot, options) } - // docs:end:get_notes } impl PrivateSet where Note: NoteInterface { diff --git a/noir-projects/aztec-nr/aztec/src/utils/point.nr b/noir-projects/aztec-nr/aztec/src/utils/point.nr index 20c6af687f8..249df9e2b0b 100644 --- a/noir-projects/aztec-nr/aztec/src/utils/point.nr +++ b/noir-projects/aztec-nr/aztec/src/utils/point.nr @@ -9,6 +9,8 @@ global BN254_FR_MODULUS_DIV_2: Field = 10944121435919637611123202872628637544274 /// We don't serialize the point at infinity flag because this function is used in situations where we do not want /// to waste the extra byte (encrypted log). pub fn point_to_bytes(pk: Point) -> [u8; 32] { + // Note that there is 1 more free bit in the 32 bytes (254 bits currently occupied by the x coordinate, 1 bit for + // the "sign") so it's possible to use that last bit as an "is_infinite" flag if desired in the future. assert(!pk.is_infinite, "Cannot serialize point at infinity as bytes."); let mut result = pk.x.to_be_bytes(32); diff --git a/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr b/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr index 0d93ae6fc21..799bd038f9c 100644 --- a/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr +++ b/noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr @@ -39,21 +39,16 @@ impl EasyPrivateUint<&mut PrivateContext> { let header = self.context.get_header(); let owner_npk_m_hash = header.get_npk_m_hash(self.context, owner); - // docs:start:get_notes + // docs:start:pop_notes let options = NoteGetterOptions::with_filter(filter_notes_min_sum, subtrahend as Field); - let notes = self.set.get_notes(options); - // docs:end:get_notes + let notes = self.set.pop_notes(options); + // docs:end:pop_notes let mut minuend: u64 = 0; for i in 0..options.limit { if i < notes.len() { let note = notes.get_unchecked(i); - // Removes the note from the owner's set of notes. - // docs:start:remove - self.set.remove(note); - // docs:end:remove - minuend += note.value as u64; } } diff --git a/noir-projects/aztec-nr/value-note/src/utils.nr b/noir-projects/aztec-nr/value-note/src/utils.nr index a66a951b00d..0f67f82eddf 100644 --- a/noir-projects/aztec-nr/value-note/src/utils.nr +++ b/noir-projects/aztec-nr/value-note/src/utils.nr @@ -5,7 +5,7 @@ use crate::{filter::filter_notes_min_sum, value_note::{ValueNote, VALUE_NOTE_LEN // Sort the note values (0th field) in descending order. // Pick the fewest notes whose sum is equal to or greater than `amount`. -pub fn create_note_getter_options_for_decreasing_balance(amount: Field) -> NoteGetterOptions { +pub fn create_note_getter_options_for_decreasing_balance(amount: Field) -> NoteGetterOptions { NoteGetterOptions::with_filter(filter_notes_min_sum, amount).sort(ValueNote::properties().value, SortOrder.DESC) } @@ -55,14 +55,13 @@ pub fn decrement_by_at_most( outgoing_viewer: AztecAddress ) -> Field { let options = create_note_getter_options_for_decreasing_balance(max_amount); - let notes = balance.get_notes(options); + let notes = balance.pop_notes(options); let mut decremented = 0; for i in 0..options.limit { if i < notes.len() { let note = notes.get_unchecked(i); - - decremented += destroy_note(balance, note); + decremented += note.value; } } @@ -76,11 +75,3 @@ pub fn decrement_by_at_most( decremented } - -// Removes the note from the owner's set of notes. -// Returns the value of the destroyed note. -pub fn destroy_note(balance: PrivateSet, note: ValueNote) -> Field { - balance.remove(note); - - note.value -} diff --git a/noir-projects/noir-contracts/Nargo.toml b/noir-projects/noir-contracts/Nargo.toml index bbd466a5585..e94fde5b221 100644 --- a/noir-projects/noir-contracts/Nargo.toml +++ b/noir-projects/noir-contracts/Nargo.toml @@ -20,9 +20,10 @@ members = [ "contracts/docs_example_contract", "contracts/easy_private_token_contract", "contracts/easy_private_voting_contract", - "contracts/ecdsa_account_contract", + "contracts/ecdsa_k_account_contract", + "contracts/ecdsa_r_account_contract", "contracts/escrow_contract", - "contracts/gas_token_contract", + "contracts/fee_juice_contract", "contracts/import_test_contract", "contracts/key_registry_contract", "contracts/inclusion_proofs_contract", diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/app_subscription_contract/Nargo.toml index cf460fd9497..956f7855db0 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/Nargo.toml +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/Nargo.toml @@ -7,5 +7,4 @@ type = "contract" [dependencies] aztec = { path = "../../../aztec-nr/aztec" } authwit = { path = "../../../aztec-nr/authwit" } -gas_token = { path = "../gas_token_contract" } -token = { path = "../token_contract" } \ No newline at end of file +token = { path = "../token_contract" } diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr index ab5054e44b0..9547ff2c0a2 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr @@ -13,7 +13,6 @@ contract AppSubscription { protocol_types::constants::MAX_FIELD_VALUE }; use authwit::{auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit}; - use gas_token::GasToken; use token::Token; #[aztec(storage)] @@ -26,8 +25,7 @@ contract AppSubscription { subscription_recipient_address: SharedImmutable, subscription_price: SharedImmutable, subscriptions: Map>, - gas_token_address: SharedImmutable, - gas_token_limit_per_tx: SharedImmutable, + fee_juice_limit_per_tx: SharedImmutable, } global SUBSCRIPTION_DURATION_IN_BLOCKS = 5; @@ -50,8 +48,8 @@ contract AppSubscription { context.set_as_fee_payer(); - // TODO(palla/gas) Assert gas_token_limit_per_tx is less than this tx gas_limit - let _gas_limit = storage.gas_token_limit_per_tx.read_private(); + // TODO(palla/gas) Assert fee_juice_limit_per_tx is less than this tx gas_limit + let _gas_limit = storage.fee_juice_limit_per_tx.read_private(); context.end_setup(); @@ -67,15 +65,13 @@ contract AppSubscription { subscription_recipient_address: AztecAddress, subscription_token_address: AztecAddress, subscription_price: Field, - gas_token_address: AztecAddress, - gas_token_limit_per_tx: Field + fee_juice_limit_per_tx: Field ) { storage.target_address.initialize(target_address); storage.subscription_token_address.initialize(subscription_token_address); storage.subscription_recipient_address.initialize(subscription_recipient_address); storage.subscription_price.initialize(subscription_price); - storage.gas_token_address.initialize(gas_token_address); - storage.gas_token_limit_per_tx.initialize(gas_token_limit_per_tx); + storage.fee_juice_limit_per_tx.initialize(fee_juice_limit_per_tx); } #[aztec(public)] diff --git a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr index 8285e40177c..5f7690615da 100644 --- a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr @@ -31,9 +31,8 @@ contract Benchmarking { fn recreate_note(owner: AztecAddress, outgoing_viewer: AztecAddress, index: u32) { let owner_notes = storage.notes.at(owner); let mut getter_options = NoteGetterOptions::new(); - let notes = owner_notes.get_notes(getter_options.set_limit(1).set_offset(index)); + let notes = owner_notes.pop_notes(getter_options.set_limit(1).set_offset(index)); let note = notes.get(0); - owner_notes.remove(note); increment(owner_notes, note.value, owner, outgoing_viewer); } diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr index 0d315f4e314..a65ec2aff9c 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr @@ -120,43 +120,10 @@ impl Deck<&mut PrivateContext> { inserted_cards } - pub fn get_cards(&mut self, cards: [Card; N]) -> [CardNote; N] { - let options = NoteGetterOptions::with_filter(filter_cards, cards); - let notes = self.set.get_notes(options); - - // This array will hold the notes that correspond to each of the requested cards. It begins empty (with all the - // options being none) and we gradually fill it up as we find the matching notes. - let mut found_cards = [Option::none(); N]; - - for i in 0..options.limit { - if i < notes.len() { - let card_note = CardNote::from_note(notes.get_unchecked(i)); - - // For each note that we read, we search for a matching card that we have not already marked as found. - for j in 0..cards.len() { - if found_cards[j].is_none() - & (cards[j].strength == card_note.card.strength) - & (cards[j].points == card_note.card.points) { - found_cards[j] = Option::some(card_note); - } - } - } - } - - // And then we assert that we did indeed find all cards, since found_cards and cards have the same length. - found_cards.map( - |card_note: Option| { - assert(card_note.is_some(), "Card not found"); - card_note.unwrap_unchecked() - } - ) - } - pub fn remove_cards(&mut self, cards: [Card; N]) { - let card_notes = self.get_cards(cards); - for card_note in card_notes { - self.set.remove(card_note.note); - } + let options = NoteGetterOptions::with_filter(filter_cards, cards); + let notes = self.set.pop_notes(options); + assert(notes.len() == N, "Not all cards were removed"); } } diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr index df478482f1f..51e8f090500 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr @@ -10,7 +10,7 @@ use dep::aztec::note::note_getter_options::{Sort, SortOrder}; pub fn create_points_card_getter_options( points: Field, offset: u32 -) -> NoteGetterOptions { +) -> NoteGetterOptions { let mut options = NoteGetterOptions::new(); options.select(CardNote::properties().points, points, Option::none()).sort(CardNote::properties().points, SortOrder.DESC).set_offset(offset) } @@ -21,7 +21,7 @@ pub fn create_exact_card_getter_options( points: u8, secret: Field, account_npk_m_hash: Field -) -> NoteGetterOptions { +) -> NoteGetterOptions { let mut options = NoteGetterOptions::new(); options.select(CardNote::properties().points, points as Field, Option::none()).select(CardNote::properties().randomness, secret, Option::none()).select( CardNote::properties().npk_m_hash, @@ -49,13 +49,13 @@ pub fn filter_min_points( // docs:end:state_vars-OptionFilter // docs:start:state_vars-NoteGetterOptionsFilter -pub fn create_cards_with_min_points_getter_options(min_points: u8) -> NoteGetterOptions { +pub fn create_cards_with_min_points_getter_options(min_points: u8) -> NoteGetterOptions { NoteGetterOptions::with_filter(filter_min_points, min_points).sort(CardNote::properties().points, SortOrder.ASC) } // docs:end:state_vars-NoteGetterOptionsFilter // docs:start:state_vars-NoteGetterOptionsPickOne -pub fn create_largest_card_getter_options() -> NoteGetterOptions { +pub fn create_largest_card_getter_options() -> NoteGetterOptions { let mut options = NoteGetterOptions::new(); options.sort(CardNote::properties().points, SortOrder.DESC).set_limit(1) } diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/Nargo.toml similarity index 65% rename from noir-projects/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml rename to noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/Nargo.toml index 3be9963cdae..2a7dd2645db 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml +++ b/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "ecdsa_account_contract" +name = "ecdsa_k_account_contract" authors = [""] compiler_version = ">=0.25.0" type = "contract" @@ -7,3 +7,4 @@ type = "contract" [dependencies] aztec = { path = "../../../aztec-nr/aztec" } authwit = { path = "../../../aztec-nr/authwit" } +ecdsa_public_key_note = { path = "../ecdsa_public_key_note" } diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/src/main.nr similarity index 96% rename from noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr rename to noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/src/main.nr index f4495e48217..cbb29eb3779 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_k_account_contract/src/main.nr @@ -1,8 +1,6 @@ -mod ecdsa_public_key_note; - // Account contract that uses ECDSA signatures for authentication on the same curve as Ethereum. // The signing key is stored in an immutable private note and should be different from the signing key. -contract EcdsaAccount { +contract EcdsaKAccount { use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable}; use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note; @@ -14,7 +12,7 @@ contract EcdsaAccount { auth_witness::get_auth_witness }; - use crate::ecdsa_public_key_note::EcdsaPublicKeyNote; + use dep::ecdsa_public_key_note::EcdsaPublicKeyNote; #[aztec(storage)] struct Storage { diff --git a/noir-projects/noir-contracts/contracts/ecdsa_public_key_note/Nargo.toml b/noir-projects/noir-contracts/contracts/ecdsa_public_key_note/Nargo.toml new file mode 100644 index 00000000000..6399145f965 --- /dev/null +++ b/noir-projects/noir-contracts/contracts/ecdsa_public_key_note/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "ecdsa_public_key_note" +authors = ["aztec-labs"] +compiler_version = ">=0.25.0" +type = "lib" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr b/noir-projects/noir-contracts/contracts/ecdsa_public_key_note/src/lib.nr similarity index 100% rename from noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr rename to noir-projects/noir-contracts/contracts/ecdsa_public_key_note/src/lib.nr diff --git a/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/Nargo.toml new file mode 100644 index 00000000000..2c51fa00b77 --- /dev/null +++ b/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "ecdsa_r_account_contract" +authors = [""] +compiler_version = ">=0.25.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } +ecdsa_public_key_note = { path = "../ecdsa_public_key_note" } diff --git a/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/src/main.nr new file mode 100644 index 00000000000..b5f76de410a --- /dev/null +++ b/noir-projects/noir-contracts/contracts/ecdsa_r_account_contract/src/main.nr @@ -0,0 +1,73 @@ +// Account contract that uses ECDSA signatures for authentication on random version of the p256 curve (to use with touchID). +contract EcdsaRAccount { + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable}; + use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note; + + use dep::aztec::protocol_types::abis::call_context::CallContext; + use dep::std; + + use dep::authwit::{ + entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, + auth_witness::get_auth_witness + }; + + use dep::ecdsa_public_key_note::EcdsaPublicKeyNote; + + #[aztec(storage)] + struct Storage { + public_key: PrivateImmutable, + } + + // Creates a new account out of an ECDSA public key to use for signature verification + #[aztec(private)] + #[aztec(initializer)] + fn constructor(signing_pub_key_x: [u8; 32], signing_pub_key_y: [u8; 32]) { + let this = context.this_address(); + let header = context.get_header(); + let this_npk_m_hash = header.get_npk_m_hash(&mut context, this); + // Not emitting outgoing for msg_sender here to not have to register keys for the contract through which we + // deploy this (typically MultiCallEntrypoint). I think it's ok here as I feel the outgoing here is not that + // important. + + let mut pub_key_note = EcdsaPublicKeyNote::new(signing_pub_key_x, signing_pub_key_y, this_npk_m_hash); + storage.public_key.initialize(&mut pub_key_note).emit(encode_and_encrypt_note(&mut context, this, this)); + } + + // Note: If you globally change the entrypoint signature don't forget to update default_entrypoint.ts + #[aztec(private)] + fn entrypoint(app_payload: AppPayload, fee_payload: FeePayload) { + let actions = AccountActions::init(&mut context, is_valid_impl); + actions.entrypoint(app_payload, fee_payload); + } + + #[aztec(private)] + #[aztec(noinitcheck)] + #[aztec(view)] + fn verify_private_authwit(inner_hash: Field) -> Field { + let actions = AccountActions::init(&mut context, is_valid_impl); + actions.verify_private_authwit(inner_hash) + } + + #[contract_library_method] + fn is_valid_impl(context: &mut PrivateContext, outer_hash: Field) -> bool { + // Load public key from storage + let storage = Storage::init(context); + let public_key = storage.public_key.get_note(); + + // Load auth witness + let witness: [Field; 64] = get_auth_witness(outer_hash); + let mut signature: [u8; 64] = [0; 64]; + for i in 0..64 { + signature[i] = witness[i] as u8; + } + + // Verify payload signature using Ethereum's signing scheme + // Note that noir expects the hash of the message/challenge as input to the ECDSA verification. + let outer_hash_bytes: [u8; 32] = outer_hash.to_be_bytes(32).as_array(); + let hashed_message: [u8; 32] = std::hash::sha256(outer_hash_bytes); + let verification = std::ecdsa_secp256r1::verify_signature(public_key.x, public_key.y, signature, hashed_message); + assert(verification == true); + + true + } +} diff --git a/noir-projects/noir-contracts/contracts/gas_token_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/fee_juice_contract/Nargo.toml similarity index 72% rename from noir-projects/noir-contracts/contracts/gas_token_contract/Nargo.toml rename to noir-projects/noir-contracts/contracts/fee_juice_contract/Nargo.toml index 4ae5a749f3b..bab26316c4e 100644 --- a/noir-projects/noir-contracts/contracts/gas_token_contract/Nargo.toml +++ b/noir-projects/noir-contracts/contracts/fee_juice_contract/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "gas_token_contract" +name = "fee_juice_contract" authors = [""] compiler_version = ">=0.25.0" type = "contract" @@ -8,4 +8,4 @@ type = "contract" aztec = { path = "../../../aztec-nr/aztec" } authwit = { path = "../../../aztec-nr/authwit" } deployer = { path = "../contract_instance_deployer_contract" } -registerer = { path = "../contract_class_registerer_contract" } \ No newline at end of file +registerer = { path = "../contract_class_registerer_contract" } diff --git a/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr similarity index 100% rename from noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr rename to noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr diff --git a/noir-projects/noir-contracts/contracts/gas_token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr similarity index 92% rename from noir-projects/noir-contracts/contracts/gas_token_contract/src/main.nr rename to noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr index 96b25801626..b753fa9cecd 100644 --- a/noir-projects/noir-contracts/contracts/gas_token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr @@ -1,6 +1,6 @@ mod lib; -contract GasToken { +contract FeeJuice { use dep::aztec::{ protocol_types::{ contract_class_id::ContractClassId, abis::function_selector::FunctionSelector, @@ -42,12 +42,12 @@ contract GasToken { public_bytecode_commitment ); assert( - instance.contract_class_id == contract_class_id, "Invalid contract class id computed for gas token" + instance.contract_class_id == contract_class_id, "Invalid contract class id computed for Fee Juice" ); // Increase self balance and set as fee payer, and end setup let deploy_fees = 20000000000; - GasToken::at(self)._increase_public_balance(self, deploy_fees).enqueue(&mut context); + FeeJuice::at(self)._increase_public_balance(self, deploy_fees).enqueue(&mut context); context.set_as_fee_payer(); context.end_setup(); @@ -66,11 +66,11 @@ contract GasToken { ).call(&mut context); // Enqueue call to set the portal address - GasToken::at(self).set_portal(portal_address).enqueue(&mut context); + FeeJuice::at(self).set_portal(portal_address).enqueue(&mut context); } // We purposefully not set this function as an initializer so we do not bind - // the contract to a specific L1 portal address, since the gas token address + // the contract to a specific L1 portal address, since the Fee Juice address // is a hardcoded constant in the rollup circuits. #[aztec(public)] fn set_portal(portal_address: EthAddress) { @@ -90,7 +90,7 @@ contract GasToken { // TODO(palla/gas) Emit an unencrypted log to announce which L1 to L2 message has been claimed // Otherwise, we cannot trace L1 deposits to their corresponding claims on L2 - GasToken::at(context.this_address())._increase_public_balance(to, amount).enqueue(&mut context); + FeeJuice::at(context.this_address())._increase_public_balance(to, amount).enqueue(&mut context); } #[aztec(public)] @@ -116,7 +116,7 @@ contract GasToken { // TODO(@just-mitch): remove this function before mainnet deployment // convenience function for testing - // the true canonical gas token contract will not have this function + // the true canonical Fee Juice contract will not have this function #[aztec(public)] fn mint_public(to: AztecAddress, amount: Field) { let amount = U128::from_integer(amount); diff --git a/noir-projects/noir-contracts/contracts/fpc_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/fpc_contract/Nargo.toml index 96bd8bacba7..b1f9481c44e 100644 --- a/noir-projects/noir-contracts/contracts/fpc_contract/Nargo.toml +++ b/noir-projects/noir-contracts/contracts/fpc_contract/Nargo.toml @@ -8,4 +8,3 @@ type = "contract" aztec = { path = "../../../aztec-nr/aztec" } authwit = { path = "../../../aztec-nr/authwit" } token = { path = "../token_contract" } -gas_token = { path = "../gas_token_contract" } diff --git a/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr b/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr index 68be91d4dde..2aab1481669 100644 --- a/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr @@ -6,20 +6,17 @@ contract FPC { state_vars::SharedImmutable, context::gas::GasOpts }; use dep::token::Token; - use dep::gas_token::GasToken; use crate::lib::compute_rebate; #[aztec(storage)] struct Storage { other_asset: SharedImmutable, - gas_token_address: SharedImmutable, } #[aztec(public)] #[aztec(initializer)] - fn constructor(other_asset: AztecAddress, gas_token_address: AztecAddress) { + fn constructor(other_asset: AztecAddress) { storage.other_asset.initialize(other_asset); - storage.gas_token_address.initialize(gas_token_address); } #[aztec(private)] diff --git a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr index 2c9e092e2da..d91d5455807 100644 --- a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr @@ -149,10 +149,8 @@ contract InclusionProofs { let private_values = storage.private_values.at(owner); let mut options = NoteGetterOptions::new(); options = options.set_limit(1); - let notes = private_values.get_notes(options); - let note = notes.get(0); - - private_values.remove(note); + let notes = private_values.pop_notes(options); + assert(notes.len() == 1, "note not popped"); } // docs:end:nullify_note diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index 5cd3a8e7cac..371cc6afbef 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -39,14 +39,12 @@ contract PendingNoteHashes { let options = NoteGetterOptions::with_filter(filter_notes_min_sum, amount); // get note inserted above - let notes = owner_balance.get_notes(options); + let notes = owner_balance.pop_notes(options); let note0 = notes.get(0); assert(note.value == note0.value); assert(notes.len() == 1); - owner_balance.remove(note0); - note0.value } @@ -137,12 +135,9 @@ contract PendingNoteHashes { let mut options = NoteGetterOptions::new(); options = options.set_limit(1); - let note = owner_balance.get_notes(options).get(0); + let note = owner_balance.pop_notes(options).get(0); assert(expected_value == note.value); - - owner_balance.remove(note); - expected_value } @@ -378,12 +373,9 @@ contract PendingNoteHashes { #[contract_library_method] fn destroy_max_notes(owner: AztecAddress, storage: Storage<&mut PrivateContext>) { let owner_balance = storage.balances.at(owner); - let notes = owner_balance.get_notes(NoteGetterOptions::new()); - - for i in 0..max_notes_per_call() { - let note = notes.get(i); - owner_balance.remove(note); - } + // Note that we're relying on PXE actually returning the notes, we're not constraining that any specific + // numer of notes are deleted. + let _ = owner_balance.pop_notes(NoteGetterOptions::new()); } #[contract_library_method] diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index 0a19e7583da..27a2f6cd6b8 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -474,9 +474,8 @@ contract Test { let secret_hash = compute_secret_hash(secret); let mut options = NoteGetterOptions::new(); options = options.select(TestNote::properties().value, secret_hash, Option::none()).set_limit(1); - let notes = notes_set.get_notes(options); - let note = notes.get(0); - notes_set.remove(note); + let notes = notes_set.pop_notes(options); + assert(notes.len() == 1, "note not popped"); } unconstrained fn get_constant() -> pub Field { diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr index 73685be5bb9..c445e179405 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr @@ -162,20 +162,19 @@ contract TokenBlacklist { let to_roles = storage.roles.at(to).get_current_value_in_private(); assert(!to_roles.is_blacklisted, "Blacklisted: Recipient"); - let pending_shields = storage.pending_shields; let secret_hash = compute_secret_hash(secret); - // Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash - // stored in field with index 1 (select(1, secret_hash)). + + // Pop 1 note (set_limit(1)) which has an amount stored in a field with index 0 (select(0, amount)) and + // a secret_hash stored in a field with index 1 (select(1, secret_hash)). let mut options = NoteGetterOptions::new(); options = options.select(TransparentNote::properties().amount, amount, Option::none()).select( TransparentNote::properties().secret_hash, secret_hash, Option::none() ).set_limit(1); - let notes = pending_shields.get_notes(options); - let note = notes.get(0); - // Remove the note from the pending shields set - pending_shields.remove(note); + + let notes = storage.pending_shields.pop_notes(options); + assert(notes.len() == 1, "note not popped"); // Add the token note to user's balances set let caller = context.msg_sender(); diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr index 882364d9f65..1ce88b39889 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr @@ -81,24 +81,13 @@ impl BalancesMap { owner: AztecAddress, subtrahend: U128 ) -> OuterNoteEmission where T: NoteInterface + OwnedNote + Eq { - // docs:start:get_notes let options = NoteGetterOptions::with_filter(filter_notes_min_sum, subtrahend); - let notes = self.map.at(owner).get_notes(options); - // docs:end:get_notes + let notes = self.map.at(owner).pop_notes(options); let mut minuend: U128 = U128::from_integer(0); for i in 0..options.limit { if i < notes.len() { - let note = notes.get_unchecked(i); - - // Removes the note from the owner's set of notes. - // This will call the the `compute_nullifer` function of the `token_note` - // which require knowledge of the secret key (currently the users encryption key). - // The contract logic must ensure that the spending key is used as well. - // docs:start:remove - self.map.at(owner).remove(note); - // docs:end:remove - + let note: T = notes.get_unchecked(i); minuend = minuend + note.get_amount(); } } diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index 03832189f32..489b9fce80e 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -293,20 +293,19 @@ contract Token { // docs:start:redeem_shield #[aztec(private)] fn redeem_shield(to: AztecAddress, amount: Field, secret: Field) { - let pending_shields = storage.pending_shields; let secret_hash = compute_secret_hash(secret); - // Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash - // stored in field with index 1 (select(1, secret_hash)). + + // Pop 1 note (set_limit(1)) which has an amount stored in a field with index 0 (select(0, amount)) and + // a secret_hash stored in a field with index 1 (select(1, secret_hash)). let mut options = NoteGetterOptions::new(); options = options.select(TransparentNote::properties().amount, amount, Option::none()).select( TransparentNote::properties().secret_hash, secret_hash, Option::none() ).set_limit(1); - let notes = pending_shields.get_notes(options); - let note = notes.get(0); - // Remove the note from the pending shields set - pending_shields.remove(note); + + let notes = storage.pending_shields.pop_notes(options); + assert(notes.len() == 1, "note not popped"); // Add the token note to user's balances set // Note: Using context.msg_sender() as a sender below makes this incompatible with escrows because we send @@ -394,10 +393,22 @@ contract Token { // try_sub failed to nullify enough notes to reach the target amount, so we compute the amount remaining // and try again. let remaining = amount - subtracted; - Token::at(context.this_address())._recurse_subtract_balance(account, remaining.to_field()).call(context) + compute_recurse_subtract_balance_call(*context, account, remaining).call(context) } } + // TODO(#7729): apply no_predicates to the contract interface method directly instead of having to use a wrapper + // like we do here. + #[no_predicates] + #[contract_library_method] + fn compute_recurse_subtract_balance_call( + context: PrivateContext, + account: AztecAddress, + remaining: U128 + ) -> PrivateCallInterface<25, U128, (AztecAddress, Field)> { + Token::at(context.this_address())._recurse_subtract_balance(account, remaining.to_field()) + } + // TODO(#7728): even though the amount should be a U128, we can't have that type in a contract interface due to // serialization issues. #[aztec(internal)] diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/test/minting.nr b/noir-projects/noir-contracts/contracts/token_contract/src/test/minting.nr index 45a60898e62..159c4daf0fc 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/test/minting.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/test/minting.nr @@ -88,7 +88,7 @@ unconstrained fn mint_private_success() { utils::check_private_balance(token_contract_address, owner, mint_amount); } -#[test(should_fail_with="Attempted to read past end of BoundedVec")] +#[test(should_fail_with="note not popped")] unconstrained fn mint_private_failure_double_spend() { // Setup without account contracts. We are not using authwits here, so dummy accounts are enough let (env, token_contract_address, owner, recipient) = utils::setup(/* with_account_contracts */ false); diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr index b357b93bf1a..b7975db3c5a 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr @@ -107,24 +107,18 @@ impl BalancesMap { target_amount: U128, max_notes: u32 ) -> U128 where T: NoteInterface + OwnedNote + Eq { - // docs:start:get_notes - let options = NoteGetterOptions::with_filter(filter_notes_min_sum, target_amount).set_limit(max_notes); - let notes = self.map.at(owner).get_notes(options); - // docs:end:get_notes + // We are using a preprocessor here (filter applied in an unconstrained context) instead of a filter because + // we do not need to prove correct execution of the preprocessor. + // Because the `min_sum` notes is not constrained, users could choose to e.g. not call it. However, all this + // might result in is simply higher DA costs due to more nullifiers being emitted. Since we don't care + // about proving optimal note usage, we can save these constraints and make the circuit smaller. + let options = NoteGetterOptions::with_preprocessor(preprocess_notes_min_sum, target_amount).set_limit(max_notes); + let notes = self.map.at(owner).pop_notes(options); let mut subtracted = U128::from_integer(0); for i in 0..options.limit { if i < notes.len() { let note = notes.get_unchecked(i); - - // Removes the note from the owner's set of notes. - // This will call the the `compute_nullifer` function of the `token_note` - // which require knowledge of the secret key (currently the users encryption key). - // The contract logic must ensure that the spending key is used as well. - // docs:start:remove - self.map.at(owner).remove(note); - // docs:end:remove - subtracted = subtracted + note.get_amount(); } } @@ -135,10 +129,10 @@ impl BalancesMap { // Computes the partial sum of the notes array, stopping once 'min_sum' is reached. This can be used to minimize the // number of notes read that add to some value, e.g. when transferring some amount of tokens. -// The filter does not check if total sum is larger or equal to 'min_sum' - all it does is remove extra notes if it does -// reach that value. -// Note that proper usage of this filter requires for notes to be sorted in descending order. -pub fn filter_notes_min_sum( +// The preprocessor (a filter applied in an unconstrained context) does not check if total sum is larger or equal to +// 'min_sum' - all it does is remove extra notes if it does reach that value. +// Note that proper usage of this preprocessor requires for notes to be sorted in descending order. +pub fn preprocess_notes_min_sum( notes: [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL], min_sum: U128 ) -> [Option; MAX_NOTE_HASH_READ_REQUESTS_PER_CALL] where T: NoteInterface + OwnedNote { diff --git a/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/main.nr index 527024d7ea3..f60a2cffea7 100644 --- a/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/main.nr @@ -280,20 +280,19 @@ contract TokenWithRefunds { // docs:start:redeem_shield #[aztec(private)] fn redeem_shield(to: AztecAddress, amount: Field, secret: Field) { - let pending_shields = storage.pending_shields; let secret_hash = compute_secret_hash(secret); - // Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash - // stored in field with index 1 (select(1, secret_hash)). + + // Pop 1 note (set_limit(1)) which has an amount stored in a field with index 0 (select(0, amount)) and + // a secret_hash stored in a field with index 1 (select(1, secret_hash)). let mut options = NoteGetterOptions::new(); options = options.select(TransparentNote::properties().amount, amount, Option::none()).select( TransparentNote::properties().secret_hash, secret_hash, Option::none() ).set_limit(1); - let notes = pending_shields.get_notes(options); - let note = notes.get_unchecked(0); - // Remove the note from the pending shields set - pending_shields.remove(note); + + let notes = storage.pending_shields.pop_notes(options); + assert(notes.len() == 1, "note not popped"); // Add the token note to user's balances set // Note: Using context.msg_sender() as a sender below makes this incompatible with escrows because we send @@ -424,10 +423,7 @@ contract TokenWithRefunds { // docs:end:balance_of_private // REFUNDS SPECIFIC FUNCTIONALITY FOLLOWS - use dep::aztec::{ - prelude::{FunctionSelector, NoteHeader}, - protocol_types::{storage::map::derive_storage_slot_in_map, point::Point} - }; + use dep::aztec::prelude::{FunctionSelector, NoteHeader, Point}; use crate::types::token_note::TokenNoteHidingPoint; /// We need to use different randomness for the user and for the fee payer notes because if the randomness values @@ -469,18 +465,13 @@ contract TokenWithRefunds { // to the user in the `complete_refund(...)` function. storage.balances.sub(user, U128::from_integer(funded_amount)).emit(encode_and_encrypt_note_with_keys(&mut context, user_ovpk, user_ivpk, user)); - // 4. Now we "manually" compute the slots (by setting the slots we insert the notes to the balances map under - // the correct keys) - let fee_payer_balances_slot = derive_storage_slot_in_map(TokenWithRefunds::storage().balances.slot, fee_payer); - let user_balances_slot = derive_storage_slot_in_map(TokenWithRefunds::storage().balances.slot, user); - - // 5. We create the partial notes for the fee payer and the user. + // 4. We create the partial notes for the fee payer and the user. // --> Called "partial" because they don't have the amount set yet (that will be done in `complete_refund(...)`). let fee_payer_partial_note = TokenNote { header: NoteHeader { contract_address: AztecAddress::zero(), nonce: 0, - storage_slot: fee_payer_balances_slot, + storage_slot: storage.balances.map.at(fee_payer).storage_slot, note_hash_counter: 0 }, amount: U128::zero(), @@ -491,7 +482,7 @@ contract TokenWithRefunds { header: NoteHeader { contract_address: AztecAddress::zero(), nonce: 0, - storage_slot: user_balances_slot, + storage_slot: storage.balances.map.at(user).storage_slot, note_hash_counter: 0 }, amount: U128::zero(), @@ -499,11 +490,11 @@ contract TokenWithRefunds { randomness: user_randomness }; - // 6. Now we get the note hiding points. + // 5. Now we get the note hiding points. let mut fee_payer_point = fee_payer_partial_note.to_note_hiding_point(); let mut user_point = user_partial_note.to_note_hiding_point(); - // 7. Set the public teardown function to `complete_refund(...)`. Public teardown is the only time when a public + // 6. Set the public teardown function to `complete_refund(...)`. Public teardown is the only time when a public // function has access to the final transaction fee, which is needed to compute the actual refund amount. context.set_public_teardown_function( context.this_address(), @@ -535,6 +526,7 @@ contract TokenWithRefunds { let tx_fee = U128::from_integer(context.transaction_fee()); // 1. We check that user funded the fee payer contract with at least the transaction fee. + // TODO(#7796): we should try to prevent reverts here assert(funded_amount >= tx_fee, "funded amount not enough to cover tx fee"); // 2. We compute the refund amount as the difference between funded amount and tx fee. diff --git a/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/types/balances_map.nr index 63a0092ea5c..dc31fc842ce 100644 --- a/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_with_refunds_contract/src/types/balances_map.nr @@ -84,24 +84,13 @@ impl BalancesMap { owner: AztecAddress, subtrahend: U128 ) -> OuterNoteEmission where T: NoteInterface + OwnedNote + Eq { - // docs:start:get_notes let options = NoteGetterOptions::with_filter(filter_notes_min_sum, subtrahend); - let notes = self.map.at(owner).get_notes(options); - // docs:end:get_notes + let notes = self.map.at(owner).pop_notes(options); let mut minuend: U128 = U128::from_integer(0); for i in 0..options.limit { if i < notes.len() { let note = notes.get_unchecked(i); - - // Removes the note from the owner's set of notes. - // This will call the the `compute_nullifer` function of the `token_note` - // which require knowledge of the secret key (currently the users encryption key). - // The contract logic must ensure that the spending key is used as well. - // docs:start:remove - self.map.at(owner).remove(note); - // docs:end:remove - minuend = minuend + note.get_amount(); } } diff --git a/noir-projects/noir-contracts/scripts/flamegraph.sh b/noir-projects/noir-contracts/scripts/flamegraph.sh index 96d6d99f033..8db540142e6 100755 --- a/noir-projects/noir-contracts/scripts/flamegraph.sh +++ b/noir-projects/noir-contracts/scripts/flamegraph.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash set -eu +# Function to clean up and exit +cleanup_and_exit() { + echo "Cleaning up..." + rm -f "$SCRIPT_DIR/../target/$FUNCTION_ARTIFACT" + exit 0 +} + +# Trap SIGINT (Ctrl+C) and call cleanup_and_exit +trap cleanup_and_exit SIGINT + # If first arg is -h or --help, print usage if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then echo "Usage: $0 " @@ -41,6 +51,7 @@ function sed_wrapper() { # convert contract name to following format: token_bridge_contract-TokenBridge.json ARTIFACT=$(echo "$CONTRACT" | sed_wrapper -r 's/^([A-Z])/\L\1/; s/([a-z0-9])([A-Z])/\1_\L\2/g') +ARTIFACT=$(echo "$ARTIFACT" | tr '[:upper:]' '[:lower:]') ARTIFACT_NAME="${ARTIFACT}_contract-${CONTRACT}" # Extract artifact for the specific function @@ -57,3 +68,6 @@ $PROFILER gates-flamegraph --artifact-path "$SCRIPT_DIR/../target/$FUNCTION_ARTI # serve the file over http echo "Serving flamegraph at http://0.0.0.0:8000/main_gates.svg" python3 -m http.server --directory "$SCRIPT_DIR/../dest" 8000 + +# Clean up before exiting +cleanup_and_exit \ No newline at end of file diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr index 496460a498a..092c5149894 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_public_inputs_composer.nr @@ -10,7 +10,7 @@ use dep::types::{ MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL }, - hash::{silo_encrypted_log_hash, silo_note_hash, silo_nullifier}, traits::is_empty, + hash::{silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, traits::is_empty, transaction::tx_request::TxRequest, utils::arrays::{array_length, array_to_bounded_vec, sort_by_counters_asc, sort_by_counters_desc} }; @@ -276,7 +276,7 @@ impl PrivateKernelCircuitPublicInputsComposer { fn silo_scoped_values(&mut self) { self.silo_note_hashes(); self.silo_nullifiers(); - self.silo_encrypted_logs(); + self.mask_encrypted_logs(); } fn silo_note_hashes(&mut self) { @@ -298,10 +298,10 @@ impl PrivateKernelCircuitPublicInputsComposer { } } - fn silo_encrypted_logs(&mut self) { + fn mask_encrypted_logs(&mut self) { let logs = self.public_inputs.end.encrypted_logs_hashes.storage; for i in 0..logs.len() { - self.public_inputs.end.encrypted_logs_hashes.storage[i].log_hash.value = silo_encrypted_log_hash(logs[i]); + self.public_inputs.end.encrypted_logs_hashes.storage[i].contract_address = mask_encrypted_log_hash(logs[i]); } } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr index d282bedcc70..a645c56f0fa 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_composer.nr @@ -43,8 +43,8 @@ impl TailOutputComposer { data.note_hashes = source.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value); data.nullifiers = source.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value); data.l2_to_l1_msgs = source.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.expose_to_public()); - data.note_encrypted_logs_hash = compute_tx_note_logs_hash(source.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public())); - data.encrypted_logs_hash = compute_tx_logs_hash(source.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public())); + data.note_encrypted_logs_hashes = source.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public()); + data.encrypted_logs_hashes = source.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public()); data.unencrypted_logs_hashes = source.unencrypted_logs_hashes.storage.map(|l: ScopedLogHash| l.expose_to_public()); data.note_encrypted_log_preimages_length = source.note_encrypted_logs_hashes.storage.fold(0, |len, l: NoteLogHash| len + l.length); data.encrypted_log_preimages_length = source.encrypted_logs_hashes.storage.fold(0, |len, l: ScopedEncryptedLogHash| len + l.log_hash.length); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr index 815233c9cd8..c81d74a8623 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr @@ -15,7 +15,7 @@ use dep::types::{ log_hash::{LogHash, NoteLogHash, ScopedEncryptedLogHash, ScopedLogHash} }, messaging::l2_to_l1_message::ScopedL2ToL1Message, - hash::{compute_tx_logs_hash, compute_tx_note_logs_hash, silo_encrypted_log_hash, silo_note_hash, silo_nullifier}, + hash::{compute_tx_logs_hash, compute_tx_note_logs_hash, silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, traits::is_empty, utils::arrays::{assert_sorted_transformed_value_array, assert_sorted_array_with_order_hints} }; @@ -107,39 +107,34 @@ impl TailOutputValidator { fn validate_accumulated_values(self) { // note_encrypted_log_hashes - validate_value_transformation( - self.previous_kernel.end.note_encrypted_logs_hashes, - self.hints.note_encrypted_log_hashes, - |nlh: NoteLogHash, lh: LogHash| (nlh.value == lh.value) & (nlh.length == lh.length) - ); - - assert_sorted_transformed_value_array( + assert_sorted_array_with_order_hints( self.previous_kernel.end.note_encrypted_logs_hashes, - self.hints.note_encrypted_log_hashes, self.hints.sorted_note_encrypted_log_hashes, self.hints.sorted_note_encrypted_log_hash_hints ); - let hash = compute_tx_note_logs_hash(self.hints.sorted_note_encrypted_log_hashes); - assert_eq(hash, self.output.end.note_encrypted_logs_hash, "mismatch note_encrypted_logs_hash"); + assert_eq( + self.hints.sorted_note_encrypted_log_hashes.map(|log: NoteLogHash| log.expose_to_public()), self.output.end.note_encrypted_logs_hashes, "mismatch note_encrypted_logs_hashes" + ); // encrypted_log_hashes validate_value_transformation( self.previous_kernel.end.encrypted_logs_hashes, - self.hints.siloed_encrypted_log_hashes, - |slh: ScopedEncryptedLogHash, lh: LogHash| (lh.value == silo_encrypted_log_hash(slh)) & (lh.length == slh.log_hash.length) + self.hints.masked_encrypted_log_hashes, + |lh: ScopedEncryptedLogHash, mlh: ScopedLogHash| + (mlh.contract_address == mask_encrypted_log_hash(lh)) & + (lh.log_hash.value == mlh.log_hash.value) & + (lh.log_hash.length == mlh.log_hash.length) & + (mlh.log_hash.counter == 0) ); assert_sorted_transformed_value_array( self.previous_kernel.end.encrypted_logs_hashes, - self.hints.siloed_encrypted_log_hashes, - self.hints.sorted_siloed_encrypted_log_hashes, - self.hints.sorted_encrypted_log_hash_hints + self.hints.masked_encrypted_log_hashes, + self.output.end.encrypted_logs_hashes, + self.hints.sorted_masked_encrypted_log_hash_hints ); - let hash = compute_tx_logs_hash(self.hints.sorted_siloed_encrypted_log_hashes); - assert_eq(hash, self.output.end.encrypted_logs_hash, "mismatch encrypted_logs_hash"); - // unencrypted_log_hashes assert_sorted_array_with_order_hints( self.previous_kernel.end.unencrypted_logs_hashes, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/tail_output_hints.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/tail_output_hints.nr index d8326c2b00f..32736bb7535 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/tail_output_hints.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/tail_output_hints.nr @@ -7,7 +7,7 @@ use dep::types::{ MAX_ENCRYPTED_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX }, - hash::{silo_encrypted_log_hash, silo_note_hash, silo_nullifier}, + hash::{silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, messaging::l2_to_l1_message::ScopedL2ToL1Message, traits::{Empty, is_empty}, utils::arrays::{OrderHint, sort_by_counters_asc, sort_get_order_hints_asc} }; @@ -21,13 +21,11 @@ struct TailOutputHints { // L2 to l1 msgs. sorted_l2_to_l1_msg_hints: [OrderHint; MAX_L2_TO_L1_MSGS_PER_TX], // Note encrypted log hashes. - note_encrypted_log_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], - sorted_note_encrypted_log_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + sorted_note_encrypted_log_hashes: [NoteLogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], sorted_note_encrypted_log_hash_hints: [OrderHint; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], // Encrypted log hashes. - siloed_encrypted_log_hashes: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX], - sorted_siloed_encrypted_log_hashes: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX], - sorted_encrypted_log_hash_hints: [OrderHint; MAX_ENCRYPTED_LOGS_PER_TX], + masked_encrypted_log_hashes: [ScopedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], + sorted_masked_encrypted_log_hash_hints: [OrderHint; MAX_ENCRYPTED_LOGS_PER_TX], // Unencrypted log hashes. sorted_unencrypted_log_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX], sorted_unencrypted_log_hash_hints: [OrderHint; MAX_UNENCRYPTED_LOGS_PER_TX], @@ -45,18 +43,16 @@ unconstrained pub fn generate_tail_output_hints(previous_kernel: PrivateKernelCi let sorted_l2_to_l1_msg_hints = sort_get_order_hints_asc(previous_kernel.end.l2_to_l1_msgs); // note_encrypted_logs - let note_encrypted_log_hashes = previous_kernel.end.note_encrypted_logs_hashes.map(|h: NoteLogHash| h.expose_to_public()); - let sorted_note_encrypted_log_hashes = sort_by_counters_asc(previous_kernel.end.note_encrypted_logs_hashes).map(|h: NoteLogHash| h.expose_to_public()); + let sorted_note_encrypted_log_hashes = sort_by_counters_asc(previous_kernel.end.note_encrypted_logs_hashes); let sorted_note_encrypted_log_hash_hints = sort_get_order_hints_asc(previous_kernel.end.note_encrypted_logs_hashes); // encrypted_logs - let mut siloed_log_hashes = previous_kernel.end.encrypted_logs_hashes; - for i in 0..siloed_log_hashes.len() { - siloed_log_hashes[i].log_hash.value = silo_encrypted_log_hash(previous_kernel.end.encrypted_logs_hashes[i]); + let mut masked_log_hashes = previous_kernel.end.encrypted_logs_hashes; + for i in 0..masked_log_hashes.len() { + masked_log_hashes[i].contract_address = mask_encrypted_log_hash(previous_kernel.end.encrypted_logs_hashes[i]); } - let sorted_siloed_encrypted_log_hashes = sort_by_counters_asc(siloed_log_hashes).map(|h: ScopedEncryptedLogHash| h.expose_to_public()); - let siloed_encrypted_log_hashes = siloed_log_hashes.map(|h: ScopedEncryptedLogHash| h.expose_to_public()); - let sorted_encrypted_log_hash_hints = sort_get_order_hints_asc(previous_kernel.end.encrypted_logs_hashes); + let masked_encrypted_log_hashes = masked_log_hashes.map(|h: ScopedEncryptedLogHash| h.expose_to_public()); + let sorted_masked_encrypted_log_hash_hints = sort_get_order_hints_asc(previous_kernel.end.encrypted_logs_hashes); // unencrypted_logs let sorted_unencrypted_log_hashes = sort_by_counters_asc(previous_kernel.end.unencrypted_logs_hashes); @@ -67,12 +63,10 @@ unconstrained pub fn generate_tail_output_hints(previous_kernel: PrivateKernelCi sorted_nullifier_hints, siloed_nullifiers, sorted_l2_to_l1_msg_hints, - note_encrypted_log_hashes, sorted_note_encrypted_log_hashes, - sorted_siloed_encrypted_log_hashes, sorted_note_encrypted_log_hash_hints, - siloed_encrypted_log_hashes, - sorted_encrypted_log_hash_hints, + masked_encrypted_log_hashes, + sorted_masked_encrypted_log_hash_hints, sorted_unencrypted_log_hashes, sorted_unencrypted_log_hash_hints } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr index 3614a49df5d..4d75aa162ab 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer/meter_gas_used.nr @@ -28,7 +28,7 @@ fn meter_gas_used(data: PublicAccumulatedData) -> Gas { metered_da_bytes += note_encrypted_log_preimages_length as u32; metered_l2_gas += note_encrypted_log_preimages_length as u32 * L2_GAS_PER_LOG_BYTE; - let encrypted_log_preimages_length = data.encrypted_logs_hashes.fold(0, |len, l: LogHash| len + l.length); + let encrypted_log_preimages_length = data.encrypted_logs_hashes.fold(0, |len, l: ScopedLogHash| len + l.log_hash.length); metered_da_bytes += encrypted_log_preimages_length as u32; metered_l2_gas += encrypted_log_preimages_length as u32 * L2_GAS_PER_LOG_BYTE; diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr index 837718312c5..7cd33f5aac1 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr @@ -13,7 +13,7 @@ use dep::types::{ nullifier::Nullifier, public_call_request::PublicCallRequest }, messaging::l2_to_l1_message::ScopedL2ToL1Message, address::AztecAddress, - hash::{silo_encrypted_log_hash, silo_note_hash, silo_nullifier}, + hash::{silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, traits::{Empty, is_empty, is_empty_array}, utils::arrays::{ array_length, assert_split_sorted_transformed_value_arrays_asc, @@ -157,13 +157,17 @@ impl TailToPublicOutputValidator { // encrypted_logs_hashes validate_value_transformation( prev_data.encrypted_logs_hashes, - hints.siloed_encrypted_logs_hashes, - |slh: ScopedEncryptedLogHash, lh: LogHash| (lh.value == silo_encrypted_log_hash(slh)) & (lh.length == slh.log_hash.length) & (lh.counter == 0) + hints.masked_encrypted_logs_hashes, + |lh: ScopedEncryptedLogHash, mlh: ScopedLogHash| + (mlh.contract_address == mask_encrypted_log_hash(lh)) & + (lh.log_hash.value == mlh.log_hash.value) & + (lh.log_hash.length == mlh.log_hash.length) & + (mlh.log_hash.counter == 0) ); assert_split_sorted_transformed_value_arrays_asc( prev_data.encrypted_logs_hashes, - hints.siloed_encrypted_logs_hashes, + hints.masked_encrypted_logs_hashes, split_counter, output_non_revertible.encrypted_logs_hashes, output_revertible.encrypted_logs_hashes, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr index 576e3b840de..e4248176275 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator/tail_to_public_output_hints.nr @@ -8,7 +8,7 @@ use dep::types::{ MAX_ENCRYPTED_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX }, - hash::{silo_encrypted_log_hash, silo_note_hash, silo_nullifier}, + hash::{silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, messaging::l2_to_l1_message::ScopedL2ToL1Message, utils::arrays::{sort_get_split_order_hints_asc, sort_get_split_order_hints_desc, SplitOrderHints} }; @@ -25,7 +25,7 @@ struct TailToPublicOutputHints { note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], sorted_note_encrypted_log_hash_hints: SplitOrderHints, // Encrypted log hashes. - siloed_encrypted_logs_hashes: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX], + masked_encrypted_logs_hashes: [ScopedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], sorted_encrypted_log_hash_hints: SplitOrderHints, // Unencrypted log hashes. sorted_unencrypted_log_hash_hints: SplitOrderHints, @@ -59,11 +59,12 @@ unconstrained pub fn generate_tail_to_public_output_hints(previous_kernel: Priva let sorted_note_encrypted_log_hash_hints = sort_get_split_order_hints_asc(previous_kernel.end.note_encrypted_logs_hashes, split_counter); // encrypted_logs - let mut siloed_log_hashes = previous_kernel.end.encrypted_logs_hashes; - for i in 0..siloed_log_hashes.len() { - siloed_log_hashes[i].log_hash.value = silo_encrypted_log_hash(previous_kernel.end.encrypted_logs_hashes[i]); + let masked_encrypted_logs_hashes = previous_kernel.end.encrypted_logs_hashes.map( + |mut h: ScopedEncryptedLogHash| { + h.contract_address = mask_encrypted_log_hash(h); + h.expose_to_public() } - let siloed_encrypted_logs_hashes = siloed_log_hashes.map(|h: ScopedEncryptedLogHash| h.expose_to_public()); + ); let sorted_encrypted_log_hash_hints = sort_get_split_order_hints_asc(previous_kernel.end.encrypted_logs_hashes, split_counter); // unencrypted_logs @@ -80,7 +81,7 @@ unconstrained pub fn generate_tail_to_public_output_hints(previous_kernel: Priva sorted_l2_to_l1_msg_hints, note_encrypted_logs_hashes, sorted_note_encrypted_log_hash_hints, - siloed_encrypted_logs_hashes, + masked_encrypted_logs_hashes, sorted_encrypted_log_hash_hints, sorted_unencrypted_log_hash_hints, public_call_requests, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr index fa796b323d2..a52abc72a81 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr @@ -66,10 +66,10 @@ mod tests { abis::{ kernel_circuit_public_inputs::KernelCircuitPublicInputs, max_block_number::MaxBlockNumber, note_hash::{NoteHash, ScopedNoteHash}, nullifier::{Nullifier, ScopedNullifier}, gas::Gas, - log_hash::ScopedLogHash + log_hash::{ScopedLogHash, ScopedEncryptedLogHash, LogHash, NoteLogHash} }, address::{AztecAddress, EthAddress}, scalar::Scalar, - hash::{sha256_to_field, silo_note_hash, silo_nullifier, compute_siloed_encrypted_log_hash}, + hash::{sha256_to_field, silo_note_hash, silo_nullifier, mask_encrypted_log_hash}, tests::fixture_builder::FixtureBuilder, utils::{arrays::array_length}, traits::{Empty, is_empty}, point::Point }; @@ -141,7 +141,7 @@ mod tests { } #[test] - fn logs_are_handled_as_expected() { + fn measuring_of_log_lengths() { let mut builder = PrivateKernelTailInputsBuilder::new(); // Logs for the previous call stack. let prev_encrypted_logs_hash = 80; @@ -164,72 +164,96 @@ mod tests { assert_eq( public_inputs.end.unencrypted_log_preimages_length, unencrypted_log_preimages_length + prev_unencrypted_log_preimages_length ); + } - let siloed_encrypted_logs_hash = compute_siloed_encrypted_log_hash( - builder.previous_kernel.storage_contract_address, - builder.previous_kernel.encrypted_logs_hashes.storage[0].log_hash.randomness, - prev_encrypted_logs_hash - ); + #[test] + fn ordering_of_encrypted_logs() { + let mut builder = PrivateKernelTailInputsBuilder::new(); + + builder.previous_kernel.append_encrypted_log_hashes(2); + + // Set the randomness in the first log to 0 to signal not masking the address to silo with + builder.previous_kernel.encrypted_logs_hashes.storage[0].log_hash.randomness = 0; + + // Reorder the logs + let mut reversed_logs = [ScopedEncryptedLogHash::empty(); 2]; + for i in 0..reversed_logs.len() { + reversed_logs[i] = builder.previous_kernel.encrypted_logs_hashes.pop(); + } + builder.previous_kernel.encrypted_logs_hashes.extend_from_array(reversed_logs); - // noir-fmt:ignore - let hash_bytes: [u8; MAX_ENCRYPTED_LOGS_PER_TX * 32] = siloed_encrypted_logs_hash - .to_be_bytes(32) - .append(&[0; MAX_ENCRYPTED_LOGS_PER_TX * 32 - 32]) - .as_array(); - let expected_encrypted_logs_hash = sha256_to_field(hash_bytes); - assert_eq(public_inputs.end.encrypted_logs_hash, expected_encrypted_logs_hash); + let public_inputs = builder.execute(); + + let resulting_encrypted_logs = public_inputs.end.encrypted_logs_hashes; assert_eq( - public_inputs.end.unencrypted_logs_hashes, builder.previous_kernel.unencrypted_logs_hashes.storage.map(|log: ScopedLogHash| log.expose_to_public()) + resulting_encrypted_logs[0], ScopedLogHash { + contract_address: builder.previous_kernel.storage_contract_address, // Not masked, randomness = 0 + log_hash: LogHash { value: reversed_logs[1].log_hash.value, counter: 0, length: reversed_logs[1].log_hash.length } + } ); - } - unconstrained fn compute_hash_bytes( - siloed_encrypted_logs_hash: Field, - new_siloed_encrypted_logs_hash: Field - ) -> [u8; MAX_ENCRYPTED_LOGS_PER_TX * 32] { - siloed_encrypted_logs_hash.to_be_bytes(32).append(new_siloed_encrypted_logs_hash.to_be_bytes(32)).append(&[0; MAX_ENCRYPTED_LOGS_PER_TX * 32 - 64]).as_array() + assert_eq( + resulting_encrypted_logs[1], ScopedLogHash { + contract_address: mask_encrypted_log_hash(reversed_logs[0]), + log_hash: LogHash { value: reversed_logs[0].log_hash.value, counter: 0, length: reversed_logs[0].log_hash.length } + } + ); } #[test] - fn encrypted_logs_are_hashed_as_expected() { + fn ordering_of_note_encrypted_logs() { let mut builder = PrivateKernelTailInputsBuilder::new(); - // Logs for the previous call stack. - let prev_encrypted_logs_hash = 80; - let prev_encrypted_log_preimages_length = 13; - builder.previous_kernel.add_encrypted_log_hash(prev_encrypted_logs_hash, prev_encrypted_log_preimages_length); - // Set the randomness to 0 to signal not masking the address to silo with - builder.previous_kernel.encrypted_logs_hashes.storage[0].log_hash.randomness = 0; + builder.previous_kernel.append_note_encrypted_log_hashes(2); - let new_encrypted_logs_hash = 26; - let new_encrypted_log_preimages_length = 50; - builder.previous_kernel.add_encrypted_log_hash(new_encrypted_logs_hash, new_encrypted_log_preimages_length); + // Reorder the logs + let original_logs = builder.previous_kernel.note_encrypted_logs_hashes.storage; + let mut reversed_logs = [NoteLogHash::empty(); 2]; + for i in 0..reversed_logs.len() { + reversed_logs[i] = builder.previous_kernel.note_encrypted_logs_hashes.pop(); + } + builder.previous_kernel.note_encrypted_logs_hashes.extend_from_array(reversed_logs); let public_inputs = builder.execute(); + let resulting_encrypted_logs = public_inputs.end.note_encrypted_logs_hashes; + assert_eq( - public_inputs.end.encrypted_log_preimages_length, prev_encrypted_log_preimages_length + new_encrypted_log_preimages_length + resulting_encrypted_logs, original_logs.map( + |log: NoteLogHash| { + LogHash { value: log.value, counter: 0, length: log.length } + } + ) ); + } - let siloed_encrypted_logs_hash = compute_siloed_encrypted_log_hash( - builder.previous_kernel.storage_contract_address, - builder.previous_kernel.encrypted_logs_hashes.storage[0].log_hash.randomness, - prev_encrypted_logs_hash - ); + #[test] + fn ordering_of_unencrypted_logs() { + let mut builder = PrivateKernelTailInputsBuilder::new(); - let siloed_hash_bytes: [u8; 64] = builder.previous_kernel.storage_contract_address.to_field().to_be_bytes(32).append(prev_encrypted_logs_hash.to_be_bytes(32)).as_array(); - assert_eq(siloed_encrypted_logs_hash, sha256_to_field(siloed_hash_bytes)); + builder.previous_kernel.append_unencrypted_log_hashes(2); - let new_siloed_encrypted_logs_hash = compute_siloed_encrypted_log_hash( - builder.previous_kernel.storage_contract_address, - builder.previous_kernel.encrypted_logs_hashes.storage[1].log_hash.randomness, - new_encrypted_logs_hash - ); + // Reorder the logs + let original_logs = builder.previous_kernel.unencrypted_logs_hashes.storage; + let mut reversed_logs = [ScopedLogHash::empty(); 2]; + for i in 0..reversed_logs.len() { + reversed_logs[i] = builder.previous_kernel.unencrypted_logs_hashes.pop(); + } + builder.previous_kernel.unencrypted_logs_hashes.extend_from_array(reversed_logs); + + let public_inputs = builder.execute(); - let hash_bytes = compute_hash_bytes(siloed_encrypted_logs_hash, new_siloed_encrypted_logs_hash); - let expected_encrypted_logs_hash = sha256_to_field(hash_bytes); - assert_eq(public_inputs.end.encrypted_logs_hash, expected_encrypted_logs_hash); + let resulting_encrypted_logs = public_inputs.end.unencrypted_logs_hashes; + + assert_eq( + resulting_encrypted_logs, original_logs.map( + |mut log: ScopedLogHash| { + log.log_hash.counter = 0; + log + } + ) + ); } #[test] diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_accumulated_values.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_accumulated_values.nr index 46109355c55..e38c86f8ef9 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_accumulated_values.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_accumulated_values.nr @@ -13,7 +13,6 @@ fn validate_accumulated_values_note_encrypted_log_hashes_succeeds() { builder.previous_kernel.append_note_encrypted_log_hashes(3); builder.output.append_note_encrypted_log_hashes(3); - builder.output.hash_note_encrypted_log_hashes(); builder.validate(); } @@ -26,12 +25,11 @@ fn validate_accumulated_values_note_encrypted_log_hashes_unordered_succeeds() { // Swap the items at index 0 and 2. swap_items(&mut builder.previous_kernel.note_encrypted_logs_hashes, 0, 2); builder.output.append_note_encrypted_log_hashes(3); - builder.output.hash_note_encrypted_log_hashes(); builder.validate(); } -#[test(should_fail_with="mismatch note_encrypted_logs_hash")] +#[test(should_fail_with="mismatch note_encrypted_logs_hashes")] fn validate_accumulated_values_note_encrypted_log_hashes_wrong_hash_fails() { let mut builder = TailOutputValidatorBuilder::new(); @@ -39,7 +37,6 @@ fn validate_accumulated_values_note_encrypted_log_hashes_wrong_hash_fails() { builder.output.append_note_encrypted_log_hashes(3); // Swap the items in the output, making them out of order, and then hash. swap_items(&mut builder.output.note_encrypted_logs_hashes, 0, 2); - builder.output.hash_note_encrypted_log_hashes(); builder.validate(); } @@ -54,7 +51,7 @@ fn validate_accumulated_values_encrypted_log_hashes_succeeds() { builder.previous_kernel.append_encrypted_log_hashes(3); builder.output.append_encrypted_log_hashes(3); - builder.output.hash_encrypted_log_hashes(); + builder.output.mask_encrypted_log_hashes(); builder.validate(); } @@ -67,12 +64,12 @@ fn validate_accumulated_values_encrypted_log_hashes_unordered_succeeds() { // Swap the items at index 0 and 2. swap_items(&mut builder.previous_kernel.encrypted_logs_hashes, 0, 2); builder.output.append_encrypted_log_hashes(3); - builder.output.hash_encrypted_log_hashes(); + builder.output.mask_encrypted_log_hashes(); builder.validate(); } -#[test(should_fail_with="mismatch encrypted_logs_hash")] +#[test(should_fail_with="mismatch sorted values")] fn validate_accumulated_values_encrypted_log_hashes_wrong_hash_fails() { let mut builder = TailOutputValidatorBuilder::new(); @@ -80,7 +77,7 @@ fn validate_accumulated_values_encrypted_log_hashes_wrong_hash_fails() { builder.output.append_encrypted_log_hashes(3); // Swap the items in the output, making them out of order, and then hash. swap_items(&mut builder.output.encrypted_logs_hashes, 0, 2); - builder.output.hash_encrypted_log_hashes(); + builder.output.mask_encrypted_log_hashes(); builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_gas_used.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_gas_used.nr index de9c3b78ff9..7e5bb139132 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_gas_used.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_output_validator_builder/validate_gas_used.nr @@ -9,7 +9,6 @@ impl TailOutputValidatorBuilder { builder.previous_kernel.append_note_encrypted_log_hashes(3); builder.output.append_note_encrypted_log_hashes(3); - builder.output.hash_note_encrypted_log_hashes(); builder } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr index 5f504f44a46..53c8d473488 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/tail_to_public_output_composer_builder/tail_to_public_output_composer.nr @@ -29,7 +29,7 @@ fn tail_to_public_output_composer_succeeds() { builder.previous_kernel.add_note_encrypted_log_hash(1002, 8, 0); builder.previous_kernel.add_encrypted_log_hash(2001, 2); - siloed_data_builder.add_siloed_encrypted_log_hash(2001, 2); + siloed_data_builder.add_masked_encrypted_log_hash(2001, 2); builder.previous_kernel.add_unencrypted_log_hash(3001, 51); @@ -50,9 +50,9 @@ fn tail_to_public_output_composer_succeeds() { builder.previous_kernel.add_note_encrypted_log_hash(1003, 20, 0); builder.previous_kernel.add_encrypted_log_hash(2002, 6); - siloed_data_builder.add_siloed_encrypted_log_hash(2002, 6); + siloed_data_builder.add_masked_encrypted_log_hash(2002, 6); builder.previous_kernel.add_encrypted_log_hash(2003, 24); - siloed_data_builder.add_siloed_encrypted_log_hash(2003, 24); + siloed_data_builder.add_masked_encrypted_log_hash(2003, 24); builder.previous_kernel.add_unencrypted_log_hash(3002, 4); diff --git a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr index d4bf8494520..9debf85bfe1 100644 --- a/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr +++ b/noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/public_kernel_tail.nr @@ -337,6 +337,25 @@ mod tests { let sorted_unencrypted_logs_hashes = sorted.sorted_array; let sorted_unencrypted_logs_hashes_indexes = sorted.sorted_index_hints; + let merged = array_merge( + previous_kernel.public_inputs.end_non_revertible.encrypted_logs_hashes, + previous_kernel.public_inputs.end.encrypted_logs_hashes + ); + let sorted = sort_get_sorted_hints( + merged, + |a: ScopedLogHash, b: ScopedLogHash| a.counter() < b.counter() + ); + let sorted_encrypted_logs_hashes = sorted.sorted_array; + let sorted_encrypted_logs_hashes_indexes = sorted.sorted_index_hints; + + let merged = array_merge( + previous_kernel.public_inputs.end_non_revertible.note_encrypted_logs_hashes, + previous_kernel.public_inputs.end.note_encrypted_logs_hashes + ); + let sorted = sort_get_sorted_hints(merged, |a: LogHash, b: LogHash| a.counter() < b.counter()); + let sorted_note_encrypted_logs_hashes = sorted.sorted_array; + let sorted_note_encrypted_logs_hashes_indexes = sorted.sorted_index_hints; + let merged = array_merge( previous_kernel.public_inputs.end_non_revertible.public_data_update_requests, previous_kernel.public_inputs.end.public_data_update_requests @@ -357,6 +376,10 @@ mod tests { sorted_note_hashes_indexes, sorted_unencrypted_logs_hashes, sorted_unencrypted_logs_hashes_indexes, + sorted_encrypted_logs_hashes, + sorted_encrypted_logs_hashes_indexes, + sorted_note_encrypted_logs_hashes, + sorted_note_encrypted_logs_hashes_indexes, sorted_public_data_update_requests: merged, sorted_public_data_update_requests_indexes, deduped_public_data_update_requests: merged, @@ -393,7 +416,7 @@ mod tests { } #[test] - fn logs_are_handled_as_expected() { + fn measuring_of_log_lengths() { let mut builder = PublicKernelTailCircuitPrivateInputsBuilder::new(); // Logs for the previous call stack. let prev_encrypted_logs_hash = 80; @@ -417,10 +440,6 @@ mod tests { public_inputs.end.unencrypted_log_preimages_length, unencrypted_log_preimages_length + prev_unencrypted_log_preimages_length ); - let hash_bytes: [u8; MAX_ENCRYPTED_LOGS_PER_TX * 32] = prev_encrypted_logs_hash.to_be_bytes(32).append(&[0; MAX_ENCRYPTED_LOGS_PER_TX * 32 - 32]).as_array(); - let expected_encrypted_logs_hash = sha256_to_field(hash_bytes); - assert_eq(public_inputs.end.encrypted_logs_hash, expected_encrypted_logs_hash); - assert_eq( public_inputs.end.unencrypted_logs_hashes, builder.previous_revertible.unencrypted_logs_hashes.storage ); diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr index 15a86cc1602..d38a1ce0f5b 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr @@ -25,7 +25,7 @@ use dep::types::{ MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_DATA_READS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, NULLIFIER_TREE_HEIGHT, PUBLIC_DATA_SUBTREE_SIBLING_PATH_LENGTH, PUBLIC_DATA_SUBTREE_HEIGHT, - PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, ARCHIVE_HEIGHT, GAS_TOKEN_ADDRESS, + PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, ARCHIVE_HEIGHT, FEE_JUICE_ADDRESS, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PUBLIC_KERNEL_TAIL_INDEX, PRIVATE_KERNEL_EMPTY_INDEX, PRIVATE_KERNEL_TAIL_INDEX }, @@ -49,7 +49,7 @@ struct BaseRollupInputs { start: PartialStateReference, state_diff_hints: StateDiffHints, - fee_payer_gas_token_balance_read_hint: PublicDataHint, + fee_payer_fee_juice_balance_read_hint: PublicDataHint, // TODO: The following 6 values are eventually going to be nuked from here. See discussion: // https://aztecprotocol.slack.com/archives/C060PU5R327/p1701965354071269 @@ -264,10 +264,10 @@ impl BaseRollupInputs { all_update_requests } - // Deducts the tx_fee from the GasToken balance of the fee_payer. If there is already a PublicDataUpdateRequest + // Deducts the tx_fee from the FeeJuice balance of the fee_payer. If there is already a PublicDataUpdateRequest // in this tx for their balance (because they issued a 'claim' to increase their balance by bridging from L1), // update it by subtracting the tx_fee. Otherwise, build a new PublicDataUpdateRequest to subtract the tx_fee - // from the balance of the fee_payer, using the fee_payer_gas_token_balance_read_hint to read the current balance. + // from the balance of the fee_payer, using the fee_payer_fee_juice_balance_read_hint to read the current balance. // Returns the data update request that subtracts the tx_fee from the fee_payer's balance, and the index where it // should be inserted in the public data update requests array. fn build_or_patch_payment_update_request(self, tx_fee: Field) -> (PublicDataUpdateRequest, u32) { @@ -275,15 +275,15 @@ impl BaseRollupInputs { // TODO(@spalladino) Eventually remove the is_zero condition as we should always charge fees to every tx if !fee_payer.is_zero() { - let read_hint = self.fee_payer_gas_token_balance_read_hint; - let leaf_slot = compute_fee_payer_gas_token_balance_leaf_slot(fee_payer); + let read_hint = self.fee_payer_fee_juice_balance_read_hint; + let leaf_slot = compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer); if read_hint.leaf_slot == 0 { // Is there a balance update already in this tx? If so, update it and return its index. - let existing_update_index = self.find_fee_payer_gas_token_update_index(leaf_slot); + let existing_update_index = self.find_fee_payer_fee_juice_update_index(leaf_slot); let existing_update = self.kernel_data.public_inputs.end.public_data_update_requests[existing_update_index]; assert( - existing_update.leaf_slot == leaf_slot, "Wrong leaf slot for gas token balance update request" + existing_update.leaf_slot == leaf_slot, "Wrong leaf slot for Fee Juice balance update request" ); assert( !existing_update.new_value.lt(tx_fee), "Not enough balance for fee payer after claim to pay for transaction" @@ -297,7 +297,7 @@ impl BaseRollupInputs { read_hint.validate(self.start.public_data_tree.root); let balance = read_hint.value; - assert(read_hint.leaf_slot == leaf_slot, "Wrong leaf slot for gas token balance read hint"); + assert(read_hint.leaf_slot == leaf_slot, "Wrong leaf slot for Fee Juice balance read hint"); assert(!balance.lt(tx_fee), "Not enough balance for fee payer to pay for transaction"); let new_value = compute_public_data_tree_value(balance - tx_fee); @@ -332,7 +332,7 @@ impl BaseRollupInputs { ); } - unconstrained fn find_fee_payer_gas_token_update_index(self, leaf_slot: Field) -> u32 { + unconstrained fn find_fee_payer_fee_juice_update_index(self, leaf_slot: Field) -> u32 { let mut update_index = MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + 1; for i in 0..MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX { if self.kernel_data.public_inputs.end.public_data_update_requests[i].leaf_slot == leaf_slot { @@ -340,7 +340,7 @@ impl BaseRollupInputs { } } assert( - update_index < MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, "Could not find fee payer gas token update request" + update_index < MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, "Could not find fee payer Fee Juice update request" ); update_index } @@ -418,11 +418,11 @@ fn insert_public_data_update_requests( ) } -fn compute_fee_payer_gas_token_balance_leaf_slot(fee_payer: AztecAddress) -> Field { - let balances_slot_in_gas_token_contract = 1; - let gas_token = AztecAddress::from_field(GAS_TOKEN_ADDRESS); - let fee_payer_balance_slot_in_gas_token_contract = derive_storage_slot_in_map(balances_slot_in_gas_token_contract, fee_payer); - compute_public_data_tree_index(gas_token, fee_payer_balance_slot_in_gas_token_contract) +fn compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer: AztecAddress) -> Field { + let balances_slot_in_fee_juice_contract = 1; + let fee_juice = AztecAddress::from_field(FEE_JUICE_ADDRESS); + let fee_payer_balance_slot_in_fee_juice_contract = derive_storage_slot_in_map(balances_slot_in_fee_juice_contract, fee_payer); + compute_public_data_tree_index(fee_juice, fee_payer_balance_slot_in_fee_juice_contract) } #[test] @@ -458,7 +458,7 @@ mod tests { }, base::{ state_diff_hints::StateDiffHints, - base_rollup_inputs::{BaseRollupInputs, compute_fee_payer_gas_token_balance_leaf_slot, ALLOWED_PREVIOUS_CIRCUITS} + base_rollup_inputs::{BaseRollupInputs, compute_fee_payer_fee_juice_balance_leaf_slot, ALLOWED_PREVIOUS_CIRCUITS} }, components::{TX_EFFECTS_HASH_INPUT_FIELDS, compute_kernel_out_hash} }; @@ -605,9 +605,9 @@ mod tests { final_public_data_writes: BoundedVec<(u32, PublicDataTreeLeaf), MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>, nullifiers: BoundedVec, constants: ConstantRollupData, - // Index of the item in the pre_existing_public_data array that contains the fee payer's gas token balance. + // Index of the item in the pre_existing_public_data array that contains the fee payer's Fee Juice balance. // Used for building the public data hint read for the payment update request. If set to none, no hint is built. - fee_payer_gas_token_balance_pre_existing_public_data_index: Option + fee_payer_fee_juice_balance_pre_existing_public_data_index: Option } fn test_compute_empty_root(size: [Field; N]) -> Field { @@ -627,11 +627,11 @@ mod tests { inputs } - fn build_fee_payer_gas_token_balance_read_hint( + fn build_fee_payer_fee_juice_balance_read_hint( self, start_public_data_tree: NonEmptyMerkleTree ) -> PublicDataHint { - self.fee_payer_gas_token_balance_pre_existing_public_data_index.map_or( + self.fee_payer_fee_juice_balance_pre_existing_public_data_index.map_or( PublicDataHint::empty(), |leaf_index_u32: u32| { let leaf_index = leaf_index_u32 as Field; @@ -759,7 +759,7 @@ mod tests { next_available_leaf_index: start_public_data_tree.get_next_available_index() as u32 }; - let fee_payer_gas_token_balance_read_hint = self.build_fee_payer_gas_token_balance_read_hint(start_public_data_tree); + let fee_payer_fee_juice_balance_read_hint = self.build_fee_payer_fee_juice_balance_read_hint(start_public_data_tree); let start_archive = NonEmptyMerkleTree::new( self.pre_existing_blocks, @@ -831,7 +831,7 @@ mod tests { low_public_data_writes_witnesses, archive_root_membership_witness: MembershipWitness { leaf_index: 0, sibling_path: start_archive.get_sibling_path(0) }, constants: self.constants, - fee_payer_gas_token_balance_read_hint + fee_payer_fee_juice_balance_read_hint } } @@ -863,7 +863,7 @@ mod tests { final_public_data_writes: BoundedVec::new(), nullifiers: BoundedVec::new(), constants: ConstantRollupData::empty(), - fee_payer_gas_token_balance_pre_existing_public_data_index: Option::none() + fee_payer_fee_juice_balance_pre_existing_public_data_index: Option::none() } } } @@ -1276,7 +1276,7 @@ mod tests { #[test] unconstrained fn updates_fee_payer_balance_with_new_data_write() { let fee_payer = AztecAddress::from_field(0x1234); - let balance_slot = compute_fee_payer_gas_token_balance_leaf_slot(fee_payer); + let balance_slot = compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer); let initial_balance = 300_000; let tx_fee = 100_000; let expected_balance = 200_000; @@ -1293,7 +1293,7 @@ mod tests { next_slot: 0, next_index: 0, }; - builder.fee_payer_gas_token_balance_pre_existing_public_data_index = Option::some(0); + builder.fee_payer_fee_juice_balance_pre_existing_public_data_index = Option::some(0); // Set values for computing exact tx_fee builder.kernel_data.tx_context.gas_settings.inclusion_fee = tx_fee; @@ -1318,7 +1318,7 @@ mod tests { #[test] unconstrained fn updates_fee_payer_balance_in_existing_data_write() { let fee_payer = AztecAddress::from_field(0x1234); - let balance_slot = compute_fee_payer_gas_token_balance_leaf_slot(fee_payer); + let balance_slot = compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer); let initial_balance = 100_000; let after_claim_balance = 300_000; let tx_fee = 100_000; @@ -1364,7 +1364,7 @@ mod tests { #[test(should_fail_with="Not enough balance for fee payer to pay for transaction")] unconstrained fn fails_to_update_fee_payer_balance_if_not_enough_funds() { let fee_payer = AztecAddress::from_field(0x1234); - let balance_slot = compute_fee_payer_gas_token_balance_leaf_slot(fee_payer); + let balance_slot = compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer); // Set low initial balance so it fails! let initial_balance = 10_000; let tx_fee = 100_000; @@ -1381,7 +1381,7 @@ mod tests { next_slot: 0, next_index: 0, }; - builder.fee_payer_gas_token_balance_pre_existing_public_data_index = Option::some(0); + builder.fee_payer_fee_juice_balance_pre_existing_public_data_index = Option::some(0); // Set values for computing exact tx_fee builder.kernel_data.tx_context.gas_settings.inclusion_fee = tx_fee; @@ -1392,10 +1392,10 @@ mod tests { builder.fails(); } - #[test(should_fail_with="Wrong leaf slot for gas token balance read hint")] + #[test(should_fail_with="Wrong leaf slot for Fee Juice balance read hint")] unconstrained fn fails_to_update_fee_payer_balance_if_wrong_read_hint() { let fee_payer = AztecAddress::from_field(0x1234); - let balance_slot = compute_fee_payer_gas_token_balance_leaf_slot(fee_payer); + let balance_slot = compute_fee_payer_fee_juice_balance_leaf_slot(fee_payer); let initial_balance = 300_000; let expected_balance = 200_000; let tx_fee = 100_000; @@ -1421,7 +1421,7 @@ mod tests { }; // But point the read hint to the wrong one! - builder.fee_payer_gas_token_balance_pre_existing_public_data_index = Option::some(1); + builder.fee_payer_fee_juice_balance_pre_existing_public_data_index = Option::some(1); // Set values for computing exact tx_fee builder.kernel_data.tx_context.gas_settings.inclusion_fee = tx_fee; diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr index 0d14ab92b6a..ce5f2b9aeeb 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr @@ -1,7 +1,10 @@ use crate::abis::base_or_merge_rollup_public_inputs::BaseOrMergeRollupPublicInputs; use crate::abis::previous_rollup_data::PreviousRollupData; use dep::types::{ - hash::{accumulate_sha256, silo_unencrypted_log_hash, compute_tx_logs_hash}, + hash::{ + accumulate_sha256, silo_unencrypted_log_hash, compute_tx_logs_hash, silo_encrypted_log_hash, + compute_tx_note_logs_hash +}, merkle_tree::VariableMerkleTree, constants::{ MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, @@ -112,8 +115,8 @@ pub fn compute_txs_effects_hash(previous_rollup_data: [PreviousRollupData; 2]) - ) } -fn scope_and_hash_unencrypted_logs(unencrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX]) -> Field { - let scoped_logs = unencrypted_logs_hashes.map( +fn silo_and_hash_unencrypted_logs(unencrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX]) -> Field { + let siloed_logs = unencrypted_logs_hashes.map( |log: ScopedLogHash| { LogHash { value: silo_unencrypted_log_hash(log), @@ -122,7 +125,20 @@ fn scope_and_hash_unencrypted_logs(unencrypted_logs_hashes: [ScopedLogHash; MAX_ } } ); - compute_tx_logs_hash(scoped_logs) + compute_tx_logs_hash(siloed_logs) +} + +fn silo_and_hash_encrypted_logs(encrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX]) -> Field { + let siloed_encrypted_logs = encrypted_logs_hashes.map( + |log: ScopedLogHash| { + LogHash { + value: silo_encrypted_log_hash(log), + counter: log.log_hash.counter, + length: log.log_hash.length + } + } + ); + compute_tx_logs_hash(siloed_encrypted_logs) } // Tx effects hash consists of @@ -161,9 +177,9 @@ pub fn compute_tx_effects_hash( let note_logs_length = combined.note_encrypted_log_preimages_length; let encrypted_logs_length = combined.encrypted_log_preimages_length; let unencrypted_logs_length = combined.unencrypted_log_preimages_length; - let note_encrypted_logs_hash = combined.note_encrypted_logs_hash; - let encrypted_logs_hash = combined.encrypted_logs_hash; - let unencrypted_logs_hash = scope_and_hash_unencrypted_logs(combined.unencrypted_logs_hashes); + let note_encrypted_logs_hash = compute_tx_note_logs_hash(combined.note_encrypted_logs_hashes); + let encrypted_logs_hash = silo_and_hash_encrypted_logs(combined.encrypted_logs_hashes); + let unencrypted_logs_hash = silo_and_hash_unencrypted_logs(combined.unencrypted_logs_hashes); let mut offset = 0; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr index 79196bb3137..789eafcbfaa 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr @@ -9,7 +9,7 @@ use crate::{ constants::{ MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, COMBINED_ACCUMULATED_DATA_LENGTH, - MAX_UNENCRYPTED_LOGS_PER_TX + MAX_UNENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, MAX_ENCRYPTED_LOGS_PER_TX }, hash::silo_note_hash, utils::{arrays::{array_merge, assert_sorted_array, assert_deduped_array, check_permutation}, reader::Reader}, @@ -19,6 +19,10 @@ use crate::{ struct CombineHints { sorted_note_hashes: [ScopedNoteHash; MAX_NOTE_HASHES_PER_TX], sorted_note_hashes_indexes: [u32; MAX_NOTE_HASHES_PER_TX], + sorted_note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + sorted_note_encrypted_logs_hashes_indexes: [u32; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + sorted_encrypted_logs_hashes: [ScopedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], + sorted_encrypted_logs_hashes_indexes: [u32; MAX_ENCRYPTED_LOGS_PER_TX], sorted_unencrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX], sorted_unencrypted_logs_hashes_indexes: [u32; MAX_UNENCRYPTED_LOGS_PER_TX], // the public data update requests are sorted by their leaf index AND counter @@ -34,8 +38,8 @@ struct CombinedAccumulatedData { nullifiers: [Field; MAX_NULLIFIERS_PER_TX], l2_to_l1_msgs: [ScopedL2ToL1Message; MAX_L2_TO_L1_MSGS_PER_TX], - note_encrypted_logs_hash: Field, - encrypted_logs_hash: Field, + note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + encrypted_logs_hashes: [ScopedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX], // Here so that the gas cost of this request can be measured by circuits, without actually needing to feed in the @@ -98,18 +102,26 @@ impl CombinedAccumulatedData { combine_hints.deduped_public_data_update_requests_runs ); - // TODO(Miranda): Hash here or elsewhere? - let note_encrypted_logs_hash = compute_tx_note_logs_hash( - array_merge( - non_revertible.note_encrypted_logs_hashes, - revertible.note_encrypted_logs_hashes - ) + let merged_note_encrypted_logs_hashes = array_merge( + non_revertible.note_encrypted_logs_hashes, + revertible.note_encrypted_logs_hashes ); - let encrypted_logs_hash = compute_tx_logs_hash( - array_merge( - non_revertible.encrypted_logs_hashes, - revertible.encrypted_logs_hashes - ) + assert_sorted_array( + merged_note_encrypted_logs_hashes, + combine_hints.sorted_note_encrypted_logs_hashes, + combine_hints.sorted_note_encrypted_logs_hashes_indexes, + asc_sort_by_counters + ); + + let merged_encrypted_logs_hashes = array_merge( + non_revertible.encrypted_logs_hashes, + revertible.encrypted_logs_hashes + ); + assert_sorted_array( + merged_encrypted_logs_hashes, + combine_hints.sorted_encrypted_logs_hashes, + combine_hints.sorted_encrypted_logs_hashes_indexes, + asc_sort_by_counters ); let merged_unencrypted_logs_hashes = array_merge( @@ -125,16 +137,16 @@ impl CombinedAccumulatedData { let note_encrypted_log_preimages_length = non_revertible.note_encrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length) + revertible.note_encrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length); - let encrypted_log_preimages_length = non_revertible.encrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length) - + revertible.encrypted_logs_hashes.fold(0, |a, b: LogHash| a + b.length); + let encrypted_log_preimages_length = non_revertible.encrypted_logs_hashes.fold(0, |a, b: ScopedLogHash| a + b.log_hash.length) + + revertible.encrypted_logs_hashes.fold(0, |a, b: ScopedLogHash| a + b.log_hash.length); let unencrypted_log_preimages_length = non_revertible.unencrypted_logs_hashes.fold(0, |a, b: ScopedLogHash| a + b.log_hash.length) + revertible.unencrypted_logs_hashes.fold(0, |a, b: ScopedLogHash| a + b.log_hash.length); CombinedAccumulatedData { note_hashes: siloed_note_hashes, nullifiers: array_merge(non_revertible.nullifiers, revertible.nullifiers).map(|n: Nullifier| n.value), l2_to_l1_msgs: array_merge(non_revertible.l2_to_l1_msgs, revertible.l2_to_l1_msgs), - note_encrypted_logs_hash, - encrypted_logs_hash, + note_encrypted_logs_hashes: combine_hints.sorted_note_encrypted_logs_hashes, + encrypted_logs_hashes: combine_hints.sorted_encrypted_logs_hashes, unencrypted_logs_hashes: combine_hints.sorted_unencrypted_logs_hashes, note_encrypted_log_preimages_length, encrypted_log_preimages_length, @@ -151,8 +163,8 @@ impl Empty for CombinedAccumulatedData { note_hashes: [0; MAX_NOTE_HASHES_PER_TX], nullifiers: [0; MAX_NULLIFIERS_PER_TX], l2_to_l1_msgs: [ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX], - note_encrypted_logs_hash: 0, - encrypted_logs_hash: 0, + note_encrypted_logs_hashes: [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX], + encrypted_logs_hashes: [ScopedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX], note_encrypted_log_preimages_length: 0, encrypted_log_preimages_length: 0, @@ -172,8 +184,12 @@ impl Serialize for CombinedAccumulatedData { for i in 0..self.l2_to_l1_msgs.len() { fields.extend_from_array(self.l2_to_l1_msgs[i].serialize()); } - fields.push(self.note_encrypted_logs_hash); - fields.push(self.encrypted_logs_hash); + for i in 0..self.note_encrypted_logs_hashes.len() { + fields.extend_from_array(self.note_encrypted_logs_hashes[i].serialize()); + } + for i in 0..self.encrypted_logs_hashes.len() { + fields.extend_from_array(self.encrypted_logs_hashes[i].serialize()); + } for i in 0..self.unencrypted_logs_hashes.len() { fields.extend_from_array(self.unencrypted_logs_hashes[i].serialize()); } @@ -201,8 +217,8 @@ impl Deserialize for CombinedAccumulatedData { note_hashes: reader.read_array([0; MAX_NOTE_HASHES_PER_TX]), nullifiers: reader.read_array([0; MAX_NULLIFIERS_PER_TX]), l2_to_l1_msgs: reader.read_struct_array(ScopedL2ToL1Message::deserialize,[ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX]), - note_encrypted_logs_hash: reader.read(), - encrypted_logs_hash: reader.read(), + note_encrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX]), + encrypted_logs_hashes: reader.read_struct_array(ScopedLogHash::deserialize, [ScopedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX]), unencrypted_logs_hashes: reader.read_struct_array(ScopedLogHash::deserialize, [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX]), note_encrypted_log_preimages_length: reader.read(), encrypted_log_preimages_length: reader.read(), @@ -220,8 +236,8 @@ impl Eq for CombinedAccumulatedData { (self.note_hashes == other.note_hashes) & (self.nullifiers == other.nullifiers) & (self.l2_to_l1_msgs == other.l2_to_l1_msgs) & - (self.note_encrypted_logs_hash == other.note_encrypted_logs_hash) & - (self.encrypted_logs_hash == other.encrypted_logs_hash) & + (self.note_encrypted_logs_hashes == other.note_encrypted_logs_hashes) & + (self.encrypted_logs_hashes == other.encrypted_logs_hashes) & (self.unencrypted_logs_hashes == other.unencrypted_logs_hashes) & (self.note_encrypted_log_preimages_length == other.note_encrypted_log_preimages_length) & (self.encrypted_log_preimages_length == other.encrypted_log_preimages_length) & diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr index aa43a1c4fe9..0367a9d9673 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data.nr @@ -19,7 +19,7 @@ struct PublicAccumulatedData { l2_to_l1_msgs: [ScopedL2ToL1Message; MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX], - encrypted_logs_hashes: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX], + encrypted_logs_hashes: [ScopedLogHash; MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [ScopedLogHash; MAX_UNENCRYPTED_LOGS_PER_TX], public_data_update_requests: [PublicDataUpdateRequest; MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], @@ -36,7 +36,7 @@ impl Empty for PublicAccumulatedData { nullifiers: [Nullifier::empty(); MAX_NULLIFIERS_PER_TX], l2_to_l1_msgs: [ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX], note_encrypted_logs_hashes: [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX], - encrypted_logs_hashes: [LogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX], + encrypted_logs_hashes: [ScopedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX], unencrypted_logs_hashes: [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX], public_data_update_requests: [PublicDataUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX], public_call_stack: [PublicCallRequest::empty(); MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX], @@ -98,7 +98,7 @@ impl Deserialize for PublicAccumulatedData { nullifiers: reader.read_struct_array(Nullifier::deserialize, [Nullifier::empty(); MAX_NULLIFIERS_PER_TX]), l2_to_l1_msgs: reader.read_struct_array(ScopedL2ToL1Message::deserialize, [ScopedL2ToL1Message::empty(); MAX_L2_TO_L1_MSGS_PER_TX]), note_encrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_NOTE_ENCRYPTED_LOGS_PER_TX]), - encrypted_logs_hashes: reader.read_struct_array(LogHash::deserialize, [LogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX]), + encrypted_logs_hashes: reader.read_struct_array(ScopedLogHash::deserialize, [ScopedLogHash::empty(); MAX_ENCRYPTED_LOGS_PER_TX]), unencrypted_logs_hashes: reader.read_struct_array(ScopedLogHash::deserialize, [ScopedLogHash::empty(); MAX_UNENCRYPTED_LOGS_PER_TX]), public_data_update_requests: reader.read_struct_array(PublicDataUpdateRequest::deserialize, [PublicDataUpdateRequest::empty(); MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX]), public_call_stack: reader.read_struct_array(PublicCallRequest::deserialize, [PublicCallRequest::empty(); MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX]), diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr index 8c9f42ab5e5..d193809e0e4 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/public_accumulated_data_builder.nr @@ -19,7 +19,7 @@ struct PublicAccumulatedDataBuilder { l2_to_l1_msgs: BoundedVec, note_encrypted_logs_hashes: BoundedVec, - encrypted_logs_hashes: BoundedVec, + encrypted_logs_hashes: BoundedVec, unencrypted_logs_hashes: BoundedVec, public_data_update_requests: BoundedVec, diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/log_hash.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/log_hash.nr index f5983f4dbde..9945e7b4fa7 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/log_hash.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/log_hash.nr @@ -221,11 +221,13 @@ impl Scoped for ScopedEncryptedLogHash { } impl ScopedEncryptedLogHash { - pub fn expose_to_public(self) -> LogHash { + pub fn expose_to_public(self) -> ScopedLogHash { // Hide the secret randomness and counter when exposing to public - // Expose as a LogHash rather than EncryptedLogHash to avoid bringing an unnec. 0 value around - // The log hash will already be silo'd when we call this - LogHash { value: self.log_hash.value, counter: 0, length: self.log_hash.length } + // Expose as a ScopedLogHash. The contract address is assumed to be masked before calling this. + ScopedLogHash { + contract_address: self.contract_address, + log_hash: LogHash { value: self.log_hash.value, counter: 0, length: self.log_hash.length } + } } } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index f3cb9300fc8..4322bb8f011 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -128,6 +128,8 @@ global MAX_ARGS_LENGTH: u32 = ARGS_HASH_CHUNK_COUNT * ARGS_HASH_CHUNK_LENGTH; global INITIALIZATION_SLOT_SEPARATOR: Field = 1000_000_000; global INITIAL_L2_BLOCK_NUM: Field = 1; global BLOB_SIZE_IN_BYTES: Field = 31 * 4096; +global ETHEREUM_SLOT_DURATION: u32 = 12; +global IS_DEV_NET: bool = true; // CONTRACT CLASS CONSTANTS global MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS: u32 = 20000; @@ -179,7 +181,7 @@ global CANONICAL_KEY_REGISTRY_ADDRESS = 0x1dc0848be99ba522c157b46ab5ed64d86703a7 global CANONICAL_AUTH_REGISTRY_ADDRESS = 0x24877c50868f86712240eb535d90d1c97403d074805dd3758c3aecb02958f8d4; global DEPLOYER_CONTRACT_ADDRESS = 0x2ab1a2bd6d07d8d61ea56d85861446349e52c6b7c0612b702cb1e6db6ad0b089; global REGISTERER_CONTRACT_ADDRESS = 0x05d15342d76e46e5be07d3cda0d753158431cdc5e39d29ce4e8fe1f5c070564a; -global GAS_TOKEN_ADDRESS = 0x0b9185bb21ae5ec07011d459dca15a226712e49d9f6238ba0799bd6c2768a169; +global FEE_JUICE_ADDRESS = 0x16a83e3395bc921a2441db55dce24f0e0932636901a2e676fa68b9b2b9a644c1; // LENGTH OF STRUCTS SERIALIZED TO FIELDS global AZTEC_ADDRESS_LENGTH = 1; @@ -236,13 +238,13 @@ global PRIVATE_VALIDATION_REQUESTS_LENGTH = ROLLUP_VALIDATION_REQUESTS_LENGTH + global PUBLIC_VALIDATION_REQUESTS_LENGTH = ROLLUP_VALIDATION_REQUESTS_LENGTH + (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_READ_REQUESTS_PER_TX) + (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX) + (PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX); global PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 3; -global COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NOTE_HASHES_PER_TX + MAX_NULLIFIERS_PER_TX + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + 5 + (MAX_UNENCRYPTED_LOGS_PER_TX * SCOPED_LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH; +global COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NOTE_HASHES_PER_TX + MAX_NULLIFIERS_PER_TX + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) + (SCOPED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) + 3 + (MAX_UNENCRYPTED_LOGS_PER_TX * SCOPED_LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH; global COMBINED_CONSTANT_DATA_LENGTH = HEADER_LENGTH + TX_CONTEXT_LENGTH + GLOBAL_VARIABLES_LENGTH + 1; global PRIVATE_ACCUMULATED_DATA_LENGTH = (SCOPED_NOTE_HASH_LENGTH * MAX_NOTE_HASHES_PER_TX) + (SCOPED_NULLIFIER_LENGTH * MAX_NULLIFIERS_PER_TX) + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) + (SCOPED_ENCRYPTED_LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) + (SCOPED_LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + (PRIVATE_CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX) + (PUBLIC_CALL_REQUEST_LENGTH * MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX); global PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1 + PRIVATE_VALIDATION_REQUESTS_LENGTH + PRIVATE_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + PUBLIC_CALL_REQUEST_LENGTH + AZTEC_ADDRESS_LENGTH; -global PUBLIC_ACCUMULATED_DATA_LENGTH = (MAX_NOTE_HASHES_PER_TX * SCOPED_NOTE_HASH_LENGTH) + (MAX_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (MAX_NOTE_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * SCOPED_LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * PUBLIC_CALL_REQUEST_LENGTH) + GAS_LENGTH; +global PUBLIC_ACCUMULATED_DATA_LENGTH = (MAX_NOTE_HASHES_PER_TX * SCOPED_NOTE_HASH_LENGTH) + (MAX_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) + (MAX_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (MAX_NOTE_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_ENCRYPTED_LOGS_PER_TX * SCOPED_LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * SCOPED_LOG_HASH_LENGTH) + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * PUBLIC_CALL_REQUEST_LENGTH) + GAS_LENGTH; global PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = PUBLIC_VALIDATION_REQUESTS_LENGTH + PUBLIC_ACCUMULATED_DATA_LENGTH + PUBLIC_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + 1 + (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * PUBLIC_CALL_REQUEST_LENGTH) + AZTEC_ADDRESS_LENGTH; global KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = ROLLUP_VALIDATION_REQUESTS_LENGTH + COMBINED_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + PARTIAL_STATE_REFERENCE_LENGTH + 1 + AZTEC_ADDRESS_LENGTH; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr b/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr index ae9a9f7d984..a9afe4dc9b9 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr @@ -90,27 +90,26 @@ pub fn silo_nullifier(nullifier: ScopedNullifier) -> Field { } } -pub fn compute_siloed_encrypted_log_hash(address: AztecAddress, randomness: Field, log_hash: Field) -> Field { - // TODO: Using 0 GENERATOR_INDEX here as interim before we move to posiedon - // NB: A unique separator will be needed for masked_contract_address - let mut masked_contract_address = poseidon2_hash_with_separator([address.to_field(), randomness], 0); - if randomness == 0 { - // In some cases, we actually want to reveal the contract address we are siloing with: - // e.g. 'handshaking' contract w/ known address - // An app providing randomness = 0 signals to not mask the address. - masked_contract_address = address.to_field(); +pub fn silo_encrypted_log_hash(log_hash: ScopedLogHash) -> Field { + // We assume contract address has already been masked + if log_hash.contract_address.is_zero() { + 0 + } else { + accumulate_sha256([log_hash.contract_address.to_field(), log_hash.log_hash.value]) } - accumulate_sha256([masked_contract_address, log_hash]) } -pub fn silo_encrypted_log_hash(log_hash: ScopedEncryptedLogHash) -> Field { - if log_hash.contract_address.is_zero() { - 0 +pub fn mask_encrypted_log_hash(scoped_log: ScopedEncryptedLogHash) -> AztecAddress { + if scoped_log.contract_address.is_zero() { + AztecAddress::from_field(0) + } else if (scoped_log.log_hash.randomness == 0) { + scoped_log.contract_address } else { - compute_siloed_encrypted_log_hash( - log_hash.contract_address, - log_hash.log_hash.randomness, - log_hash.log_hash.value + AztecAddress::from_field( + poseidon2_hash_with_separator( + [scoped_log.contract_address.to_field(), scoped_log.log_hash.randomness], + 0 + ) ) } } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr index 8f067225330..a03d4ddb24a 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr @@ -34,7 +34,7 @@ use crate::{ }, hash::{ compute_l2_to_l1_hash, compute_tx_logs_hash, compute_tx_note_logs_hash, compute_siloed_nullifier, - silo_encrypted_log_hash, silo_note_hash, silo_unencrypted_log_hash + silo_encrypted_log_hash, silo_note_hash, silo_unencrypted_log_hash, mask_encrypted_log_hash }, header::Header, merkle_tree::membership::MembershipWitness, messaging::l2_to_l1_message::{L2ToL1Message, ScopedL2ToL1Message}, @@ -322,7 +322,9 @@ impl FixtureBuilder { len: self.note_encrypted_logs_hashes.len() }; let encrypted_logs_hashes = BoundedVec { - storage: self.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.log_hash).map(|l: EncryptedLogHash| LogHash { value: l.value, counter: l.counter, length: l.length }), + storage: self.encrypted_logs_hashes.storage.map( + |l: ScopedEncryptedLogHash| ScopedLogHash { log_hash: LogHash { value: l.log_hash.value, counter: l.log_hash.counter, length: l.log_hash.length}, contract_address: l.contract_address } + ), len: self.encrypted_logs_hashes.len() }; @@ -362,8 +364,8 @@ impl FixtureBuilder { note_hashes: self.note_hashes.storage.map(|n: ScopedNoteHash| n.note_hash.value), nullifiers: self.nullifiers.storage.map(|n: ScopedNullifier| n.nullifier.value), l2_to_l1_msgs: self.l2_to_l1_msgs.storage.map(|m: ScopedL2ToL1Message| m.expose_to_public()), - note_encrypted_logs_hash: self.note_encrypted_logs_hash, - encrypted_logs_hash: self.encrypted_logs_hash, + note_encrypted_logs_hashes: self.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public()), + encrypted_logs_hashes: self.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public()), unencrypted_logs_hashes: self.unencrypted_logs_hashes.storage.map(|l: ScopedLogHash| l.expose_to_public()), note_encrypted_log_preimages_length: self.note_encrypted_log_preimages_length, encrypted_log_preimages_length: self.encrypted_log_preimages_length, @@ -717,20 +719,15 @@ impl FixtureBuilder { } } - pub fn hash_note_encrypted_log_hashes(&mut self) { - let log_hashes = self.note_encrypted_logs_hashes.storage.map(|l: NoteLogHash| l.expose_to_public()); - self.note_encrypted_logs_hash = compute_tx_note_logs_hash(log_hashes); - } - pub fn add_encrypted_log_hash(&mut self, hash: Field, length: Field) { let log_hash = EncryptedLogHash { value: hash, counter: self.next_counter(), length, randomness: 2 }; self.encrypted_logs_hashes.push(log_hash.scope(self.storage_contract_address)); self.encrypted_log_preimages_length += length; } - pub fn add_siloed_encrypted_log_hash(&mut self, hash: Field, length: Field) { + pub fn add_masked_encrypted_log_hash(&mut self, hash: Field, length: Field) { let mut log_hash = EncryptedLogHash { value: hash, counter: self.next_counter(), length, randomness: 2 }.scope(self.storage_contract_address); - log_hash.log_hash.value = silo_encrypted_log_hash(log_hash); + log_hash.contract_address = mask_encrypted_log_hash(log_hash); self.encrypted_logs_hashes.push(log_hash); self.encrypted_log_preimages_length += length; } @@ -745,15 +742,10 @@ impl FixtureBuilder { } } - pub fn hash_encrypted_log_hashes(&mut self) { - let mut log_hashes = self.encrypted_logs_hashes.storage.map(|l: ScopedEncryptedLogHash| l.expose_to_public()); + pub fn mask_encrypted_log_hashes(&mut self) { for i in 0..self.encrypted_logs_hashes.max_len() { - let log_hash = self.encrypted_logs_hashes.storage[i]; - if !log_hash.contract_address.is_zero() { - log_hashes[i].value = silo_encrypted_log_hash(log_hash); - } + self.encrypted_logs_hashes.storage[i].contract_address = mask_encrypted_log_hash(self.encrypted_logs_hashes.storage[i]); } - self.encrypted_logs_hash = compute_tx_logs_hash(log_hashes); } pub fn add_unencrypted_log_hash(&mut self, hash: Field, length: Field) { diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Nargo.toml b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Nargo.toml new file mode 100644 index 00000000000..15d4b01ac44 --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "databus_two_calldata" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Prover.toml b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Prover.toml new file mode 100644 index 00000000000..1229857d3f5 --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/Prover.toml @@ -0,0 +1,3 @@ +x = [0,1,2,3] +y = [0,2,4] +z = [1,3,5,7] diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata/src/main.nr b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/src/main.nr new file mode 100644 index 00000000000..75df2a0953c --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata/src/main.nr @@ -0,0 +1,11 @@ +// An simple program demonstrating two calldata array inputs and a single return data array. As an arbitrary example, +// the return data is computed as a linear combination of the calldata. +fn main(mut x: [u32; 4], y: call_data(0) [u32; 3], z: call_data(1) [u32; 4]) -> return_data [u32; 4] { + let mut result = [0; 4]; + for i in 0..3 { + let idx = x[i]; + result[idx] = y[idx] + z[idx]; + } + result[x[3]] = z[x[3]]; + result +} diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Nargo.toml b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Nargo.toml new file mode 100644 index 00000000000..5104029c08e --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "databus_two_calldata_simple" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Prover.toml b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Prover.toml new file mode 100644 index 00000000000..58257d1fe14 --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Prover.toml @@ -0,0 +1,3 @@ +idx = "1" +y = [7, 9] +z = [1,2,3,4] diff --git a/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/src/main.nr b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/src/main.nr new file mode 100644 index 00000000000..2477f0006c8 --- /dev/null +++ b/noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/src/main.nr @@ -0,0 +1,5 @@ +fn main(mut idx: u32, y: call_data(0) [u32; 2], z: call_data(1) [u32; 4]) -> return_data u32 { + let a = y[idx]; + let b = z[idx]; + a + b +} diff --git a/yarn-project/.gitignore b/yarn-project/.gitignore index e044af6d3bd..52a732c53c2 100644 --- a/yarn-project/.gitignore +++ b/yarn-project/.gitignore @@ -20,6 +20,7 @@ circuits.js/fixtures/*.json circuits.js/src/structs/kernel/private_kernel_reset_circuit_private_inputs_variants.ts docs/dist end-to-end/addresses.json +end-to-end/flame_graph end-to-end/log end-to-end/data end-to-end/src/web/main.js diff --git a/yarn-project/accounts/package.json b/yarn-project/accounts/package.json index b1209964ae4..d4d3d8ab916 100644 --- a/yarn-project/accounts/package.json +++ b/yarn-project/accounts/package.json @@ -9,7 +9,8 @@ "./ecdsa": "./dest/ecdsa/index.js", "./schnorr": "./dest/schnorr/index.js", "./single_key": "./dest/single_key/index.js", - "./testing": "./dest/testing/index.js" + "./testing": "./dest/testing/index.js", + "./utils": "./dest/utils/index.js" }, "typedocOptions": { "entryPoints": [ diff --git a/yarn-project/accounts/scripts/copy-contracts.sh b/yarn-project/accounts/scripts/copy-contracts.sh index 5984357006a..d7f19e13c10 100755 --- a/yarn-project/accounts/scripts/copy-contracts.sh +++ b/yarn-project/accounts/scripts/copy-contracts.sh @@ -2,7 +2,7 @@ set -euo pipefail mkdir -p ./artifacts -contracts=(schnorr_account_contract-SchnorrAccount ecdsa_account_contract-EcdsaAccount schnorr_single_key_account_contract-SchnorrSingleKeyAccount) +contracts=(schnorr_account_contract-SchnorrAccount ecdsa_k_account_contract-EcdsaKAccount ecdsa_r_account_contract-EcdsaRAccount schnorr_single_key_account_contract-SchnorrSingleKeyAccount) decl=$(cat < { diff --git a/yarn-project/accounts/src/ecdsa/ecdsa_k/artifact.ts b/yarn-project/accounts/src/ecdsa/ecdsa_k/artifact.ts new file mode 100644 index 00000000000..eac072ed08e --- /dev/null +++ b/yarn-project/accounts/src/ecdsa/ecdsa_k/artifact.ts @@ -0,0 +1,5 @@ +import { type NoirCompiledContract, loadContractArtifact } from '@aztec/aztec.js'; + +import EcdsaKAccountContractJson from '../../../artifacts/EcdsaKAccount.json' assert { type: 'json' }; + +export const EcdsaKAccountContractArtifact = loadContractArtifact(EcdsaKAccountContractJson as NoirCompiledContract); diff --git a/yarn-project/accounts/src/ecdsa/ecdsa_k/index.ts b/yarn-project/accounts/src/ecdsa/ecdsa_k/index.ts new file mode 100644 index 00000000000..660cfe33913 --- /dev/null +++ b/yarn-project/accounts/src/ecdsa/ecdsa_k/index.ts @@ -0,0 +1,37 @@ +/** + * The `@aztec/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption. + * Consider using this account type when working with integrations with Ethereum wallets. + * + * @packageDocumentation + */ +import { AccountManager, type Salt } from '@aztec/aztec.js/account'; +import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet'; +import { type PXE } from '@aztec/circuit-types'; +import { type AztecAddress, type Fr } from '@aztec/circuits.js'; + +import { EcdsaKAccountContract } from './account_contract.js'; + +export { EcdsaKAccountContractArtifact } from './artifact.js'; +export { EcdsaKAccountContract }; + +/** + * Creates an Account that relies on an ECDSA signing key for authentication. + * @param pxe - An PXE server instance. + * @param secretKey - Secret key used to derive all the keystore keys. + * @param signingPrivateKey - Secp256k1 key used for signing transactions. + * @param salt - Deployment salt. + */ +export function getEcdsaKAccount(pxe: PXE, secretKey: Fr, signingPrivateKey: Buffer, salt?: Salt): AccountManager { + return new AccountManager(pxe, secretKey, new EcdsaKAccountContract(signingPrivateKey), salt); +} + +/** + * Gets a wallet for an already registered account using ECDSA signatures. + * @param pxe - An PXE server instance. + * @param address - Address for the account. + * @param signingPrivateKey - ECDSA key used for signing transactions. + * @returns A wallet for this account that can be used to interact with a contract instance. + */ +export function getEcdsaKWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise { + return getWallet(pxe, address, new EcdsaKAccountContract(signingPrivateKey)); +} diff --git a/yarn-project/accounts/src/ecdsa/index.ts b/yarn-project/accounts/src/ecdsa/index.ts index b27891f23dc..a380d7b954d 100644 --- a/yarn-project/accounts/src/ecdsa/index.ts +++ b/yarn-project/accounts/src/ecdsa/index.ts @@ -1,37 +1,2 @@ -/** - * The `@aztec/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption. - * Consider using this account type when working with integrations with Ethereum wallets. - * - * @packageDocumentation - */ -import { AccountManager, type Salt } from '@aztec/aztec.js/account'; -import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet'; -import { type PXE } from '@aztec/circuit-types'; -import { type AztecAddress, type Fr } from '@aztec/circuits.js'; - -import { EcdsaAccountContract } from './account_contract.js'; - -export { EcdsaAccountContractArtifact } from './artifact.js'; -export { EcdsaAccountContract }; - -/** - * Creates an Account that relies on an ECDSA signing key for authentication. - * @param pxe - An PXE server instance. - * @param secretKey - Secret key used to derive all the keystore keys. - * @param signingPrivateKey - Secp256k1 key used for signing transactions. - * @param salt - Deployment salt. - */ -export function getEcdsaAccount(pxe: PXE, secretKey: Fr, signingPrivateKey: Buffer, salt?: Salt): AccountManager { - return new AccountManager(pxe, secretKey, new EcdsaAccountContract(signingPrivateKey), salt); -} - -/** - * Gets a wallet for an already registered account using ECDSA signatures. - * @param pxe - An PXE server instance. - * @param address - Address for the account. - * @param signingPrivateKey - ECDSA key used for signing transactions. - * @returns A wallet for this account that can be used to interact with a contract instance. - */ -export function getEcdsaWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise { - return getWallet(pxe, address, new EcdsaAccountContract(signingPrivateKey)); -} +export * from './ecdsa_k/index.js'; +export * from './ssh_ecdsa_r/index.js'; diff --git a/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/account_contract.ts b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/account_contract.ts new file mode 100644 index 00000000000..60812c83680 --- /dev/null +++ b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/account_contract.ts @@ -0,0 +1,88 @@ +import { type AuthWitnessProvider } from '@aztec/aztec.js/account'; +import { AuthWitness, type CompleteAddress } from '@aztec/circuit-types'; +import { EcdsaSignature } from '@aztec/circuits.js/barretenberg'; +import { type ContractArtifact } from '@aztec/foundation/abi'; +import { type Fr } from '@aztec/foundation/fields'; + +import { DefaultAccountContract } from '../../defaults/account_contract.js'; +import { signWithAgent } from '../../utils/ssh_agent.js'; +import { EcdsaRAccountContractArtifact } from './artifact.js'; + +const secp256r1N = 115792089210356248762697446949407573529996955224135760342422259061068512044369n; +/** + * Account contract that authenticates transactions using ECDSA signatures + * verified against a secp256r1 public key stored in an immutable encrypted note. + * Since this implementation relays signatures to an SSH agent, we provide the + * public key here not for signature verification, but to identify actual identity + * that will be used to sign authwitnesses. + */ +export class EcdsaRSSHAccountContract extends DefaultAccountContract { + constructor(private signingPublicKey: Buffer) { + super(EcdsaRAccountContractArtifact as ContractArtifact); + } + + getDeploymentArgs() { + return [this.signingPublicKey.subarray(0, 32), this.signingPublicKey.subarray(32, 64)]; + } + + getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider { + return new SSHEcdsaRAuthWitnessProvider(this.signingPublicKey); + } +} + +/** Creates auth witnesses using ECDSA signatures. */ +class SSHEcdsaRAuthWitnessProvider implements AuthWitnessProvider { + constructor(private signingPublicKey: Buffer) {} + + #parseECDSASignature(data: Buffer) { + // Extract ECDSA signature components + let offset = 0; + const sigTypeLen = data.readUInt32BE(offset); + offset += 4; + const sigType = data.subarray(offset, offset + sigTypeLen).toString(); + offset += sigTypeLen; + + if (sigType !== 'ecdsa-sha2-nistp256') { + throw new Error(`Unexpected signature type: ${sigType}`); + } + + offset += 4; + const rLen = data.readUInt32BE(offset); + offset += 4; + let r = data.subarray(offset, offset + rLen); + offset += rLen; + + const sLen = data.readUInt32BE(offset); + offset += 4; + let s = data.subarray(offset, offset + sLen); + + // R and S are encoded using ASN.1 DER format, which may include a leading zero byte to avoid interpreting the value as negative + if (r.length > 32) { + r = Buffer.from(Uint8Array.prototype.slice.call(r, 1)); + } + + if (s.length > 32) { + s = Buffer.from(Uint8Array.prototype.slice.call(s, 1)); + } + + const maybeHighS = BigInt(`0x${s.toString('hex')}`); + + // ECDSA signatures must have a low S value so they can be used as a nullifier. BB forces a value of 27 for v, so + // only one PublicKey can verify the signature (and not its negated counterpart) https://ethereum.stackexchange.com/a/55728 + if (maybeHighS > secp256r1N / 2n + 1n) { + s = Buffer.from((secp256r1N - maybeHighS).toString(16), 'hex'); + } + + return new EcdsaSignature(r, s, Buffer.from([0])); + } + + async createAuthWit(messageHash: Fr): Promise { + // Key type and curve name + const keyType = Buffer.from('ecdsa-sha2-nistp256'); + const curveName = Buffer.from('nistp256'); + const data = await signWithAgent(keyType, curveName, this.signingPublicKey, messageHash.toBuffer()); + const signature = this.#parseECDSASignature(data); + + return new AuthWitness(messageHash, [...signature.r, ...signature.s]); + } +} diff --git a/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/artifact.ts b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/artifact.ts new file mode 100644 index 00000000000..ea8382b6137 --- /dev/null +++ b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/artifact.ts @@ -0,0 +1,5 @@ +import { type NoirCompiledContract, loadContractArtifact } from '@aztec/aztec.js'; + +import EcdsaRAccountContractJson from '../../../artifacts/EcdsaRAccount.json' assert { type: 'json' }; + +export const EcdsaRAccountContractArtifact = loadContractArtifact(EcdsaRAccountContractJson as NoirCompiledContract); diff --git a/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/index.ts b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/index.ts new file mode 100644 index 00000000000..fb368a3c7a9 --- /dev/null +++ b/yarn-project/accounts/src/ecdsa/ssh_ecdsa_r/index.ts @@ -0,0 +1,37 @@ +/** + * The `@aztec/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption. + * Consider using this account type when working with integrations with Ethereum wallets. + * + * @packageDocumentation + */ +import { AccountManager, type Salt } from '@aztec/aztec.js/account'; +import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet'; +import { type PXE } from '@aztec/circuit-types'; +import { type AztecAddress, type Fr } from '@aztec/circuits.js'; + +import { EcdsaRSSHAccountContract } from './account_contract.js'; + +export { EcdsaRAccountContractArtifact } from './artifact.js'; +export { EcdsaRSSHAccountContract }; + +/** + * Creates an Account that relies on an ECDSA signing key for authentication. + * @param pxe - An PXE server instance. + * @param secretKey - Secret key used to derive all the keystore keys. + * @param signingPublicKey - Secp2561 key used to identify its corresponding private key in the SSH Agent. + * @param salt - Deployment salt. + */ +export function getEcdsaRSSHAccount(pxe: PXE, secretKey: Fr, signingPublicKey: Buffer, salt?: Salt): AccountManager { + return new AccountManager(pxe, secretKey, new EcdsaRSSHAccountContract(signingPublicKey), salt); +} + +/** + * Gets a wallet for an already registered account using ECDSA signatures. + * @param pxe - An PXE server instance. + * @param address - Address for the account. + * @param signingPrivateKey - ECDSA key used for signing transactions. + * @returns A wallet for this account that can be used to interact with a contract instance. + */ +export function getEcdsaRSSHWallet(pxe: PXE, address: AztecAddress, signingPublicKey: Buffer): Promise { + return getWallet(pxe, address, new EcdsaRSSHAccountContract(signingPublicKey)); +} diff --git a/yarn-project/accounts/src/utils/index.ts b/yarn-project/accounts/src/utils/index.ts new file mode 100644 index 00000000000..ba7c543a064 --- /dev/null +++ b/yarn-project/accounts/src/utils/index.ts @@ -0,0 +1 @@ +export * from './ssh_agent.js'; diff --git a/yarn-project/accounts/src/utils/ssh_agent.ts b/yarn-project/accounts/src/utils/ssh_agent.ts new file mode 100644 index 00000000000..2812e7f825d --- /dev/null +++ b/yarn-project/accounts/src/utils/ssh_agent.ts @@ -0,0 +1,136 @@ +import { Buffer } from 'buffer'; +import net from 'net'; + +const SSH_AGENT_IDENTITIES_REQUEST = 11; +const SSH_AGENT_IDENTITIES_RESPONSE = 12; +const SSH_AGENT_SIGN_REQUEST = 13; +const SSH_AGENT_SIGN_RESPONSE = 14; + +/** + * Connect to the SSH agent via a TCP socket using the standard env variable + */ +export function connectToAgent() { + const socketPath = process.env.SSH_AUTH_SOCK; + if (!socketPath) { + throw new Error('SSH_AUTH_SOCK is not set'); + } + return net.connect(socketPath); +} + +/** + * Type representing a stored key in the SSH agent. + */ +type StoredKey = { + /** + * Type of the key. + */ + type: string; + /** + * Public key in base64 encoding. + */ + publicKey: string; + /** + * Comment associated with the key. + */ + comment: string; +}; + +/** + * Retrieve the identities stored in the SSH agent. + */ +export function getIdentities(): Promise { + return new Promise((resolve, reject) => { + const stream = connectToAgent(); + stream.on('connect', () => { + const request = Buffer.concat([ + Buffer.from([0, 0, 0, 5 + 4]), // length + Buffer.from([SSH_AGENT_IDENTITIES_REQUEST]), + Buffer.from([0, 0, 0, 0]), // flags + ]); + + stream.write(request); + }); + + stream.on('data', data => { + const responseType = data[4]; + if (responseType === SSH_AGENT_IDENTITIES_RESPONSE) { + let offset = 5; + const numKeys = data.readUInt32BE(offset); + offset += 4; + + const keys = []; + for (let i = 0; i < numKeys; i++) { + const keyLength = data.readUInt32BE(offset); + offset += 4; + const key = data.subarray(offset, offset + keyLength); + offset += keyLength; + const commentLength = data.readUInt32BE(offset); + offset += 4; + const comment = data.subarray(offset, offset + commentLength); + offset += commentLength; + + let keyOffset = 0; + const typeLen = key.readUInt32BE(keyOffset); + keyOffset += 4; + const type = key.subarray(keyOffset, keyOffset + typeLen); + + keys.push({ + type: type.toString('ascii'), + publicKey: key.toString('base64'), + comment: comment.toString('utf8'), + }); + } + stream.end(); + resolve(keys); + } else { + stream.end(); + reject(`Unexpected response type: ${responseType}`); + } + }); + }); +} + +/** + * Sign data using a key stored in the SSH agent. The private signing key is identified by its corresponding public key. + */ +export function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer) { + return new Promise((resolve, reject) => { + const stream = connectToAgent(); + stream.on('connect', () => { + // Construct the key blob + const keyBlob = Buffer.concat([ + Buffer.from([0, 0, 0, keyType.length]), + keyType, + Buffer.from([0, 0, 0, curveName.length]), + curveName, + Buffer.from([0, 0, 0, publicKey.length + 1, 4]), + publicKey, + ]); + const request = Buffer.concat([ + Buffer.from([0, 0, 0, 5 + keyBlob.length + 4 + data.length + 4]), // length + Buffer.from([SSH_AGENT_SIGN_REQUEST]), + Buffer.from([0, 0, 0, keyBlob.length]), // key blob length + keyBlob, + Buffer.from([0, 0, 0, data.length]), // data length + data, + Buffer.from([0, 0, 0, 0]), // flags + ]); + + stream.write(request); + }); + + stream.on('data', data => { + const type = data[4]; + + if (type === SSH_AGENT_SIGN_RESPONSE) { + const signatureLength = data.readUInt32BE(5); + const signature = data.subarray(9, 9 + signatureLength); + stream.end(); + resolve(signature); + } else { + stream.end(); + reject(`Unexpected response type: ${type}`); + } + }); + }); +} diff --git a/yarn-project/archiver/src/archiver/archiver.ts b/yarn-project/archiver/src/archiver/archiver.ts index 006bccdfd4d..594fb8fb062 100644 --- a/yarn-project/archiver/src/archiver/archiver.ts +++ b/yarn-project/archiver/src/archiver/archiver.ts @@ -28,6 +28,7 @@ import { type EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; +import { Timer } from '@aztec/foundation/timer'; import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer'; import { type TelemetryClient } from '@aztec/telemetry-client'; import { @@ -109,7 +110,7 @@ export class Archiver implements ArchiveSource { telemetry: TelemetryClient, blockUntilSynced = true, ): Promise { - const chain = createEthereumChain(config.rpcUrl, config.l1ChainId); + const chain = createEthereumChain(config.l1RpcUrl, config.l1ChainId); const publicClient = createPublicClient({ chain: chain.chainInfo, transport: http(chain.rpcUrl), @@ -234,6 +235,8 @@ export class Archiver implements ArchiveSource { // the metadata let retrievedBlocks: DataRetrieval; { + // @todo @LHerskind Investigate how necessary that nextExpectedL2BlockNum really is. + // Also, I would expect it to break horribly if we have a reorg. const retrievedBlockMetadata = await retrieveBlockMetadataFromRollup( this.publicClient, this.rollupAddress, @@ -247,15 +250,27 @@ export class Archiver implements ArchiveSource { ([header]) => header.contentCommitment.txsEffectsHash, ); + // @note @LHerskind We will occasionally be hitting this point BEFORE, we have actually retrieved the bodies. + // The main reason this have not been an issue earlier is because: + // i) the design previously published the body in one tx and the header in another, + // which in an anvil auto mine world mean that they are separate blocks. + // ii) We have been lucky that latency have been small enough to not matter. const blockBodiesFromStore = await this.store.getBlockBodies(retrievedBodyHashes); if (retrievedBlockMetadata.retrievedData.length !== blockBodiesFromStore.length) { - throw new Error('Block headers length does not equal block bodies length'); + this.log.warn('Block headers length does not equal block bodies length'); } - const blocks = retrievedBlockMetadata.retrievedData.map( - (blockMetadata, i) => new L2Block(blockMetadata[1], blockMetadata[0], blockBodiesFromStore[i]), - ); + const blocks: L2Block[] = []; + for (let i = 0; i < retrievedBlockMetadata.retrievedData.length; i++) { + const [header, archive] = retrievedBlockMetadata.retrievedData[i]; + const blockBody = blockBodiesFromStore[i]; + if (blockBody) { + blocks.push(new L2Block(archive, header, blockBody)); + } else { + this.log.warn(`Block body not found for block ${header.globalVariables.blockNumber.toBigInt()}.`); + } + } (blocks.length ? this.log.verbose : this.log.debug)( `Retrieved ${blocks.length || 'no'} new L2 blocks between L1 blocks ${ @@ -263,8 +278,13 @@ export class Archiver implements ArchiveSource { } and ${currentL1BlockNumber}.`, ); + // Set the `lastProcessedL1BlockNumber` to the smallest of the header and body retrieval + const min = (a: bigint, b: bigint) => (a < b ? a : b); retrievedBlocks = { - lastProcessedL1BlockNumber: retrievedBlockMetadata.lastProcessedL1BlockNumber, + lastProcessedL1BlockNumber: min( + retrievedBlockMetadata.lastProcessedL1BlockNumber, + retrievedBlockBodies.lastProcessedL1BlockNumber, + ), retrievedData: blocks, }; } @@ -291,8 +311,12 @@ export class Archiver implements ArchiveSource { ); if (retrievedBlocks.retrievedData.length > 0) { + const timer = new Timer(); await this.store.addBlocks(retrievedBlocks); - this.instrumentation.processNewBlocks(retrievedBlocks.retrievedData); + this.instrumentation.processNewBlocks( + timer.ms() / retrievedBlocks.retrievedData.length, + retrievedBlocks.retrievedData, + ); const lastL2BlockNumber = retrievedBlocks.retrievedData[retrievedBlocks.retrievedData.length - 1].number; this.log.verbose(`Processed ${retrievedBlocks.retrievedData.length} new L2 blocks up to ${lastL2BlockNumber}`); } @@ -323,6 +347,7 @@ export class Archiver implements ArchiveSource { if (provenBlockNumber > currentProvenBlockNumber) { this.log.verbose(`Updated last proven block number from ${currentProvenBlockNumber} to ${provenBlockNumber}`); await this.store.setProvenL2BlockNumber(Number(provenBlockNumber)); + this.instrumentation.updateLastProvenBlock(Number(provenBlockNumber)); } } diff --git a/yarn-project/archiver/src/archiver/archiver_store.ts b/yarn-project/archiver/src/archiver/archiver_store.ts index 7e388cbf52f..d2dcd7ae9b1 100644 --- a/yarn-project/archiver/src/archiver/archiver_store.ts +++ b/yarn-project/archiver/src/archiver/archiver_store.ts @@ -61,7 +61,7 @@ export interface ArchiverDataStore { * @param txsEffectsHashes - A list of txsEffectsHashes. * @returns The requested L2 block bodies */ - getBlockBodies(txsEffectsHashes: Buffer[]): Promise; + getBlockBodies(txsEffectsHashes: Buffer[]): Promise<(Body | undefined)[]>; /** * Gets up to `limit` amount of L2 blocks starting from `from`. diff --git a/yarn-project/archiver/src/archiver/config.ts b/yarn-project/archiver/src/archiver/config.ts index c59e6d1789c..f4ec61d3106 100644 --- a/yarn-project/archiver/src/archiver/config.ts +++ b/yarn-project/archiver/src/archiver/config.ts @@ -1,4 +1,5 @@ -import { type L1ContractAddresses, getL1ContractAddressesFromEnv } from '@aztec/ethereum'; +import { type L1ContractAddresses, type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum'; +import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config'; /** * There are 2 polling intervals used in this configuration. The first is the archiver polling interval, archiverPollingIntervalMS. @@ -10,27 +11,12 @@ import { type L1ContractAddresses, getL1ContractAddressesFromEnv } from '@aztec/ /** * The archiver configuration. */ -export interface ArchiverConfig { +export type ArchiverConfig = { /** * URL for an archiver service. If set, will return an archiver client as opposed to starting a new one. */ archiverUrl?: string; - /** - * The url of the Ethereum RPC node. - */ - rpcUrl: string; - - /** - * The key for the ethereum node. - */ - apiKey?: string; - - /** - * The L1 chain's ID - */ - l1ChainId: number; - /** * The polling interval in ms for retrieving new L2 blocks and encrypted logs. */ @@ -53,7 +39,35 @@ export interface ArchiverConfig { /** The max number of logs that can be obtained in 1 "getUnencryptedLogs" call. */ maxLogs?: number; -} +} & L1ReaderConfig; + +export const archiverConfigMappings: ConfigMappingsType = { + archiverUrl: { + env: 'ARCHIVER_URL', + description: + 'URL for an archiver service. If set, will return an archiver client as opposed to starting a new one.', + }, + archiverPollingIntervalMS: { + env: 'ARCHIVER_POLLING_INTERVAL_MS', + description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.', + ...numberConfigHelper(1000), + }, + viemPollingIntervalMS: { + env: 'ARCHIVER_VIEM_POLLING_INTERVAL_MS', + description: 'The polling interval viem uses in ms', + ...numberConfigHelper(1000), + }, + dataDirectory: { + env: 'DATA_DIRECTORY', + description: 'Optional dir to store data. If omitted will store in memory.', + }, + maxLogs: { + env: 'ARCHIVER_MAX_LOGS', + description: 'The max number of logs that can be obtained in 1 "getUnencryptedLogs" call.', + ...numberConfigHelper(1_000), + }, + ...l1ReaderConfigMappings, +}; /** * Returns the archiver configuration from the environment variables. @@ -61,23 +75,5 @@ export interface ArchiverConfig { * @returns The archiver configuration. */ export function getArchiverConfigFromEnv(): ArchiverConfig { - const { - ETHEREUM_HOST, - L1_CHAIN_ID, - ARCHIVER_POLLING_INTERVAL_MS, - ARCHIVER_VIEM_POLLING_INTERVAL_MS, - API_KEY, - DATA_DIRECTORY, - ARCHIVER_URL, - } = process.env; - return { - rpcUrl: ETHEREUM_HOST || '', - l1ChainId: L1_CHAIN_ID ? +L1_CHAIN_ID : 31337, // 31337 is the default chain id for anvil - archiverPollingIntervalMS: ARCHIVER_POLLING_INTERVAL_MS ? +ARCHIVER_POLLING_INTERVAL_MS : 1_000, - viemPollingIntervalMS: ARCHIVER_VIEM_POLLING_INTERVAL_MS ? +ARCHIVER_VIEM_POLLING_INTERVAL_MS : 1_000, - apiKey: API_KEY, - l1Contracts: getL1ContractAddressesFromEnv(), - dataDirectory: DATA_DIRECTORY, - archiverUrl: ARCHIVER_URL, - }; + return getConfigFromMappings(archiverConfigMappings); } diff --git a/yarn-project/archiver/src/archiver/eth_log_handlers.ts b/yarn-project/archiver/src/archiver/eth_log_handlers.ts index 00d0b6d4bef..2d844409b4d 100644 --- a/yarn-project/archiver/src/archiver/eth_log_handlers.ts +++ b/yarn-project/archiver/src/archiver/eth_log_handlers.ts @@ -5,7 +5,16 @@ import { Fr } from '@aztec/foundation/fields'; import { numToUInt32BE } from '@aztec/foundation/serialize'; import { AvailabilityOracleAbi, InboxAbi, RollupAbi } from '@aztec/l1-artifacts'; -import { type Hex, type Log, type PublicClient, decodeFunctionData, getAbiItem, getAddress, hexToBytes } from 'viem'; +import { + type Hex, + type Log, + type PublicClient, + decodeFunctionData, + getAbiItem, + getAddress, + hexToBytes, + slice, +} from 'viem'; /** * Processes newly received MessageSent (L1 to L2) logs. @@ -88,7 +97,7 @@ async function getBlockMetadataFromRollupTx( data, }); - if (functionName !== 'process') { + if (!(functionName === 'process' || functionName === 'publishAndProcess')) { throw new Error(`Unexpected method called ${functionName}`); } const [headerHex, archiveRootHex] = args! as readonly [Hex, Hex]; @@ -113,7 +122,7 @@ async function getBlockMetadataFromRollupTx( /** * Gets block bodies from calldata of an L1 transaction, and deserializes them into Body objects. - * Assumes that the block was published from an EOA. + * @note Assumes that the block was published using `publishAndProcess` or `publish`. * TODO: Add retries and error management. * @param publicClient - The viem public client to use for transaction retrieval. * @param txHash - Hash of the tx that published it. @@ -124,20 +133,41 @@ async function getBlockBodiesFromAvailabilityOracleTx( txHash: `0x${string}`, ): Promise { const { input: data } = await publicClient.getTransaction({ hash: txHash }); - const { functionName, args } = decodeFunctionData({ - abi: AvailabilityOracleAbi, - data, - }); + const DATA_INDEX = [3, 2, 0]; - if (functionName !== 'publish') { - throw new Error(`Unexpected method called ${functionName}`); - } + // @note Use `forge inspect Rollup methodIdentifiers to get this, + // If using `forge sig` you will get an INVALID value for the case with a struct. + // [ + // "publishAndProcess(bytes calldata _header,bytes32 _archive,SignatureLib.Signature[] memory _signatures,bytes calldata _body)", + // "publishAndProcess(bytes calldata _header,bytes32 _archive,bytes calldata _body)", + // "publish(bytes calldata _body)" + // ] + const SUPPORTED_SIGS = ['0xe4e90c26', '0xe86e3595', '0x7fd28346']; - const [bodyHex] = args! as [Hex]; + const signature = slice(data, 0, 4); - const blockBody = Body.fromBuffer(Buffer.from(hexToBytes(bodyHex))); + if (!SUPPORTED_SIGS.includes(signature)) { + throw new Error(`Unexpected method called ${signature}`); + } - return blockBody; + if (signature === SUPPORTED_SIGS[2]) { + const { args } = decodeFunctionData({ + abi: AvailabilityOracleAbi, + data, + }); + const [bodyHex] = args! as [Hex]; + const blockBody = Body.fromBuffer(Buffer.from(hexToBytes(bodyHex))); + return blockBody; + } else { + const { args } = decodeFunctionData({ + abi: RollupAbi, + data, + }); + const index = SUPPORTED_SIGS.indexOf(signature); + const bodyHex = args![DATA_INDEX[index]] as Hex; + const blockBody = Body.fromBuffer(Buffer.from(hexToBytes(bodyHex))); + return blockBody; + } } /** diff --git a/yarn-project/archiver/src/archiver/instrumentation.ts b/yarn-project/archiver/src/archiver/instrumentation.ts index 837b00af7f2..764a6f9eb28 100644 --- a/yarn-project/archiver/src/archiver/instrumentation.ts +++ b/yarn-project/archiver/src/archiver/instrumentation.ts @@ -1,9 +1,18 @@ import { type L2Block } from '@aztec/circuit-types'; -import { type Gauge, type Histogram, Metrics, type TelemetryClient, ValueType } from '@aztec/telemetry-client'; +import { + Attributes, + type Gauge, + type Histogram, + Metrics, + type TelemetryClient, + ValueType, + exponentialBuckets, +} from '@aztec/telemetry-client'; export class ArchiverInstrumentation { private blockHeight: Gauge; - private blockSize: Histogram; + private blockSize: Gauge; + private syncDuration: Histogram; constructor(telemetry: TelemetryClient) { const meter = telemetry.getMeter('Archiver'); @@ -12,19 +21,30 @@ export class ArchiverInstrumentation { valueType: ValueType.INT, }); - this.blockSize = meter.createHistogram(Metrics.ARCHIVER_BLOCK_SIZE, { - description: 'The number of transactions processed per block', + this.blockSize = meter.createGauge(Metrics.ARCHIVER_BLOCK_SIZE, { + description: 'The number of transactions in a block', + valueType: ValueType.INT, + }); + + this.syncDuration = meter.createHistogram(Metrics.ARCHIVER_SYNC_DURATION, { + unit: 'ms', + description: 'Duration to sync a block', valueType: ValueType.INT, advice: { - explicitBucketBoundaries: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192], + explicitBucketBoundaries: exponentialBuckets(1, 16), }, }); } - public processNewBlocks(blocks: L2Block[]) { + public processNewBlocks(syncTimePerBlock: number, blocks: L2Block[]) { + this.syncDuration.record(syncTimePerBlock); this.blockHeight.record(Math.max(...blocks.map(b => b.number))); for (const block of blocks) { this.blockSize.record(block.body.txEffects.length); } } + + public updateLastProvenBlock(blockNumber: number) { + this.blockHeight.record(blockNumber, { [Attributes.STATUS]: 'proven' }); + } } diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts index 4dce18fca50..a34317045cc 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts @@ -1,11 +1,12 @@ import { Body } from '@aztec/circuit-types'; +import { createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; export class BlockBodyStore { /** Map block body hash to block body */ #blockBodies: AztecMap; - constructor(private db: AztecKVStore) { + constructor(private db: AztecKVStore, private log = createDebugLogger('aztec:archiver:block_body_store')) { this.#blockBodies = db.openMap('archiver_block_bodies'); } @@ -29,21 +30,26 @@ export class BlockBodyStore { * @param txsEffectsHashes - The txsEffectsHashes list that corresponds to the blockBodies we want to retrieve * @returns The requested L2 block bodies */ - async getBlockBodies(txsEffectsHashes: Buffer[]): Promise { + async getBlockBodies(txsEffectsHashes: Buffer[]): Promise<(Body | undefined)[]> { const blockBodiesBuffer = await this.db.transaction(() => txsEffectsHashes.map(txsEffectsHash => this.#blockBodies.get(txsEffectsHash.toString('hex'))), ); - if (blockBodiesBuffer.some(bodyBuffer => bodyBuffer === undefined)) { - throw new Error('Block body buffer is undefined'); + const blockBodies: (Body | undefined)[] = []; + for (let i = 0; i < blockBodiesBuffer.length; i++) { + const blockBodyBuffer = blockBodiesBuffer[i]; + if (blockBodyBuffer === undefined) { + this.log.warn(`Block body buffer is undefined for txsEffectsHash: ${txsEffectsHashes[i].toString('hex')}`); + } + blockBodies.push(blockBodyBuffer ? Body.fromBuffer(blockBodyBuffer) : undefined); } - return blockBodiesBuffer.map(blockBodyBuffer => Body.fromBuffer(blockBodyBuffer!)); + return blockBodies; } /** * Gets an L2 block body. - * @param txsEffectsHash - The txHash of the the block body to return + * @param txsEffectsHash - The txHash of the block body to return * @returns The requested L2 block body */ getBlockBody(txsEffectsHash: Buffer): Body | undefined { diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts index b0a17431953..b5bee9f274e 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts @@ -111,7 +111,7 @@ export class KVArchiverDataStore implements ArchiverDataStore { * @param txsEffectsHashes - A list of txsEffectsHashes (body hashes). * @returns The requested L2 block bodies */ - getBlockBodies(txsEffectsHashes: Buffer[]): Promise { + getBlockBodies(txsEffectsHashes: Buffer[]): Promise<(Body | undefined)[]> { return this.#blockBodyStore.getBlockBodies(txsEffectsHashes); } diff --git a/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts b/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts index 8cad7257baa..cd6bc3278fb 100644 --- a/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts +++ b/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts @@ -45,7 +45,7 @@ export class MemoryArchiverStore implements ArchiverDataStore { private l2BlockBodies: Map = new Map(); /** - * An array containing all the the tx effects in the L2 blocks that have been fetched so far. + * An array containing all the tx effects in the L2 blocks that have been fetched so far. */ private txEffects: TxEffect[] = []; @@ -177,14 +177,10 @@ export class MemoryArchiverStore implements ArchiverDataStore { * @param txsEffectsHashes - A list of txsEffectsHashes (body hashes). * @returns The requested L2 block bodies */ - getBlockBodies(txsEffectsHashes: Buffer[]): Promise { - const blockBodies = txsEffectsHashes.map(txsEffectsHash => this.l2BlockBodies.get(txsEffectsHash.toString('hex'))); - - if (blockBodies.some(bodyBuffer => bodyBuffer === undefined)) { - throw new Error('Block body is undefined'); - } - - return Promise.resolve(blockBodies as Body[]); + getBlockBodies(txsEffectsHashes: Buffer[]): Promise<(Body | undefined)[]> { + return Promise.resolve( + txsEffectsHashes.map(txsEffectsHash => this.l2BlockBodies.get(txsEffectsHash.toString('hex'))), + ); } /** diff --git a/yarn-project/archiver/src/index.ts b/yarn-project/archiver/src/index.ts index e47c3ebb5c5..7b8fa78a625 100644 --- a/yarn-project/archiver/src/index.ts +++ b/yarn-project/archiver/src/index.ts @@ -23,7 +23,7 @@ const log = createDebugLogger('aztec:archiver'); // eslint-disable-next-line require-await async function main() { const config = getArchiverConfigFromEnv(); - const { rpcUrl, l1Contracts } = config; + const { l1RpcUrl: rpcUrl, l1Contracts } = config; const publicClient = createPublicClient({ chain: localhost, diff --git a/yarn-project/aztec-faucet/terraform/main.tf b/yarn-project/aztec-faucet/terraform/main.tf index ab2e8630665..691401b4ef1 100644 --- a/yarn-project/aztec-faucet/terraform/main.tf +++ b/yarn-project/aztec-faucet/terraform/main.tf @@ -144,7 +144,7 @@ resource "aws_ecs_task_definition" "aztec-faucet" { }, { name = "EXTRA_ASSETS", - value = "fee_juice:${var.GAS_TOKEN_CONTRACT_ADDRESS},dev_coin:${var.DEV_COIN_CONTRACT_ADDRESS}" + value = "fee_juice:${var.FEE_JUICE_CONTRACT_ADDRESS},dev_coin:${var.DEV_COIN_CONTRACT_ADDRESS}" }, { name = "EXTRA_ASSET_AMOUNT", diff --git a/yarn-project/aztec-faucet/terraform/variables.tf b/yarn-project/aztec-faucet/terraform/variables.tf index 0151c28bdf8..f1d2fbf5c86 100644 --- a/yarn-project/aztec-faucet/terraform/variables.tf +++ b/yarn-project/aztec-faucet/terraform/variables.tf @@ -31,7 +31,7 @@ variable "FAUCET_ACCOUNT_INDEX" { type = string } -variable "GAS_TOKEN_CONTRACT_ADDRESS" { +variable "FEE_JUICE_CONTRACT_ADDRESS" { type = string } diff --git a/yarn-project/aztec-node/src/aztec-node/config.ts b/yarn-project/aztec-node/src/aztec-node/config.ts index 8d2f883f1bf..79f705ab417 100644 --- a/yarn-project/aztec-node/src/aztec-node/config.ts +++ b/yarn-project/aztec-node/src/aztec-node/config.ts @@ -1,13 +1,16 @@ -import { type ArchiverConfig, getArchiverConfigFromEnv as getArchiverVars } from '@aztec/archiver'; -import { type P2PConfig, getP2PConfigEnvVars } from '@aztec/p2p'; -import { type ProverClientConfig, getProverEnvVars } from '@aztec/prover-client'; -import { type SequencerClientConfig, getConfigEnvVars as getSequencerVars } from '@aztec/sequencer-client'; -import { type WorldStateConfig, getWorldStateConfigFromEnv as getWorldStateVars } from '@aztec/world-state'; +import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver'; +import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config'; +import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p'; +import { type ProverClientConfig, proverClientConfigMappings } from '@aztec/prover-client'; +import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client'; +import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state'; import { readFileSync } from 'fs'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; +export { sequencerClientConfigMappings, SequencerClientConfig } from '@aztec/sequencer-client'; + /** * The configuration the aztec node. */ @@ -23,24 +26,32 @@ export type AztecNodeConfig = ArchiverConfig & disableProver: boolean; }; +export const aztecNodeConfigMappings: ConfigMappingsType = { + ...archiverConfigMappings, + ...sequencerClientConfigMappings, + ...proverClientConfigMappings, + ...worldStateConfigMappings, + ...p2pConfigMappings, + disableSequencer: { + env: 'SEQ_DISABLED', + parseEnv: (val: string) => ['1', 'true'].includes(val), + default: false, + description: 'Whether the sequencer is disabled for this node.', + }, + disableProver: { + env: 'PROVER_DISABLED', + parseEnv: (val: string) => ['1', 'true'].includes(val), + default: false, + description: 'Whether the prover is disabled for this node.', + }, +}; + /** * Returns the config of the aztec node from environment variables with reasonable defaults. * @returns A valid aztec node config. */ export function getConfigEnvVars(): AztecNodeConfig { - const { SEQ_DISABLED, PROVER_DISABLED = '' } = process.env; - - const allEnvVars: AztecNodeConfig = { - ...getSequencerVars(), - ...getArchiverVars(), - ...getP2PConfigEnvVars(), - ...getWorldStateVars(), - ...getProverEnvVars(), - disableSequencer: !!SEQ_DISABLED, - disableProver: ['1', 'true'].includes(PROVER_DISABLED), - }; - - return allEnvVars; + return getConfigFromMappings(aztecNodeConfigMappings); } /** diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index 216509bbdc9..3dd11e09d26 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -54,7 +54,7 @@ import { createStore, openTmpStore } from '@aztec/kv-store/utils'; import { SHA256Trunc, StandardTree, UnbalancedTree } from '@aztec/merkle-tree'; import { AztecKVTxPool, type P2P, createP2PClient } from '@aztec/p2p'; import { getCanonicalClassRegisterer } from '@aztec/protocol-contracts/class-registerer'; -import { getCanonicalGasToken } from '@aztec/protocol-contracts/gas-token'; +import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice'; import { getCanonicalInstanceDeployer } from '@aztec/protocol-contracts/instance-deployer'; import { getCanonicalKeyRegistryAddress } from '@aztec/protocol-contracts/key-registry'; import { getCanonicalMultiCallEntrypointAddress } from '@aztec/protocol-contracts/multi-call-entrypoint'; @@ -134,7 +134,7 @@ export class AztecNodeService implements AztecNode { storeLog = createDebugLogger('aztec:node:lmdb'), ): Promise { telemetry ??= new NoopTelemetryClient(); - const ethereumChain = createEthereumChain(config.rpcUrl, config.l1ChainId); + const ethereumChain = createEthereumChain(config.l1RpcUrl, config.l1ChainId); //validate that the actual chain id matches that specified in configuration if (config.l1ChainId !== ethereumChain.chainInfo.id) { throw new Error( @@ -168,7 +168,7 @@ export class AztecNodeService implements AztecNode { const simulationProvider = await createSimulationProvider(config, log); - const prover = await createProverClient(config, worldStateSynchronizer, archiver, telemetry); + const prover = await createProverClient(config, telemetry); if (!prover && !config.disableSequencer) { throw new Error("Can't start a sequencer without a prover"); @@ -741,6 +741,7 @@ export class AztecNodeService implements AztecNode { this.telemetry, ); const processor = publicProcessorFactory.create(prevHeader, newGlobalVariables); + // REFACTOR: Consider merging ProcessReturnValues into ProcessedTx const [processedTxs, failedTxs, returns] = await processor.process([tx]); // REFACTOR: Consider returning the error/revert rather than throwing @@ -786,7 +787,7 @@ export class AztecNodeService implements AztecNode { public getProtocolContractAddresses(): Promise { return Promise.resolve({ classRegisterer: getCanonicalClassRegisterer().address, - gasToken: getCanonicalGasToken().address, + feeJuice: getCanonicalFeeJuice().address, instanceDeployer: getCanonicalInstanceDeployer().address, keyRegistry: getCanonicalKeyRegistryAddress(), multiCallEntrypoint: getCanonicalMultiCallEntrypointAddress(), diff --git a/yarn-project/aztec.js/src/api/fee.ts b/yarn-project/aztec.js/src/api/fee.ts index 13dfffad38d..19d77c5c0fb 100644 --- a/yarn-project/aztec.js/src/api/fee.ts +++ b/yarn-project/aztec.js/src/api/fee.ts @@ -1,6 +1,6 @@ export type { FeePaymentMethod } from '../fee/fee_payment_method.js'; -export { NativeFeePaymentMethod } from '../fee/native_fee_payment_method.js'; +export { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js'; export { PrivateFeePaymentMethod } from '../fee/private_fee_payment_method.js'; export { PublicFeePaymentMethod } from '../fee/public_fee_payment_method.js'; -export { NativeFeePaymentMethodWithClaim } from '../fee/native_fee_payment_method_with_claim.js'; +export { FeeJuicePaymentMethodWithClaim } from '../fee/fee_juice_payment_method_with_claim.js'; export { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js'; diff --git a/yarn-project/aztec.js/src/contract/contract.test.ts b/yarn-project/aztec.js/src/contract/contract.test.ts index f6801fe4ec2..49aad6296de 100644 --- a/yarn-project/aztec.js/src/contract/contract.test.ts +++ b/yarn-project/aztec.js/src/contract/contract.test.ts @@ -27,8 +27,8 @@ describe('Contract Class', () => { registryAddress: EthAddress.random(), inboxAddress: EthAddress.random(), outboxAddress: EthAddress.random(), - gasTokenAddress: EthAddress.random(), - gasPortalAddress: EthAddress.random(), + feeJuiceAddress: EthAddress.random(), + feeJuicePortalAddress: EthAddress.random(), }; const mockNodeInfo: NodeInfo = { nodeVersion: 'vx.x.x', @@ -37,7 +37,7 @@ describe('Contract Class', () => { l1ContractAddresses: l1Addresses, protocolContractAddresses: { classRegisterer: AztecAddress.random(), - gasToken: AztecAddress.random(), + feeJuice: AztecAddress.random(), instanceDeployer: AztecAddress.random(), keyRegistry: AztecAddress.random(), multiCallEntrypoint: AztecAddress.random(), diff --git a/yarn-project/aztec.js/src/fee/native_fee_payment_method.ts b/yarn-project/aztec.js/src/fee/fee_juice_payment_method.ts similarity index 67% rename from yarn-project/aztec.js/src/fee/native_fee_payment_method.ts rename to yarn-project/aztec.js/src/fee/fee_juice_payment_method.ts index 49a1567482f..d8d24f31b70 100644 --- a/yarn-project/aztec.js/src/fee/native_fee_payment_method.ts +++ b/yarn-project/aztec.js/src/fee/fee_juice_payment_method.ts @@ -1,17 +1,17 @@ import { type FunctionCall } from '@aztec/circuit-types'; import { type AztecAddress } from '@aztec/circuits.js'; -import { GasTokenAddress } from '@aztec/protocol-contracts/gas-token'; +import { FeeJuiceAddress } from '@aztec/protocol-contracts/fee-juice'; import { type FeePaymentMethod } from './fee_payment_method.js'; /** - * Pay fee directly in the native gas token. + * Pay fee directly in the native Fee Juice. */ -export class NativeFeePaymentMethod implements FeePaymentMethod { +export class FeeJuicePaymentMethod implements FeePaymentMethod { constructor(protected sender: AztecAddress) {} getAsset() { - return GasTokenAddress; + return FeeJuiceAddress; } getFunctionCalls(): Promise { diff --git a/yarn-project/aztec.js/src/fee/native_fee_payment_method_with_claim.ts b/yarn-project/aztec.js/src/fee/fee_juice_payment_method_with_claim.ts similarity index 66% rename from yarn-project/aztec.js/src/fee/native_fee_payment_method_with_claim.ts rename to yarn-project/aztec.js/src/fee/fee_juice_payment_method_with_claim.ts index 39e82d28663..c7d4adf18c5 100644 --- a/yarn-project/aztec.js/src/fee/native_fee_payment_method_with_claim.ts +++ b/yarn-project/aztec.js/src/fee/fee_juice_payment_method_with_claim.ts @@ -1,26 +1,26 @@ import { type FunctionCall } from '@aztec/circuit-types'; import { type AztecAddress, Fr, FunctionSelector } from '@aztec/circuits.js'; import { FunctionType } from '@aztec/foundation/abi'; -import { GasTokenAddress } from '@aztec/protocol-contracts/gas-token'; +import { FeeJuiceAddress } from '@aztec/protocol-contracts/fee-juice'; -import { NativeFeePaymentMethod } from './native_fee_payment_method.js'; +import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js'; /** - * Pay fee directly with native gas token claimed on the same tx. + * Pay fee directly with native Fee Juice claimed on the same tx. */ -export class NativeFeePaymentMethodWithClaim extends NativeFeePaymentMethod { +export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod { constructor(sender: AztecAddress, private claimAmount: bigint | Fr, private claimSecret: Fr) { super(sender); } /** - * Creates a function call to pay the fee in gas token. + * Creates a function call to pay the fee in Fee Juice. * @returns A function call */ override getFunctionCalls(): Promise { return Promise.resolve([ { - to: GasTokenAddress, + to: FeeJuiceAddress, name: 'claim', selector: FunctionSelector.fromSignature('claim((Field),Field,Field)'), isStatic: false, diff --git a/yarn-project/aztec.js/src/utils/cheat_codes.ts b/yarn-project/aztec.js/src/utils/cheat_codes.ts index d05045a8dd2..83266fd6275 100644 --- a/yarn-project/aztec.js/src/utils/cheat_codes.ts +++ b/yarn-project/aztec.js/src/utils/cheat_codes.ts @@ -94,6 +94,18 @@ export class EthCheatCodes { this.logger.info(`Mined ${numberOfBlocks} blocks`); } + /** + * Set the interval between blocks (block time) + * @param interval - The interval to use between blocks + */ + public async setBlockInterval(interval: number): Promise { + const res = await this.rpcCall('anvil_setBlockTimestampInterval', [interval]); + if (res.error) { + throw new Error(`Error setting block interval: ${res.error.message}`); + } + this.logger.info(`Set block interval to ${interval}`); + } + /** * Set the next block timestamp * @param timestamp - The timestamp to set the next block to @@ -106,6 +118,19 @@ export class EthCheatCodes { this.logger.info(`Set next block timestamp to ${timestamp}`); } + /** + * Set the next block timestamp and mines the block + * @param timestamp - The timestamp to set the next block to + */ + public async warp(timestamp: number): Promise { + const res = await this.rpcCall('evm_setNextBlockTimestamp', [timestamp]); + if (res.error) { + throw new Error(`Error warping: ${res.error.message}`); + } + await this.mine(); + this.logger.info(`Warped to ${timestamp}`); + } + /** * Dumps the current chain state to a file. * @param fileName - The file name to dump state into @@ -257,18 +282,12 @@ export class AztecCheatCodes { } /** - * Set time of the next execution on aztec. - * It also modifies time on eth for next execution and stores this time as the last rollup block on the rollup contract. - * @param to - The timestamp to set the next block to (must be greater than current time) + * Get the current timestamp + * @returns The current timestamp */ - public async warp(to: number): Promise { - const rollupContract = (await this.pxe.getNodeInfo()).l1ContractAddresses.rollupAddress; - await this.eth.setNextBlockTimestamp(to); - // also store this time on the rollup contract (slot 2 tracks `lastBlockTs`). - // This is because when the sequencer executes public functions, it uses the timestamp stored in the rollup contract. - await this.eth.store(rollupContract, 6n, BigInt(to)); - // also store this on slot of the rollup contract (`lastWarpedBlockTs`) which tracks the last time warp was used. - await this.eth.store(rollupContract, 7n, BigInt(to)); + public async timestamp(): Promise { + const res = await this.pxe.getBlock(await this.blockNumber()); + return res?.header.globalVariables.timestamp.toNumber() ?? 0; } /** diff --git a/yarn-project/aztec/package.json b/yarn-project/aztec/package.json index 879963d1ca2..ccd6261e0a5 100644 --- a/yarn-project/aztec/package.json +++ b/yarn-project/aztec/package.json @@ -55,7 +55,9 @@ "@aztec/telemetry-client": "workspace:^", "@aztec/txe": "workspace:^", "@aztec/types": "workspace:^", + "@types/chalk": "^2.2.0", "abitype": "^0.8.11", + "chalk": "^5.3.0", "commander": "^12.1.0", "koa": "^2.14.2", "koa-router": "^12.0.0", diff --git a/yarn-project/aztec/src/cli/aztec_start_options.ts b/yarn-project/aztec/src/cli/aztec_start_options.ts new file mode 100644 index 00000000000..56804e93918 --- /dev/null +++ b/yarn-project/aztec/src/cli/aztec_start_options.ts @@ -0,0 +1,305 @@ +import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver'; +import { sequencerClientConfigMappings } from '@aztec/aztec-node'; +import { botConfigMappings } from '@aztec/bot'; +import { type ConfigMapping, filterConfigMappings, isBooleanConfigValue } from '@aztec/foundation/config'; +import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p'; +import { proverClientConfigMappings } from '@aztec/prover-client'; +import { proverNodeConfigMappings } from '@aztec/prover-node'; +import { allPxeConfigMappings } from '@aztec/pxe'; +import { telemetryClientConfigMappings } from '@aztec/telemetry-client/start'; + +import { defaultMnemonic } from '../sandbox.js'; + +// Define an interface for options +export interface AztecStartOption { + flag: string; + description: string; + defaultValue: any | undefined; + printDefault?: (val: any) => string; + envVar: string | undefined; + parseVal?: (val: string) => any; +} + +export const getOptions = (namespace: string, configMappings: Record) => { + const options: AztecStartOption[] = []; + for (const [key, { env, default: def, parseEnv, description, printDefault }] of Object.entries(configMappings)) { + if (universalOptions.includes(key)) { + continue; + } + const isBoolean = isBooleanConfigValue(configMappings, key as keyof typeof configMappings); + options.push({ + flag: `--${namespace}.${key}${isBoolean ? '' : ' '}`, + description, + defaultValue: def, + printDefault, + envVar: env, + parseVal: parseEnv, + }); + } + return options; +}; + +// These are options used by multiple modules so should be inputted once +export const universalOptions = ['l1RpcUrl', 'l1ChainId', 'l1Contracts', 'p2pEnabled']; + +// Define categories and options +export const aztecStartOptions: { [key: string]: AztecStartOption[] } = { + SANDBOX: [ + { + flag: '--sandbox', + description: 'Starts Aztec Sandbox', + defaultValue: undefined, + envVar: undefined, + }, + { + flag: '--sandbox.testAccounts', + description: 'Deploy test accounts on sandbox start', + defaultValue: true, + envVar: 'TEST_ACCOUNTS', + parseVal: val => ['1', true].includes(val), + }, + { + flag: '--sandbox.enableGas', + description: 'Enable gas on sandbox start', + defaultValue: false, + envVar: 'ENABLE_GAS', + parseVal: val => ['1', true].includes(val), + }, + ], + API: [ + { + flag: '--port', + description: 'Port to run the Aztec Services on on', + defaultValue: 8080, + envVar: 'AZTEC_PORT', + parseVal: val => parseInt(val, 10), + }, + { + flag: '--api-prefix', + description: 'Prefix for API routes on any service that is started', + defaultValue: '', + envVar: 'API_PREFIX', + }, + ], + ETHEREUM: [ + { + flag: '--l1-rpc-url ', + description: 'URL of the Ethereum RPC node that services will connect to', + defaultValue: 'http://localhost:8545', + envVar: 'ETHEREUM_HOST', + }, + { + flag: '--l1-chain-id ', + description: 'The L1 chain ID', + defaultValue: 31337, + envVar: 'L1_CHAIN_ID', + parseVal: val => parseInt(val, 10), + }, + { + flag: '--l1-mnemonic ', + description: 'Mnemonic for L1 accounts. Will be used if no publisher private keys are provided', + defaultValue: defaultMnemonic, + envVar: 'MNEMONIC', + }, + ], + 'L1 CONTRACT ADDRESSES': [ + { + flag: '--rollup-address ', + description: 'The deployed L1 rollup contract address', + defaultValue: undefined, + envVar: 'ROLLUP_CONTRACT_ADDRESS', + }, + { + flag: '--registry-address ', + description: 'The deployed L1 registry contract address', + defaultValue: undefined, + envVar: 'REGISTRY_CONTRACT_ADDRESS', + }, + { + flag: '--inbox-address ', + description: 'The deployed L1 -> L2 inbox contract address', + defaultValue: undefined, + envVar: 'INBOX_CONTRACT_ADDRESS', + }, + { + flag: '--outbox-address ', + description: 'The deployed L2 -> L1 outbox contract address', + defaultValue: undefined, + envVar: 'OUTBOX_CONTRACT_ADDRESS', + }, + { + flag: '--availability-oracle-address ', + description: 'The deployed L1 availability oracle contract address', + defaultValue: undefined, + envVar: 'AVAILABILITY_ORACLE_CONTRACT_ADDRESS', + }, + { + flag: '--fee-juice-address ', + description: 'The deployed L1 gas token contract address', + defaultValue: undefined, + envVar: 'FEE_JUICE_CONTRACT_ADDRESS', + }, + { + flag: '--fee-juice-portal-address ', + description: 'The deployed L1 gas portal contract address', + defaultValue: undefined, + envVar: 'FEE_JUICE_PORTAL_CONTRACT_ADDRESS', + }, + ], + // We can't easily auto-generate node options as they're parts of modules defined below + 'AZTEC NODE': [ + { + flag: '--node', + description: 'Starts Aztec Node with options', + defaultValue: undefined, + envVar: undefined, + }, + { + flag: '--node.archiverUrl ', + description: 'URL for an archiver service', + defaultValue: undefined, + envVar: 'ARCHIVER_URL', + }, + { + flag: '--node.dataDirectory ', + description: 'Where to store node data. If not set, will store temporarily', + defaultValue: undefined, + envVar: 'NODE_DATA_DIRECTORY', + }, + { + flag: '--node.deployAztecContracts', + description: 'Deploys L1 Aztec contracts before starting the node. Needs mnemonic or private key to be set', + defaultValue: false, + envVar: 'DEPLOY_AZTEC_CONTRACTS', + parseVal: val => ['1', true].includes(val), + }, + { + flag: '--node.assumeProvenUntilBlockNumber', + description: + 'Cheats the rollup contract into assuming every block until this one is proven. Useful for speeding up bootstraps.', + envVar: 'ASSUME_PROVEN_UNTIL_BLOCK_NUMBER', + parseVal: (val: string) => parseInt(val, 10), + defaultValue: 0, + }, + { + flag: '--node.publisherPrivateKey ', + description: 'Private key of account for publishing L1 contracts', + defaultValue: undefined, + envVar: 'L1_PRIVATE_KEY', + }, + { + flag: '--node.l2QueueSize ', + description: 'Size of queue of L2 blocks to store in world state', + defaultValue: 1000, + envVar: 'L2_QUEUE_SIZE', + parseVal: val => parseInt(val, 10), + }, + { + flag: '--node.worldStateBlockCheckIntervalMS ', + description: 'Frequency in which to check for blocks in ms', + defaultValue: 100, + envVar: 'WS_BLOCK_CHECK_INTERVAL_MS', + parseVal: val => parseInt(val, 10), + }, + ], + 'P2P SUBSYSTEM': [ + { + flag: '--p2p-enabled', + description: 'Enable P2P subsystem', + defaultValue: false, + envVar: 'P2P_ENABLED', + parseVal: val => ['1', true].includes(val), + }, + ...getOptions('p2p', p2pConfigMappings), + ], + TELEMETRY: [...getOptions('tel', telemetryClientConfigMappings)], + PXE: [ + { + flag: '--pxe', + description: 'Starts Aztec PXE with options', + defaultValue: undefined, + envVar: undefined, + }, + ...getOptions('pxe', allPxeConfigMappings), + ], + ARCHIVER: [ + { + flag: '--archiver', + description: 'Starts Aztec Archiver with options', + defaultValue: undefined, + envVar: undefined, + }, + // filter out archiverUrl as it's passed separately in --node & --prover-node + ...getOptions('archiver', archiverConfigMappings).filter(opt => !opt.flag.includes('archiverUrl')), + ], + SEQUENCER: [ + { + flag: '--sequencer', + description: 'Starts Aztec Sequencer with options', + defaultValue: undefined, + envVar: undefined, + }, + ...getOptions('sequencer', sequencerClientConfigMappings), + ], + 'PROVER AGENT': [ + { + flag: '--prover', + description: 'Starts Aztec Prover Agent with options', + defaultValue: undefined, + envVar: undefined, + }, + ...getOptions('prover', proverClientConfigMappings), + ], + 'PROVER NODE': [ + { + flag: '--prover-node', + description: 'Starts Aztec Prover Node with options', + defaultValue: undefined, + envVar: undefined, + }, + { + flag: '--proverNode.archiverUrl ', + description: 'URL for an archiver service', + defaultValue: undefined, + envVar: 'ARCHIVER_URL', + }, + ...getOptions( + 'proverNode', + // filter out archiver options from prover node options as they're passed separately in --archiver + filterConfigMappings(proverNodeConfigMappings, Object.keys(archiverConfigMappings) as (keyof ArchiverConfig)[]), + ), + ], + 'P2P BOOTSTRAP': [ + { + flag: '--p2p-bootstrap', + description: 'Starts Aztec P2P Bootstrap with options', + defaultValue: undefined, + envVar: undefined, + }, + ...getOptions('p2pBootstrap', bootnodeConfigMappings), + ], + BOT: [ + { + flag: '--bot', + description: 'Starts Aztec Bot with options', + defaultValue: undefined, + envVar: undefined, + }, + ...getOptions('bot', botConfigMappings), + ], + TXE: [ + { + flag: '--txe', + description: 'Starts Aztec TXE with options', + defaultValue: undefined, + envVar: undefined, + }, + { + flag: '--txe.port ', + description: 'Port to run TXE on', + defaultValue: 8081, + envVar: 'TXE_PORT', + parseVal: val => parseInt(val, 10), + }, + ], +}; diff --git a/yarn-project/aztec/src/cli/cli.ts b/yarn-project/aztec/src/cli/cli.ts index d5b92f2b566..4242e07c644 100644 --- a/yarn-project/aztec/src/cli/cli.ts +++ b/yarn-project/aztec/src/cli/cli.ts @@ -4,116 +4,118 @@ import { type ServerList, createNamespacedJsonRpcServer, createStatusRouter } fr import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { createPXERpcServer } from '@aztec/pxe'; -import { type Command } from 'commander'; +import { Command } from 'commander'; import http from 'http'; import { createSandbox } from '../sandbox.js'; import { github, splash } from '../splash.js'; -import { cliTexts } from './texts.js'; -import { createAccountLogs, installSignalHandlers } from './util.js'; - -const { AZTEC_PORT = '8080', API_PREFIX = '', TEST_ACCOUNTS = 'true', ENABLE_GAS = '' } = process.env; +import { aztecStartOptions } from './aztec_start_options.js'; +import { + addOptions, + createAccountLogs, + extractNamespacedOptions, + installSignalHandlers, + printAztecStartHelpText, +} from './util.js'; /** * Returns commander program that defines the 'aztec' command line interface. * @param userLog - log function for logging user output. * @param debugLogger - logger for logging debug messages. */ -export function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: DebugLogger) { - // Start Aztec modules with options - program - .command('start') - .description( - 'Starts Aztec modules. Options for each module can be set as key-value pairs (e.g. "option1=value1,option2=value2") or as environment variables.', - ) - .option('-sb, --sandbox', 'Starts Aztec Sandbox.') - .option('-p, --port ', 'Port to run Aztec on.', AZTEC_PORT) - .option('-n, --node [options]', cliTexts.node) - .option('-px, --pxe [options]', cliTexts.pxe) - .option('-a, --archiver [options]', cliTexts.archiver) - .option('-s, --sequencer [options]', cliTexts.sequencer) - .option('-r, --prover [options]', cliTexts.proverAgent) - .option('-o, --prover-node [options]', cliTexts.proverNode) - .option('-p2p, --p2p-bootstrap [options]', cliTexts.p2pBootstrap) - .option('-t, --txe [options]', cliTexts.txe) - .option('--bot [options]', cliTexts.bot) - .action(async options => { - // list of 'stop' functions to call when process ends - const signalHandlers: Array<() => Promise> = []; - let services: ServerList = []; - - if (options.sandbox) { - userLog(`${splash}\n${github}\n\n`); - userLog(`Setting up Aztec Sandbox, please stand by...`); - const { aztecNodeConfig, node, pxe, stop } = await createSandbox({ - enableGas: ['true', '1'].includes(ENABLE_GAS), - }); - - // Deploy test accounts by default - if (TEST_ACCOUNTS === 'true') { - if (aztecNodeConfig.p2pEnabled) { - userLog(`Not setting up test accounts as we are connecting to a network`); - } else { - userLog('Setting up test accounts...'); - const accounts = await deployInitialTestAccounts(pxe); - const accLogs = await createAccountLogs(accounts, pxe); - userLog(accLogs.join('')); - } - } +export function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: DebugLogger): Command { + const startCmd = new Command('start').description( + 'Starts Aztec modules. Options for each module can be set as key-value pairs (e.g. "option1=value1,option2=value2") or as environment variables.', + ); - // Start Node and PXE JSON-RPC server - const nodeServer = createAztecNodeRpcServer(node); - const pxeServer = createPXERpcServer(pxe); - signalHandlers.push(stop); - services = [{ node: nodeServer }, { pxe: pxeServer }]; - } else { - if (options.node) { - const { startNode } = await import('./cmds/start_node.js'); - services = await startNode(options, signalHandlers, userLog); - } else if (options.bot) { - const { startBot } = await import('./cmds/start_bot.js'); - services = await startBot(options, signalHandlers, userLog); - } else if (options.proverNode) { - const { startProverNode } = await import('./cmds/start_prover_node.js'); - services = await startProverNode(options, signalHandlers, userLog); - } else if (options.pxe) { - const { startPXE } = await import('./cmds/start_pxe.js'); - services = await startPXE(options, signalHandlers, userLog); - } else if (options.archiver) { - const { startArchiver } = await import('./cmds/start_archiver.js'); - services = await startArchiver(options, signalHandlers); - } else if (options.p2pBootstrap) { - const { startP2PBootstrap } = await import('./cmds/start_p2p_bootstrap.js'); - await startP2PBootstrap(options, userLog, debugLogger); - } else if (options.prover) { - const { startProverAgent } = await import('./cmds/start_prover_agent.js'); - services = await startProverAgent(options, signalHandlers, userLog); - } else if (options.txe) { - const { startTXE } = await import('./cmds/start_txe.js'); - startTXE(options, debugLogger); - } else if (options.sequencer) { - userLog(`Cannot run a standalone sequencer without a node`); - process.exit(1); + // Assuming commands are added elsewhere, here we just add options to the main program + Object.keys(aztecStartOptions).forEach(category => { + addOptions(startCmd, aztecStartOptions[category]); + }); + + startCmd.helpInformation = printAztecStartHelpText; + + startCmd.action(async options => { + // list of 'stop' functions to call when process ends + const signalHandlers: Array<() => Promise> = []; + let services: ServerList = []; + + if (options.sandbox) { + const sandboxOptions = extractNamespacedOptions(options, 'sandbox'); + userLog(`${splash}\n${github}\n\n`); + userLog(`Setting up Aztec Sandbox, please stand by...`); + const { aztecNodeConfig, node, pxe, stop } = await createSandbox({ + enableGas: sandboxOptions.enableGas, + l1Mnemonic: options.l1Mnemonic, + }); + + // Deploy test accounts by default + if (sandboxOptions.testAccounts) { + if (aztecNodeConfig.p2pEnabled) { + userLog(`Not setting up test accounts as we are connecting to a network`); } else { - userLog(`No module specified to start ${JSON.stringify(options, null, 2)}`); - process.exit(1); + userLog('Setting up test accounts...'); + const accounts = await deployInitialTestAccounts(pxe); + const accLogs = await createAccountLogs(accounts, pxe); + userLog(accLogs.join('')); } } - installSignalHandlers(debugLogger.info, signalHandlers); - if (services.length) { - const rpcServer = createNamespacedJsonRpcServer(services, debugLogger); + // Start Node and PXE JSON-RPC server + const nodeServer = createAztecNodeRpcServer(node); + const pxeServer = createPXERpcServer(pxe); + signalHandlers.push(stop); + services = [{ node: nodeServer }, { pxe: pxeServer }]; + } else { + if (options.node) { + const { startNode } = await import('./cmds/start_node.js'); + services = await startNode(options, signalHandlers, userLog); + } else if (options.bot) { + const { startBot } = await import('./cmds/start_bot.js'); + services = await startBot(options, signalHandlers, userLog); + } else if (options.proverNode) { + const { startProverNode } = await import('./cmds/start_prover_node.js'); + services = await startProverNode(options, signalHandlers, userLog); + } else if (options.pxe) { + const { startPXE } = await import('./cmds/start_pxe.js'); + services = await startPXE(options, signalHandlers, userLog); + } else if (options.archiver) { + const { startArchiver } = await import('./cmds/start_archiver.js'); + services = await startArchiver(options, signalHandlers); + } else if (options.p2pBootstrap) { + const { startP2PBootstrap } = await import('./cmds/start_p2p_bootstrap.js'); + await startP2PBootstrap(options, userLog, debugLogger); + } else if (options.prover) { + const { startProverAgent } = await import('./cmds/start_prover_agent.js'); + services = await startProverAgent(options, signalHandlers, userLog); + } else if (options.txe) { + const { startTXE } = await import('./cmds/start_txe.js'); + startTXE(options, debugLogger); + } else if (options.sequencer) { + userLog(`Cannot run a standalone sequencer without a node`); + process.exit(1); + } else { + userLog(`No module specified to start ${JSON.stringify(options, null, 2)}`); + process.exit(1); + } + } + installSignalHandlers(debugLogger.info, signalHandlers); + + if (services.length) { + const rpcServer = createNamespacedJsonRpcServer(services, debugLogger); - const app = rpcServer.getApp(API_PREFIX); - // add status route - const statusRouter = createStatusRouter(API_PREFIX); - app.use(statusRouter.routes()).use(statusRouter.allowedMethods()); + const app = rpcServer.getApp(options.apiPrefix); + // add status route + const statusRouter = createStatusRouter(options.apiPrefix); + app.use(statusRouter.routes()).use(statusRouter.allowedMethods()); - const httpServer = http.createServer(app.callback()); - httpServer.listen(options.port); - userLog(`Aztec Server listening on port ${options.port}`); - } - }); + const httpServer = http.createServer(app.callback()); + httpServer.listen(options.port); + userLog(`Aztec Server listening on port ${options.port}`); + } + }); + + program.addCommand(startCmd); program.configureHelp({ sortSubcommands: true }); @@ -125,7 +127,7 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge test [options]: starts a dockerized TXE node via $ aztec start --txe - then runs + then runs $ aztec-nargo test --silence-warnings --oracle-resolver= [options] `, ); diff --git a/yarn-project/aztec/src/cli/cmds/start_archiver.ts b/yarn-project/aztec/src/cli/cmds/start_archiver.ts index 4d6e487e532..c3464fdbad9 100644 --- a/yarn-project/aztec/src/cli/cmds/start_archiver.ts +++ b/yarn-project/aztec/src/cli/cmds/start_archiver.ts @@ -2,8 +2,8 @@ import { Archiver, type ArchiverConfig, KVArchiverDataStore, + archiverConfigMappings, createArchiverRpcServer, - getArchiverConfigFromEnv as getArchiverConfigEnvVars, } from '@aztec/archiver'; import { createDebugLogger } from '@aztec/aztec.js'; import { type ServerList } from '@aztec/foundation/json-rpc/server'; @@ -14,21 +14,16 @@ import { getConfigEnvVars as getTelemetryClientConfig, } from '@aztec/telemetry-client/start'; -import { mergeEnvVarsAndCliOptions, parseModuleOptions } from '../util.js'; +import { extractRelevantOptions } from '../util.js'; export const startArchiver = async (options: any, signalHandlers: (() => Promise)[]) => { const services: ServerList = []; // Start a standalone archiver. - // get env vars first - const archiverConfigEnvVars = getArchiverConfigEnvVars(); - // get config from options - const archiverCliOptions = parseModuleOptions(options.archiver); - // merge env vars and cli options - const archiverConfig = mergeEnvVarsAndCliOptions(archiverConfigEnvVars, archiverCliOptions, true); + const archiverConfig = extractRelevantOptions(options, archiverConfigMappings); const storeLog = createDebugLogger('aztec:archiver:lmdb'); const store = await initStoreForRollup( - AztecLmdbStore.open(archiverConfig.dataDirectory, false, storeLog), + AztecLmdbStore.open(archiverConfig.dataDirectory, false), archiverConfig.l1Contracts.rollupAddress, storeLog, ); diff --git a/yarn-project/aztec/src/cli/cmds/start_bot.ts b/yarn-project/aztec/src/cli/cmds/start_bot.ts index 0d33f0bf10c..0888b9dbf63 100644 --- a/yarn-project/aztec/src/cli/cmds/start_bot.ts +++ b/yarn-project/aztec/src/cli/cmds/start_bot.ts @@ -1,9 +1,9 @@ -import { type BotConfig, BotRunner, createBotRunnerRpcServer, getBotConfigFromEnv } from '@aztec/bot'; +import { type BotConfig, BotRunner, botConfigMappings, createBotRunnerRpcServer } from '@aztec/bot'; import { type PXE } from '@aztec/circuit-types'; import { type ServerList } from '@aztec/foundation/json-rpc/server'; import { type LogFn } from '@aztec/foundation/log'; -import { mergeEnvVarsAndCliOptions, parseModuleOptions } from '../util.js'; +import { extractRelevantOptions } from '../util.js'; export async function startBot( options: any, @@ -20,7 +20,6 @@ export async function startBot( ); process.exit(1); } - // Start a PXE client that is used by the bot if required let pxe: PXE | undefined; if (options.pxe) { @@ -38,9 +37,7 @@ export function addBot( signalHandlers: (() => Promise)[], deps: { pxe?: PXE } = {}, ) { - const envVars = getBotConfigFromEnv(); - const cliOptions = parseModuleOptions(options.bot); - const config = mergeEnvVarsAndCliOptions(envVars, cliOptions); + const config = extractRelevantOptions(options, botConfigMappings); const botRunner = new BotRunner(config, { pxe: deps.pxe }); const botServer = createBotRunnerRpcServer(botRunner); diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index 33dd2a2489b..511ce520e22 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -1,38 +1,36 @@ -import { - type AztecNodeConfig, - createAztecNodeRpcServer, - getConfigEnvVars as getNodeConfigEnvVars, -} from '@aztec/aztec-node'; +import { aztecNodeConfigMappings, createAztecNodeRpcServer } from '@aztec/aztec-node'; import { type PXE } from '@aztec/circuit-types'; import { NULL_KEY } from '@aztec/ethereum'; import { type ServerList } from '@aztec/foundation/json-rpc/server'; import { type LogFn } from '@aztec/foundation/log'; import { createProvingJobSourceServer } from '@aztec/prover-client/prover-agent'; import { + type TelemetryClientConfig, createAndStartTelemetryClient, - getConfigEnvVars as getTelemetryClientConfig, + telemetryClientConfigMappings, } from '@aztec/telemetry-client/start'; import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts'; -import { MNEMONIC, createAztecNode, deployContractsToL1 } from '../../sandbox.js'; -import { mergeEnvVarsAndCliOptions, parseModuleOptions } from '../util.js'; - -const { DEPLOY_AZTEC_CONTRACTS } = process.env; +import { createAztecNode, deployContractsToL1 } from '../../sandbox.js'; +import { extractL1ContractAddresses, extractNamespacedOptions, extractRelevantOptions } from '../util.js'; export const startNode = async ( options: any, signalHandlers: (() => Promise)[], userLog: LogFn, -): Promise => { + // ): Promise => { +) => { // Services that will be started in a single multi-rpc server const services: ServerList = []; - // get env vars first - const aztecNodeConfigEnvVars = getNodeConfigEnvVars(); - // get config from options - const nodeCliOptions = parseModuleOptions(options.node); - // merge env vars and cli options - let nodeConfig = mergeEnvVarsAndCliOptions(aztecNodeConfigEnvVars, nodeCliOptions); + + // options specifically namespaced with --node.