@aztec/blob-lib 5.2.0-nightly.20260726 → 5.2.0-nightly.20260728
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/kzg_context.d.ts +8 -4
- package/dest/kzg_context.d.ts.map +1 -1
- package/dest/kzg_context.js +13 -5
- package/package.json +3 -3
- package/src/kzg_context.ts +12 -4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/blob-lib",
|
|
3
|
-
"version": "5.2.0-nightly.
|
|
3
|
+
"version": "5.2.0-nightly.20260728",
|
|
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": "5.2.0-nightly.
|
|
31
|
-
"@aztec/foundation": "5.2.0-nightly.
|
|
30
|
+
"@aztec/constants": "5.2.0-nightly.20260728",
|
|
31
|
+
"@aztec/foundation": "5.2.0-nightly.20260728",
|
|
32
32
|
"@crate-crypto/node-eth-kzg": "^0.10.0",
|
|
33
33
|
"tslib": "^2.4.0"
|
|
34
34
|
},
|
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
|
}
|