@aztec/stdlib 2.1.0-rc.23 → 2.1.0-rc.24

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.
@@ -93,13 +93,13 @@ export interface L2BlockSource {
93
93
  */
94
94
  getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
95
95
  /**
96
- * Returns the current L2 slot number based on the current L1 timestamp.
96
+ * Returns the current L2 slot number based on the currently synced L1 timestamp.
97
97
  */
98
- getL2SlotNumber(): Promise<bigint>;
98
+ getL2SlotNumber(): Promise<bigint | undefined>;
99
99
  /**
100
- * Returns the current L2 epoch number based on the current L1 timestamp.
100
+ * Returns the current L2 epoch number based on the currently synced L1 timestamp.
101
101
  */
102
- getL2EpochNumber(): Promise<bigint>;
102
+ getL2EpochNumber(): Promise<bigint | undefined>;
103
103
  /**
104
104
  * Returns all blocks for a given epoch.
105
105
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
@@ -130,7 +130,7 @@ export interface L2BlockSource {
130
130
  genesisArchiveRoot: Fr;
131
131
  }>;
132
132
  /** Latest synced L1 timestamp. */
133
- getL1Timestamp(): Promise<bigint>;
133
+ getL1Timestamp(): Promise<bigint | undefined>;
134
134
  /**
135
135
  * Returns whether the latest block in the pending chain on L1 is invalid (ie its attestations are incorrect).
136
136
  * Note that invalid blocks do not get synced, so the latest block returned by the block source is always a valid one.
@@ -1 +1 @@
1
- {"version":3,"file":"l2_block_source.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BA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B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,gBAAgB,EAAE,2BAA2B,CAAC;CAC/C,CAAC"}
@@ -40,8 +40,8 @@ export const ArchiverApiSchema = {
40
40
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
41
41
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
42
42
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
43
- getL2SlotNumber: z.function().args().returns(schemas.BigInt),
44
- getL2EpochNumber: z.function().args().returns(schemas.BigInt),
43
+ getL2SlotNumber: z.function().args().returns(schemas.BigInt.optional()),
44
+ getL2EpochNumber: z.function().args().returns(schemas.BigInt.optional()),
45
45
  getBlocksForEpoch: z.function().args(schemas.BigInt).returns(z.array(L2Block.schema)),
46
46
  getBlockHeadersForEpoch: z.function().args(schemas.BigInt).returns(z.array(BlockHeader.schema)),
47
47
  isEpochComplete: z.function().args(schemas.BigInt).returns(z.boolean()),
@@ -62,7 +62,7 @@ export const ArchiverApiSchema = {
62
62
  getGenesisValues: z.function().args().returns(z.object({
63
63
  genesisArchiveRoot: schemas.Fr
64
64
  })),
65
- getL1Timestamp: z.function().args().returns(schemas.BigInt),
65
+ getL1Timestamp: z.function().args().returns(schemas.BigInt.optional()),
66
66
  syncImmediate: z.function().args().returns(z.void()),
67
67
  isPendingChainInvalid: z.function().args().returns(z.boolean()),
68
68
  getPendingChainValidationStatus: z.function().args().returns(ValidateBlockResultSchema)
@@ -14,26 +14,18 @@ export declare class P2PMessage {
14
14
  */
15
15
  export declare abstract class Gossipable {
16
16
  private cachedId;
17
- /** p2p Topic
18
- *
19
- * - The p2p topic identifier, this determines how the message is handled
20
- */
17
+ /** The p2p topic identifier, this determines how the message is handled */
21
18
  static p2pTopic: TopicType;
22
- /** p2p Message Identifier
23
- *
24
- * - A digest of the message information, this key is used for deduplication
19
+ /**
20
+ * A digest of the message information **used for logging only**.
21
+ * The identifier used for deduplication is `getMsgIdFn` as defined in `encoding.ts` which is a hash over topic and data.
25
22
  */
26
23
  p2pMessageIdentifier(): Promise<Buffer32>;
27
24
  abstract generateP2PMessageIdentifier(): Promise<Buffer32>;
28
- /** To Buffer
29
- *
30
- * - Serialization method
31
- */
32
25
  abstract toBuffer(): Buffer;
33
26
  toMessage(): Buffer;
34
27
  /**
35
28
  * Get the size of the gossipable object.
36
- *
37
29
  * This is used for metrics recording.
38
30
  */
39
31
  abstract getSize(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"gossipable.d.ts","sourceRoot":"","sources":["../../src/p2p/gossipable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,UAAU;aACO,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAE3C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAItD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAMvD,aAAa,IAAI,MAAM;CAGxB;AAED;;;;GAIG;AACH,8BAAsB,UAAU;IAC9B,OAAO,CAAC,QAAQ,CAAuB;IACvC;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE3B;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAQ/C,QAAQ,CAAC,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE1D;;;OAGG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;CAC3B"}
1
+ {"version":3,"file":"gossipable.d.ts","sourceRoot":"","sources":["../../src/p2p/gossipable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,UAAU;aACO,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAE3C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAItD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAMvD,aAAa,IAAI,MAAM;CAGxB;AAED;;;;GAIG;AACH,8BAAsB,UAAU;IAC9B,OAAO,CAAC,QAAQ,CAAuB;IACvC,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE3B;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAQ/C,QAAQ,CAAC,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE1D,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;CAC3B"}
@@ -24,13 +24,10 @@ export class P2PMessage {
24
24
  * Any class which extends gossipable will be able to be Gossiped over the p2p network
25
25
  */ export class Gossipable {
26
26
  cachedId;
27
- /** p2p Topic
28
- *
29
- * - The p2p topic identifier, this determines how the message is handled
30
- */ static p2pTopic;
31
- /** p2p Message Identifier
32
- *
33
- * - A digest of the message information, this key is used for deduplication
27
+ /** The p2p topic identifier, this determines how the message is handled */ static p2pTopic;
28
+ /**
29
+ * A digest of the message information **used for logging only**.
30
+ * The identifier used for deduplication is `getMsgIdFn` as defined in `encoding.ts` which is a hash over topic and data.
34
31
  */ async p2pMessageIdentifier() {
35
32
  if (this.cachedId) {
36
33
  return this.cachedId;
@@ -1,14 +1,10 @@
1
1
  import { P2PClientType } from './client_type.js';
2
- /** Create Topic String
3
- *
4
- * The topic channel identifier
5
- * @param topicType
6
- * @returns
7
- */
8
- export declare function createTopicString(topicType: TopicType, protocolVersion: string): string;
9
2
  /**
10
- *
3
+ * Creates the topic channel identifier string from a given topic type
11
4
  */
5
+ export declare function createTopicString(topicType: TopicType, protocolVersion: string): string;
6
+ /** Extracts the topic type from a topic string */
7
+ export declare function getTopicFromString(topicStr: string): TopicType | undefined;
12
8
  export declare enum TopicType {
13
9
  tx = "tx",
14
10
  block_proposal = "block_proposal",
@@ -1 +1 @@
1
- {"version":3,"file":"topic_type.d.ts","sourceRoot":"","sources":["../../src/p2p/topic_type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAE9E;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,EAAE,OAAO;IACT,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;CACxC;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,aAAa,eASlE;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,OAAO,eAMlG;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,MAAM,uBAO9D"}
1
+ {"version":3,"file":"topic_type.d.ts","sourceRoot":"","sources":["../../src/p2p/topic_type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAE9E;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAU1E;AAED,oBAAY,SAAS;IACnB,EAAE,OAAO;IACT,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;CACxC;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,aAAa,eASlE;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,OAAO,eAMlG;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,MAAM,uBAO9D"}
@@ -1,15 +1,21 @@
1
1
  import { P2PClientType } from './client_type.js';
2
- /** Create Topic String
3
- *
4
- * The topic channel identifier
5
- * @param topicType
6
- * @returns
2
+ /**
3
+ * Creates the topic channel identifier string from a given topic type
7
4
  */ export function createTopicString(topicType, protocolVersion) {
8
5
  return `/aztec/${TopicType[topicType]}/${protocolVersion}`;
9
6
  }
10
- /**
11
- *
12
- */ export var TopicType = /*#__PURE__*/ function(TopicType) {
7
+ /** Extracts the topic type from a topic string */ export function getTopicFromString(topicStr) {
8
+ const parts = topicStr.split('/');
9
+ if (parts.length < 4 || parts[1] !== 'aztec') {
10
+ return undefined;
11
+ }
12
+ const topic = parts[2];
13
+ if (Object.values(TopicType).includes(topic)) {
14
+ return topic;
15
+ }
16
+ return undefined;
17
+ }
18
+ export var TopicType = /*#__PURE__*/ function(TopicType) {
13
19
  TopicType["tx"] = "tx";
14
20
  TopicType["block_proposal"] = "block_proposal";
15
21
  TopicType["block_attestation"] = "block_attestation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "2.1.0-rc.23",
3
+ "version": "2.1.0-rc.24",
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": "2.1.0-rc.23",
74
- "@aztec/blob-lib": "2.1.0-rc.23",
75
- "@aztec/constants": "2.1.0-rc.23",
76
- "@aztec/ethereum": "2.1.0-rc.23",
77
- "@aztec/foundation": "2.1.0-rc.23",
78
- "@aztec/l1-artifacts": "2.1.0-rc.23",
79
- "@aztec/noir-noirc_abi": "2.1.0-rc.23",
73
+ "@aztec/bb.js": "2.1.0-rc.24",
74
+ "@aztec/blob-lib": "2.1.0-rc.24",
75
+ "@aztec/constants": "2.1.0-rc.24",
76
+ "@aztec/ethereum": "2.1.0-rc.24",
77
+ "@aztec/foundation": "2.1.0-rc.24",
78
+ "@aztec/l1-artifacts": "2.1.0-rc.24",
79
+ "@aztec/noir-noirc_abi": "2.1.0-rc.24",
80
80
  "@google-cloud/storage": "^7.15.0",
81
81
  "axios": "^1.12.0",
82
82
  "json-stringify-deterministic": "1.0.12",
@@ -110,14 +110,14 @@ export interface L2BlockSource {
110
110
  getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
111
111
 
112
112
  /**
113
- * Returns the current L2 slot number based on the current L1 timestamp.
113
+ * Returns the current L2 slot number based on the currently synced L1 timestamp.
114
114
  */
115
- getL2SlotNumber(): Promise<bigint>;
115
+ getL2SlotNumber(): Promise<bigint | undefined>;
116
116
 
117
117
  /**
118
- * Returns the current L2 epoch number based on the current L1 timestamp.
118
+ * Returns the current L2 epoch number based on the currently synced L1 timestamp.
119
119
  */
120
- getL2EpochNumber(): Promise<bigint>;
120
+ getL2EpochNumber(): Promise<bigint | undefined>;
121
121
 
122
122
  /**
123
123
  * Returns all blocks for a given epoch.
@@ -153,7 +153,7 @@ export interface L2BlockSource {
153
153
  getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }>;
154
154
 
155
155
  /** Latest synced L1 timestamp. */
156
- getL1Timestamp(): Promise<bigint>;
156
+ getL1Timestamp(): Promise<bigint | undefined>;
157
157
 
158
158
  /**
159
159
  * Returns whether the latest block in the pending chain on L1 is invalid (ie its attestations are incorrect).
@@ -89,8 +89,8 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
89
89
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
90
90
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
91
91
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
92
- getL2SlotNumber: z.function().args().returns(schemas.BigInt),
93
- getL2EpochNumber: z.function().args().returns(schemas.BigInt),
92
+ getL2SlotNumber: z.function().args().returns(schemas.BigInt.optional()),
93
+ getL2EpochNumber: z.function().args().returns(schemas.BigInt.optional()),
94
94
  getBlocksForEpoch: z.function().args(schemas.BigInt).returns(z.array(L2Block.schema)),
95
95
  getBlockHeadersForEpoch: z.function().args(schemas.BigInt).returns(z.array(BlockHeader.schema)),
96
96
  isEpochComplete: z.function().args(schemas.BigInt).returns(z.boolean()),
@@ -118,7 +118,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
118
118
  .function()
119
119
  .args()
120
120
  .returns(z.object({ genesisArchiveRoot: schemas.Fr })),
121
- getL1Timestamp: z.function().args().returns(schemas.BigInt),
121
+ getL1Timestamp: z.function().args().returns(schemas.BigInt.optional()),
122
122
  syncImmediate: z.function().args().returns(z.void()),
123
123
  isPendingChainInvalid: z.function().args().returns(z.boolean()),
124
124
  getPendingChainValidationStatus: z.function().args().returns(ValidateBlockResultSchema),
@@ -28,15 +28,12 @@ export class P2PMessage {
28
28
  */
29
29
  export abstract class Gossipable {
30
30
  private cachedId: Buffer32 | undefined;
31
- /** p2p Topic
32
- *
33
- * - The p2p topic identifier, this determines how the message is handled
34
- */
31
+ /** The p2p topic identifier, this determines how the message is handled */
35
32
  static p2pTopic: TopicType;
36
33
 
37
- /** p2p Message Identifier
38
- *
39
- * - A digest of the message information, this key is used for deduplication
34
+ /**
35
+ * A digest of the message information **used for logging only**.
36
+ * The identifier used for deduplication is `getMsgIdFn` as defined in `encoding.ts` which is a hash over topic and data.
40
37
  */
41
38
  async p2pMessageIdentifier(): Promise<Buffer32> {
42
39
  if (this.cachedId) {
@@ -48,10 +45,6 @@ export abstract class Gossipable {
48
45
 
49
46
  abstract generateP2PMessageIdentifier(): Promise<Buffer32>;
50
47
 
51
- /** To Buffer
52
- *
53
- * - Serialization method
54
- */
55
48
  abstract toBuffer(): Buffer;
56
49
 
57
50
  toMessage(): Buffer {
@@ -60,7 +53,6 @@ export abstract class Gossipable {
60
53
 
61
54
  /**
62
55
  * Get the size of the gossipable object.
63
- *
64
56
  * This is used for metrics recording.
65
57
  */
66
58
  abstract getSize(): number;
@@ -1,18 +1,25 @@
1
1
  import { P2PClientType } from './client_type.js';
2
2
 
3
- /** Create Topic String
4
- *
5
- * The topic channel identifier
6
- * @param topicType
7
- * @returns
3
+ /**
4
+ * Creates the topic channel identifier string from a given topic type
8
5
  */
9
6
  export function createTopicString(topicType: TopicType, protocolVersion: string) {
10
7
  return `/aztec/${TopicType[topicType]}/${protocolVersion}`;
11
8
  }
12
9
 
13
- /**
14
- *
15
- */
10
+ /** Extracts the topic type from a topic string */
11
+ export function getTopicFromString(topicStr: string): TopicType | undefined {
12
+ const parts = topicStr.split('/');
13
+ if (parts.length < 4 || parts[1] !== 'aztec') {
14
+ return undefined;
15
+ }
16
+ const topic = parts[2];
17
+ if (Object.values(TopicType).includes(topic as TopicType)) {
18
+ return topic as TopicType;
19
+ }
20
+ return undefined;
21
+ }
22
+
16
23
  export enum TopicType {
17
24
  tx = 'tx',
18
25
  block_proposal = 'block_proposal',