@aztec/foundation 0.47.1 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config/env_var.d.ts +2 -0
- package/dest/config/env_var.d.ts.map +1 -0
- package/dest/config/env_var.js +2 -0
- package/dest/config/index.d.ts +53 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +99 -0
- package/dest/crypto/pedersen/pedersen.wasm.d.ts +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.js +3 -3
- package/dest/crypto/poseidon/index.d.ts +7 -0
- package/dest/crypto/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/poseidon/index.js +14 -1
- package/dest/fields/fields.js +2 -2
- package/dest/fields/point.d.ts +0 -6
- package/dest/fields/point.d.ts.map +1 -1
- package/dest/fields/point.js +1 -13
- package/dest/hash/index.d.ts +83 -0
- package/dest/hash/index.d.ts.map +1 -0
- package/dest/hash/index.js +110 -0
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +4 -2
- package/dest/noir/noir_package_config.d.ts +4 -4
- package/dest/promise/running-promise.d.ts +5 -0
- package/dest/promise/running-promise.d.ts.map +1 -1
- package/dest/promise/running-promise.js +8 -1
- package/dest/{fifo/memory_fifo.d.ts → queue/base_memory_queue.d.ts} +8 -8
- package/dest/queue/base_memory_queue.d.ts.map +1 -0
- package/dest/{fifo/memory_fifo.js → queue/base_memory_queue.js} +5 -11
- package/dest/queue/bounded_serial_queue.d.ts.map +1 -0
- package/dest/{fifo → queue}/bounded_serial_queue.js +1 -1
- package/dest/queue/fifo_memory_queue.d.ts +21 -0
- package/dest/queue/fifo_memory_queue.d.ts.map +1 -0
- package/dest/queue/fifo_memory_queue.js +33 -0
- package/dest/queue/index.d.ts +6 -0
- package/dest/queue/index.d.ts.map +1 -0
- package/dest/queue/index.js +6 -0
- package/dest/queue/priority_memory_queue.d.ts +13 -0
- package/dest/queue/priority_memory_queue.d.ts.map +1 -0
- package/dest/queue/priority_memory_queue.js +17 -0
- package/dest/queue/priority_queue.d.ts +14 -0
- package/dest/queue/priority_queue.d.ts.map +1 -0
- package/dest/queue/priority_queue.js +29 -0
- package/dest/queue/semaphore.d.ts.map +1 -0
- package/dest/{fifo → queue}/semaphore.js +3 -3
- package/dest/queue/serial_queue.d.ts.map +1 -0
- package/dest/{fifo → queue}/serial_queue.js +3 -3
- package/dest/wasm/wasm_module.d.ts.map +1 -1
- package/dest/wasm/wasm_module.js +3 -3
- package/package.json +5 -3
- package/src/config/env_var.ts +98 -0
- package/src/config/index.ts +132 -0
- package/src/crypto/pedersen/pedersen.wasm.ts +5 -2
- package/src/crypto/poseidon/index.ts +20 -0
- package/src/fields/fields.ts +1 -1
- package/src/fields/point.ts +0 -13
- package/src/hash/index.ts +123 -0
- package/src/index.ts +3 -1
- package/src/promise/running-promise.ts +8 -0
- package/src/{fifo/memory_fifo.ts → queue/base_memory_queue.ts} +11 -10
- package/src/queue/fifo_memory_queue.ts +39 -0
- package/src/{fifo → queue}/index.ts +2 -1
- package/src/queue/priority_memory_queue.ts +20 -0
- package/src/queue/priority_queue.ts +34 -0
- package/src/{fifo → queue}/semaphore.ts +2 -2
- package/src/{fifo → queue}/serial_queue.ts +2 -2
- package/src/wasm/wasm_module.ts +2 -2
- package/dest/fifo/bounded_serial_queue.d.ts.map +0 -1
- package/dest/fifo/index.d.ts +0 -5
- package/dest/fifo/index.d.ts.map +0 -1
- package/dest/fifo/index.js +0 -5
- package/dest/fifo/memory_fifo.d.ts.map +0 -1
- package/dest/fifo/semaphore.d.ts.map +0 -1
- package/dest/fifo/serial_queue.d.ts.map +0 -1
- /package/dest/{fifo → queue}/bounded_serial_queue.d.ts +0 -0
- /package/dest/{fifo → queue}/semaphore.d.ts +0 -0
- /package/dest/{fifo → queue}/serial_queue.d.ts +0 -0
- /package/src/{fifo → queue}/bounded_serial_queue.ts +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Priority queue implementation based on a custom comparator.
|
|
3
|
+
*/
|
|
4
|
+
export class PriorityQueue<T> {
|
|
5
|
+
private items: T[];
|
|
6
|
+
|
|
7
|
+
constructor(private comparator: (a: T, b: T) => number) {
|
|
8
|
+
this.items = [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public put(item: T): void {
|
|
12
|
+
let i = 0;
|
|
13
|
+
while (i < this.items.length && this.comparator(item, this.items[i]) >= 0) {
|
|
14
|
+
i++;
|
|
15
|
+
}
|
|
16
|
+
this.items.splice(i, 0, item);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public get(): T | undefined {
|
|
20
|
+
return this.items.shift();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public peek(): T | undefined {
|
|
24
|
+
return this.items[0];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public clear() {
|
|
28
|
+
this.items = [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public get length(): number {
|
|
32
|
+
return this.items.length;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FifoMemoryQueue } from './fifo_memory_queue.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Allows the acquiring of up to `size` tokens before calls to acquire block, waiting for a call to release().
|
|
5
5
|
*/
|
|
6
6
|
export class Semaphore {
|
|
7
|
-
private readonly queue = new
|
|
7
|
+
private readonly queue = new FifoMemoryQueue<boolean>();
|
|
8
8
|
|
|
9
9
|
constructor(size: number) {
|
|
10
10
|
new Array(size).fill(true).map(() => this.queue.put(true));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FifoMemoryQueue } from './fifo_memory_queue.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A more specialized fifo queue that enqueues functions to execute. Enqueued functions are executed in serial.
|
|
5
5
|
*/
|
|
6
6
|
export class SerialQueue {
|
|
7
|
-
private readonly queue = new
|
|
7
|
+
private readonly queue = new FifoMemoryQueue<() => Promise<void>>();
|
|
8
8
|
private runningPromise!: Promise<void>;
|
|
9
9
|
|
|
10
10
|
/**
|
package/src/wasm/wasm_module.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
|
|
3
3
|
import { randomBytes } from '../crypto/index.js';
|
|
4
|
-
import { MemoryFifo } from '../fifo/index.js';
|
|
5
4
|
import { type LogFn, createDebugOnlyLogger } from '../log/index.js';
|
|
5
|
+
import { FifoMemoryQueue } from '../queue/index.js';
|
|
6
6
|
import { getEmptyWasiSdk } from './empty_wasi_sdk.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -47,7 +47,7 @@ export class WasmModule implements IWasmModule {
|
|
|
47
47
|
private memory!: WebAssembly.Memory;
|
|
48
48
|
private heap!: Uint8Array;
|
|
49
49
|
private instance?: WebAssembly.Instance;
|
|
50
|
-
private mutexQ = new
|
|
50
|
+
private mutexQ = new FifoMemoryQueue<boolean>();
|
|
51
51
|
private debug: LogFn;
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bounded_serial_queue.d.ts","sourceRoot":"","sources":["../../src/fifo/bounded_serial_queue.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,kBAAkB;IAIK,OAAO,CAAC,GAAG;IAH7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,SAAS,CAAY;gBAEjB,YAAY,EAAE,MAAM,EAAU,GAAG,oCAA6D;IAI1G;;;OAGG;IACI,KAAK;IAIZ;;;;;OAKG;IACI,MAAM;IAIb;;;;;OAKG;IACI,MAAM;IAIb;;;;;;;OAOG;IACI,GAAG;IAIV;;;;;OAKG;IACU,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAexD;;;;OAIG;IACU,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAWtD;;OAEG;IACU,SAAS;CAGvB"}
|
package/dest/fifo/index.d.ts
DELETED
package/dest/fifo/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fifo/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC"}
|
package/dest/fifo/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export * from './memory_fifo.js';
|
|
2
|
-
export * from './serial_queue.js';
|
|
3
|
-
export * from './bounded_serial_queue.js';
|
|
4
|
-
export * from './semaphore.js';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmlmby9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLGdCQUFnQixDQUFDIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory_fifo.d.ts","sourceRoot":"","sources":["../../src/fifo/memory_fifo.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qBAAa,UAAU,CAAC,CAAC;IAKX,OAAO,CAAC,GAAG;IAJvB,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,QAAQ,CAAS;gBAEL,GAAG,oCAAoD;IAE3E;;;;;OAKG;IACI,MAAM;IAIb;;;;;;;;;;OAUG;IACI,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA+BlD;;;;OAIG;IACI,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO;IAa5B;;;;OAIG;IACI,GAAG;IAKV;;;;OAIG;IACI,MAAM;IAMb;;;;;;;;OAQG;IACU,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;CAazD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../src/fifo/semaphore.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;gBAEvC,IAAI,EAAE,MAAM;IAIxB;;;;;;OAMG;IACU,OAAO;IAIpB;;;;;OAKG;IACI,OAAO;CAGf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serial_queue.d.ts","sourceRoot":"","sources":["../../src/fifo/serial_queue.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAC/D,OAAO,CAAC,cAAc,CAAiB;IAEvC;;;;;OAKG;IACI,KAAK;IAIZ;;;;;OAKG;IACI,MAAM;IAIb;;;;;;OAMG;IACI,MAAM;IAKb;;;;;OAKG;IACI,GAAG;IAKV;;;;;OAKG;IACI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgB/C;;OAEG;IACU,SAAS;CAGvB"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|