@aztec/blob-lib 2.1.0-rc.3 → 2.1.0-rc.31
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.d.ts +3 -0
- package/dest/blob.d.ts.map +1 -1
- package/dest/blob.js +3 -1
- package/dest/index.js +1 -1
- package/dest/types.d.ts +2 -0
- package/dest/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/blob.ts +7 -0
- package/src/index.ts +1 -1
- package/src/types.ts +2 -0
package/dest/blob.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import cKzg from 'c-kzg';
|
|
|
4
4
|
import type { Blob as BlobBuffer } from 'c-kzg';
|
|
5
5
|
import type { BlobJson } from './interface.js';
|
|
6
6
|
export declare const VERSIONED_HASH_VERSION_KZG = 1;
|
|
7
|
+
/** Versioned blob hash for an empty blob */
|
|
8
|
+
export declare const EMPTY_BLOB_VERSIONED_HASH: Buffer<ArrayBuffer>;
|
|
7
9
|
/**
|
|
8
10
|
* A class to create, manage, and prove EVM blobs.
|
|
9
11
|
*/
|
|
@@ -153,6 +155,7 @@ export declare class Blob {
|
|
|
153
155
|
static getViemKzgInstance(): {
|
|
154
156
|
blobToKzgCommitment: typeof cKzg.blobToKzgCommitment;
|
|
155
157
|
computeBlobKzgProof: typeof cKzg.computeBlobKzgProof;
|
|
158
|
+
computeCellsAndKzgProofs: typeof cKzg.computeCellsAndKzgProofs;
|
|
156
159
|
};
|
|
157
160
|
/**
|
|
158
161
|
* @param fields - Fields to broadcast in the blob(s)
|
package/dest/blob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAG9E,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,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 -8,6 +8,7 @@ import { BlobDeserializationError } from './errors.js';
|
|
|
8
8
|
const { BYTES_PER_BLOB, FIELD_ELEMENTS_PER_BLOB, blobToKzgCommitment, computeKzgProof, verifyKzgProof } = cKzg;
|
|
9
9
|
// The prefix to the EVM blobHash, defined here: https://eips.ethereum.org/EIPS/eip-4844#specification
|
|
10
10
|
export const VERSIONED_HASH_VERSION_KZG = 0x01;
|
|
11
|
+
/** Versioned blob hash for an empty blob */ export const EMPTY_BLOB_VERSIONED_HASH = Buffer.from(`010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014`, 'hex');
|
|
11
12
|
/**
|
|
12
13
|
* A class to create, manage, and prove EVM blobs.
|
|
13
14
|
*/ export class Blob {
|
|
@@ -231,7 +232,8 @@ export const VERSIONED_HASH_VERSION_KZG = 0x01;
|
|
|
231
232
|
static getViemKzgInstance() {
|
|
232
233
|
return {
|
|
233
234
|
blobToKzgCommitment: cKzg.blobToKzgCommitment,
|
|
234
|
-
computeBlobKzgProof: cKzg.computeBlobKzgProof
|
|
235
|
+
computeBlobKzgProof: cKzg.computeBlobKzgProof,
|
|
236
|
+
computeCellsAndKzgProofs: cKzg.computeCellsAndKzgProofs
|
|
235
237
|
};
|
|
236
238
|
}
|
|
237
239
|
/**
|
package/dest/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export * from './errors.js';
|
|
|
8
8
|
export * from './blob_batching_public_inputs.js';
|
|
9
9
|
export * from './sponge_blob.js';
|
|
10
10
|
try {
|
|
11
|
-
loadTrustedSetup();
|
|
11
|
+
loadTrustedSetup(8); // See https://notes.ethereum.org/@jtraglia/windowed_multiplications
|
|
12
12
|
} catch (error) {
|
|
13
13
|
if (error.message.includes('trusted setup is already loaded')) {
|
|
14
14
|
// NB: The c-kzg lib has no way of checking whether the setup is loaded or not,
|
package/dest/types.d.ts
CHANGED
|
@@ -8,5 +8,7 @@ export interface BlobKzgInstance {
|
|
|
8
8
|
blobToKzgCommitment(blob: Uint8Array): Uint8Array;
|
|
9
9
|
/** Function to compute KZG proof for blob data */
|
|
10
10
|
computeBlobKzgProof(blob: Uint8Array, commitment: Uint8Array): Uint8Array;
|
|
11
|
+
/** Function to compute both blob data cells and their corresponding KZG proofs for EIP7594 */
|
|
12
|
+
computeCellsAndKzgProofs(blob: Uint8Array): [Uint8Array[], Uint8Array[]];
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=types.d.ts.map
|
package/dest/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAIjC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,kDAAkD;IAClD,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAIjC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,kDAAkD;IAClD,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IAC1E,8FAA8F;IAC9F,wBAAwB,CAAC,IAAI,EAAE,UAAU,GAAG,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;CAC1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/blob-lib",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"../package.common.json"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/constants": "2.1.0-rc.
|
|
30
|
-
"@aztec/foundation": "2.1.0-rc.
|
|
31
|
-
"c-kzg": "4.
|
|
29
|
+
"@aztec/constants": "2.1.0-rc.31",
|
|
30
|
+
"@aztec/foundation": "2.1.0-rc.31",
|
|
31
|
+
"c-kzg": "4.1.0",
|
|
32
32
|
"tslib": "^2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/blob.ts
CHANGED
|
@@ -15,6 +15,12 @@ const { BYTES_PER_BLOB, FIELD_ELEMENTS_PER_BLOB, blobToKzgCommitment, computeKzg
|
|
|
15
15
|
// The prefix to the EVM blobHash, defined here: https://eips.ethereum.org/EIPS/eip-4844#specification
|
|
16
16
|
export const VERSIONED_HASH_VERSION_KZG = 0x01;
|
|
17
17
|
|
|
18
|
+
/** Versioned blob hash for an empty blob */
|
|
19
|
+
export const EMPTY_BLOB_VERSIONED_HASH = Buffer.from(
|
|
20
|
+
`010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014`,
|
|
21
|
+
'hex',
|
|
22
|
+
);
|
|
23
|
+
|
|
18
24
|
/**
|
|
19
25
|
* A class to create, manage, and prove EVM blobs.
|
|
20
26
|
*/
|
|
@@ -279,6 +285,7 @@ export class Blob {
|
|
|
279
285
|
return {
|
|
280
286
|
blobToKzgCommitment: cKzg.blobToKzgCommitment,
|
|
281
287
|
computeBlobKzgProof: cKzg.computeBlobKzgProof,
|
|
288
|
+
computeCellsAndKzgProofs: cKzg.computeCellsAndKzgProofs,
|
|
282
289
|
};
|
|
283
290
|
}
|
|
284
291
|
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export * from './blob_batching_public_inputs.js';
|
|
|
11
11
|
export * from './sponge_blob.js';
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
loadTrustedSetup();
|
|
14
|
+
loadTrustedSetup(8); // See https://notes.ethereum.org/@jtraglia/windowed_multiplications
|
|
15
15
|
} catch (error: any) {
|
|
16
16
|
if (error.message.includes('trusted setup is already loaded')) {
|
|
17
17
|
// NB: The c-kzg lib has no way of checking whether the setup is loaded or not,
|
package/src/types.ts
CHANGED
|
@@ -11,4 +11,6 @@ export interface BlobKzgInstance {
|
|
|
11
11
|
blobToKzgCommitment(blob: Uint8Array): Uint8Array;
|
|
12
12
|
/** Function to compute KZG proof for blob data */
|
|
13
13
|
computeBlobKzgProof(blob: Uint8Array, commitment: Uint8Array): Uint8Array;
|
|
14
|
+
/** Function to compute both blob data cells and their corresponding KZG proofs for EIP7594 */
|
|
15
|
+
computeCellsAndKzgProofs(blob: Uint8Array): [Uint8Array[], Uint8Array[]];
|
|
14
16
|
}
|