@aztec/aztec-node 0.0.1-commit.0dc957cde → 0.0.1-commit.0ec55a70b

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.
@@ -37,6 +37,12 @@ export class Sentinel extends EventEmitter {
37
37
  const interval = epochCache.getL1Constants().ethereumSlotDuration * 1000 / 4;
38
38
  this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
39
39
  }
40
+ getSignatureContext() {
41
+ return {
42
+ chainId: this.config.l1ChainId,
43
+ rollupAddress: this.config.l1Contracts.rollupAddress
44
+ };
45
+ }
40
46
  updateConfig(config) {
41
47
  this.config = {
42
48
  ...this.config,
@@ -75,7 +81,7 @@ export class Sentinel extends EventEmitter {
75
81
  this.slotNumberToCheckpoint.set(checkpoint.checkpoint.header.slotNumber, {
76
82
  checkpointNumber: checkpoint.checkpoint.number,
77
83
  archive: checkpoint.checkpoint.archive.root.toString(),
78
- attestors: getAttestationInfoFromPublishedCheckpoint(checkpoint).filter((a)=>a.status === 'recovered-from-signature').map((a)=>a.address)
84
+ attestors: getAttestationInfoFromPublishedCheckpoint(checkpoint, this.getSignatureContext()).filter((a)=>a.status === 'recovered-from-signature').map((a)=>a.address)
79
85
  });
80
86
  // Prune the archive map to only keep at most N entries
81
87
  const historyLength = this.store.getHistoryLength();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec-node",
3
- "version": "0.0.1-commit.0dc957cde",
3
+ "version": "0.0.1-commit.0ec55a70b",
4
4
  "main": "dest/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -65,31 +65,31 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@aztec/archiver": "0.0.1-commit.0dc957cde",
69
- "@aztec/bb-prover": "0.0.1-commit.0dc957cde",
70
- "@aztec/blob-client": "0.0.1-commit.0dc957cde",
71
- "@aztec/blob-lib": "0.0.1-commit.0dc957cde",
72
- "@aztec/constants": "0.0.1-commit.0dc957cde",
73
- "@aztec/epoch-cache": "0.0.1-commit.0dc957cde",
74
- "@aztec/ethereum": "0.0.1-commit.0dc957cde",
75
- "@aztec/foundation": "0.0.1-commit.0dc957cde",
76
- "@aztec/kv-store": "0.0.1-commit.0dc957cde",
77
- "@aztec/l1-artifacts": "0.0.1-commit.0dc957cde",
78
- "@aztec/node-keystore": "0.0.1-commit.0dc957cde",
79
- "@aztec/node-lib": "0.0.1-commit.0dc957cde",
80
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.0dc957cde",
81
- "@aztec/p2p": "0.0.1-commit.0dc957cde",
82
- "@aztec/protocol-contracts": "0.0.1-commit.0dc957cde",
83
- "@aztec/prover-client": "0.0.1-commit.0dc957cde",
84
- "@aztec/prover-node": "0.0.1-commit.0dc957cde",
85
- "@aztec/sequencer-client": "0.0.1-commit.0dc957cde",
86
- "@aztec/simulator": "0.0.1-commit.0dc957cde",
87
- "@aztec/slasher": "0.0.1-commit.0dc957cde",
88
- "@aztec/stdlib": "0.0.1-commit.0dc957cde",
89
- "@aztec/telemetry-client": "0.0.1-commit.0dc957cde",
90
- "@aztec/validator-client": "0.0.1-commit.0dc957cde",
91
- "@aztec/validator-ha-signer": "0.0.1-commit.0dc957cde",
92
- "@aztec/world-state": "0.0.1-commit.0dc957cde",
68
+ "@aztec/archiver": "0.0.1-commit.0ec55a70b",
69
+ "@aztec/bb-prover": "0.0.1-commit.0ec55a70b",
70
+ "@aztec/blob-client": "0.0.1-commit.0ec55a70b",
71
+ "@aztec/blob-lib": "0.0.1-commit.0ec55a70b",
72
+ "@aztec/constants": "0.0.1-commit.0ec55a70b",
73
+ "@aztec/epoch-cache": "0.0.1-commit.0ec55a70b",
74
+ "@aztec/ethereum": "0.0.1-commit.0ec55a70b",
75
+ "@aztec/foundation": "0.0.1-commit.0ec55a70b",
76
+ "@aztec/kv-store": "0.0.1-commit.0ec55a70b",
77
+ "@aztec/l1-artifacts": "0.0.1-commit.0ec55a70b",
78
+ "@aztec/node-keystore": "0.0.1-commit.0ec55a70b",
79
+ "@aztec/node-lib": "0.0.1-commit.0ec55a70b",
80
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.0ec55a70b",
81
+ "@aztec/p2p": "0.0.1-commit.0ec55a70b",
82
+ "@aztec/protocol-contracts": "0.0.1-commit.0ec55a70b",
83
+ "@aztec/prover-client": "0.0.1-commit.0ec55a70b",
84
+ "@aztec/prover-node": "0.0.1-commit.0ec55a70b",
85
+ "@aztec/sequencer-client": "0.0.1-commit.0ec55a70b",
86
+ "@aztec/simulator": "0.0.1-commit.0ec55a70b",
87
+ "@aztec/slasher": "0.0.1-commit.0ec55a70b",
88
+ "@aztec/stdlib": "0.0.1-commit.0ec55a70b",
89
+ "@aztec/telemetry-client": "0.0.1-commit.0ec55a70b",
90
+ "@aztec/validator-client": "0.0.1-commit.0ec55a70b",
91
+ "@aztec/validator-ha-signer": "0.0.1-commit.0ec55a70b",
92
+ "@aztec/world-state": "0.0.1-commit.0ec55a70b",
93
93
  "koa": "^2.16.1",
94
94
  "koa-router": "^13.1.1",
95
95
  "tslib": "^2.4.0",
@@ -0,0 +1,131 @@
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import {
3
+ type BlockData,
4
+ type BlockDataWithCheckpointContext,
5
+ type CheckpointedL2Block,
6
+ type CommitteeAttestation,
7
+ L2Block,
8
+ } from '@aztec/stdlib/block';
9
+ import type { CheckpointData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
10
+ import {
11
+ type BlockIncludeOptions,
12
+ type BlockResponse,
13
+ type CheckpointIncludeOptions,
14
+ type CheckpointResponse,
15
+ l1PublishInfoFromL1PublishedData,
16
+ } from '@aztec/stdlib/interfaces/client';
17
+
18
+ /** Projects a full {@link L2Block} into a {@link BlockResponse}, attaching L1 / attestation context when provided. */
19
+ export async function blockResponseFromL2Block(
20
+ block: L2Block,
21
+ options: BlockIncludeOptions,
22
+ context?: { l1?: BlockDataWithCheckpointContext['l1']; attestations?: CommitteeAttestation[] },
23
+ ): Promise<BlockResponse> {
24
+ const response: BlockResponse = {
25
+ header: block.header,
26
+ archive: block.archive,
27
+ hash: await block.hash(),
28
+ checkpointNumber: block.checkpointNumber,
29
+ indexWithinCheckpoint: block.indexWithinCheckpoint,
30
+ number: block.number,
31
+ };
32
+ if (options.includeTransactions) {
33
+ (response as BlockResponse).body = block.body;
34
+ }
35
+ if (options.includeL1PublishInfo) {
36
+ (response as BlockResponse).l1 = l1PublishInfoFromL1PublishedData(context?.l1);
37
+ }
38
+ if (options.includeAttestations) {
39
+ (response as BlockResponse).attestations = context?.attestations ?? [];
40
+ }
41
+ return response;
42
+ }
43
+
44
+ /** Projects metadata-only {@link BlockData} into a {@link BlockResponse}. */
45
+ export function blockResponseFromBlockData(
46
+ data: BlockData,
47
+ blockNumber: BlockNumber,
48
+ options: BlockIncludeOptions,
49
+ context?: { l1?: BlockDataWithCheckpointContext['l1']; attestations?: CommitteeAttestation[] },
50
+ ): BlockResponse {
51
+ const response: BlockResponse = {
52
+ header: data.header,
53
+ archive: data.archive,
54
+ hash: data.blockHash,
55
+ checkpointNumber: data.checkpointNumber,
56
+ indexWithinCheckpoint: data.indexWithinCheckpoint,
57
+ number: blockNumber,
58
+ };
59
+ if (options.includeL1PublishInfo) {
60
+ (response as BlockResponse).l1 = l1PublishInfoFromL1PublishedData(context?.l1);
61
+ }
62
+ if (options.includeAttestations) {
63
+ (response as BlockResponse).attestations = context?.attestations ?? [];
64
+ }
65
+ return response;
66
+ }
67
+
68
+ /** Projects a {@link CheckpointedL2Block} into a {@link BlockResponse}. */
69
+ export function blockResponseFromCheckpointedL2Block(
70
+ cp: CheckpointedL2Block,
71
+ options: BlockIncludeOptions,
72
+ ): Promise<BlockResponse> {
73
+ return blockResponseFromL2Block(cp.block, options, { l1: cp.l1, attestations: cp.attestations });
74
+ }
75
+
76
+ /** Projects a {@link PublishedCheckpoint} into a {@link CheckpointResponse}. */
77
+ export async function checkpointResponseFromPublishedCheckpoint(
78
+ pc: PublishedCheckpoint,
79
+ options: CheckpointIncludeOptions,
80
+ ): Promise<CheckpointResponse> {
81
+ const response: CheckpointResponse = {
82
+ number: pc.checkpoint.number,
83
+ header: pc.checkpoint.header,
84
+ archive: pc.checkpoint.archive,
85
+ checkpointOutHash: pc.checkpoint.getCheckpointOutHash(),
86
+ startBlock: pc.checkpoint.blocks[0]?.number ?? BlockNumber.ZERO,
87
+ blockCount: pc.checkpoint.blocks.length,
88
+ feeAssetPriceModifier: pc.checkpoint.feeAssetPriceModifier,
89
+ };
90
+ if (options.includeBlocks) {
91
+ (response as CheckpointResponse).blocks = await Promise.all(
92
+ pc.checkpoint.blocks.map(block =>
93
+ blockResponseFromL2Block(block, {
94
+ includeTransactions: options.includeTransactions,
95
+ includeL1PublishInfo: false,
96
+ includeAttestations: false,
97
+ }),
98
+ ),
99
+ );
100
+ }
101
+ if (options.includeL1PublishInfo) {
102
+ (response as CheckpointResponse).l1 = l1PublishInfoFromL1PublishedData(pc.l1);
103
+ }
104
+ if (options.includeAttestations) {
105
+ (response as CheckpointResponse).attestations = pc.attestations;
106
+ }
107
+ return response;
108
+ }
109
+
110
+ /** Projects metadata-only {@link CheckpointData} into a {@link CheckpointResponse}. `includeBlocks` is ignored (no blocks loaded). */
111
+ export function checkpointResponseFromCheckpointData(
112
+ cd: CheckpointData,
113
+ options: CheckpointIncludeOptions,
114
+ ): CheckpointResponse {
115
+ const response: CheckpointResponse = {
116
+ number: cd.checkpointNumber,
117
+ header: cd.header,
118
+ archive: cd.archive,
119
+ checkpointOutHash: cd.checkpointOutHash,
120
+ startBlock: cd.startBlock,
121
+ blockCount: cd.blockCount,
122
+ feeAssetPriceModifier: cd.feeAssetPriceModifier,
123
+ };
124
+ if (options.includeL1PublishInfo) {
125
+ (response as CheckpointResponse).l1 = l1PublishInfoFromL1PublishedData(cd.l1);
126
+ }
127
+ if (options.includeAttestations) {
128
+ (response as CheckpointResponse).attestations = cd.attestations;
129
+ }
130
+ return response;
131
+ }