@aztec/stdlib 0.85.0 → 0.86.0-nightly.20250426
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/block/l2_block.js +1 -1
- package/dest/interfaces/aztec-node-admin.d.ts +3 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +1 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.d.ts +4 -9
- package/dest/interfaces/prover-coordination.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.js +1 -7
- package/dest/kernel/private_kernel_data.d.ts +3 -3
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +8 -8
- package/dest/kernel/private_kernel_prover_output.d.ts +6 -2
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +17 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts +3 -3
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/p2p/block_attestation.d.ts +4 -3
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_attestation.js +4 -4
- package/dest/p2p/block_proposal.d.ts +4 -3
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +5 -5
- package/dest/p2p/consensus_payload.d.ts +1 -1
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +2 -3
- package/dest/p2p/gossipable.d.ts +2 -1
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/interface.d.ts +0 -13
- package/dest/p2p/interface.d.ts.map +1 -1
- package/dest/p2p/interface.js +1 -19
- package/dest/p2p/signature_utils.d.ts +3 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +4 -4
- package/dest/p2p/topic_type.d.ts +2 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +4 -4
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts +0 -16
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_root_or_block_merge_public_inputs.js +2 -10
- package/dest/rollup/block_root_rollup.d.ts +9 -1
- package/dest/rollup/block_root_rollup.d.ts.map +1 -1
- package/dest/rollup/block_root_rollup.js +6 -1
- package/dest/rollup/root_rollup.d.ts +2 -4
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +3 -9
- package/dest/snapshots/download.d.ts +1 -1
- package/dest/snapshots/download.d.ts.map +1 -1
- package/dest/snapshots/download.js +3 -3
- package/dest/snapshots/index.d.ts +1 -1
- package/dest/snapshots/index.d.ts.map +1 -1
- package/dest/snapshots/index.js +1 -1
- package/dest/snapshots/types.d.ts +27 -4
- package/dest/snapshots/types.d.ts.map +1 -1
- package/dest/snapshots/types.js +8 -0
- package/dest/snapshots/upload.d.ts +6 -3
- package/dest/snapshots/upload.d.ts.map +1 -1
- package/dest/snapshots/upload.js +10 -6
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +3 -3
- package/dest/tests/mocks.d.ts +2 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +6 -6
- package/dest/tx/block_header.d.ts +1 -0
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -0
- package/dest/tx/profiled_tx.d.ts.map +1 -1
- package/dest/tx/profiled_tx.js +2 -1
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +2 -6
- package/package.json +7 -8
- package/src/block/l2_block.ts +1 -1
- package/src/interfaces/aztec-node-admin.ts +1 -1
- package/src/interfaces/aztec-node.ts +1 -3
- package/src/interfaces/prover-coordination.ts +6 -16
- package/src/kernel/private_kernel_data.ts +6 -6
- package/src/kernel/private_kernel_prover_output.ts +18 -2
- package/src/kernel/private_kernel_simulated_output.ts +3 -3
- package/src/p2p/block_attestation.ts +5 -8
- package/src/p2p/block_proposal.ts +5 -8
- package/src/p2p/consensus_payload.ts +3 -9
- package/src/p2p/gossipable.ts +3 -1
- package/src/p2p/interface.ts +0 -24
- package/src/p2p/signature_utils.ts +6 -9
- package/src/p2p/topic_type.ts +4 -4
- package/src/rollup/block_root_or_block_merge_public_inputs.ts +0 -12
- package/src/rollup/block_root_rollup.ts +6 -0
- package/src/rollup/root_rollup.ts +0 -8
- package/src/snapshots/download.ts +3 -4
- package/src/snapshots/index.ts +1 -1
- package/src/snapshots/types.ts +12 -0
- package/src/snapshots/upload.ts +19 -11
- package/src/tests/factories.ts +11 -14
- package/src/tests/mocks.ts +6 -6
- package/src/tx/block_header.ts +4 -0
- package/src/tx/profiled_tx.ts +1 -0
- package/src/tx/tx.ts +2 -7
package/src/p2p/topic_type.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { P2PClientType } from './client_type.js';
|
|
|
6
6
|
* @param topicType
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export function createTopicString(topicType: TopicType) {
|
|
10
|
-
return
|
|
9
|
+
export function createTopicString(topicType: TopicType, protocolVersion: string) {
|
|
10
|
+
return `/aztec/${TopicType[topicType]}/${protocolVersion}`;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -35,10 +35,10 @@ export function getTopicTypeForClientType(clientType: P2PClientType) {
|
|
|
35
35
|
* ...
|
|
36
36
|
* }
|
|
37
37
|
*/
|
|
38
|
-
export function metricsTopicStrToLabels() {
|
|
38
|
+
export function metricsTopicStrToLabels(protocolVersion: string) {
|
|
39
39
|
const topicStrToLabel = new Map<string, string>();
|
|
40
40
|
for (const topic in TopicType) {
|
|
41
|
-
topicStrToLabel.set(createTopicString(TopicType[topic as keyof typeof TopicType]), topic);
|
|
41
|
+
topicStrToLabel.set(createTopicString(TopicType[topic as keyof typeof TopicType], protocolVersion), topic);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return topicStrToLabel;
|
|
@@ -23,14 +23,6 @@ export class BlockRootOrBlockMergePublicInputs {
|
|
|
23
23
|
* Archive tree after adding this block range.
|
|
24
24
|
*/
|
|
25
25
|
public newArchive: AppendOnlyTreeSnapshot,
|
|
26
|
-
/**
|
|
27
|
-
* Identifier of the previous block before the range.
|
|
28
|
-
*/
|
|
29
|
-
public previousBlockHash: Fr,
|
|
30
|
-
/**
|
|
31
|
-
* Identifier of the last block in the range.
|
|
32
|
-
*/
|
|
33
|
-
public endBlockHash: Fr,
|
|
34
26
|
/**
|
|
35
27
|
* Global variables for the first block in the range.
|
|
36
28
|
*/
|
|
@@ -76,8 +68,6 @@ export class BlockRootOrBlockMergePublicInputs {
|
|
|
76
68
|
return new BlockRootOrBlockMergePublicInputs(
|
|
77
69
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
78
70
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
79
|
-
Fr.fromBuffer(reader),
|
|
80
|
-
Fr.fromBuffer(reader),
|
|
81
71
|
reader.readObject(GlobalVariables),
|
|
82
72
|
reader.readObject(GlobalVariables),
|
|
83
73
|
Fr.fromBuffer(reader),
|
|
@@ -97,8 +87,6 @@ export class BlockRootOrBlockMergePublicInputs {
|
|
|
97
87
|
return serializeToBuffer(
|
|
98
88
|
this.previousArchive,
|
|
99
89
|
this.newArchive,
|
|
100
|
-
this.previousBlockHash,
|
|
101
|
-
this.endBlockHash,
|
|
102
90
|
this.startGlobalVariables,
|
|
103
91
|
this.endGlobalVariables,
|
|
104
92
|
this.outHash,
|
|
@@ -25,6 +25,10 @@ export class BlockRootRollupData {
|
|
|
25
25
|
* Hint for inserting the new l1 to l2 message subtree.
|
|
26
26
|
*/
|
|
27
27
|
public l1ToL2MessageSubtreeSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH>,
|
|
28
|
+
/**
|
|
29
|
+
* Hint for checking the hash of previous_block_header is the last leaf of the previous archive.
|
|
30
|
+
*/
|
|
31
|
+
public previousArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
28
32
|
/**
|
|
29
33
|
* Hint for inserting the new block hash to the last archive.
|
|
30
34
|
*/
|
|
@@ -73,6 +77,7 @@ export class BlockRootRollupData {
|
|
|
73
77
|
return [
|
|
74
78
|
fields.l1ToL2Roots,
|
|
75
79
|
fields.l1ToL2MessageSubtreeSiblingPath,
|
|
80
|
+
fields.previousArchiveSiblingPath,
|
|
76
81
|
fields.newArchiveSiblingPath,
|
|
77
82
|
fields.previousBlockHeader,
|
|
78
83
|
fields.proverId,
|
|
@@ -90,6 +95,7 @@ export class BlockRootRollupData {
|
|
|
90
95
|
RootParityInput.fromBuffer(reader, NESTED_RECURSIVE_PROOF_LENGTH),
|
|
91
96
|
reader.readArray(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, Fr),
|
|
92
97
|
reader.readArray(ARCHIVE_HEIGHT, Fr),
|
|
98
|
+
reader.readArray(ARCHIVE_HEIGHT, Fr),
|
|
93
99
|
BlockHeader.fromBuffer(reader),
|
|
94
100
|
Fr.fromBuffer(reader),
|
|
95
101
|
);
|
|
@@ -103,8 +103,6 @@ export class RootRollupPublicInputs {
|
|
|
103
103
|
/** Snapshot of archive tree before/after this rollup been processed */
|
|
104
104
|
public previousArchive: AppendOnlyTreeSnapshot,
|
|
105
105
|
public endArchive: AppendOnlyTreeSnapshot,
|
|
106
|
-
public previousBlockHash: Fr,
|
|
107
|
-
public endBlockHash: Fr,
|
|
108
106
|
// This is a u64 in nr, but GlobalVariables contains this as a u64 and is mapped to ts as a field, so I'm doing the same here
|
|
109
107
|
public endTimestamp: Fr,
|
|
110
108
|
public endBlockNumber: Fr,
|
|
@@ -120,8 +118,6 @@ export class RootRollupPublicInputs {
|
|
|
120
118
|
return [
|
|
121
119
|
fields.previousArchive,
|
|
122
120
|
fields.endArchive,
|
|
123
|
-
fields.previousBlockHash,
|
|
124
|
-
fields.endBlockHash,
|
|
125
121
|
fields.endTimestamp,
|
|
126
122
|
fields.endBlockNumber,
|
|
127
123
|
fields.outHash,
|
|
@@ -158,8 +154,6 @@ export class RootRollupPublicInputs {
|
|
|
158
154
|
Fr.fromBuffer(reader),
|
|
159
155
|
Fr.fromBuffer(reader),
|
|
160
156
|
Fr.fromBuffer(reader),
|
|
161
|
-
Fr.fromBuffer(reader),
|
|
162
|
-
Fr.fromBuffer(reader),
|
|
163
157
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient),
|
|
164
158
|
Fr.fromBuffer(reader),
|
|
165
159
|
Fr.fromBuffer(reader),
|
|
@@ -194,8 +188,6 @@ export class RootRollupPublicInputs {
|
|
|
194
188
|
Fr.random(),
|
|
195
189
|
Fr.random(),
|
|
196
190
|
Fr.random(),
|
|
197
|
-
Fr.random(),
|
|
198
|
-
Fr.random(),
|
|
199
191
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, FeeRecipient.random),
|
|
200
192
|
Fr.random(),
|
|
201
193
|
Fr.random(),
|
|
@@ -2,8 +2,6 @@ import { fromEntries, getEntries, maxBy } from '@aztec/foundation/collection';
|
|
|
2
2
|
import { jsonParseWithSchemaSync } from '@aztec/foundation/json-rpc';
|
|
3
3
|
import type { ReadOnlyFileStore } from '@aztec/stdlib/file-store';
|
|
4
4
|
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
|
|
7
5
|
import {
|
|
8
6
|
SnapshotDataKeys,
|
|
9
7
|
type SnapshotDataUrls,
|
|
@@ -47,8 +45,9 @@ export function getSnapshotIndexPath(metadata: SnapshotsIndexMetadata): string {
|
|
|
47
45
|
return `${getBasePath(metadata)}/index.json`;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
export function
|
|
51
|
-
|
|
48
|
+
export function makeSnapshotPaths(baseDir: string): SnapshotDataUrls {
|
|
49
|
+
// We do not use path.join since that screws up protocol prefixes
|
|
50
|
+
return fromEntries(SnapshotDataKeys.map(key => [key, `${baseDir}/${key}.db`]));
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export async function downloadSnapshot(
|
package/src/snapshots/index.ts
CHANGED
package/src/snapshots/types.ts
CHANGED
|
@@ -35,6 +35,9 @@ export type SnapshotsIndex = SnapshotsIndexMetadata & {
|
|
|
35
35
|
snapshots: SnapshotMetadata[];
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export type UploadSnapshotMetadata = Pick<SnapshotMetadata, 'l2BlockNumber' | 'l2BlockHash' | 'l1BlockNumber'> &
|
|
39
|
+
Pick<SnapshotsIndex, 'l1ChainId' | 'rollupVersion' | 'rollupAddress'>;
|
|
40
|
+
|
|
38
41
|
export const SnapshotsIndexSchema = z.object({
|
|
39
42
|
l1ChainId: z.number(),
|
|
40
43
|
rollupVersion: z.number(),
|
|
@@ -56,3 +59,12 @@ export const SnapshotsIndexSchema = z.object({
|
|
|
56
59
|
}),
|
|
57
60
|
),
|
|
58
61
|
}) satisfies ZodFor<SnapshotsIndex>;
|
|
62
|
+
|
|
63
|
+
export const UploadSnapshotMetadataSchema = z.object({
|
|
64
|
+
l2BlockNumber: z.number(),
|
|
65
|
+
l2BlockHash: z.string(),
|
|
66
|
+
l1BlockNumber: z.number(),
|
|
67
|
+
l1ChainId: z.number(),
|
|
68
|
+
rollupVersion: z.number(),
|
|
69
|
+
rollupAddress: schemas.EthAddress,
|
|
70
|
+
}) satisfies ZodFor<UploadSnapshotMetadata>;
|
package/src/snapshots/upload.ts
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
import { fromEntries, getEntries, pick } from '@aztec/foundation/collection';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { isoDate } from '@aztec/foundation/string';
|
|
3
4
|
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
4
5
|
|
|
5
6
|
import { getBasePath, getSnapshotIndex, getSnapshotIndexPath } from './download.js';
|
|
6
|
-
import type { SnapshotDataKeys, SnapshotMetadata, SnapshotsIndex } from './types.js';
|
|
7
|
+
import type { SnapshotDataKeys, SnapshotMetadata, SnapshotsIndex, UploadSnapshotMetadata } from './types.js';
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
-
Pick<SnapshotsIndex, 'l1ChainId' | 'rollupVersion' | 'rollupAddress'>;
|
|
10
|
-
|
|
11
|
-
export async function uploadSnapshot(
|
|
9
|
+
export async function uploadSnapshotData(
|
|
12
10
|
localPaths: Record<SnapshotDataKeys, string>,
|
|
13
11
|
schemaVersions: SnapshotMetadata['schemaVersions'],
|
|
14
12
|
metadata: UploadSnapshotMetadata,
|
|
15
13
|
store: FileStore,
|
|
14
|
+
opts: { pathFor?: (key: SnapshotDataKeys) => string; private?: boolean } = {},
|
|
16
15
|
): Promise<SnapshotMetadata> {
|
|
17
16
|
const timestamp = Date.now();
|
|
18
|
-
const date =
|
|
17
|
+
const date = isoDate();
|
|
19
18
|
const basePath = getBasePath(metadata);
|
|
20
|
-
const targetPathFor =
|
|
19
|
+
const targetPathFor =
|
|
20
|
+
opts.pathFor ?? ((key: SnapshotDataKeys) => `${basePath}/${key}-${date}-${metadata.l2BlockHash}.db`);
|
|
21
21
|
|
|
22
22
|
const dataUrls = fromEntries(
|
|
23
23
|
await Promise.all(
|
|
24
24
|
getEntries(localPaths).map(
|
|
25
25
|
async ([key, path]) =>
|
|
26
|
-
[key, await store.upload(targetPathFor(key), path, { compress: true, public:
|
|
26
|
+
[key, await store.upload(targetPathFor(key), path, { compress: true, public: !opts.private })] as const,
|
|
27
27
|
),
|
|
28
28
|
),
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const newSnapshotMetadata: SnapshotMetadata = {
|
|
31
|
+
return {
|
|
34
32
|
...pick(metadata, 'l1BlockNumber', 'l2BlockHash', 'l2BlockNumber'),
|
|
35
33
|
schemaVersions,
|
|
36
34
|
timestamp,
|
|
37
35
|
dataUrls,
|
|
38
36
|
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function uploadSnapshotToIndex(
|
|
40
|
+
localPaths: Record<SnapshotDataKeys, string>,
|
|
41
|
+
schemaVersions: SnapshotMetadata['schemaVersions'],
|
|
42
|
+
metadata: UploadSnapshotMetadata,
|
|
43
|
+
store: FileStore,
|
|
44
|
+
): Promise<SnapshotMetadata> {
|
|
45
|
+
const newSnapshotMetadata = await uploadSnapshotData(localPaths, schemaVersions, metadata, store);
|
|
46
|
+
const snapshotsIndex = (await getSnapshotIndex(metadata, store)) ?? createEmptyIndex(metadata);
|
|
39
47
|
snapshotsIndex.snapshots.unshift(newSnapshotMetadata);
|
|
40
48
|
|
|
41
49
|
await store.save(getSnapshotIndexPath(metadata), Buffer.from(jsonStringify(snapshotsIndex, true)), {
|
package/src/tests/factories.ts
CHANGED
|
@@ -713,10 +713,8 @@ export function makeBlockRootOrBlockMergeRollupPublicInputs(
|
|
|
713
713
|
return new BlockRootOrBlockMergePublicInputs(
|
|
714
714
|
makeAppendOnlyTreeSnapshot(seed + 0x200),
|
|
715
715
|
makeAppendOnlyTreeSnapshot(seed + 0x300),
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
globalVariables ?? makeGlobalVariables(seed + 0x501),
|
|
719
|
-
globalVariables ?? makeGlobalVariables(seed + 0x502),
|
|
716
|
+
globalVariables ?? makeGlobalVariables(seed + 0x400),
|
|
717
|
+
globalVariables ?? makeGlobalVariables(seed + 0x500),
|
|
720
718
|
fr(seed + 0x600),
|
|
721
719
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x700),
|
|
722
720
|
fr(seed + 0x800),
|
|
@@ -786,8 +784,9 @@ function makeBlockRootRollupData(seed = 0) {
|
|
|
786
784
|
makeRootParityInput<typeof NESTED_RECURSIVE_PROOF_LENGTH>(NESTED_RECURSIVE_PROOF_LENGTH, seed + 0x2000),
|
|
787
785
|
makeTuple(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, fr, 0x2100),
|
|
788
786
|
makeTuple(ARCHIVE_HEIGHT, fr, 0x2200),
|
|
789
|
-
|
|
790
|
-
|
|
787
|
+
makeTuple(ARCHIVE_HEIGHT, fr, 0x2300),
|
|
788
|
+
makeHeader(seed + 0x2400),
|
|
789
|
+
fr(seed + 0x2500),
|
|
791
790
|
);
|
|
792
791
|
}
|
|
793
792
|
|
|
@@ -880,18 +879,16 @@ export function makeRootParityInputs(seed = 0): RootParityInputs {
|
|
|
880
879
|
*/
|
|
881
880
|
export function makeRootRollupPublicInputs(seed = 0): RootRollupPublicInputs {
|
|
882
881
|
return new RootRollupPublicInputs(
|
|
882
|
+
makeAppendOnlyTreeSnapshot(seed + 0x100),
|
|
883
883
|
makeAppendOnlyTreeSnapshot(seed + 0x200),
|
|
884
|
-
|
|
884
|
+
fr(seed + 0x300),
|
|
885
885
|
fr(seed + 0x400),
|
|
886
886
|
fr(seed + 0x500),
|
|
887
|
-
|
|
887
|
+
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x600),
|
|
888
888
|
fr(seed + 0x700),
|
|
889
|
-
fr(seed +
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
fr(seed + 0x101),
|
|
893
|
-
fr(seed + 0x200),
|
|
894
|
-
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeBlockBlobPublicInputs(seed), 0x300),
|
|
889
|
+
fr(seed + 0x701),
|
|
890
|
+
fr(seed + 0x702),
|
|
891
|
+
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeBlockBlobPublicInputs(seed), 0x800),
|
|
895
892
|
);
|
|
896
893
|
}
|
|
897
894
|
|
package/src/tests/mocks.ts
CHANGED
|
@@ -221,7 +221,7 @@ export interface MakeConsensusPayloadOptions {
|
|
|
221
221
|
txHashes?: TxHash[];
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const makeAndSignConsensusPayload =
|
|
224
|
+
const makeAndSignConsensusPayload = (
|
|
225
225
|
domainSeparator: SignatureDomainSeparator,
|
|
226
226
|
options?: MakeConsensusPayloadOptions,
|
|
227
227
|
) => {
|
|
@@ -238,19 +238,19 @@ const makeAndSignConsensusPayload = async (
|
|
|
238
238
|
txHashes,
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
const hash =
|
|
241
|
+
const hash = getHashedSignaturePayloadEthSignedMessage(payload, domainSeparator);
|
|
242
242
|
const signature = signer.sign(hash);
|
|
243
243
|
|
|
244
244
|
return { payload, signature };
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
-
export const makeBlockProposal =
|
|
248
|
-
const { payload, signature } =
|
|
247
|
+
export const makeBlockProposal = (options?: MakeConsensusPayloadOptions): BlockProposal => {
|
|
248
|
+
const { payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
|
|
249
249
|
return new BlockProposal(payload, signature);
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
|
|
253
|
-
export const makeBlockAttestation =
|
|
254
|
-
const { payload, signature } =
|
|
253
|
+
export const makeBlockAttestation = (options?: MakeConsensusPayloadOptions): BlockAttestation => {
|
|
254
|
+
const { payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockAttestation, options);
|
|
255
255
|
return new BlockAttestation(payload, signature);
|
|
256
256
|
};
|
package/src/tx/block_header.ts
CHANGED
package/src/tx/profiled_tx.ts
CHANGED
package/src/tx/tx.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { ScopedLogHash } from '../kernel/log_hash.js';
|
|
|
15
15
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
16
16
|
import { ContractClassLog } from '../logs/contract_class_log.js';
|
|
17
17
|
import { Gossipable } from '../p2p/gossipable.js';
|
|
18
|
-
import { TopicType
|
|
18
|
+
import { TopicType } from '../p2p/topic_type.js';
|
|
19
19
|
import { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
20
20
|
import type { TxStats } from '../stats/stats.js';
|
|
21
21
|
import { HashedValues } from './hashed_values.js';
|
|
@@ -26,7 +26,7 @@ import { TxHash } from './tx_hash.js';
|
|
|
26
26
|
* The interface of an L2 transaction.
|
|
27
27
|
*/
|
|
28
28
|
export class Tx extends Gossipable {
|
|
29
|
-
static override p2pTopic
|
|
29
|
+
static override p2pTopic = TopicType.tx;
|
|
30
30
|
// For memoization
|
|
31
31
|
private txHash: TxHash | undefined;
|
|
32
32
|
private calldataMap: Map<string, Fr[]> | undefined;
|
|
@@ -53,11 +53,6 @@ export class Tx extends Gossipable {
|
|
|
53
53
|
super();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// Gossipable method
|
|
57
|
-
static {
|
|
58
|
-
this.p2pTopic = createTopicString(TopicType.tx);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
56
|
// Gossipable method
|
|
62
57
|
override async p2pMessageIdentifier(): Promise<Buffer32> {
|
|
63
58
|
return new Buffer32((await this.getTxHash()).toBuffer());
|