Skip to content

Commit

Permalink
last touches
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Oct 10, 2023
1 parent 45b61e6 commit f446df1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion yarn-project/acir-simulator/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './client/index.js';
export * from './acvm/index.js';
export * from './public/index.js';
export { computeSlotForMapping } from './utils.js';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { deserializeArrayFromVector, deserializeField, serializeBufferArrayToVec
* @param lhs - The first hash.
* @param rhs - The second hash.
* @returns The new 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenCompress(wasm: IWasmModule, lhs: Uint8Array, rhs: Uint8Array): Buffer {
// If not done already, precompute constants.
Expand All @@ -30,7 +30,7 @@ export function pedersenCompress(wasm: IWasmModule, lhs: Uint8Array, rhs: Uint8A
* @param lhs - The first hash.
* @param rhs - The second hash.
* @returns The new 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenHashInputs(wasm: IWasmModule, inputs: Buffer[]): Buffer {
// If not done already, precompute constants.
Expand All @@ -46,7 +46,7 @@ export function pedersenHashInputs(wasm: IWasmModule, inputs: Buffer[]): Buffer
* @param wasm - The barretenberg module.
* @param inputs - The array of buffers to compress.
* @returns The resulting 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenCompressInputs(wasm: IWasmModule, inputs: Buffer[]): Buffer {
// If not done already, precompute constants.
Expand All @@ -62,7 +62,7 @@ export function pedersenCompressInputs(wasm: IWasmModule, inputs: Buffer[]): Buf
* @param wasm - The barretenberg module.
* @param inputs - The array of buffers to compress.
* @returns The resulting 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenPlookupCommitInputs(wasm: IWasmModule, inputs: Buffer[]): Buffer {
// If not done already, precompute constants.
Expand All @@ -79,7 +79,7 @@ export function pedersenPlookupCommitInputs(wasm: IWasmModule, inputs: Buffer[])
* @param inputs - The array of buffers to compress.
* @param hashIndex - Hash index of the generator to use (See GeneratorIndex enum).
* @returns The resulting 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenPlookupCommitWithHashIndex(wasm: IWasmModule, inputs: Buffer[], hashIndex: number): Buffer {
// If not done already, precompute constants.
Expand All @@ -96,7 +96,7 @@ export function pedersenPlookupCommitWithHashIndex(wasm: IWasmModule, inputs: Bu
* @param inputs - The array of buffers to compress.
* @param hashIndex - Hash index of the generator to use (See GeneratorIndex enum).
* @returns The resulting 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenCompressWithHashIndex(wasm: IWasmModule, inputs: Buffer[], hashIndex: number): Buffer {
// If not done already, precompute constants.
Expand All @@ -113,7 +113,7 @@ export function pedersenCompressWithHashIndex(wasm: IWasmModule, inputs: Buffer[
* @param inputs - The array of buffers to compress.
* @param hashIndex - Hash index of the generator to use (See GeneratorIndex enum).
* @returns The resulting 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenPlookupCompressWithHashIndex(wasm: IWasmModule, inputs: Buffer[], hashIndex: number): Buffer {
// If not done already, precompute constants.
Expand All @@ -129,7 +129,7 @@ export function pedersenPlookupCompressWithHashIndex(wasm: IWasmModule, inputs:
* @param wasm - The barretenberg module.
* @param data - The data buffer.
* @returns The hash buffer.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenGetHash(wasm: IWasmModule, data: Buffer): Buffer {
// If not done already, precompute constants.
Expand All @@ -152,7 +152,7 @@ export function pedersenGetHash(wasm: IWasmModule, data: Buffer): Buffer {
* @param wasm - The barretenberg module.
* @param values - The 32 byte pedersen leaves.
* @returns A tree represented by an array.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export function pedersenGetHashTree(wasm: IWasmModule, values: Buffer[]) {
// If not done already, precompute constants.
Expand Down
10 changes: 5 additions & 5 deletions yarn-project/merkle-tree/src/pedersen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@ import { Hasher } from '@aztec/types';

/**
* A helper class encapsulating Pedersen hash functionality.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export class Pedersen implements Hasher {
constructor(private wasm: IWasmModule) {}

/*
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
public compress(lhs: Uint8Array, rhs: Uint8Array): Buffer {
return pedersenCompress(this.wasm, lhs, rhs);
}

/*
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
public compressInputs(inputs: Buffer[]): Buffer {
return pedersenHashInputs(this.wasm, inputs);
}

/*
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
public hashToField(data: Uint8Array): Buffer {
return pedersenGetHash(this.wasm, Buffer.from(data));
}

/*
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
public hashToTree(leaves: Buffer[]): Promise<Buffer[]> {
return Promise.resolve(pedersenGetHashTree(this.wasm, leaves));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Pedersen } from '../../index.js';

/**
* A test utility allowing us to count the number of times the compress function has been called.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
export class PedersenWithCounter extends Pedersen {
/**
Expand All @@ -15,7 +15,7 @@ export class PedersenWithCounter extends Pedersen {
* @param lhs - The first hash.
* @param rhs - The second hash.
* @returns The new 32-byte hash.
* @deprecated Don't call pedersen directly. Create specific nicely-called WASM functions for your use-case.
* @deprecated Don't call pedersen directly in production code. Instead, create specific nicely-called WASM functions.
*/
public compress(lhs: Uint8Array, rhs: Uint8Array): Buffer {
this.compressCounter++;
Expand Down

0 comments on commit f446df1

Please sign in to comment.