@aztec/stdlib 1.0.0-nightly.20250729 → 1.0.0-nightly.20250730

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.
@@ -12,21 +12,21 @@ export declare function inBlockSchemaFor<T extends ZodTypeAny>(schema: T): z.Zod
12
12
  data: T;
13
13
  l2BlockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
14
14
  l2BlockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
15
- }, "strip", ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
15
+ }, "strip", ZodTypeAny, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
16
16
  data: T;
17
17
  l2BlockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
18
18
  l2BlockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
19
- }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
19
+ }>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
20
20
  data: T;
21
21
  l2BlockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
22
22
  l2BlockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
23
- }>, any>[k]; } : never, z.baseObjectInputType<{
23
+ }>, any>[k]; }, { [k_1 in keyof z.baseObjectInputType<{
24
24
  data: T;
25
25
  l2BlockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
26
26
  l2BlockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
27
- }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
27
+ }>]: z.baseObjectInputType<{
28
28
  data: T;
29
29
  l2BlockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
30
30
  l2BlockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
31
- }>[k_1]; } : never>;
31
+ }>[k_1]; }>;
32
32
  //# sourceMappingURL=in_block.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in_block.d.ts","sourceRoot":"","sources":["../../src/block/in_block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMpD;AAED,wBAAsB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAMjF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;oBAM/D"}
1
+ {"version":3,"file":"in_block.d.ts","sourceRoot":"","sources":["../../src/block/in_block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMpD;AAED,wBAAsB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAMjF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;YAM/D"}
@@ -23,6 +23,7 @@ export declare class CommitteeAttestation {
23
23
  }>;
24
24
  static fromAddress(address: EthAddress): CommitteeAttestation;
25
25
  static fromAddressAndSignature(address: EthAddress, signature: Signature): CommitteeAttestation;
26
+ static fromSignature(signature: Signature): CommitteeAttestation;
26
27
  static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation;
27
28
  static fromBuffer(buffer: Buffer | BufferReader): CommitteeAttestation;
28
29
  static random(): CommitteeAttestation;
@@ -1 +1 @@
1
- {"version":3,"file":"committee_attestation.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/committee_attestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,U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AAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAEjC,qBAAa,oBAAoB;aAEb,OAAO,EAAE,UAAU;aACnB,SAAS,EAAE,SAAS;gBADpB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,SAAS;IAGtC,MAAM,KAAK,MAAM;;;;;;;;;;;;OAOhB;IAGD,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,oBAAoB;IAK7D,MAAM,CAAC,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,oBAAoB;IAI/F,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,oBAAoB;IAIhE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,GAAG,oBAAoB;IAIrE,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,oBAAoB;IAOtE,MAAM,CAAC,MAAM,IAAI,oBAAoB;IAKrC,MAAM,CAAC,KAAK,IAAI,oBAAoB;IAIpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,GAAG,oBAAoB,EAAE;IA+CnG,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO;IAI5C,MAAM,IAAI,wBAAwB;CAMnC"}
@@ -24,6 +24,9 @@ export class CommitteeAttestation {
24
24
  static fromAddressAndSignature(address, signature) {
25
25
  return new CommitteeAttestation(address, signature);
26
26
  }
27
+ static fromSignature(signature) {
28
+ return new CommitteeAttestation(EthAddress.ZERO, signature);
29
+ }
27
30
  static fromViem(viem) {
28
31
  return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
29
32
  }
@@ -20,6 +20,7 @@ export declare class L1PublishedData {
20
20
  timestamp: string | number | bigint;
21
21
  blockHash: string;
22
22
  }>;
23
+ static random(): L1PublishedData;
23
24
  }
24
25
  export declare class PublishedL2Block {
25
26
  block: L2Block;
@@ -116,5 +117,5 @@ export declare class PublishedL2Block {
116
117
  }[];
117
118
  }>;
118
119
  }
119
- export declare function getAttestationsFromPublishedL2Block(block: PublishedL2Block): BlockAttestation[];
120
+ export declare function getAttestationsFromPublishedL2Block(block: Pick<PublishedL2Block, 'attestations' | 'block'>): BlockAttestation[];
120
121
  //# sourceMappingURL=published_l2_block.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published_l2_block.d.ts","sourceRoot":"","sources":["../../src/block/published_l2_block.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,qBAAa,eAAe;IAEjB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;gBAFjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM;IAG1B,MAAM,KAAK,MAAM;;;;;;;;;;;;OAMhB;CACF;AAED,qBAAa,gBAAgB;IAElB,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,eAAe;IACnB,YAAY,EAAE,oBAAoB,EAAE;gBAFpC,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,oBAAoB,EAAE;IAG7C,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAMhB;CACF;AAED,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,sBAQ1E"}
