Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@noir-lang/backend_barretenberg

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noir-lang/backend_barretenberg - npm Package Compare versions

Comparing version 0.19.3 to 0.19.4-1ef8546.nightly

lib/cjs/public_inputs.d.ts

2

lib/cjs/index.d.ts
import { Backend, CompiledCircuit, ProofData } from '@noir-lang/types';
import { BackendOptions } from './types.js';
export { flattenPublicInputs } from './public_inputs.js';
export declare class BarretenbergBackend implements Backend {
private acirCircuit;
private options;

@@ -5,0 +7,0 @@ private api;

26

lib/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BarretenbergBackend = void 0;
exports.BarretenbergBackend = exports.flattenPublicInputs = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
const fflate_1 = require("fflate");
const serialize_js_1 = require("./serialize.js");
const public_inputs_js_1 = require("./public_inputs.js");
var public_inputs_js_2 = require("./public_inputs.js");
Object.defineProperty(exports, "flattenPublicInputs", { enumerable: true, get: function () { return public_inputs_js_2.flattenPublicInputs; } });
// This is the number of bytes in a UltraPlonk proof

@@ -11,2 +14,3 @@ // minus the public inputs.

class BarretenbergBackend {
acirCircuit;
options;

@@ -21,2 +25,3 @@ // These type assertions are used so that we don't

constructor(acirCircuit, options = { threads: 1 }) {
this.acirCircuit = acirCircuit;
this.options = options;

@@ -79,9 +84,4 @@ const acirBytecodeBase64 = acirCircuit.bytecode;

const publicInputsConcatenated = proofWithPublicInputs.slice(0, splitIndex);
const publicInputSize = 32;
const publicInputs = [];
for (let i = 0; i < publicInputsConcatenated.length; i += publicInputSize) {
const publicInput = publicInputsConcatenated.slice(i, i + publicInputSize);
publicInputs.push(publicInput);
}
const proof = proofWithPublicInputs.slice(splitIndex);
const publicInputs = (0, public_inputs_js_1.deflattenPublicInputs)(publicInputsConcatenated, this.acirCircuit.abi);
return { proof, publicInputs };

@@ -154,3 +154,3 @@ }

// Flatten publicInputs
const publicInputsConcatenated = flattenUint8Arrays(proofData.publicInputs);
const publicInputsConcatenated = (0, public_inputs_js_1.flattenPublicInputsAsArray)(proofData.publicInputs);
// Concatenate publicInputs and proof

@@ -160,11 +160,1 @@ const proofWithPublicInputs = Uint8Array.from([...publicInputsConcatenated, ...proofData.proof]);

}
function flattenUint8Arrays(arrays) {
const totalLength = arrays.reduce((acc, val) => acc + val.length, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const arr of arrays) {
result.set(arr, offset);
offset += arr.length;
}
return result;
}
import { Backend, CompiledCircuit, ProofData } from '@noir-lang/types';
import { BackendOptions } from './types.js';
export { flattenPublicInputs } from './public_inputs.js';
export declare class BarretenbergBackend implements Backend {
private acirCircuit;
private options;

@@ -5,0 +7,0 @@ private api;

/* eslint-disable @typescript-eslint/no-explicit-any */
import { decompressSync as gunzip } from 'fflate';
import { acirToUint8Array } from './serialize.js';
import { deflattenPublicInputs, flattenPublicInputsAsArray } from './public_inputs.js';
export { flattenPublicInputs } from './public_inputs.js';
// This is the number of bytes in a UltraPlonk proof

@@ -8,2 +10,3 @@ // minus the public inputs.

export class BarretenbergBackend {
acirCircuit;
options;

@@ -18,2 +21,3 @@ // These type assertions are used so that we don't

constructor(acirCircuit, options = { threads: 1 }) {
this.acirCircuit = acirCircuit;
this.options = options;

@@ -76,9 +80,4 @@ const acirBytecodeBase64 = acirCircuit.bytecode;

const publicInputsConcatenated = proofWithPublicInputs.slice(0, splitIndex);
const publicInputSize = 32;
const publicInputs = [];
for (let i = 0; i < publicInputsConcatenated.length; i += publicInputSize) {
const publicInput = publicInputsConcatenated.slice(i, i + publicInputSize);
publicInputs.push(publicInput);
}
const proof = proofWithPublicInputs.slice(splitIndex);
const publicInputs = deflattenPublicInputs(publicInputsConcatenated, this.acirCircuit.abi);
return { proof, publicInputs };

@@ -150,3 +149,3 @@ }

// Flatten publicInputs
const publicInputsConcatenated = flattenUint8Arrays(proofData.publicInputs);
const publicInputsConcatenated = flattenPublicInputsAsArray(proofData.publicInputs);
// Concatenate publicInputs and proof

@@ -156,11 +155,1 @@ const proofWithPublicInputs = Uint8Array.from([...publicInputsConcatenated, ...proofData.proof]);

}
function flattenUint8Arrays(arrays) {
const totalLength = arrays.reduce((acc, val) => acc + val.length, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const arr of arrays) {
result.set(arr, offset);
offset += arr.length;
}
return result;
}

@@ -6,3 +6,3 @@ {

],
"version": "0.19.3",
"version": "0.19.4-1ef8546.nightly",
"packageManager": "yarn@3.5.1",

@@ -36,4 +36,4 @@ "license": "(MIT OR Apache-2.0)",

"dependencies": {
"@aztec/bb.js": "0.15.1",
"@noir-lang/types": "0.19.3",
"@aztec/bb.js": "0.16.0",
"@noir-lang/types": "0.19.4-1ef8546.nightly",
"fflate": "^0.8.0"

@@ -40,0 +40,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc