@aztec/blob-lib 3.0.0-nightly.20251126 → 3.0.0-nightly.20251128
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/batched_blob.d.ts +25 -0
- package/dest/batched_blob.d.ts.map +1 -0
- package/dest/batched_blob.js +20 -0
- package/dest/blob.d.ts +4 -10
- package/dest/blob.d.ts.map +1 -1
- package/dest/blob_batching.d.ts +30 -80
- package/dest/blob_batching.d.ts.map +1 -1
- package/dest/blob_batching.js +46 -87
- package/dest/blob_utils.d.ts +14 -1
- package/dest/blob_utils.d.ts.map +1 -1
- package/dest/blob_utils.js +21 -1
- package/dest/circuit_types/blob_accumulator.d.ts +2 -1
- package/dest/circuit_types/blob_accumulator.d.ts.map +1 -1
- package/dest/circuit_types/blob_accumulator.js +3 -0
- package/dest/circuit_types/final_blob_accumulator.d.ts +1 -1
- package/dest/circuit_types/final_blob_accumulator.d.ts.map +1 -1
- package/dest/circuit_types/final_blob_batching_challenges.d.ts +1 -1
- package/dest/circuit_types/final_blob_batching_challenges.d.ts.map +1 -1
- package/dest/circuit_types/index.d.ts +1 -1
- package/dest/encoding/block_blob_data.d.ts +1 -1
- package/dest/encoding/block_end_marker.d.ts +1 -1
- package/dest/encoding/block_end_state_field.d.ts +1 -1
- package/dest/encoding/checkpoint_blob_data.d.ts +1 -1
- package/dest/encoding/checkpoint_end_marker.d.ts +1 -1
- package/dest/encoding/fixtures.d.ts +1 -1
- package/dest/encoding/index.d.ts +2 -1
- package/dest/encoding/index.d.ts.map +1 -1
- package/dest/encoding/index.js +1 -0
- package/dest/encoding/tx_blob_data.d.ts +1 -1
- package/dest/encoding/tx_start_marker.d.ts +1 -1
- package/dest/errors.d.ts +1 -1
- package/dest/errors.d.ts.map +1 -1
- package/dest/hash.d.ts +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/interface.d.ts +1 -1
- package/dest/kzg_context.d.ts +1 -1
- package/dest/sponge_blob.d.ts +1 -3
- package/dest/sponge_blob.d.ts.map +1 -1
- package/dest/testing.d.ts +7 -3
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +34 -5
- package/dest/types.d.ts +2 -1
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +1 -0
- package/package.json +7 -6
- package/src/batched_blob.ts +25 -0
- package/src/blob_batching.ts +58 -105
- package/src/blob_utils.ts +24 -1
- package/src/circuit_types/blob_accumulator.ts +11 -0
- package/src/encoding/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/testing.ts +48 -12
- package/src/types.ts +1 -0
package/src/testing.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { makeTuple } from '@aztec/foundation/array';
|
|
2
|
-
import { BLS12Fr, BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { BLS12Fq, BLS12Fr, BLS12Point, BLSPointNotOnCurveError, Fr } from '@aztec/foundation/fields';
|
|
3
3
|
|
|
4
4
|
import { Blob } from './blob.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { BlobAccumulator } from './circuit_types/blob_accumulator.js';
|
|
6
|
+
import { FinalBlobAccumulator } from './circuit_types/final_blob_accumulator.js';
|
|
7
|
+
import { FinalBlobBatchingChallenges } from './circuit_types/final_blob_batching_challenges.js';
|
|
7
8
|
import { Poseidon2Sponge, SpongeBlob } from './sponge_blob.js';
|
|
8
9
|
|
|
9
10
|
export * from './encoding/fixtures.js';
|
|
@@ -26,25 +27,60 @@ export function makeSpongeBlob(seed = 1): SpongeBlob {
|
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Makes an arbitrary but valid BLS12 point. The value is deterministic for a given seed.
|
|
32
|
+
* @param seed - The seed to use for generating the point.
|
|
33
|
+
* @returns A BLS12 point instance.
|
|
34
|
+
*/
|
|
35
|
+
function makeBLS12Point(seed = 1): BLS12Point {
|
|
36
|
+
let accum = 0;
|
|
37
|
+
while (true) {
|
|
38
|
+
try {
|
|
39
|
+
const x = new BLS12Fq(seed + accum);
|
|
40
|
+
const y = BLS12Point.YFromX(x);
|
|
41
|
+
if (y) {
|
|
42
|
+
return new BLS12Point(x, y, false);
|
|
43
|
+
}
|
|
44
|
+
accum++;
|
|
45
|
+
} catch (e: any) {
|
|
46
|
+
if (!(e instanceof BLSPointNotOnCurveError)) {
|
|
47
|
+
throw e;
|
|
48
|
+
}
|
|
49
|
+
// The point is not on the curve - try again
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
29
54
|
/**
|
|
30
55
|
* Makes arbitrary blob public accumulator.
|
|
31
56
|
* Note: will not verify inside the circuit.
|
|
32
57
|
* @param seed - The seed to use for generating the blob accumulator.
|
|
33
58
|
* @returns A blob accumulator instance.
|
|
34
59
|
*/
|
|
35
|
-
export function
|
|
36
|
-
return new
|
|
60
|
+
export function makeBlobAccumulator(seed = 1): BlobAccumulator {
|
|
61
|
+
return new BlobAccumulator(
|
|
62
|
+
new Fr(seed),
|
|
63
|
+
new Fr(seed + 0x10),
|
|
64
|
+
new BLS12Fr(seed + 0x20),
|
|
65
|
+
makeBLS12Point(seed + 0x30),
|
|
66
|
+
new Fr(seed + 0x50),
|
|
67
|
+
new BLS12Fr(seed + 0x60),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function makeFinalBlobAccumulator(seed = 1) {
|
|
72
|
+
return new FinalBlobAccumulator(
|
|
37
73
|
new Fr(seed),
|
|
38
|
-
new Fr(seed +
|
|
39
|
-
new BLS12Fr(seed +
|
|
40
|
-
|
|
41
|
-
BLS12Point.random(),
|
|
42
|
-
new Fr(seed + 3),
|
|
43
|
-
new BLS12Fr(seed + 4),
|
|
44
|
-
new FinalBlobBatchingChallenges(new Fr(seed + 5), new BLS12Fr(seed + 6)),
|
|
74
|
+
new Fr(seed + 0x10),
|
|
75
|
+
new BLS12Fr(seed + 0x20),
|
|
76
|
+
makeBLS12Point(seed + 0x30),
|
|
45
77
|
);
|
|
46
78
|
}
|
|
47
79
|
|
|
80
|
+
export function makeFinalBlobBatchingChallenges(seed = 1) {
|
|
81
|
+
return new FinalBlobBatchingChallenges(new Fr(seed), new BLS12Fr(seed + 0x10));
|
|
82
|
+
}
|
|
83
|
+
|
|
48
84
|
/**
|
|
49
85
|
* Make a blob with random fields.
|
|
50
86
|
*
|
package/src/types.ts
CHANGED