@aztec/blob-lib 3.0.0-nightly.20251002 → 3.0.0-nightly.20251004
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 +2 -2
- package/dest/blob_batching.js +2 -2
- package/dest/blob_batching_public_inputs.d.ts +17 -17
- package/dest/blob_batching_public_inputs.d.ts.map +1 -1
- package/dest/blob_batching_public_inputs.js +16 -16
- package/package.json +3 -3
- package/src/blob_batching.ts +2 -2
- package/src/blob_batching_public_inputs.ts +23 -30
package/dest/blob_batching.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export declare class BatchedBlob {
|
|
|
79
79
|
* - used such that y = sum_i { gamma^i * y_i }, and C = sum_i { gamma^i * C_i }
|
|
80
80
|
* for all blob evaluations y_i (see above) and commitments C_i.
|
|
81
81
|
*
|
|
82
|
-
* Iteratively calculated by
|
|
82
|
+
* Iteratively calculated by BlobAccumulator.accumulate() in nr. See also precomputeBatchedBlobChallenges() above.
|
|
83
83
|
*/
|
|
84
84
|
export declare class FinalBlobBatchingChallenges {
|
|
85
85
|
readonly z: Fr;
|
|
@@ -91,7 +91,7 @@ export declare class FinalBlobBatchingChallenges {
|
|
|
91
91
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/
|
|
94
|
+
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
95
95
|
*/
|
|
96
96
|
export declare class BatchedBlobAccumulator {
|
|
97
97
|
/** Hash of Cs (to link to L1 blob hashes). */
|
package/dest/blob_batching.js
CHANGED
|
@@ -128,7 +128,7 @@ const { computeKzgProof, verifyKzgProof } = cKzg;
|
|
|
128
128
|
* - used such that y = sum_i { gamma^i * y_i }, and C = sum_i { gamma^i * C_i }
|
|
129
129
|
* for all blob evaluations y_i (see above) and commitments C_i.
|
|
130
130
|
*
|
|
131
|
-
* Iteratively calculated by
|
|
131
|
+
* Iteratively calculated by BlobAccumulator.accumulate() in nr. See also precomputeBatchedBlobChallenges() above.
|
|
132
132
|
*/ export class FinalBlobBatchingChallenges {
|
|
133
133
|
z;
|
|
134
134
|
gamma;
|
|
@@ -151,7 +151,7 @@ const { computeKzgProof, verifyKzgProof } = cKzg;
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/
|
|
154
|
+
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
155
155
|
*/ export class BatchedBlobAccumulator {
|
|
156
156
|
blobCommitmentsHashAcc;
|
|
157
157
|
zAcc;
|
|
@@ -4,9 +4,9 @@ import { inspect } from 'util';
|
|
|
4
4
|
import { Blob } from './blob.js';
|
|
5
5
|
import { BatchedBlob, BatchedBlobAccumulator, FinalBlobBatchingChallenges } from './blob_batching.js';
|
|
6
6
|
/**
|
|
7
|
-
* See nr
|
|
7
|
+
* See nr BlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class BlobAccumulator {
|
|
10
10
|
blobCommitmentsHashAcc: Fr;
|
|
11
11
|
zAcc: Fr;
|
|
12
12
|
yAcc: BLS12Fr;
|
|
@@ -14,9 +14,9 @@ export declare class BlobAccumulatorPublicInputs {
|
|
|
14
14
|
gammaAcc: Fr;
|
|
15
15
|
gammaPowAcc: BLS12Fr;
|
|
16
16
|
constructor(blobCommitmentsHashAcc: Fr, zAcc: Fr, yAcc: BLS12Fr, cAcc: BLS12Point, gammaAcc: Fr, gammaPowAcc: BLS12Fr);
|
|
17
|
-
static empty():
|
|
18
|
-
equals(other:
|
|
19
|
-
static fromBuffer(buffer: Buffer | BufferReader):
|
|
17
|
+
static empty(): BlobAccumulator;
|
|
18
|
+
equals(other: BlobAccumulator): boolean;
|
|
19
|
+
static fromBuffer(buffer: Buffer | BufferReader): BlobAccumulator;
|
|
20
20
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
21
21
|
/**
|
|
22
22
|
* Given blobs, accumulate all public inputs state.
|
|
@@ -25,33 +25,33 @@ export declare class BlobAccumulatorPublicInputs {
|
|
|
25
25
|
* and is unsafe for other use. For that reason, a toBatchedBlobAccumulator does not exist. See evaluateBlobs() oracle for usage.
|
|
26
26
|
* @returns An updated blob accumulator.
|
|
27
27
|
*/
|
|
28
|
-
accumulateBlobs(blobs: Blob[], finalBlobChallenges: FinalBlobBatchingChallenges): Promise<
|
|
28
|
+
accumulateBlobs(blobs: Blob[], finalBlobChallenges: FinalBlobBatchingChallenges): Promise<BlobAccumulator>;
|
|
29
29
|
toFields(): Fr[];
|
|
30
|
-
static fromFields(fields: Fr[] | FieldReader):
|
|
30
|
+
static fromFields(fields: Fr[] | FieldReader): BlobAccumulator;
|
|
31
31
|
/**
|
|
32
32
|
* Converts from an accumulator to a struct for the public inputs of our rollup circuits.
|
|
33
|
-
* @returns A
|
|
33
|
+
* @returns A BlobAccumulator instance.
|
|
34
34
|
*/
|
|
35
|
-
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator):
|
|
35
|
+
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator): BlobAccumulator;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* See nr
|
|
38
|
+
* See nr FinalBlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
39
39
|
*/
|
|
40
|
-
export declare class
|
|
40
|
+
export declare class FinalBlobAccumulator {
|
|
41
41
|
blobCommitmentsHash: Fr;
|
|
42
42
|
z: Fr;
|
|
43
43
|
y: BLS12Fr;
|
|
44
44
|
c: BLS12Point;
|
|
45
45
|
constructor(blobCommitmentsHash: Fr, z: Fr, y: BLS12Fr, c: BLS12Point);
|
|
46
|
-
static empty():
|
|
47
|
-
static fromBuffer(buffer: Buffer | BufferReader):
|
|
46
|
+
static empty(): FinalBlobAccumulator;
|
|
47
|
+
static fromBuffer(buffer: Buffer | BufferReader): FinalBlobAccumulator;
|
|
48
48
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
49
|
-
static fromBatchedBlob(blob: BatchedBlob):
|
|
49
|
+
static fromBatchedBlob(blob: BatchedBlob): FinalBlobAccumulator;
|
|
50
50
|
toFields(): Fr[];
|
|
51
51
|
toString(): string;
|
|
52
|
-
equals(other:
|
|
53
|
-
static random():
|
|
54
|
-
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator):
|
|
52
|
+
equals(other: FinalBlobAccumulator): boolean;
|
|
53
|
+
static random(): FinalBlobAccumulator;
|
|
54
|
+
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator): FinalBlobAccumulator;
|
|
55
55
|
[inspect.custom](): string;
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=blob_batching_public_inputs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob_batching_public_inputs.d.ts","sourceRoot":"","sources":["../src/blob_batching_public_inputs.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtG;;GAEG;AACH,qBAAa,
|
|
1
|
+
{"version":3,"file":"blob_batching_public_inputs.d.ts","sourceRoot":"","sources":["../src/blob_batching_public_inputs.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtG;;GAEG;AACH,qBAAa,eAAe;IAEjB,sBAAsB,EAAE,EAAE;IAC1B,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,OAAO;gBALpB,sBAAsB,EAAE,EAAE,EAC1B,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,EAAE,EACZ,WAAW,EAAE,OAAO;IAG7B,MAAM,CAAC,KAAK,IAAI,eAAe;IAI/B,MAAM,CAAC,KAAK,EAAE,eAAe;IAW7B,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,eAAe;IAYjE,QAAQ;IAWR;;;;;;OAMG;IACG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,mBAAmB,EAAE,2BAA2B;IAerF,QAAQ;IAaR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,eAAe;IAgB9D;;;OAGG;IACH,MAAM,CAAC,0BAA0B,CAAC,WAAW,EAAE,sBAAsB;CAUtE;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAEtB,mBAAmB,EAAE,EAAE;IACvB,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,UAAU;gBAHb,mBAAmB,EAAE,EAAE,EACvB,CAAC,EAAE,EAAE,EACL,CAAC,EAAE,OAAO,EACV,CAAC,EAAE,UAAU;IAGtB,MAAM,CAAC,KAAK,IAAI,oBAAoB;IAIpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,oBAAoB;IAUtE,QAAQ;IAIR,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW;IAIxC,QAAQ;IAUR,QAAQ;IAQR,MAAM,CAAC,KAAK,EAAE,oBAAoB;IAUlC,MAAM,CAAC,MAAM;IAKb,MAAM,CAAC,0BAA0B,CAAC,WAAW,EAAE,sBAAsB;IASrE,CAAC,OAAO,CAAC,MAAM,CAAC;CAQjB"}
|
|
@@ -4,8 +4,8 @@ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/
|
|
|
4
4
|
import { inspect } from 'util';
|
|
5
5
|
import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
6
6
|
/**
|
|
7
|
-
* See nr
|
|
8
|
-
*/ export class
|
|
7
|
+
* See nr BlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
8
|
+
*/ export class BlobAccumulator {
|
|
9
9
|
blobCommitmentsHashAcc;
|
|
10
10
|
zAcc;
|
|
11
11
|
yAcc;
|
|
@@ -21,14 +21,14 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
21
21
|
this.gammaPowAcc = gammaPowAcc;
|
|
22
22
|
}
|
|
23
23
|
static empty() {
|
|
24
|
-
return new
|
|
24
|
+
return new BlobAccumulator(Fr.ZERO, Fr.ZERO, BLS12Fr.ZERO, BLS12Point.ZERO, Fr.ZERO, BLS12Fr.ZERO);
|
|
25
25
|
}
|
|
26
26
|
equals(other) {
|
|
27
27
|
return this.blobCommitmentsHashAcc.equals(other.blobCommitmentsHashAcc) && this.zAcc.equals(other.zAcc) && this.yAcc.equals(other.yAcc) && this.cAcc.equals(other.cAcc) && this.gammaAcc.equals(other.gammaAcc) && this.gammaPowAcc.equals(other.gammaPowAcc);
|
|
28
28
|
}
|
|
29
29
|
static fromBuffer(buffer) {
|
|
30
30
|
const reader = BufferReader.asReader(buffer);
|
|
31
|
-
return new
|
|
31
|
+
return new BlobAccumulator(Fr.fromBuffer(reader), Fr.fromBuffer(reader), BLS12Fr.fromBuffer(reader), BLS12Point.fromBuffer(reader), Fr.fromBuffer(reader), BLS12Fr.fromBuffer(reader));
|
|
32
32
|
}
|
|
33
33
|
toBuffer() {
|
|
34
34
|
return serializeToBuffer(this.blobCommitmentsHashAcc, this.zAcc, this.yAcc, this.cAcc, this.gammaAcc, this.gammaPowAcc);
|
|
@@ -42,7 +42,7 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
42
42
|
*/ async accumulateBlobs(blobs, finalBlobChallenges) {
|
|
43
43
|
let acc = new BatchedBlobAccumulator(this.blobCommitmentsHashAcc, this.zAcc, this.yAcc, this.cAcc, BLS12Point.ZERO, this.gammaAcc, this.gammaPowAcc, finalBlobChallenges);
|
|
44
44
|
acc = await acc.accumulateBlobs(blobs);
|
|
45
|
-
return new
|
|
45
|
+
return new BlobAccumulator(acc.blobCommitmentsHashAcc, acc.zAcc, acc.yAcc, acc.cAcc, acc.gammaAcc, acc.gammaPow);
|
|
46
46
|
}
|
|
47
47
|
toFields() {
|
|
48
48
|
return [
|
|
@@ -58,7 +58,7 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
58
58
|
}
|
|
59
59
|
static fromFields(fields) {
|
|
60
60
|
const reader = FieldReader.asReader(fields);
|
|
61
|
-
return new
|
|
61
|
+
return new BlobAccumulator(reader.readField(), reader.readField(), BLS12Fr.fromNoirBigNum({
|
|
62
62
|
limbs: reader.readFieldArray(BLS12_FR_LIMBS).map((f)=>f.toString())
|
|
63
63
|
}), new BLS12Point(BLS12Fq.fromNoirBigNum({
|
|
64
64
|
limbs: reader.readFieldArray(BLS12_FQ_LIMBS).map((f)=>f.toString())
|
|
@@ -70,14 +70,14 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Converts from an accumulator to a struct for the public inputs of our rollup circuits.
|
|
73
|
-
* @returns A
|
|
73
|
+
* @returns A BlobAccumulator instance.
|
|
74
74
|
*/ static fromBatchedBlobAccumulator(accumulator) {
|
|
75
|
-
return new
|
|
75
|
+
return new BlobAccumulator(accumulator.blobCommitmentsHashAcc, accumulator.zAcc, accumulator.yAcc, accumulator.cAcc, accumulator.gammaAcc, accumulator.gammaPow);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* See nr
|
|
80
|
-
*/ export class
|
|
79
|
+
* See nr FinalBlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
80
|
+
*/ export class FinalBlobAccumulator {
|
|
81
81
|
blobCommitmentsHash;
|
|
82
82
|
z;
|
|
83
83
|
y;
|
|
@@ -89,17 +89,17 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
89
89
|
this.c = c;
|
|
90
90
|
}
|
|
91
91
|
static empty() {
|
|
92
|
-
return new
|
|
92
|
+
return new FinalBlobAccumulator(Fr.ZERO, Fr.ZERO, BLS12Fr.ZERO, BLS12Point.ZERO);
|
|
93
93
|
}
|
|
94
94
|
static fromBuffer(buffer) {
|
|
95
95
|
const reader = BufferReader.asReader(buffer);
|
|
96
|
-
return new
|
|
96
|
+
return new FinalBlobAccumulator(Fr.fromBuffer(reader), Fr.fromBuffer(reader), BLS12Fr.fromBuffer(reader), BLS12Point.fromBuffer(reader));
|
|
97
97
|
}
|
|
98
98
|
toBuffer() {
|
|
99
99
|
return serializeToBuffer(this.blobCommitmentsHash, this.z, this.y, this.c);
|
|
100
100
|
}
|
|
101
101
|
static fromBatchedBlob(blob) {
|
|
102
|
-
return new
|
|
102
|
+
return new FinalBlobAccumulator(blob.blobCommitmentsHash, blob.z, blob.y, blob.commitment);
|
|
103
103
|
}
|
|
104
104
|
toFields() {
|
|
105
105
|
return [
|
|
@@ -127,14 +127,14 @@ import { BatchedBlobAccumulator } from './blob_batching.js';
|
|
|
127
127
|
}
|
|
128
128
|
// Creates a random instance. Used for testing only - will not prove/verify.
|
|
129
129
|
static random() {
|
|
130
|
-
return new
|
|
130
|
+
return new FinalBlobAccumulator(Fr.random(), Fr.random(), BLS12Fr.random(), BLS12Point.random());
|
|
131
131
|
}
|
|
132
132
|
// Warning: MUST be final accumulator state.
|
|
133
133
|
static fromBatchedBlobAccumulator(accumulator) {
|
|
134
|
-
return new
|
|
134
|
+
return new FinalBlobAccumulator(accumulator.blobCommitmentsHashAcc, accumulator.zAcc, accumulator.yAcc, accumulator.cAcc);
|
|
135
135
|
}
|
|
136
136
|
[inspect.custom]() {
|
|
137
|
-
return `
|
|
137
|
+
return `FinalBlobAccumulator {
|
|
138
138
|
blobCommitmentsHash: ${inspect(this.blobCommitmentsHash)},
|
|
139
139
|
z: ${inspect(this.z)},
|
|
140
140
|
y: ${inspect(this.y)},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/blob-lib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251004",
|
|
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": "3.0.0-nightly.
|
|
31
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
30
|
+
"@aztec/constants": "3.0.0-nightly.20251004",
|
|
31
|
+
"@aztec/foundation": "3.0.0-nightly.20251004",
|
|
32
32
|
"c-kzg": "4.0.0-alpha.1",
|
|
33
33
|
"tslib": "^2.4.0"
|
|
34
34
|
},
|
package/src/blob_batching.ts
CHANGED
|
@@ -138,7 +138,7 @@ export class BatchedBlob {
|
|
|
138
138
|
* - used such that y = sum_i { gamma^i * y_i }, and C = sum_i { gamma^i * C_i }
|
|
139
139
|
* for all blob evaluations y_i (see above) and commitments C_i.
|
|
140
140
|
*
|
|
141
|
-
* Iteratively calculated by
|
|
141
|
+
* Iteratively calculated by BlobAccumulator.accumulate() in nr. See also precomputeBatchedBlobChallenges() above.
|
|
142
142
|
*/
|
|
143
143
|
export class FinalBlobBatchingChallenges {
|
|
144
144
|
constructor(
|
|
@@ -165,7 +165,7 @@ export class FinalBlobBatchingChallenges {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* See noir-projects/noir-protocol-circuits/crates/blob/src/
|
|
168
|
+
* See noir-projects/noir-protocol-circuits/crates/blob/src/abis/blob_accumulator.nr
|
|
169
169
|
*/
|
|
170
170
|
export class BatchedBlobAccumulator {
|
|
171
171
|
constructor(
|
|
@@ -8,9 +8,9 @@ import { Blob } from './blob.js';
|
|
|
8
8
|
import { BatchedBlob, BatchedBlobAccumulator, FinalBlobBatchingChallenges } from './blob_batching.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* See nr
|
|
11
|
+
* See nr BlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
12
12
|
*/
|
|
13
|
-
export class
|
|
13
|
+
export class BlobAccumulator {
|
|
14
14
|
constructor(
|
|
15
15
|
public blobCommitmentsHashAcc: Fr,
|
|
16
16
|
public zAcc: Fr,
|
|
@@ -20,11 +20,11 @@ export class BlobAccumulatorPublicInputs {
|
|
|
20
20
|
public gammaPowAcc: BLS12Fr,
|
|
21
21
|
) {}
|
|
22
22
|
|
|
23
|
-
static empty():
|
|
24
|
-
return new
|
|
23
|
+
static empty(): BlobAccumulator {
|
|
24
|
+
return new BlobAccumulator(Fr.ZERO, Fr.ZERO, BLS12Fr.ZERO, BLS12Point.ZERO, Fr.ZERO, BLS12Fr.ZERO);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
equals(other:
|
|
27
|
+
equals(other: BlobAccumulator) {
|
|
28
28
|
return (
|
|
29
29
|
this.blobCommitmentsHashAcc.equals(other.blobCommitmentsHashAcc) &&
|
|
30
30
|
this.zAcc.equals(other.zAcc) &&
|
|
@@ -35,9 +35,9 @@ export class BlobAccumulatorPublicInputs {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
static fromBuffer(buffer: Buffer | BufferReader):
|
|
38
|
+
static fromBuffer(buffer: Buffer | BufferReader): BlobAccumulator {
|
|
39
39
|
const reader = BufferReader.asReader(buffer);
|
|
40
|
-
return new
|
|
40
|
+
return new BlobAccumulator(
|
|
41
41
|
Fr.fromBuffer(reader),
|
|
42
42
|
Fr.fromBuffer(reader),
|
|
43
43
|
BLS12Fr.fromBuffer(reader),
|
|
@@ -77,14 +77,7 @@ export class BlobAccumulatorPublicInputs {
|
|
|
77
77
|
finalBlobChallenges,
|
|
78
78
|
);
|
|
79
79
|
acc = await acc.accumulateBlobs(blobs);
|
|
80
|
-
return new
|
|
81
|
-
acc.blobCommitmentsHashAcc,
|
|
82
|
-
acc.zAcc,
|
|
83
|
-
acc.yAcc,
|
|
84
|
-
acc.cAcc,
|
|
85
|
-
acc.gammaAcc,
|
|
86
|
-
acc.gammaPow,
|
|
87
|
-
);
|
|
80
|
+
return new BlobAccumulator(acc.blobCommitmentsHashAcc, acc.zAcc, acc.yAcc, acc.cAcc, acc.gammaAcc, acc.gammaPow);
|
|
88
81
|
}
|
|
89
82
|
|
|
90
83
|
toFields() {
|
|
@@ -100,9 +93,9 @@ export class BlobAccumulatorPublicInputs {
|
|
|
100
93
|
];
|
|
101
94
|
}
|
|
102
95
|
|
|
103
|
-
static fromFields(fields: Fr[] | FieldReader):
|
|
96
|
+
static fromFields(fields: Fr[] | FieldReader): BlobAccumulator {
|
|
104
97
|
const reader = FieldReader.asReader(fields);
|
|
105
|
-
return new
|
|
98
|
+
return new BlobAccumulator(
|
|
106
99
|
reader.readField(),
|
|
107
100
|
reader.readField(),
|
|
108
101
|
BLS12Fr.fromNoirBigNum({ limbs: reader.readFieldArray(BLS12_FR_LIMBS).map(f => f.toString()) }),
|
|
@@ -118,10 +111,10 @@ export class BlobAccumulatorPublicInputs {
|
|
|
118
111
|
|
|
119
112
|
/**
|
|
120
113
|
* Converts from an accumulator to a struct for the public inputs of our rollup circuits.
|
|
121
|
-
* @returns A
|
|
114
|
+
* @returns A BlobAccumulator instance.
|
|
122
115
|
*/
|
|
123
116
|
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator) {
|
|
124
|
-
return new
|
|
117
|
+
return new BlobAccumulator(
|
|
125
118
|
accumulator.blobCommitmentsHashAcc,
|
|
126
119
|
accumulator.zAcc,
|
|
127
120
|
accumulator.yAcc,
|
|
@@ -133,9 +126,9 @@ export class BlobAccumulatorPublicInputs {
|
|
|
133
126
|
}
|
|
134
127
|
|
|
135
128
|
/**
|
|
136
|
-
* See nr
|
|
129
|
+
* See nr FinalBlobAccumulator and ts BatchedBlobAccumulator for documentation.
|
|
137
130
|
*/
|
|
138
|
-
export class
|
|
131
|
+
export class FinalBlobAccumulator {
|
|
139
132
|
constructor(
|
|
140
133
|
public blobCommitmentsHash: Fr,
|
|
141
134
|
public z: Fr,
|
|
@@ -143,13 +136,13 @@ export class FinalBlobAccumulatorPublicInputs {
|
|
|
143
136
|
public c: BLS12Point,
|
|
144
137
|
) {}
|
|
145
138
|
|
|
146
|
-
static empty():
|
|
147
|
-
return new
|
|
139
|
+
static empty(): FinalBlobAccumulator {
|
|
140
|
+
return new FinalBlobAccumulator(Fr.ZERO, Fr.ZERO, BLS12Fr.ZERO, BLS12Point.ZERO);
|
|
148
141
|
}
|
|
149
142
|
|
|
150
|
-
static fromBuffer(buffer: Buffer | BufferReader):
|
|
143
|
+
static fromBuffer(buffer: Buffer | BufferReader): FinalBlobAccumulator {
|
|
151
144
|
const reader = BufferReader.asReader(buffer);
|
|
152
|
-
return new
|
|
145
|
+
return new FinalBlobAccumulator(
|
|
153
146
|
Fr.fromBuffer(reader),
|
|
154
147
|
Fr.fromBuffer(reader),
|
|
155
148
|
BLS12Fr.fromBuffer(reader),
|
|
@@ -162,7 +155,7 @@ export class FinalBlobAccumulatorPublicInputs {
|
|
|
162
155
|
}
|
|
163
156
|
|
|
164
157
|
static fromBatchedBlob(blob: BatchedBlob) {
|
|
165
|
-
return new
|
|
158
|
+
return new FinalBlobAccumulator(blob.blobCommitmentsHash, blob.z, blob.y, blob.commitment);
|
|
166
159
|
}
|
|
167
160
|
|
|
168
161
|
toFields() {
|
|
@@ -183,7 +176,7 @@ export class FinalBlobAccumulatorPublicInputs {
|
|
|
183
176
|
return buf.toString('hex');
|
|
184
177
|
}
|
|
185
178
|
|
|
186
|
-
equals(other:
|
|
179
|
+
equals(other: FinalBlobAccumulator) {
|
|
187
180
|
return (
|
|
188
181
|
this.blobCommitmentsHash.equals(other.blobCommitmentsHash) &&
|
|
189
182
|
this.z.equals(other.z) &&
|
|
@@ -194,12 +187,12 @@ export class FinalBlobAccumulatorPublicInputs {
|
|
|
194
187
|
|
|
195
188
|
// Creates a random instance. Used for testing only - will not prove/verify.
|
|
196
189
|
static random() {
|
|
197
|
-
return new
|
|
190
|
+
return new FinalBlobAccumulator(Fr.random(), Fr.random(), BLS12Fr.random(), BLS12Point.random());
|
|
198
191
|
}
|
|
199
192
|
|
|
200
193
|
// Warning: MUST be final accumulator state.
|
|
201
194
|
static fromBatchedBlobAccumulator(accumulator: BatchedBlobAccumulator) {
|
|
202
|
-
return new
|
|
195
|
+
return new FinalBlobAccumulator(
|
|
203
196
|
accumulator.blobCommitmentsHashAcc,
|
|
204
197
|
accumulator.zAcc,
|
|
205
198
|
accumulator.yAcc,
|
|
@@ -208,7 +201,7 @@ export class FinalBlobAccumulatorPublicInputs {
|
|
|
208
201
|
}
|
|
209
202
|
|
|
210
203
|
[inspect.custom]() {
|
|
211
|
-
return `
|
|
204
|
+
return `FinalBlobAccumulator {
|
|
212
205
|
blobCommitmentsHash: ${inspect(this.blobCommitmentsHash)},
|
|
213
206
|
z: ${inspect(this.z)},
|
|
214
207
|
y: ${inspect(this.y)},
|