@aztec/blob-lib 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/blob_batching.d.ts +1 -1
- package/dest/blob_batching.js +1 -1
- package/dest/circuit_types/blob_accumulator.d.ts +1 -1
- package/dest/circuit_types/blob_accumulator.js +1 -1
- package/dest/circuit_types/final_blob_accumulator.d.ts +1 -1
- package/dest/circuit_types/final_blob_accumulator.js +1 -1
- package/dest/circuit_types/final_blob_batching_challenges.d.ts +1 -1
- package/dest/circuit_types/final_blob_batching_challenges.js +1 -1
- package/dest/kzg_context.d.ts +8 -4
- package/dest/kzg_context.d.ts.map +1 -1
- package/dest/kzg_context.js +13 -5
- package/dest/sponge_blob.d.ts +1 -1
- package/dest/sponge_blob.js +2 -2
- package/package.json +3 -3
- package/src/blob_batching.ts +1 -1
- package/src/circuit_types/blob_accumulator.ts +1 -1
- package/src/circuit_types/final_blob_accumulator.ts +1 -1
- package/src/circuit_types/final_blob_batching_challenges.ts +1 -1
- package/src/kzg_context.ts +12 -4
- package/src/sponge_blob.ts +2 -2
package/dest/blob_batching.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Blob } from './blob.js';
|
|
|
5
5
|
import { BlobAccumulator, FinalBlobAccumulator, FinalBlobBatchingChallenges } from './circuit_types/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* A class to create, manage, and prove batched EVM blobs.
|
|
8
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
8
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
9
9
|
*/
|
|
10
10
|
export declare class BatchedBlobAccumulator {
|
|
11
11
|
/** Hash of Cs (to link to L1 blob hashes). */
|
package/dest/blob_batching.js
CHANGED
|
@@ -10,7 +10,7 @@ import { computeBlobFieldsHash, hashBlobYLimbs } from './hash.js';
|
|
|
10
10
|
import { getKzg } from './kzg_context.js';
|
|
11
11
|
/**
|
|
12
12
|
* A class to create, manage, and prove batched EVM blobs.
|
|
13
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
13
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
14
14
|
*/ export class BatchedBlobAccumulator {
|
|
15
15
|
blobCommitmentsHashAcc;
|
|
16
16
|
zAcc;
|
|
@@ -2,7 +2,7 @@ import { BLS12Fr, BLS12Point } from '@aztec/foundation/curves/bls12';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
4
4
|
/**
|
|
5
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
5
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
6
6
|
*/
|
|
7
7
|
export declare class BlobAccumulator {
|
|
8
8
|
blobCommitmentsHashAcc: Fr;
|
|
@@ -3,7 +3,7 @@ import { BLS12Fq, BLS12Fr, BLS12Point } from '@aztec/foundation/curves/bls12';
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
/**
|
|
6
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
6
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
7
7
|
*/ export class BlobAccumulator {
|
|
8
8
|
blobCommitmentsHashAcc;
|
|
9
9
|
zAcc;
|
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
4
|
import { inspect } from 'util';
|
|
5
5
|
/**
|
|
6
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
6
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
7
7
|
*/
|
|
8
8
|
export declare class FinalBlobAccumulator {
|
|
9
9
|
blobCommitmentsHash: Fr;
|
|
@@ -5,7 +5,7 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
5
5
|
import { inspect } from 'util';
|
|
6
6
|
_computedKey = inspect.custom;
|
|
7
7
|
/**
|
|
8
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
8
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
9
9
|
*/ export class FinalBlobAccumulator {
|
|
10
10
|
blobCommitmentsHash;
|
|
11
11
|
z;
|
|
@@ -2,7 +2,7 @@ import { BLS12Fr } from '@aztec/foundation/curves/bls12';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
4
|
/**
|
|
5
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
5
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FinalBlobBatchingChallenges {
|
|
8
8
|
readonly z: Fr;
|
|
@@ -2,7 +2,7 @@ import { BLS12Fr } from '@aztec/foundation/curves/bls12';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
/**
|
|
5
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
5
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
6
6
|
*/ export class FinalBlobBatchingChallenges {
|
|
7
7
|
z;
|
|
8
8
|
gamma;
|
package/dest/kzg_context.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
1
2
|
import type { DasContextJs } from '@crate-crypto/node-eth-kzg';
|
|
2
3
|
export type { DasContextJs } from '@crate-crypto/node-eth-kzg';
|
|
3
4
|
export declare function getBytesPerBlob(): number;
|
|
4
5
|
export declare function getBytesPerCommitment(): number;
|
|
5
6
|
/**
|
|
6
|
-
* Returns the lazily-initialized KZG context.
|
|
7
|
-
*
|
|
7
|
+
* Returns the lazily-initialized KZG context. The first call synchronously builds the
|
|
8
|
+
* precomputation tables (~2s locally, blocking the event loop; longer under constrained CPU), so
|
|
9
|
+
* callers on a latency-sensitive path should warm it ahead of time. Pass a logger to record how
|
|
10
|
+
* long that first build took.
|
|
11
|
+
* @param logger - Optional logger; when provided, the initial table build is timed and logged.
|
|
8
12
|
*/
|
|
9
|
-
export declare function getKzg(): DasContextJs;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function getKzg(logger?: Logger): DasContextJs;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia3pnX2NvbnRleHQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9remdfY29udGV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUdwRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQU0vRCxZQUFZLEVBQUUsWUFBWSxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFlL0Qsd0JBQWdCLGVBQWUsSUFBSSxNQUFNLENBRXhDO0FBRUQsd0JBQWdCLHFCQUFxQixJQUFJLE1BQU0sQ0FFOUM7QUFJRDs7Ozs7O0dBTUc7QUFDSCx3QkFBZ0IsTUFBTSxDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sR0FBRyxZQUFZLENBT3BEIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kzg_context.d.ts","sourceRoot":"","sources":["../src/kzg_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAe/D,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAID
|
|
1
|
+
{"version":3,"file":"kzg_context.d.ts","sourceRoot":"","sources":["../src/kzg_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAe/D,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAID;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAOpD"}
|
package/dest/kzg_context.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { elapsedSync } from '@aztec/foundation/timer';
|
|
1
2
|
import { createRequire } from 'module';
|
|
2
3
|
let nativeModule;
|
|
3
4
|
/** Lazily loads the @crate-crypto/node-eth-kzg native module. */ function loadNativeModule() {
|
|
@@ -17,12 +18,19 @@ export function getBytesPerCommitment() {
|
|
|
17
18
|
}
|
|
18
19
|
let kzgInstance;
|
|
19
20
|
/**
|
|
20
|
-
* Returns the lazily-initialized KZG context.
|
|
21
|
-
*
|
|
22
|
-
|
|
21
|
+
* Returns the lazily-initialized KZG context. The first call synchronously builds the
|
|
22
|
+
* precomputation tables (~2s locally, blocking the event loop; longer under constrained CPU), so
|
|
23
|
+
* callers on a latency-sensitive path should warm it ahead of time. Pass a logger to record how
|
|
24
|
+
* long that first build took.
|
|
25
|
+
* @param logger - Optional logger; when provided, the initial table build is timed and logged.
|
|
26
|
+
*/ export function getKzg(logger) {
|
|
23
27
|
if (!kzgInstance) {
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
const [durationMs, instance] = elapsedSync(()=>loadNativeModule().DasContextJs.create({
|
|
29
|
+
usePrecomp: true
|
|
30
|
+
}));
|
|
31
|
+
kzgInstance = instance;
|
|
32
|
+
logger?.verbose(`Loaded KZG trusted setup`, {
|
|
33
|
+
durationMs
|
|
26
34
|
});
|
|
27
35
|
}
|
|
28
36
|
return kzgInstance;
|
package/dest/sponge_blob.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { BufferReader, FieldReader, type Tuple } from '@aztec/foundation/serialize';
|
|
4
4
|
/**
|
|
5
5
|
* A Poseidon2 sponge used to accumulate data that will be added to blobs.
|
|
6
|
-
* See noir-projects/noir-protocol-circuits/crates/types/src/
|
|
6
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/types/src/blob_data/sponge_blob.nr.
|
|
7
7
|
*/
|
|
8
8
|
export declare class SpongeBlob {
|
|
9
9
|
/** Sponge with absorbed fields that will go into one or more blobs. */
|
package/dest/sponge_blob.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
5
5
|
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
6
6
|
/**
|
|
7
7
|
* A Poseidon2 sponge used to accumulate data that will be added to blobs.
|
|
8
|
-
* See noir-projects/noir-protocol-circuits/crates/types/src/
|
|
8
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/types/src/blob_data/sponge_blob.nr.
|
|
9
9
|
*/ export class SpongeBlob {
|
|
10
10
|
sponge;
|
|
11
11
|
numAbsorbedFields;
|
|
@@ -17,7 +17,7 @@ import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from
|
|
|
17
17
|
/**
|
|
18
18
|
* Initialize the sponge blob to absorb data for a checkpoint.
|
|
19
19
|
*/ static init() {
|
|
20
|
-
// This must match the implementation in noir-projects/noir-protocol-circuits/types/src/
|
|
20
|
+
// This must match the implementation in noir-projects/fnd/noir-protocol-circuits/crates/types/src/blob_data/sponge_blob.nr
|
|
21
21
|
const iv = new Fr(BigInt(SpongeBlob.MAX_FIELDS) * TWO_POW_64);
|
|
22
22
|
const sponge = Poseidon2Sponge.init(iv);
|
|
23
23
|
return new SpongeBlob(sponge, 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/blob-lib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.9a89641",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"../package.common.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@aztec/constants": "0.0.1-commit.
|
|
31
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
30
|
+
"@aztec/constants": "0.0.1-commit.9a89641",
|
|
31
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
32
32
|
"@crate-crypto/node-eth-kzg": "^0.10.0",
|
|
33
33
|
"tslib": "^2.4.0"
|
|
34
34
|
},
|
package/src/blob_batching.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { getKzg } from './kzg_context.js';
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A class to create, manage, and prove batched EVM blobs.
|
|
16
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
16
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
17
17
|
*/
|
|
18
18
|
export class BatchedBlobAccumulator {
|
|
19
19
|
constructor(
|
|
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
4
4
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
7
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr` for documentation.
|
|
8
8
|
*/
|
|
9
9
|
export class BlobAccumulator {
|
|
10
10
|
constructor(
|
|
@@ -5,7 +5,7 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
5
5
|
import { inspect } from 'util';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
8
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_accumulator.nr` for documentation.
|
|
9
9
|
*/
|
|
10
10
|
export class FinalBlobAccumulator {
|
|
11
11
|
constructor(
|
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* See `noir-projects/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
6
|
+
* See `noir-projects/fnd/noir-protocol-circuits/crates/blob/src/abis/final_blob_batching_challenges.nr` for documentation.
|
|
7
7
|
*/
|
|
8
8
|
export class FinalBlobBatchingChallenges {
|
|
9
9
|
constructor(
|
package/src/kzg_context.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { elapsedSync } from '@aztec/foundation/timer';
|
|
3
|
+
|
|
1
4
|
import type { DasContextJs } from '@crate-crypto/node-eth-kzg';
|
|
2
5
|
import { createRequire } from 'module';
|
|
3
6
|
|
|
@@ -30,12 +33,17 @@ export function getBytesPerCommitment(): number {
|
|
|
30
33
|
let kzgInstance: DasContextJs | undefined;
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
|
-
* Returns the lazily-initialized KZG context.
|
|
34
|
-
*
|
|
36
|
+
* Returns the lazily-initialized KZG context. The first call synchronously builds the
|
|
37
|
+
* precomputation tables (~2s locally, blocking the event loop; longer under constrained CPU), so
|
|
38
|
+
* callers on a latency-sensitive path should warm it ahead of time. Pass a logger to record how
|
|
39
|
+
* long that first build took.
|
|
40
|
+
* @param logger - Optional logger; when provided, the initial table build is timed and logged.
|
|
35
41
|
*/
|
|
36
|
-
export function getKzg(): DasContextJs {
|
|
42
|
+
export function getKzg(logger?: Logger): DasContextJs {
|
|
37
43
|
if (!kzgInstance) {
|
|
38
|
-
|
|
44
|
+
const [durationMs, instance] = elapsedSync(() => loadNativeModule().DasContextJs.create({ usePrecomp: true }));
|
|
45
|
+
kzgInstance = instance;
|
|
46
|
+
logger?.verbose(`Loaded KZG trusted setup`, { durationMs });
|
|
39
47
|
}
|
|
40
48
|
return kzgInstance;
|
|
41
49
|
}
|
package/src/sponge_blob.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A Poseidon2 sponge used to accumulate data that will be added to blobs.
|
|
15
|
-
* See noir-projects/noir-protocol-circuits/crates/types/src/
|
|
15
|
+
* See noir-projects/fnd/noir-protocol-circuits/crates/types/src/blob_data/sponge_blob.nr.
|
|
16
16
|
*/
|
|
17
17
|
export class SpongeBlob {
|
|
18
18
|
static MAX_FIELDS = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB;
|
|
@@ -28,7 +28,7 @@ export class SpongeBlob {
|
|
|
28
28
|
* Initialize the sponge blob to absorb data for a checkpoint.
|
|
29
29
|
*/
|
|
30
30
|
static init(): SpongeBlob {
|
|
31
|
-
// This must match the implementation in noir-projects/noir-protocol-circuits/types/src/
|
|
31
|
+
// This must match the implementation in noir-projects/fnd/noir-protocol-circuits/crates/types/src/blob_data/sponge_blob.nr
|
|
32
32
|
const iv = new Fr(BigInt(SpongeBlob.MAX_FIELDS) * TWO_POW_64);
|
|
33
33
|
const sponge = Poseidon2Sponge.init(iv);
|
|
34
34
|
return new SpongeBlob(sponge, 0);
|