1
+ {"version":3,"file":"published_l2_block.d.ts","sourceRoot":"","sources":["../../src/block/published_l2_block.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,qBAAa,eAAe;IAEjB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;gBAFjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM;IAG1B,MAAM,KAAK,MAAM;;;;;;;;;;;;OAMhB;IAED,MAAM,CAAC,MAAM;CAOd;AAED,qBAAa,gBAAgB;IAElB,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,eAAe;IACnB,YAAY,EAAE,oBAAoB,EAAE;gBAFpC,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,oBAAoB,EAAE;IAG7C,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAMhB;CACF;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,OAAO,CAAC,GACtD,gBAAgB,EAAE,CAKpB"}
@@ -1,4 +1,6 @@
1
1
  // Ignoring import issue to fix portable inferred type issue in zod schema
2
+ import { Buffer32 } from '@aztec/foundation/buffer';
3
+ import { randomBigInt } from '@aztec/foundation/crypto';
2
4
  import { schemas } from '@aztec/foundation/schemas';
3
5
  import { z } from 'zod';
4
6
  import { BlockAttestation } from '../p2p/block_attestation.js';
@@ -21,6 +23,9 @@ export class L1PublishedData {
21
23
  blockHash: z.string()
22
24
  });
23
25
  }
26
+ static random() {
27
+ return new L1PublishedData(randomBigInt(1000n) + 1n, BigInt(Math.floor(Date.now() / 1000)), Buffer32.random().toString());
28
+ }
24
29
  }
25
30
  export class PublishedL2Block {
26
31
  block;
@@ -41,5 +46,5 @@ export class PublishedL2Block {
41
46
  }
42
47
  export function getAttestationsFromPublishedL2Block(block) {
43
48
  const payload = ConsensusPayload.fromBlock(block.block);
44
- return block.attestations.filter((attestation)=>!attestation.signature.isEmpty()).map((attestation)=>new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature));
49
+ return block.attestations.filter((attestation)=>!attestation.signature.isEmpty()).map((attestation)=>new BlockAttestation(block.block.number, payload, attestation.signature));
45
50
  }
@@ -120,7 +120,7 @@ interface ContractClassCommitments {
120
120
  }
121
121
  /** A contract class with its precomputed id. */
122
122
  export type ContractClassWithId = ContractClass & Pick<ContractClassCommitments, 'id'>;
