@aztec/stdlib 3.0.0-nightly.20251002 → 3.0.0-nightly.20251003
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/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -3
- package/dest/messaging/l2_to_l1_membership.d.ts +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +16 -18
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +5 -5
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +4 -4
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +2 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts +4 -4
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +3 -3
- package/dest/tests/factories.js +3 -3
- package/package.json +8 -8
- package/src/hash/hash.ts +0 -4
- package/src/messaging/l2_to_l1_membership.ts +20 -26
- package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +3 -3
- package/src/rollup/root_rollup_public_inputs.ts +4 -4
- package/src/tests/factories.ts +4 -4
package/dest/hash/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;GAIG;AACH,wBAAsB,MAA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AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAEzD;AAED,wBAAsB,6BAA6B,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAMtG;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,OAAO,EACP,aAAa,EACb,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,EAAE,EAAE,CAAC;IACZ,aAAa,EAAE,EAAE,CAAC;IAClB,OAAO,EAAE,EAAE,CAAC;CACb,MAEA"}
|
package/dest/hash/hash.js
CHANGED
|
@@ -103,9 +103,6 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
103
103
|
* @param calldata - Calldata to hash.
|
|
104
104
|
* @returns Hash of the calldata.
|
|
105
105
|
*/ export function computeCalldataHash(calldata) {
|
|
106
|
-
if (calldata.length === 0) {
|
|
107
|
-
return Promise.resolve(Fr.ZERO);
|
|
108
|
-
}
|
|
109
106
|
return poseidon2HashWithSeparator(calldata, GeneratorIndex.PUBLIC_CALLDATA);
|
|
110
107
|
}
|
|
111
108
|
/**
|
|
@@ -9,6 +9,6 @@ export type L2ToL1MembershipWitness = {
|
|
|
9
9
|
siblingPath: SiblingPath<number>;
|
|
10
10
|
};
|
|
11
11
|
export declare function computeL2ToL1MembershipWitness(messageRetriever: MessageRetrieval, l2BlockNumber: number, message: Fr): Promise<L2ToL1MembershipWitness | undefined>;
|
|
12
|
-
export declare function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs: Fr[][], message: Fr):
|
|
12
|
+
export declare function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs: Fr[][], message: Fr): L2ToL1MembershipWitness;
|
|
13
13
|
export declare function getL2ToL1MessageLeafId(membershipWitness: Pick<L2ToL1MembershipWitness, 'leafIndex' | 'siblingPath'>): bigint;
|
|
14
14
|
//# sourceMappingURL=l2_to_l1_membership.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAmE,MAAM,yBAAyB,CAAC;AAEvH,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC;CACvE;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,EAAE,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAO9C;AAID,wBAAgB,mDAAmD,CACjE,iBAAiB,EAAE,EAAE,EAAE,EAAE,EACzB,OAAO,EAAE,EAAE,GACV,uBAAuB,CA4DzB;AAED,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5E,MAAM,CAER"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedMerkleTreeRoot
|
|
3
|
-
async function createOutHashTree(messages) {
|
|
4
|
-
const messageSubtreeHeight = getMaxUnbalancedTreeDepth(messages.length);
|
|
5
|
-
const calculator = UnbalancedMerkleTreeCalculator.create(messageSubtreeHeight);
|
|
6
|
-
await calculator.appendLeaves(messages.map((msg)=>msg.toBuffer()));
|
|
7
|
-
return calculator;
|
|
8
|
-
}
|
|
2
|
+
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedMerkleTreeRoot } from '@aztec/foundation/trees';
|
|
9
3
|
export async function computeL2ToL1MembershipWitness(messageRetriever, l2BlockNumber, message) {
|
|
10
4
|
const messagesForAllTxs = await messageRetriever.getL2ToL1Messages(l2BlockNumber);
|
|
11
5
|
if (!messagesForAllTxs) {
|
|
@@ -13,7 +7,9 @@ export async function computeL2ToL1MembershipWitness(messageRetriever, l2BlockNu
|
|
|
13
7
|
}
|
|
14
8
|
return computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs, message);
|
|
15
9
|
}
|
|
16
|
-
|
|
10
|
+
// TODO: Allow to specify the message to consume by its index or by an offset, in case there are multiple messages with
|
|
11
|
+
// the same value.
|
|
12
|
+
export function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs, message) {
|
|
17
13
|
// Find index of message in subtree and index of tx in a block.
|
|
18
14
|
let messageIndexInTx = -1;
|
|
19
15
|
const txIndex = messagesForAllTxs.findIndex((messages)=>{
|
|
@@ -25,9 +21,9 @@ export async function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messag
|
|
|
25
21
|
}
|
|
26
22
|
// Get the txOutHash and the sibling path of the message in the tx subtree.
|
|
27
23
|
const txMessages = messagesForAllTxs[txIndex];
|
|
28
|
-
const txOutHashTree =
|
|
24
|
+
const txOutHashTree = UnbalancedMerkleTreeCalculator.create(txMessages.map((msg)=>msg.toBuffer()));
|
|
29
25
|
const txOutHash = txOutHashTree.getRoot();
|
|
30
|
-
const messagePathInSubtree =
|
|
26
|
+
const messagePathInSubtree = txOutHashTree.getSiblingPath(message.toBuffer());
|
|
31
27
|
// Calculate txOutHash for all txs.
|
|
32
28
|
const txSubtreeRoots = messagesForAllTxs.map((messages, i)=>{
|
|
33
29
|
// For a tx with no messages, we have to set an out hash of 0 to match what the circuit does.
|
|
@@ -41,19 +37,21 @@ export async function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messag
|
|
|
41
37
|
return Fr.fromBuffer(root);
|
|
42
38
|
});
|
|
43
39
|
// Construct the top tree.
|
|
44
|
-
// The leaves of this tree are the txOutHashes
|
|
45
|
-
// The root of this tree
|
|
46
|
-
|
|
40
|
+
// The leaves of this tree are the `txOutHashes`.
|
|
41
|
+
// The root of this tree should match the `out_hash` calculated in the circuits. Zero hashes are compressed to reduce
|
|
42
|
+
// cost if the non-zero leaves result in a shorter path.
|
|
43
|
+
const valueToCompress = Buffer.alloc(32);
|
|
44
|
+
const topTree = UnbalancedMerkleTreeCalculator.create(txSubtreeRoots.map((root)=>root.toBuffer()), valueToCompress);
|
|
47
45
|
const root = Fr.fromBuffer(topTree.getRoot());
|
|
48
46
|
// Compute the combined sibling path by appending the tx subtree path to the top tree path.
|
|
49
|
-
const txPathInTopTree =
|
|
47
|
+
const txPathInTopTree = topTree.getSiblingPath(txOutHash);
|
|
50
48
|
const combinedPath = messagePathInSubtree.toBufferArray().concat(txPathInTopTree.toBufferArray());
|
|
51
49
|
// Compute the combined index.
|
|
52
50
|
// It is the index of the message in the balanced tree at its current height.
|
|
53
|
-
const
|
|
54
|
-
const messageLeafPosition =
|
|
55
|
-
const numLeavesInLeftSubtrees =
|
|
56
|
-
const combinedIndex = numLeavesInLeftSubtrees + messageLeafPosition.
|
|
51
|
+
const txLeafIndexAtLevel = topTree.getLeafLocation(txIndex).index;
|
|
52
|
+
const messageLeafPosition = txOutHashTree.getLeafLocation(messageIndexInTx);
|
|
53
|
+
const numLeavesInLeftSubtrees = txLeafIndexAtLevel * (1 << messageLeafPosition.level);
|
|
54
|
+
const combinedIndex = numLeavesInLeftSubtrees + messageLeafPosition.index;
|
|
57
55
|
return {
|
|
58
56
|
root,
|
|
59
57
|
leafIndex: BigInt(combinedIndex),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -33,11 +33,11 @@ export declare class CheckpointRollupPublicInputs {
|
|
|
33
33
|
/**
|
|
34
34
|
* Accumulated opening proofs for all blobs before this checkpoint range.
|
|
35
35
|
*/
|
|
36
|
-
startBlobAccumulator:
|
|
36
|
+
startBlobAccumulator: BlobAccumulator;
|
|
37
37
|
/**
|
|
38
38
|
* Accumulated opening proofs for all blobs after applying this checkpoint range.
|
|
39
39
|
*/
|
|
40
|
-
endBlobAccumulator:
|
|
40
|
+
endBlobAccumulator: BlobAccumulator;
|
|
41
41
|
/**
|
|
42
42
|
* Final values z and gamma, shared across the epoch.
|
|
43
43
|
*/
|
|
@@ -66,11 +66,11 @@ export declare class CheckpointRollupPublicInputs {
|
|
|
66
66
|
/**
|
|
67
67
|
* Accumulated opening proofs for all blobs before this checkpoint range.
|
|
68
68
|
*/
|
|
69
|
-
startBlobAccumulator:
|
|
69
|
+
startBlobAccumulator: BlobAccumulator,
|
|
70
70
|
/**
|
|
71
71
|
* Accumulated opening proofs for all blobs after applying this checkpoint range.
|
|
72
72
|
*/
|
|
73
|
-
endBlobAccumulator:
|
|
73
|
+
endBlobAccumulator: BlobAccumulator,
|
|
74
74
|
/**
|
|
75
75
|
* Final values z and gamma, shared across the epoch.
|
|
76
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint_rollup_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/checkpoint_rollup_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"checkpoint_rollup_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/checkpoint_rollup_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAwC,MAAM,6BAA6B,CAAC;AAE7G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;GAEG;AACH,qBAAa,4BAA4B;IAErC;;OAEG;IACI,SAAS,EAAE,iBAAiB;IACnC;;OAEG;IACI,eAAe,EAAE,sBAAsB;IAC9C;;OAEG;IACI,UAAU,EAAE,sBAAsB;IACzC;;OAEG;IACI,sBAAsB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IACzE;;OAEG;IACI,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC;IACjE;;OAEG;IACI,oBAAoB,EAAE,eAAe;IAC5C;;OAEG;IACI,kBAAkB,EAAE,eAAe;IAC1C;;OAEG;IACI,mBAAmB,EAAE,2BAA2B;;IA/BvD;;OAEG;IACI,SAAS,EAAE,iBAAiB;IACnC;;OAEG;IACI,eAAe,EAAE,sBAAsB;IAC9C;;OAEG;IACI,UAAU,EAAE,sBAAsB;IACzC;;OAEG;IACI,sBAAsB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IACzE;;OAEG;IACI,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC;IACjE;;OAEG;IACI,oBAAoB,EAAE,eAAe;IAC5C;;OAEG;IACI,kBAAkB,EAAE,eAAe;IAC1C;;OAEG;IACI,mBAAmB,EAAE,2BAA2B;IAGzD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAc/C,QAAQ;IAaR,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,8DAA8D;IAC9D,MAAM;IAIN,6CAA6C;IAC7C,MAAM,KAAK,MAAM,qEAEhB;CACF;AAED,qBAAa,YAAY;IAEd,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,EAAE;gBADT,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,EAAE;IAGlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY;IAK9D,QAAQ;IAIR,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;IAI/C,QAAQ;IAIR,OAAO;IAIP,cAAc;;;;;;;IAOd,MAAM,CAAC,MAAM;CAGd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -46,7 +46,7 @@ import { EpochConstantData } from './epoch_constant_data.js';
|
|
|
46
46
|
}
|
|
47
47
|
static fromBuffer(buffer) {
|
|
48
48
|
const reader = BufferReader.asReader(buffer);
|
|
49
|
-
return new CheckpointRollupPublicInputs(reader.readObject(EpochConstantData), reader.readObject(AppendOnlyTreeSnapshot), reader.readObject(AppendOnlyTreeSnapshot), reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr), reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient), reader.readObject(
|
|
49
|
+
return new CheckpointRollupPublicInputs(reader.readObject(EpochConstantData), reader.readObject(AppendOnlyTreeSnapshot), reader.readObject(AppendOnlyTreeSnapshot), reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr), reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient), reader.readObject(BlobAccumulator), reader.readObject(BlobAccumulator), reader.readObject(FinalBlobBatchingChallenges));
|
|
50
50
|
}
|
|
51
51
|
toBuffer() {
|
|
52
52
|
return serializeToBuffer(this.constants, this.previousArchive, this.newArchive, this.checkpointHeaderHashes, this.fees, this.startBlobAccumulator, this.endBlobAccumulator, this.finalBlobChallenges);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK } from '@aztec/constants';
|
|
3
3
|
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
|
|
@@ -18,7 +18,7 @@ export declare class CheckpointRootRollupHints {
|
|
|
18
18
|
/**
|
|
19
19
|
* The current blob accumulation state across the epoch.
|
|
20
20
|
*/
|
|
21
|
-
startBlobAccumulator:
|
|
21
|
+
startBlobAccumulator: BlobAccumulator;
|
|
22
22
|
/**
|
|
23
23
|
* Finalized challenges z and gamma for performing blob batching. Shared value across the epoch.
|
|
24
24
|
*/
|
|
@@ -50,7 +50,7 @@ export declare class CheckpointRootRollupHints {
|
|
|
50
50
|
/**
|
|
51
51
|
* The current blob accumulation state across the epoch.
|
|
52
52
|
*/
|
|
53
|
-
startBlobAccumulator:
|
|
53
|
+
startBlobAccumulator: BlobAccumulator,
|
|
54
54
|
/**
|
|
55
55
|
* Finalized challenges z and gamma for performing blob batching. Shared value across the epoch.
|
|
56
56
|
*/
|
|
@@ -71,7 +71,7 @@ export declare class CheckpointRootRollupHints {
|
|
|
71
71
|
*/
|
|
72
72
|
blobsHash: Fr);
|
|
73
73
|
static from(fields: FieldsOf<CheckpointRootRollupHints>): CheckpointRootRollupHints;
|
|
74
|
-
static getFields(fields: FieldsOf<CheckpointRootRollupHints>): readonly [BlockHeader, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr],
|
|
74
|
+
static getFields(fields: FieldsOf<CheckpointRootRollupHints>): readonly [BlockHeader, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], BlobAccumulator, FinalBlobBatchingChallenges, Fr[], [BLS12Point, BLS12Point, BLS12Point], Fr];
|
|
75
75
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
76
76
|
static fromBuffer(buffer: Buffer | BufferReader): CheckpointRootRollupHints;
|
|
77
77
|
toString(): `0x${string}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint_root_rollup_private_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/checkpoint_root_rollup_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"checkpoint_root_rollup_private_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/checkpoint_root_rollup_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AACpF,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;IAIN,MAAM,KAAK,MAAM,qFAEhB;CACF;AAGD,qBAAa,oCAAoC;;IAG/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAIhD,QAAQ,IAAI,KAAK,MAAM,EAAE;IAIzB,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM;IAI9B,MAAM;IAIN,MAAM,KAAK,MAAM,6EAEhB;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
3
3
|
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
@@ -60,7 +60,7 @@ export class CheckpointRootRollupHints {
|
|
|
60
60
|
}
|
|
61
61
|
static fromBuffer(buffer) {
|
|
62
62
|
const reader = BufferReader.asReader(buffer);
|
|
63
|
-
return new CheckpointRootRollupHints(BlockHeader.fromBuffer(reader), reader.readArray(ARCHIVE_HEIGHT, Fr), reader.readObject(
|
|
63
|
+
return new CheckpointRootRollupHints(BlockHeader.fromBuffer(reader), reader.readArray(ARCHIVE_HEIGHT, Fr), reader.readObject(BlobAccumulator), reader.readObject(FinalBlobBatchingChallenges), // Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
|
|
64
64
|
// reader.readArray(FIELDS_PER_BLOB, Fr),
|
|
65
65
|
Array.from({
|
|
66
66
|
length: FIELDS_PER_BLOB * BLOBS_PER_BLOCK
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FinalBlobAccumulator } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
|
|
@@ -18,13 +18,13 @@ export declare class RootRollupPublicInputs {
|
|
|
18
18
|
checkpointHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>;
|
|
19
19
|
fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>;
|
|
20
20
|
constants: EpochConstantData;
|
|
21
|
-
blobPublicInputs:
|
|
21
|
+
blobPublicInputs: FinalBlobAccumulator;
|
|
22
22
|
constructor(
|
|
23
23
|
/** Root of the archive tree before this rollup is processed */
|
|
24
24
|
previousArchiveRoot: Fr,
|
|
25
25
|
/** Root of the archive tree after this rollup is processed */
|
|
26
|
-
endArchiveRoot: Fr, checkpointHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>, fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>, constants: EpochConstantData, blobPublicInputs:
|
|
27
|
-
static getFields(fields: FieldsOf<RootRollupPublicInputs>): readonly [Fr, Fr, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], [FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient], EpochConstantData,
|
|
26
|
+
endArchiveRoot: Fr, checkpointHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>, fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>, constants: EpochConstantData, blobPublicInputs: FinalBlobAccumulator);
|
|
27
|
+
static getFields(fields: FieldsOf<RootRollupPublicInputs>): readonly [Fr, Fr, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], [FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient, FeeRecipient], EpochConstantData, FinalBlobAccumulator];
|
|
28
28
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
29
29
|
toFields(): Fr[];
|
|
30
30
|
static from(fields: FieldsOf<RootRollupPublicInputs>): RootRollupPublicInputs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root_rollup_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/root_rollup_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"root_rollup_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/root_rollup_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAwC,MAAM,6BAA6B,CAAC;AAE7G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,sBAAsB;IAE/B,+DAA+D;IACxD,mBAAmB,EAAE,EAAE;IAC9B,8DAA8D;IACvD,cAAc,EAAE,EAAE;IAClB,sBAAsB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IAClE,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC;IAC1D,SAAS,EAAE,iBAAiB;IAC5B,gBAAgB,EAAE,oBAAoB;;IAP7C,+DAA+D;IACxD,mBAAmB,EAAE,EAAE;IAC9B,8DAA8D;IACvD,cAAc,EAAE,EAAE,EAClB,sBAAsB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC,EAClE,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC,EAC1D,SAAS,EAAE,iBAAiB,EAC5B,gBAAgB,EAAE,oBAAoB;IAG/C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAWzD,QAAQ;IAIR,QAAQ,IAAI,EAAE,EAAE;IAIhB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GAAG,sBAAsB;IAI7E;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,sBAAsB;IAY/E,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,uDAAuD;IACvD,MAAM;IAIN,yCAAyC;IACzC,MAAM,KAAK,MAAM,+DAEhB;IAED,gFAAgF;IAChF,MAAM,CAAC,MAAM;CAUd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FinalBlobAccumulator } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -51,7 +51,7 @@ import { EpochConstantData } from './epoch_constant_data.js';
|
|
|
51
51
|
* @returns The deserialized `RootRollupPublicInputs` object.
|
|
52
52
|
*/ static fromBuffer(buffer) {
|
|
53
53
|
const reader = BufferReader.asReader(buffer);
|
|
54
|
-
return new RootRollupPublicInputs(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr), reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient), EpochConstantData.fromBuffer(reader), reader.readObject(
|
|
54
|
+
return new RootRollupPublicInputs(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr), reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient), EpochConstantData.fromBuffer(reader), reader.readObject(FinalBlobAccumulator));
|
|
55
55
|
}
|
|
56
56
|
toString() {
|
|
57
57
|
return bufferToHex(this.toBuffer());
|
|
@@ -66,6 +66,6 @@ import { EpochConstantData } from './epoch_constant_data.js';
|
|
|
66
66
|
return bufferSchemaFor(RootRollupPublicInputs);
|
|
67
67
|
}
|
|
68
68
|
/** Creates a random instance. Used for testing only - will not prove/verify. */ static random() {
|
|
69
|
-
return new RootRollupPublicInputs(Fr.random(), Fr.random(), makeTuple(AZTEC_MAX_EPOCH_DURATION, Fr.random), makeTuple(AZTEC_MAX_EPOCH_DURATION, FeeRecipient.random), new EpochConstantData(Fr.random(), Fr.random(), Fr.random(), Fr.random(), Fr.random()),
|
|
69
|
+
return new RootRollupPublicInputs(Fr.random(), Fr.random(), makeTuple(AZTEC_MAX_EPOCH_DURATION, Fr.random), makeTuple(AZTEC_MAX_EPOCH_DURATION, FeeRecipient.random), new EpochConstantData(Fr.random(), Fr.random(), Fr.random(), Fr.random(), Fr.random()), FinalBlobAccumulator.random());
|
|
70
70
|
}
|
|
71
71
|
}
|
package/dest/tests/factories.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobAccumulator } from '@aztec/blob-lib';
|
|
2
2
|
import { makeBatchedBlobAccumulator, makeSpongeBlob } from '@aztec/blob-lib/testing';
|
|
3
3
|
import { ARCHIVE_HEIGHT, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, AZTEC_MAX_EPOCH_DURATION, CIVC_PROOF_LENGTH, CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, FIXED_DA_GAS, FIXED_L2_GAS, GeneratorIndex, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_CALL, MAX_ENQUEUED_CALLS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, MAX_PRIVATE_LOGS_PER_TX, MAX_PROTOCOL_CONTRACTS, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_BASE_PARITY_PER_ROOT_PARITY, NUM_MSGS_PER_BASE_PARITY, PRIVATE_LOG_SIZE_IN_FIELDS, PUBLIC_DATA_TREE_HEIGHT, RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
4
4
|
import { makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
|
|
@@ -428,7 +428,7 @@ function makeEpochConstantData(seed = 1) {
|
|
|
428
428
|
}
|
|
429
429
|
export function makeCheckpointRollupPublicInputs(seed = 0) {
|
|
430
430
|
const startBlobAccumulator = makeBatchedBlobAccumulator(seed);
|
|
431
|
-
return new CheckpointRollupPublicInputs(makeEpochConstantData(seed), makeAppendOnlyTreeSnapshot(seed + 0x100), makeAppendOnlyTreeSnapshot(seed + 0x200), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>fr(seed), 0x300), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>makeFeeRecipient(seed), 0x700),
|
|
431
|
+
return new CheckpointRollupPublicInputs(makeEpochConstantData(seed), makeAppendOnlyTreeSnapshot(seed + 0x100), makeAppendOnlyTreeSnapshot(seed + 0x200), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>fr(seed), 0x300), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>makeFeeRecipient(seed), 0x700), BlobAccumulator.fromBatchedBlobAccumulator(startBlobAccumulator), BlobAccumulator.fromBatchedBlobAccumulator(makeBatchedBlobAccumulator(seed + 1)), startBlobAccumulator.finalBlobChallenges);
|
|
432
432
|
}
|
|
433
433
|
export function makeParityPublicInputs(seed = 0) {
|
|
434
434
|
return new ParityPublicInputs(new Fr(BigInt(seed + 0x200)), new Fr(BigInt(seed + 0x300)), new Fr(BigInt(seed + 0x400)));
|
|
@@ -445,7 +445,7 @@ export function makeParityRootPrivateInputs(seed = 0) {
|
|
|
445
445
|
* @param blockNumber - The block number to use in the global variables of a header.
|
|
446
446
|
* @returns A root rollup public inputs.
|
|
447
447
|
*/ export function makeRootRollupPublicInputs(seed = 0) {
|
|
448
|
-
return new RootRollupPublicInputs(fr(seed + 0x100), fr(seed + 0x200), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>fr(seed), 0x300), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>makeFeeRecipient(seed), 0x500), makeEpochConstantData(seed + 0x600),
|
|
448
|
+
return new RootRollupPublicInputs(fr(seed + 0x100), fr(seed + 0x200), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>fr(seed), 0x300), makeTuple(AZTEC_MAX_EPOCH_DURATION, ()=>makeFeeRecipient(seed), 0x500), makeEpochConstantData(seed + 0x600), FinalBlobAccumulator.fromBatchedBlobAccumulator(makeBatchedBlobAccumulator(seed)));
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
451
451
|
* Makes content commitment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251003",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
73
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
74
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
75
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
76
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
77
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
78
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
73
|
+
"@aztec/bb.js": "3.0.0-nightly.20251003",
|
|
74
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251003",
|
|
75
|
+
"@aztec/constants": "3.0.0-nightly.20251003",
|
|
76
|
+
"@aztec/ethereum": "3.0.0-nightly.20251003",
|
|
77
|
+
"@aztec/foundation": "3.0.0-nightly.20251003",
|
|
78
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251003",
|
|
79
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251003",
|
|
80
80
|
"@google-cloud/storage": "^7.15.0",
|
|
81
81
|
"axios": "^1.9.0",
|
|
82
82
|
"json-stringify-deterministic": "1.0.12",
|
package/src/hash/hash.ts
CHANGED
|
@@ -109,10 +109,6 @@ export function computeVarArgsHash(args: Fr[]): Promise<Fr> {
|
|
|
109
109
|
* @returns Hash of the calldata.
|
|
110
110
|
*/
|
|
111
111
|
export function computeCalldataHash(calldata: Fr[]): Promise<Fr> {
|
|
112
|
-
if (calldata.length === 0) {
|
|
113
|
-
return Promise.resolve(Fr.ZERO);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
112
|
return poseidon2HashWithSeparator(calldata, GeneratorIndex.PUBLIC_CALLDATA);
|
|
117
113
|
}
|
|
118
114
|
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import {
|
|
3
|
-
SiblingPath,
|
|
4
|
-
UnbalancedMerkleTreeCalculator,
|
|
5
|
-
computeUnbalancedMerkleTreeRoot,
|
|
6
|
-
findLeafLevelAndIndex,
|
|
7
|
-
getMaxUnbalancedTreeDepth,
|
|
8
|
-
} from '@aztec/foundation/trees';
|
|
9
|
-
|
|
10
|
-
async function createOutHashTree(messages: Fr[]) {
|
|
11
|
-
const messageSubtreeHeight = getMaxUnbalancedTreeDepth(messages.length);
|
|
12
|
-
const calculator = UnbalancedMerkleTreeCalculator.create(messageSubtreeHeight);
|
|
13
|
-
await calculator.appendLeaves(messages.map(msg => msg.toBuffer()));
|
|
14
|
-
return calculator;
|
|
15
|
-
}
|
|
2
|
+
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedMerkleTreeRoot } from '@aztec/foundation/trees';
|
|
16
3
|
|
|
17
4
|
export interface MessageRetrieval {
|
|
18
5
|
getL2ToL1Messages(l2BlockNumber: number): Promise<Fr[][] | undefined>;
|
|
@@ -37,10 +24,12 @@ export async function computeL2ToL1MembershipWitness(
|
|
|
37
24
|
return computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs, message);
|
|
38
25
|
}
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
// TODO: Allow to specify the message to consume by its index or by an offset, in case there are multiple messages with
|
|
28
|
+
// the same value.
|
|
29
|
+
export function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(
|
|
41
30
|
messagesForAllTxs: Fr[][],
|
|
42
31
|
message: Fr,
|
|
43
|
-
):
|
|
32
|
+
): L2ToL1MembershipWitness {
|
|
44
33
|
// Find index of message in subtree and index of tx in a block.
|
|
45
34
|
let messageIndexInTx = -1;
|
|
46
35
|
const txIndex = messagesForAllTxs.findIndex(messages => {
|
|
@@ -54,9 +43,9 @@ export async function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(
|
|
|
54
43
|
|
|
55
44
|
// Get the txOutHash and the sibling path of the message in the tx subtree.
|
|
56
45
|
const txMessages = messagesForAllTxs[txIndex];
|
|
57
|
-
const txOutHashTree =
|
|
46
|
+
const txOutHashTree = UnbalancedMerkleTreeCalculator.create(txMessages.map(msg => msg.toBuffer()));
|
|
58
47
|
const txOutHash = txOutHashTree.getRoot();
|
|
59
|
-
const messagePathInSubtree =
|
|
48
|
+
const messagePathInSubtree = txOutHashTree.getSiblingPath(message.toBuffer());
|
|
60
49
|
|
|
61
50
|
// Calculate txOutHash for all txs.
|
|
62
51
|
const txSubtreeRoots = messagesForAllTxs.map((messages, i) => {
|
|
@@ -74,21 +63,26 @@ export async function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(
|
|
|
74
63
|
});
|
|
75
64
|
|
|
76
65
|
// Construct the top tree.
|
|
77
|
-
// The leaves of this tree are the txOutHashes
|
|
78
|
-
// The root of this tree
|
|
79
|
-
|
|
66
|
+
// The leaves of this tree are the `txOutHashes`.
|
|
67
|
+
// The root of this tree should match the `out_hash` calculated in the circuits. Zero hashes are compressed to reduce
|
|
68
|
+
// cost if the non-zero leaves result in a shorter path.
|
|
69
|
+
const valueToCompress = Buffer.alloc(32);
|
|
70
|
+
const topTree = UnbalancedMerkleTreeCalculator.create(
|
|
71
|
+
txSubtreeRoots.map(root => root.toBuffer()),
|
|
72
|
+
valueToCompress,
|
|
73
|
+
);
|
|
80
74
|
const root = Fr.fromBuffer(topTree.getRoot());
|
|
81
75
|
|
|
82
76
|
// Compute the combined sibling path by appending the tx subtree path to the top tree path.
|
|
83
|
-
const txPathInTopTree =
|
|
77
|
+
const txPathInTopTree = topTree.getSiblingPath(txOutHash);
|
|
84
78
|
const combinedPath = messagePathInSubtree.toBufferArray().concat(txPathInTopTree.toBufferArray());
|
|
85
79
|
|
|
86
80
|
// Compute the combined index.
|
|
87
81
|
// It is the index of the message in the balanced tree at its current height.
|
|
88
|
-
const
|
|
89
|
-
const messageLeafPosition =
|
|
90
|
-
const numLeavesInLeftSubtrees =
|
|
91
|
-
const combinedIndex = numLeavesInLeftSubtrees + messageLeafPosition.
|
|
82
|
+
const txLeafIndexAtLevel = topTree.getLeafLocation(txIndex).index;
|
|
83
|
+
const messageLeafPosition = txOutHashTree.getLeafLocation(messageIndexInTx);
|
|
84
|
+
const numLeavesInLeftSubtrees = txLeafIndexAtLevel * (1 << messageLeafPosition.level);
|
|
85
|
+
const combinedIndex = numLeavesInLeftSubtrees + messageLeafPosition.index;
|
|
92
86
|
|
|
93
87
|
return {
|
|
94
88
|
root,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -38,11 +38,11 @@ export class CheckpointRollupPublicInputs {
|
|
|
38
38
|
/**
|
|
39
39
|
* Accumulated opening proofs for all blobs before this checkpoint range.
|
|
40
40
|
*/
|
|
41
|
-
public startBlobAccumulator:
|
|
41
|
+
public startBlobAccumulator: BlobAccumulator,
|
|
42
42
|
/**
|
|
43
43
|
* Accumulated opening proofs for all blobs after applying this checkpoint range.
|
|
44
44
|
*/
|
|
45
|
-
public endBlobAccumulator:
|
|
45
|
+
public endBlobAccumulator: BlobAccumulator,
|
|
46
46
|
/**
|
|
47
47
|
* Final values z and gamma, shared across the epoch.
|
|
48
48
|
*/
|
|
@@ -57,8 +57,8 @@ export class CheckpointRollupPublicInputs {
|
|
|
57
57
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
58
58
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr),
|
|
59
59
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient),
|
|
60
|
-
reader.readObject(
|
|
61
|
-
reader.readObject(
|
|
60
|
+
reader.readObject(BlobAccumulator),
|
|
61
|
+
reader.readObject(BlobAccumulator),
|
|
62
62
|
reader.readObject(FinalBlobBatchingChallenges),
|
|
63
63
|
);
|
|
64
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
3
3
|
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
@@ -23,7 +23,7 @@ export class CheckpointRootRollupHints {
|
|
|
23
23
|
/**
|
|
24
24
|
* The current blob accumulation state across the epoch.
|
|
25
25
|
*/
|
|
26
|
-
public startBlobAccumulator:
|
|
26
|
+
public startBlobAccumulator: BlobAccumulator,
|
|
27
27
|
/**
|
|
28
28
|
* Finalized challenges z and gamma for performing blob batching. Shared value across the epoch.
|
|
29
29
|
*/
|
|
@@ -70,7 +70,7 @@ export class CheckpointRootRollupHints {
|
|
|
70
70
|
return new CheckpointRootRollupHints(
|
|
71
71
|
BlockHeader.fromBuffer(reader),
|
|
72
72
|
reader.readArray(ARCHIVE_HEIGHT, Fr),
|
|
73
|
-
reader.readObject(
|
|
73
|
+
reader.readObject(BlobAccumulator),
|
|
74
74
|
reader.readObject(FinalBlobBatchingChallenges),
|
|
75
75
|
// Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
|
|
76
76
|
// reader.readArray(FIELDS_PER_BLOB, Fr),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FinalBlobAccumulator } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -24,7 +24,7 @@ export class RootRollupPublicInputs {
|
|
|
24
24
|
public checkpointHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
25
25
|
public fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
26
26
|
public constants: EpochConstantData,
|
|
27
|
-
public blobPublicInputs:
|
|
27
|
+
public blobPublicInputs: FinalBlobAccumulator,
|
|
28
28
|
) {}
|
|
29
29
|
|
|
30
30
|
static getFields(fields: FieldsOf<RootRollupPublicInputs>) {
|
|
@@ -63,7 +63,7 @@ export class RootRollupPublicInputs {
|
|
|
63
63
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr),
|
|
64
64
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient),
|
|
65
65
|
EpochConstantData.fromBuffer(reader),
|
|
66
|
-
reader.readObject(
|
|
66
|
+
reader.readObject(FinalBlobAccumulator),
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -93,7 +93,7 @@ export class RootRollupPublicInputs {
|
|
|
93
93
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, Fr.random),
|
|
94
94
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, FeeRecipient.random),
|
|
95
95
|
new EpochConstantData(Fr.random(), Fr.random(), Fr.random(), Fr.random(), Fr.random()),
|
|
96
|
-
|
|
96
|
+
FinalBlobAccumulator.random(),
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
}
|
package/src/tests/factories.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulator, FinalBlobAccumulator } from '@aztec/blob-lib';
|
|
2
2
|
import { makeBatchedBlobAccumulator, makeSpongeBlob } from '@aztec/blob-lib/testing';
|
|
3
3
|
import {
|
|
4
4
|
ARCHIVE_HEIGHT,
|
|
@@ -753,8 +753,8 @@ export function makeCheckpointRollupPublicInputs(seed = 0) {
|
|
|
753
753
|
makeAppendOnlyTreeSnapshot(seed + 0x200),
|
|
754
754
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => fr(seed), 0x300),
|
|
755
755
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x700),
|
|
756
|
-
|
|
757
|
-
|
|
756
|
+
BlobAccumulator.fromBatchedBlobAccumulator(startBlobAccumulator),
|
|
757
|
+
BlobAccumulator.fromBatchedBlobAccumulator(makeBatchedBlobAccumulator(seed + 1)),
|
|
758
758
|
startBlobAccumulator.finalBlobChallenges,
|
|
759
759
|
);
|
|
760
760
|
}
|
|
@@ -790,7 +790,7 @@ export function makeRootRollupPublicInputs(seed = 0): RootRollupPublicInputs {
|
|
|
790
790
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => fr(seed), 0x300),
|
|
791
791
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x500),
|
|
792
792
|
makeEpochConstantData(seed + 0x600),
|
|
793
|
-
|
|
793
|
+
FinalBlobAccumulator.fromBatchedBlobAccumulator(makeBatchedBlobAccumulator(seed)),
|
|
794
794
|
);
|
|
795
795
|
}
|
|
796
796
|
|