@aztec/stdlib 2.0.3 → 2.1.0-rc.10

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.
Files changed (97) hide show
  1. package/dest/block/in_block.d.ts +5 -5
  2. package/dest/block/in_block.d.ts.map +1 -1
  3. package/dest/block/proposal/attestations_and_signers.d.ts +48 -0
  4. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -0
  5. package/dest/block/proposal/attestations_and_signers.js +99 -0
  6. package/dest/block/proposal/committee_attestation.d.ts +1 -0
  7. package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
  8. package/dest/block/proposal/committee_attestation.js +3 -0
  9. package/dest/block/proposal/index.d.ts +1 -0
  10. package/dest/block/proposal/index.d.ts.map +1 -1
  11. package/dest/block/proposal/index.js +1 -0
  12. package/dest/block/published_l2_block.d.ts +5 -1
  13. package/dest/block/published_l2_block.d.ts.map +1 -1
  14. package/dest/block/published_l2_block.js +5 -2
  15. package/dest/contract/interfaces/contract_class.d.ts +3 -3
  16. package/dest/epoch-helpers/index.d.ts +2 -0
  17. package/dest/epoch-helpers/index.d.ts.map +1 -1
  18. package/dest/epoch-helpers/index.js +3 -0
  19. package/dest/file-store/factory.d.ts.map +1 -1
  20. package/dest/file-store/factory.js +18 -0
  21. package/dest/file-store/interface.d.ts +8 -2
  22. package/dest/file-store/interface.d.ts.map +1 -1
  23. package/dest/file-store/s3.d.ts +26 -0
  24. package/dest/file-store/s3.d.ts.map +1 -0
  25. package/dest/file-store/s3.js +252 -0
  26. package/dest/interfaces/aztec-node-admin.d.ts +16 -7
  27. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  28. package/dest/interfaces/block-builder.d.ts +1 -0
  29. package/dest/interfaces/block-builder.d.ts.map +1 -1
  30. package/dest/interfaces/configs.d.ts +5 -0
  31. package/dest/interfaces/configs.d.ts.map +1 -1
  32. package/dest/interfaces/configs.js +2 -1
  33. package/dest/interfaces/proving-job.d.ts +6 -6
  34. package/dest/interfaces/slasher.d.ts +4 -0
  35. package/dest/interfaces/slasher.d.ts.map +1 -1
  36. package/dest/interfaces/slasher.js +1 -0
  37. package/dest/interfaces/validator.d.ts +9 -2
  38. package/dest/interfaces/validator.d.ts.map +1 -1
  39. package/dest/interfaces/validator.js +2 -1
  40. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  41. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  42. package/dest/l1-contracts/slash_factory.js +1 -1
  43. package/dest/p2p/block_attestation.d.ts +35 -0
  44. package/dest/p2p/block_attestation.d.ts.map +1 -1
  45. package/dest/p2p/block_attestation.js +17 -0
  46. package/dest/p2p/consensus_payload.d.ts +27 -0
  47. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  48. package/dest/p2p/consensus_payload.js +11 -1
  49. package/dest/p2p/gossipable.d.ts +2 -4
  50. package/dest/p2p/gossipable.d.ts.map +1 -1
  51. package/dest/p2p/gossipable.js +5 -14
  52. package/dest/p2p/signature_utils.d.ts +2 -1
  53. package/dest/p2p/signature_utils.d.ts.map +1 -1
  54. package/dest/p2p/signature_utils.js +1 -0
  55. package/dest/slashing/types.d.ts +1 -0
  56. package/dest/slashing/types.d.ts.map +1 -1
  57. package/dest/slashing/types.js +22 -0
  58. package/dest/snapshots/download.d.ts.map +1 -1
  59. package/dest/snapshots/download.js +58 -2
  60. package/dest/snapshots/upload.d.ts.map +1 -1
  61. package/dest/snapshots/upload.js +1 -0
  62. package/dest/tests/mocks.d.ts +2 -0
  63. package/dest/tests/mocks.d.ts.map +1 -1
  64. package/dest/tests/mocks.js +4 -0
  65. package/dest/tx/indexed_tx_effect.d.ts +3 -3
  66. package/dest/tx/proposed_block_header.d.ts +1 -0
  67. package/dest/tx/proposed_block_header.d.ts.map +1 -1
  68. package/dest/tx/proposed_block_header.js +3 -0
  69. package/dest/tx/state_reference.js +1 -1
  70. package/dest/tx/tx.d.ts +0 -7
  71. package/dest/tx/tx.d.ts.map +1 -1
  72. package/dest/tx/tx.js +0 -8
  73. package/package.json +11 -10
  74. package/src/block/proposal/attestations_and_signers.ts +121 -0
  75. package/src/block/proposal/committee_attestation.ts +4 -0
  76. package/src/block/proposal/index.ts +1 -0
  77. package/src/block/published_l2_block.ts +10 -4
  78. package/src/epoch-helpers/index.ts +8 -0
  79. package/src/file-store/factory.ts +15 -0
  80. package/src/file-store/interface.ts +8 -2
  81. package/src/file-store/s3.ts +254 -0
  82. package/src/interfaces/block-builder.ts +1 -0
  83. package/src/interfaces/configs.ts +3 -0
  84. package/src/interfaces/slasher.ts +2 -0
  85. package/src/interfaces/validator.ts +12 -2
  86. package/src/l1-contracts/slash_factory.ts +1 -1
  87. package/src/p2p/block_attestation.ts +20 -0
  88. package/src/p2p/consensus_payload.ts +17 -1
  89. package/src/p2p/gossipable.ts +6 -16
  90. package/src/p2p/signature_utils.ts +1 -0
  91. package/src/slashing/types.ts +23 -0
  92. package/src/snapshots/download.ts +66 -2
  93. package/src/snapshots/upload.ts +1 -0
  94. package/src/tests/mocks.ts +12 -0
  95. package/src/tx/proposed_block_header.ts +13 -0
  96. package/src/tx/state_reference.ts +1 -1
  97. package/src/tx/tx.ts +0 -10