123
- export declare const ContractClassWithIdSchema: z.ZodObject<{
123
+ export declare const ContractClassWithIdSchema: z.ZodObject<z.objectUtil.extendShape<{
124
124
  version: z.ZodLiteral<1>;
125
125
  artifactHash: z.ZodType<Fr, any, string>;
126
126
  privateFunctions: z.ZodArray<z.ZodObject<{
@@ -146,9 +146,9 @@ export declare const ContractClassWithIdSchema: z.ZodObject<{
146
146
  type: "Buffer";
147
147
  data: number[];
148
148
  }>]>;
149
- } & {
149
+ }, {
150
150
  id: z.ZodType<Fr, any, string>;
151
- }, "strip", z.ZodTypeAny, {
151
+ }>, "strip", z.ZodTypeAny, {
152
152
  version: 1;
153
153
  id: Fr;
154
154
  artifactHash: Fr;
@@ -36,7 +36,7 @@ export interface AztecNodeAdmin {
36
36
  export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & {
37
37
  maxTxPoolSize: number;
38
38
  };
39
- export declare const AztecNodeAdminConfigSchema: z.ZodObject<{
39
+ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
40
40
  transactionPollingIntervalMS: z.ZodOptional<z.ZodNumber>;
41
41
  maxTxsPerBlock: z.ZodOptional<z.ZodNumber>;
42
42
  minTxsPerBlock: z.ZodOptional<z.ZodNumber>;
@@ -84,7 +84,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<{
84
84
  enforceTimeTable: z.ZodOptional<z.ZodBoolean>;
85
85
  fakeProcessingDelayPerTxMs: z.ZodOptional<z.ZodNumber>;
86
86
  attestationPropagationTime: z.ZodOptional<z.ZodNumber>;
87
- } & {
87
+ }, {
88
88
  nodeUrl: z.ZodOptional<z.ZodString>;
89
89
  realProofs: z.ZodBoolean;
90
90
  proverId: z.ZodOptional<import("../schemas/schemas.js").ZodFor<import("@aztec/foundation/schemas").Fr>>;
@@ -92,9 +92,9 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<{
92
92
  proverTestDelayMs: z.ZodNumber;
93
93
  proverTestDelayFactor: z.ZodNumber;
94
94
  proverAgentCount: z.ZodNumber;
95
- } & {
95
+ }>, {
96
96
  maxTxPoolSize: z.ZodNumber;
97
- }, "strip", z.ZodTypeAny, {
97
+ }>, "strip", z.ZodTypeAny, {
98
98
  realProofs: boolean;
99
99
  proverTestDelayType: "fixed" | "realistic";
100
100
  proverTestDelayMs: number;
@@ -5808,11 +5808,11 @@ export declare const ProvingJobFulfilledResult: z.ZodObject<{
5808
5808
  status: z.ZodLiteral<"fulfilled">;
5809
5809
  value: z.ZodBranded<z.ZodString, "ProvingJobUri">;
5810
5810
  }, "strip", z.ZodTypeAny, {
5811
- value: string & z.BRAND<"ProvingJobUri">;
5812
5811
  status: "fulfilled";
5812
+ value: string & z.BRAND<"ProvingJobUri">;
5813
5813
  }, {
5814
- value: string;
5815
5814
  status: "fulfilled";
5815
+ value: string;
5816
5816
  }>;
5817
5817
  export type ProvingJobFulfilledResult = z.infer<typeof ProvingJobFulfilledResult>;
5818
5818
  export declare const ProvingJobRejectedResult: z.ZodObject<{
@@ -5830,11 +5830,11 @@ export declare const ProvingJobSettledResult: z.ZodDiscriminatedUnion<"status",
5830
5830
  status: z.ZodLiteral<"fulfilled">;
5831
5831
  value: z.ZodBranded<z.ZodString, "ProvingJobUri">;
5832
5832
  }, "strip", z.ZodTypeAny, {
5833
- value: string & z.BRAND<"ProvingJobUri">;
5834
5833
  status: "fulfilled";
5834
+ value: string & z.BRAND<"ProvingJobUri">;
5835
5835
  }, {
5836
- value: string;
5837
5836
  status: "fulfilled";
5837
+ value: string;
5838
5838
  }>, z.ZodObject<{
5839
5839
  status: z.ZodLiteral<"rejected">;
5840
5840
  reason: z.ZodString;
@@ -5868,11 +5868,11 @@ export declare const ProvingJobStatus: z.ZodDiscriminatedUnion<"status", [z.ZodO
5868
5868
  status: z.ZodLiteral<"fulfilled">;
5869
5869
  value: z.ZodBranded<z.ZodString, "ProvingJobUri">;
5870
5870
  }, "strip", z.ZodTypeAny, {
5871
- value: string & z.BRAND<"ProvingJobUri">;
5872
5871
  status: "fulfilled";
5872
+ value: string & z.BRAND<"ProvingJobUri">;
5873
5873
  }, {
5874
- value: string;
5875
5874
  status: "fulfilled";
5875
+ value: string;
5876
5876
  }>, z.ZodObject<{
5877
5877
  status: z.ZodLiteral<"rejected">;
5878
5878
  reason: z.ZodString;
@@ -0,0 +1,10 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { CommitteeAttestation } from '../block/index.js';
3
+ import type { BlockAttestation } from './block_attestation.js';
4
+ /**
5
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
6
+ * The rollup smart contract expects attestations to appear in the order of the committee
7
+ * @todo: perform this logic within the memory attestation store instead?
8
+ */
9
+ export declare function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]): CommitteeAttestation[];
10
+ //# sourceMappingURL=attestation_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,gBAAgB,EAAE,EAChC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB"}
@@ -0,0 +1,21 @@
1
+ import { CommitteeAttestation } from '../block/index.js';
2
+ /**
3
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
4
+ * The rollup smart contract expects attestations to appear in the order of the committee
5
+ * @todo: perform this logic within the memory attestation store instead?
6
+ */ export function orderAttestations(attestations, orderAddresses) {
7
+ // Create a map of sender addresses to BlockAttestations
8
+ const attestationMap = new Map();
9
+ for (const attestation of attestations){
10
+ const sender = attestation.getSender();
11
+ if (sender) {
12
+ attestationMap.set(sender.toString(), CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature));
13
+ }
14
+ }
15
+ // Create the ordered array based on the orderAddresses, else return an empty attestation
16
+ const orderedAttestations = orderAddresses.map((address)=>{
17
+ const addressString = address.toString();
18
+ return attestationMap.get(addressString) || CommitteeAttestation.fromAddress(address);
19
+ });
20
+ return orderedAttestations;
21
+ }
@@ -37,10 +37,9 @@ export declare class BlockAttestation extends Gossipable {
37
37
  generateP2PMessageIdentifier(): Promise<Buffer32>;
38
38
  get archive(): Fr;
39
39
  get slotNumber(): Fr;
40
- /**Get sender
41
- *
42
- * Lazily evaluate and cache the sender of the attestation
43
- * @returns The sender of the attestation
40
+ /**
41
+ * Lazily evaluate and cache the signer of the attestation
42
+ * @returns The signer of the attestation
44
43
  */
45
44
  getSender(): EthAddress;
46
45
  getPayload(): Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"block_attestation.d.ts","sourceRoot":"","sources":["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AAE,SAAS;IAKtC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAQ5C;IAEQ,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI1D,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,EAAE,CAEnB;IAED;;;OAGG;IACH,SAAS,IAAI,UAAU;IAWvB,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAK/D,MAAM,CAAC,KAAK,IAAI,gBAAgB;IAIhC,OAAO,IAAI,MAAM;CAGlB"}
@@ -43,10 +43,9 @@ export class BlockAttestationHash extends Buffer32 {
43
43
  get slotNumber() {
44
44
  return this.payload.header.slotNumber;
45
45
  }
46
- /**Get sender
47
- *
48
- * Lazily evaluate and cache the sender of the attestation
49
- * @returns The sender of the attestation
46
+ /**
47
+ * Lazily evaluate and cache the signer of the attestation
48
+ * @returns The signer of the attestation
50
49
  */ getSender() {
51
50
  if (!this.sender) {
52
51
  // Recover the sender from the attestation
@@ -1,3 +1,4 @@
1
+ export * from './attestation_utils.js';
1
2
  export * from './block_attestation.js';
2
3
  export * from './block_proposal.js';
3
4
  export * from './consensus_payload.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/p2p/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/p2p/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
package/dest/p2p/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './attestation_utils.js';
1
2
  export * from './block_attestation.js';
2
3
  export * from './block_proposal.js';
3
4
  export * from './consensus_payload.js';
@@ -2,6 +2,7 @@ import { Secp256k1Signer } from '@aztec/foundation/crypto';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { ContractArtifact } from '../abi/abi.js';
4
4
  import { AztecAddress } from '../aztec-address/index.js';
5
+ import { L2Block } from '../block/l2_block.js';
5
6
  import type { PublishedL2Block } from '../block/published_l2_block.js';
6
7
  import type { ContractInstanceWithAddress } from '../contract/index.js';
7
8
  import { GasFees } from '../gas/gas_fees.js';
@@ -49,6 +50,7 @@ export interface MakeConsensusPayloadOptions {
49
50
  }
50
51
  export declare const makeBlockProposal: (options?: MakeConsensusPayloadOptions) => BlockProposal;
51
52
  export declare const makeBlockAttestation: (options?: MakeConsensusPayloadOptions) => BlockAttestation;
53
+ export declare const makeBlockAttestationFromBlock: (block: L2Block, signer?: Secp256k1Signer) => BlockAttestation;
52
54
  export declare function randomPublishedL2Block(l2BlockNumber: number, opts?: {
53
55
  signers?: Secp256k1Signer[];
54
56
  }): Promise<PublishedL2Block>;
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,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I,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
@@ -164,6 +164,15 @@ export const makeBlockAttestation = (options)=>{
164
164
  const { blockNumber, payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockAttestation, options);
165
165
  return new BlockAttestation(blockNumber, payload, signature);
166
166
  };
167
+ export const makeBlockAttestationFromBlock = (block, signer)=>{
168
+ return makeBlockAttestation({
169
+ signer,
170
+ header: block.header,
171
+ archive: block.archive.root,
172
+ stateReference: block.header.state,
173
+ txHashes: block.body.txEffects.map((tx)=>tx.txHash)
174
+ });
175
+ };
167
176
  export async function randomPublishedL2Block(l2BlockNumber, opts = {}) {
168
177
  const block = await L2Block.random(l2BlockNumber);
169
178
  const l1 = {
@@ -172,13 +181,7 @@ export async function randomPublishedL2Block(l2BlockNumber, opts = {}) {
172
181
  blockHash: Buffer32.random().toString()
173
182
  };
174
183
  const signers = opts.signers ?? times(3, ()=>Secp256k1Signer.random());
175
- const atts = await Promise.all(signers.map((signer)=>makeBlockAttestation({
176
- signer,
177
- header: block.header,
178
- archive: block.archive.root,
179
- stateReference: block.header.state,
180
- txHashes: block.body.txEffects.map((tx)=>tx.txHash)
181
- })));
184
+ const atts = await Promise.all(signers.map((signer)=>makeBlockAttestationFromBlock(block, signer)));
182
185
  const attestations = atts.map((attestation, i)=>new CommitteeAttestation(signers[i].address, attestation.signature));
183
186
  return {
184
187
  block,
@@ -4,13 +4,13 @@ import { TxEffect } from './tx_effect.js';
4
4
  export type IndexedTxEffect = InBlock<TxEffect> & {
5
5
  txIndexInBlock: number;
6
6
  };
7
- export declare function indexedTxSchema(): import("zod").ZodObject<{
7
+ export declare function indexedTxSchema(): import("zod").ZodObject<import("zod").objectUtil.extendShape<{
8
8
  data: import("@aztec/foundation/schemas").ZodFor<TxEffect>;
9
9
  l2BlockNumber: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
10
10
  l2BlockHash: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
11
- } & {
11
+ }, {
12
12
  txIndexInBlock: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
13
- }, "strip", import("zod").ZodTypeAny, {
13
+ }>, "strip", import("zod").ZodTypeAny, {
14
14
  data: TxEffect;
15
15
  l2BlockNumber: number;
16
16
  l2BlockHash: L2BlockHash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "1.0.0-nightly.20250729",
3
+ "version": "1.0.0-nightly.20250730",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -67,12 +67,12 @@
67
67
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/bb.js": "1.0.0-nightly.20250729",
71
- "@aztec/blob-lib": "1.0.0-nightly.20250729",
72
- "@aztec/constants": "1.0.0-nightly.20250729",
73
- "@aztec/ethereum": "1.0.0-nightly.20250729",
74
- "@aztec/foundation": "1.0.0-nightly.20250729",
75
- "@aztec/noir-noirc_abi": "1.0.0-nightly.20250729",
70
+ "@aztec/bb.js": "1.0.0-nightly.20250730",
71
+ "@aztec/blob-lib": "1.0.0-nightly.20250730",
72
+ "@aztec/constants": "1.0.0-nightly.20250730",
73
+ "@aztec/ethereum": "1.0.0-nightly.20250730",
74
+ "@aztec/foundation": "1.0.0-nightly.20250730",
75
+ "@aztec/noir-noirc_abi": "1.0.0-nightly.20250730",
76
76
  "@google-cloud/storage": "^7.15.0",
77
77
  "axios": "^1.9.0",
78
78
  "json-stringify-deterministic": "1.0.12",
@@ -32,6 +32,10 @@ export class CommitteeAttestation {
32
32
  return new CommitteeAttestation(address, signature);
33
33
  }
34
34
 
35
+ static fromSignature(signature: Signature): CommitteeAttestation {
36
+ return new CommitteeAttestation(EthAddress.ZERO, signature);
37
+ }
38
+
35
39
  static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation {
36
40
  return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
37
41
  }
@@ -1,4 +1,6 @@
1
1
  // Ignoring import issue to fix portable inferred type issue in zod schema
2
+ import { Buffer32 } from '@aztec/foundation/buffer';
3
+ import { randomBigInt } from '@aztec/foundation/crypto';
2
4
  import { schemas } from '@aztec/foundation/schemas';
3
5
 
4
6
  import { z } from 'zod';
@@ -22,6 +24,14 @@ export class L1PublishedData {
22
24
  blockHash: z.string(),
23
25
  });
24
26
  }
27
+
28
+ static random() {
29
+ return new L1PublishedData(
30
+ randomBigInt(1000n) + 1n,
31
+ BigInt(Math.floor(Date.now() / 1000)),
32
+ Buffer32.random().toString(),
33
+ );
34
+ }
25
35
  }
26
36
 
27
37
  export class PublishedL2Block {
@@ -40,12 +50,11 @@ export class PublishedL2Block {
40
50
  }
41
51
  }
42
52
 
43
- export function getAttestationsFromPublishedL2Block(block: PublishedL2Block) {
53
+ export function getAttestationsFromPublishedL2Block(
54
+ block: Pick<PublishedL2Block, 'attestations' | 'block'>,
55
+ ): BlockAttestation[] {
44
56
  const payload = ConsensusPayload.fromBlock(block.block);
45
57
  return block.attestations
46
58
  .filter(attestation => !attestation.signature.isEmpty())
47
- .map(
48
- attestation =>
49
- new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature),
50
- );
59
+ .map(attestation => new BlockAttestation(block.block.number, payload, attestation.signature));
51
60
  }
@@ -0,0 +1,35 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+
3
+ import { CommitteeAttestation } from '../block/index.js';
4
+ import type { BlockAttestation } from './block_attestation.js';
5
+
6
+ /**
7
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
8
+ * The rollup smart contract expects attestations to appear in the order of the committee
9
+ * @todo: perform this logic within the memory attestation store instead?
10
+ */
11
+ export function orderAttestations(
12
+ attestations: BlockAttestation[],
13
+ orderAddresses: EthAddress[],
14
+ ): CommitteeAttestation[] {
15
+ // Create a map of sender addresses to BlockAttestations
16
+ const attestationMap = new Map<string, CommitteeAttestation>();
17
+
18
+ for (const attestation of attestations) {
19
+ const sender = attestation.getSender();
20
+ if (sender) {
21
+ attestationMap.set(
22
+ sender.toString(),
23
+ CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature),
24
+ );
25
+ }
26
+ }
27
+
28
+ // Create the ordered array based on the orderAddresses, else return an empty attestation
29
+ const orderedAttestations = orderAddresses.map(address => {
30
+ const addressString = address.toString();
31
+ return attestationMap.get(addressString) || CommitteeAttestation.fromAddress(address);
32
+ });
33
+
34
+ return orderedAttestations;
35
+ }
@@ -66,10 +66,9 @@ export class BlockAttestation extends Gossipable {
66
66
  return this.payload.header.slotNumber;
67
67
  }
68
68
 
69
- /**Get sender
70
- *
71
- * Lazily evaluate and cache the sender of the attestation
72
- * @returns The sender of the attestation
69
+ /**
70
+ * Lazily evaluate and cache the signer of the attestation
71
+ * @returns The signer of the attestation
73
72
  */
74
73
  getSender(): EthAddress {
75
74
  if (!this.sender) {
package/src/p2p/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './attestation_utils.js';
1
2
  export * from './block_attestation.js';
2
3
  export * from './block_proposal.js';
3
4
  export * from './consensus_payload.js';
@@ -291,6 +291,16 @@ export const makeBlockAttestation = (options?: MakeConsensusPayloadOptions): Blo
291
291
  return new BlockAttestation(blockNumber, payload, signature);
292
292
  };
293
293
 
294
+ export const makeBlockAttestationFromBlock = (block: L2Block, signer?: Secp256k1Signer): BlockAttestation => {
295
+ return makeBlockAttestation({
296
+ signer,
297
+ header: block.header,
298
+ archive: block.archive.root,
299
+ stateReference: block.header.state,
300
+ txHashes: block.body.txEffects.map(tx => tx.txHash),
301
+ });
302
+ };
303
+
294
304
  export async function randomPublishedL2Block(
295
305
  l2BlockNumber: number,
296
306
  opts: { signers?: Secp256k1Signer[] } = {},
@@ -303,17 +313,7 @@ export async function randomPublishedL2Block(
303
313
  };
304
314
 
305
315
  const signers = opts.signers ?? times(3, () => Secp256k1Signer.random());
306
- const atts = await Promise.all(
307
- signers.map(signer =>
308
- makeBlockAttestation({
309
- signer,
310
- header: block.header,
311
- archive: block.archive.root,
312
- stateReference: block.header.state,
313
- txHashes: block.body.txEffects.map(tx => tx.txHash),
314
- }),
315
- ),
316
- );
316
+ const atts = await Promise.all(signers.map(signer => makeBlockAttestationFromBlock(block, signer)));
317
317
  const attestations = atts.map(
318
318
  (attestation, i) => new CommitteeAttestation(signers[i].address, attestation.signature),
319
319
  );