@@ -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, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
15
+ }, "strip", ZodTypeAny, 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>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
19
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: 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]; }, { [k_1 in keyof z.baseObjectInputType<{
23
+ }>, any>[k]; } : never, 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
- }>]: z.baseObjectInputType<{
27
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: 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]; }>;
31
+ }>[k_1]; } : never>;
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,UA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C,CAMjF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;oBAM/D"}
@@ -0,0 +1,48 @@
1
+ import type { ViemCommitteeAttestations } from '@aztec/ethereum';
2
+ import { z } from 'zod';
3
+ import type { Signable, SignatureDomainSeparator } from '../../p2p/signature_utils.js';
4
+ import { CommitteeAttestation } from './committee_attestation.js';
5
+ export declare class CommitteeAttestationsAndSigners implements Signable {
6
+ attestations: CommitteeAttestation[];
7
+ constructor(attestations: CommitteeAttestation[]);
8
+ static get schema(): z.ZodEffects<z.ZodObject<{
9
+ attestations: z.ZodArray<z.ZodEffects<z.ZodObject<{
10
+ address: z.ZodType<import("./committee_attestation.js").EthAddress, any, string>;
11
+ signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, import("./committee_attestation.js").Signature, string>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ address: import("./committee_attestation.js").EthAddress;
14
+ signature: import("./committee_attestation.js").Signature;
15
+ }, {
16
+ address: string;
17
+ signature: string;
18
+ }>, CommitteeAttestation, {
19
+ address: string;
20
+ signature: string;
21
+ }>, "many">;
22
+ }, "strip", z.ZodTypeAny, {
23
+ attestations: CommitteeAttestation[];
24
+ }, {
25
+ attestations: {
26
+ address: string;
27
+ signature: string;
28
+ }[];
29
+ }>, CommitteeAttestationsAndSigners, {
30
+ attestations: {
31
+ address: string;
32
+ signature: string;
33
+ }[];
34
+ }>;
35
+ getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer;
36
+ static empty(): CommitteeAttestationsAndSigners;
37
+ toString(): string;
38
+ getSigners(): import("./committee_attestation.js").EthAddress[];
39
+ getSignedAttestations(): CommitteeAttestation[];
40
+ /**
41
+ * Packs an array of committee attestations into the format expected by the Solidity contract
42
+ *
43
+ * @param attestations - Array of committee attestations with addresses and signatures
44
+ * @returns Packed attestations with bitmap and tightly packed signature/address data
45
+ */
46
+ getPackedAttestations(): ViemCommitteeAttestations;
47
+ }
48
+ //# sourceMappingURL=attestations_and_signers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestations_and_signers.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/attestations_and_signers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAIjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,+BAAgC,YAAW,QAAQ;IAC3C,YAAY,EAAE,oBAAoB,EAAE;gBAApC,YAAY,EAAE,oBAAoB,EAAE;IAEvD,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;OAMhB;IAED,gBAAgB,CAAC,eAAe,EAAE,wBAAwB,GAAG,MAAM;IAanE,MAAM,CAAC,KAAK,IAAI,+BAA+B;IAI/C,QAAQ;IAIR,UAAU;IAIV,qBAAqB;IAIrB;;;;;OAKG;IACH,qBAAqB,IAAI,yBAAyB;CAiEnD"}
@@ -0,0 +1,99 @@
1
+ import { hexToBuffer } from '@aztec/foundation/string';
2
+ import { encodeAbiParameters, parseAbiParameters } from '@spalladino/viem';
3
+ import { z } from 'zod';
4
+ import { CommitteeAttestation } from './committee_attestation.js';
5
+ export class CommitteeAttestationsAndSigners {
6
+ attestations;
7
+ constructor(attestations){
8
+ this.attestations = attestations;
9
+ }
10
+ static get schema() {
11
+ return z.object({
12
+ attestations: CommitteeAttestation.schema.array()
13
+ }).transform((obj)=>new CommitteeAttestationsAndSigners(obj.attestations));
14
+ }
15
+ getPayloadToSign(domainSeparator) {
16
+ const abi = parseAbiParameters('uint8,(bytes,bytes),address[]');
17
+ const packed = this.getPackedAttestations();
18
+ const encodedData = encodeAbiParameters(abi, [
19
+ domainSeparator,
20
+ [
21
+ packed.signatureIndices,
22
+ packed.signaturesOrAddresses
23
+ ],
24
+ this.getSigners().map((s)=>s.toString())
25
+ ]);
26
+ return hexToBuffer(encodedData);
27
+ }
28
+ static empty() {
29
+ return new CommitteeAttestationsAndSigners([]);
30
+ }
31
+ toString() {
32
+ return `CommitteeAttestationsAndSigners(${this.attestations.map((a)=>a.toString()).join(',')})`;
33
+ }
34
+ getSigners() {
35
+ return this.attestations.filter((a)=>!a.signature.isEmpty()).map((a)=>a.address);
36
+ }
37
+ getSignedAttestations() {
38
+ return this.attestations.filter((a)=>!a.signature.isEmpty());
39
+ }
40
+ /**
41
+ * Packs an array of committee attestations into the format expected by the Solidity contract
42
+ *
43
+ * @param attestations - Array of committee attestations with addresses and signatures
44
+ * @returns Packed attestations with bitmap and tightly packed signature/address data
45
+ */ getPackedAttestations() {
46
+ const length = this.attestations.length;
47
+ const attestations = this.attestations.map((a)=>a.toViem());
48
+ // Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
49
+ const bitmapSize = Math.ceil(length / 8);
50
+ const signatureIndices = new Uint8Array(bitmapSize);
51
+ // Calculate total data size needed
52
+ let totalDataSize = 0;
53
+ for(let i = 0; i < length; i++){
54
+ const signature = attestations[i].signature;
55
+ // Check if signature is empty (v = 0)
56
+ const isEmpty = signature.v === 0;
57
+ if (!isEmpty) {
58
+ totalDataSize += 65; // v (1) + r (32) + s (32)
59
+ } else {
60
+ totalDataSize += 20; // address only
61
+ }
62
+ }
63
+ const signaturesOrAddresses = new Uint8Array(totalDataSize);
64
+ let dataIndex = 0;
65
+ // Pack the data
66
+ for(let i = 0; i < length; i++){
67
+ const attestation = attestations[i];
68
+ const signature = attestation.signature;
69
+ // Check if signature is empty
70
+ const isEmpty = signature.v === 0;
71
+ if (!isEmpty) {
72
+ // Set bit in bitmap (bit 7-0 in each byte, left to right)
73
+ const byteIndex = Math.floor(i / 8);
74
+ const bitIndex = 7 - i % 8;
75
+ signatureIndices[byteIndex] |= 1 << bitIndex;
76
+ // Pack signature: v + r + s
77
+ signaturesOrAddresses[dataIndex] = signature.v;
78
+ dataIndex++;
79
+ // Pack r (32 bytes)
80
+ const rBytes = Buffer.from(signature.r.slice(2), 'hex');
81
+ signaturesOrAddresses.set(rBytes, dataIndex);
82
+ dataIndex += 32;
83
+ // Pack s (32 bytes)
84
+ const sBytes = Buffer.from(signature.s.slice(2), 'hex');
85
+ signaturesOrAddresses.set(sBytes, dataIndex);
86
+ dataIndex += 32;
87
+ } else {
88
+ // Pack address only (20 bytes)
89
+ const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
90
+ signaturesOrAddresses.set(addrBytes, dataIndex);
91
+ dataIndex += 20;
92
+ }
93
+ }
94
+ return {
95
+ signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
96
+ signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`
97
+ };
98
+ }
99
+ }
@@ -31,6 +31,7 @@ export declare class CommitteeAttestation {
31
31
  static fromPacked(packed: ViemCommitteeAttestations, committeeSize: number): CommitteeAttestation[];
32
32
  toBuffer(): Buffer;
33
33
  equals(other: CommitteeAttestation): boolean;
34
+ toString(): string;
34
35
  toViem(): ViemCommitteeAttestation;
35
36
  }
36
37
  //# sourceMappingURL=committee_attestation.d.ts.map
@@ -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,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EA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AE,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,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,wBAAwB;CAMnC"}
@@ -92,6 +92,9 @@ export class CommitteeAttestation {
92
92
  equals(other) {
93
93
  return this.address.equals(other.address) && this.signature.equals(other.signature);
94
94
  }
95
+ toString() {
96
+ return `CommitteeAttestation(${this.address.toString()}, ${this.signature.toString()})`;
97
+ }
95
98
  toViem() {
96
99
  return {
97
100
  addr: this.address.toString(),
@@ -1,2 +1,3 @@
1
1
  export * from './committee_attestation.js';
2
+ export * from './attestations_and_signers.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from './committee_attestation.js';
2
+ export * from './attestations_and_signers.js';
@@ -141,5 +141,9 @@ export declare class PublishedL2Block {
141
141
  static fromFields(fields: FieldsOf<PublishedL2Block>): PublishedL2Block;
142
142
  toBuffer(): Buffer;
143
143
  }
144
- export declare function getAttestationsFromPublishedL2Block(block: Pick<PublishedL2Block, 'attestations' | 'block'>): BlockAttestation[];
144
+ /**
145
+ * Extracts block attestations from a published L2 block.
146
+ * Returns undefined for attestations with empty signatures, preserving array indices.
147
+ */
148
+ export declare function getAttestationsFromPublishedL2Block(block: Pick<PublishedL2Block, 'attestations' | 'block'>): (BlockAttestation | undefined)[];
145
149
  //# 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":"AAIA,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,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,M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SAAS,EAAE,MAAM;gBAFjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM;IAG1B,MAAM,KAAK,MAAM;;;;;;;;;;;;OAMhB;IAED,MAAM,CAAC,MAAM;IAQb,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC;CAGpD;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAQhB;IAED,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAU1E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAI7C,QAAQ,IAAI,MAAM;CAU1B;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,OAAO,CAAC,GACtD,CAAC,gBAAgB,GAAG,SAAS,CAAC,EAAE,CAOlC"}
@@ -63,7 +63,10 @@ export class PublishedL2Block {
63
63
  return serializeToBuffer(this.block, this.l1.blockNumber, this.l1.blockHash, this.l1.timestamp, this.attestations.length, this.attestations);
64
64
  }
65
65
  }
66
- export function getAttestationsFromPublishedL2Block(block) {
66
+ /**
67
+ * Extracts block attestations from a published L2 block.
68
+ * Returns undefined for attestations with empty signatures, preserving array indices.
69
+ */ export function getAttestationsFromPublishedL2Block(block) {
67
70
  const payload = ConsensusPayload.fromBlock(block.block);
68
- return block.attestations.filter((attestation)=>!attestation.signature.isEmpty()).map((attestation)=>new BlockAttestation(block.block.number, payload, attestation.signature));
71
+ return block.attestations.map((attestation)=>attestation.signature.isEmpty() ? undefined : new BlockAttestation(block.block.number, payload, attestation.signature));
69
72
  }
@@ -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<z.objectUtil.extendShape<{
123
+ export declare const ContractClassWithIdSchema: z.ZodObject<{
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<z.objectUtil.extendS
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;
@@ -59,4 +59,6 @@ export declare function getProofSubmissionDeadlineEpoch(epochNumber: bigint, con
59
59
  * Computed as the start of the given epoch plus the proof submission window.
60
60
  */
61
61
  export declare function getProofSubmissionDeadlineTimestamp(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'proofSubmissionEpochs'>): bigint;
62
+ /** Returns the timestamp to start building a block for a given L2 slot. Computed as the start timestamp of the slot minus one L1 slot duration. */
63
+ export declare function getSlotStartBuildTimestamp(slotNumber: number | bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>): number;
62
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/epoch-helpers/index.ts"],"names":[],"mappings":"A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AM,CAER"}
@@ -68,3 +68,6 @@ export const L1RollupConstantsSchema = z.object({
68
68
  const [deadlineSlot] = getSlotRangeForEpoch(deadlineEpoch, constants);
69
69
  return getTimestampForSlot(deadlineSlot, constants);
70
70
  }
71
+ /** Returns the timestamp to start building a block for a given L2 slot. Computed as the start timestamp of the slot minus one L1 slot duration. */ export function getSlotStartBuildTimestamp(slotNumber, constants) {
72
+ return Number(constants.l1GenesisTime) + Number(slotNumber) * constants.slotDuration - constants.ethereumSlotDuration;
73
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIlE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AASnE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3F,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAgC9F,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC3G,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIlE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAWnE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3F,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AA6C9F,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC3G,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -2,8 +2,10 @@ import { createLogger } from '@aztec/foundation/log';
2
2
  import { GoogleCloudFileStore } from './gcs.js';
3
3
  import { HttpFileStore } from './http.js';
4
4
  import { LocalFileStore } from './local.js';
5
+ import { S3FileStore } from './s3.js';
5
6
  const supportedExamples = [
6
7
  `gs://bucket-name/path/to/store`,
8
+ `s3://bucket-name/path/to/store`,
7
9
  `file:///absolute/local/path/to/store`,
8
10
  `https://host/path`
9
11
  ];
@@ -30,6 +32,22 @@ export async function createFileStore(config, logger = createLogger('stdlib:file
30
32
  } catch {
31
33
  throw new Error(`Invalid google cloud store definition: '${config}'.`);
32
34
  }
35
+ } else if (config.startsWith('s3://')) {
36
+ try {
37
+ const url = new URL(config);
38
+ const bucket = url.host;
39
+ const path = url.pathname.replace(/^\/+/, '');
40
+ const endpoint = url.searchParams.get('endpoint');
41
+ const publicBaseUrl = url.searchParams.get('publicBaseUrl') ?? undefined;
42
+ logger.info(`Creating S3 file store at ${bucket} ${path}`);
43
+ const store = new S3FileStore(bucket, path, {
44
+ endpoint: endpoint ?? undefined,
45
+ publicBaseUrl
46
+ });
47
+ return store;
48
+ } catch {
49
+ throw new Error(`Invalid S3 store definition: '${config}'.`);
50
+ }
33
51
  } else {
34
52
  throw new Error(`Unknown file store config: '${config}'. Supported values are ${supportedExamples.join(', ')}.`);
35
53
  }
@@ -14,9 +14,15 @@ export type FileStoreSaveOptions = {
14
14
  };
15
15
  /** Simple file store. */
16
16
  export interface FileStore extends ReadOnlyFileStore {
17
- /** Saves contents to the given path. Returns an URI that can be used later to `read` the file. */
17
+ /**
18
+ * Saves contents to the given path. Returns an URI that can be used later to `read` the file.
19
+ * Default: `compress` is false unless explicitly set.
20
+ */
18
21
  save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string>;
19
- /** Uploads contents from a local file. Returns an URI that can be used later to `read` the file. */
22
+ /**
23
+ * Uploads contents from a local file. Returns an URI that can be used later to `read` the file.
24
+ * Default: `compress` is true unless explicitly set to false.
25
+ */
20
26
  upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string>;
21
27
  }
22
28
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/file-store/interface.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAChC,iGAAiG;IACjG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,8DAA8D;IAC9D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,oBAAoB,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/G,yBAAyB;AACzB,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IAClD,kGAAkG;IAClG,IAAI,CAAC,IAAI,EAAE,MAAM,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undation/log';
2
+ import type { FileStore, FileStoreSaveOptions } from './interface.js';
3
+ export declare class S3FileStore implements FileStore {
4
+ private readonly bucketName;
5
+ private readonly basePath;
6
+ private readonly log;
7
+ private readonly s3;
8
+ private readonly region;
9
+ private readonly endpoint?;
10
+ private readonly publicBaseUrl?;
11
+ constructor(bucketName: string, basePath: string, opts: {
12
+ endpoint?: string;
13
+ publicBaseUrl?: string;
14
+ }, log?: Logger);
15
+ save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string>;
16
+ upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string>;
17
+ read(pathOrUrlStr: string): Promise<Buffer>;
18
+ download(pathOrUrlStr: string, destPath: string): Promise<void>;
19
+ exists(pathOrUrlStr: string): Promise<boolean>;
20
+ private extractUserMetadata;
21
+ private detectContentType;
22
+ private buildReturnedUrl;
23
+ private getBucketAndKey;
24
+ private getFullPath;
25
+ }
26
+ //# sourceMappingURL=s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../src/file-store/s3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAiBlE,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAMtE,qBAAa,WAAY,YAAW,SAAS;IAOzC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IATtB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;gBAGrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EACjC,IAAI,EAAE;Q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