@aztec/stdlib 2.1.0-rc.20 → 2.1.0-rc.22

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 (38) hide show
  1. package/dest/block/l2_block_source.d.ts +29 -0
  2. package/dest/block/l2_block_source.d.ts.map +1 -1
  3. package/dest/interfaces/archiver.d.ts +1 -1
  4. package/dest/interfaces/archiver.d.ts.map +1 -1
  5. package/dest/interfaces/archiver.js +7 -0
  6. package/dest/interfaces/aztec-node-admin.d.ts +35 -34
  7. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  8. package/dest/interfaces/aztec-node-admin.js +2 -2
  9. package/dest/interfaces/aztec-node.d.ts +24 -0
  10. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  11. package/dest/interfaces/aztec-node.js +4 -0
  12. package/dest/interfaces/tx_provider.d.ts +1 -1
  13. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  14. package/dest/interfaces/validator.d.ts +93 -1
  15. package/dest/interfaces/validator.d.ts.map +1 -1
  16. package/dest/interfaces/validator.js +6 -0
  17. package/dest/p2p/block_attestation.d.ts +4 -15
  18. package/dest/p2p/block_attestation.d.ts.map +1 -1
  19. package/dest/p2p/block_attestation.js +11 -26
  20. package/dest/p2p/block_proposal.d.ts +4 -8
  21. package/dest/p2p/block_proposal.d.ts.map +1 -1
  22. package/dest/p2p/block_proposal.js +10 -13
  23. package/dest/tests/mocks.d.ts.map +1 -1
  24. package/dest/tests/mocks.js +4 -4
  25. package/dest/zkpassport/index.d.ts +15 -9
  26. package/dest/zkpassport/index.d.ts.map +1 -1
  27. package/dest/zkpassport/index.js +17 -11
  28. package/package.json +8 -8
  29. package/src/block/l2_block_source.ts +32 -0
  30. package/src/interfaces/archiver.ts +9 -1
  31. package/src/interfaces/aztec-node-admin.ts +2 -2
  32. package/src/interfaces/aztec-node.ts +36 -0
  33. package/src/interfaces/tx_provider.ts +1 -0
  34. package/src/interfaces/validator.ts +14 -1
  35. package/src/p2p/block_attestation.ts +12 -36
  36. package/src/p2p/block_proposal.ts +9 -16
  37. package/src/tests/mocks.ts +4 -7
  38. package/src/zkpassport/index.ts +40 -28
@@ -1,9 +1,8 @@
1
1
  import { Buffer32 } from '@aztec/foundation/buffer';
2
- import { keccak256, recoverAddress } from '@aztec/foundation/crypto';
2
+ import { keccak256, tryRecoverAddress } from '@aztec/foundation/crypto';
3
3
  import { Signature } from '@aztec/foundation/eth-signature';
4
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
5
  import { z } from 'zod';
6
- import { schemas } from '../schemas/index.js';
7
6
  import { ConsensusPayload } from './consensus_payload.js';
8
7
  import { Gossipable } from './gossipable.js';
9
8
  import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
@@ -19,23 +18,21 @@ export class BlockAttestationHash extends Buffer32 {
19
18
  * A validator that has attested to seeing the contents of a block
20
19
  * will produce a block attestation over the header of the block
21
20
  */ export class BlockAttestation extends Gossipable {
22
- blockNumber;
23
21
  payload;
24
22
  signature;
25
23
  proposerSignature;
26
24
  static p2pTopic = TopicType.block_attestation;
27
25
  sender;
28
26
  proposer;
29
- constructor(/** The block number of the attestation. */ blockNumber, /** The payload of the message, and what the signature is over */ payload, /** The signature of the block attester */ signature, /** The signature from the block proposer */ proposerSignature){
30
- super(), this.blockNumber = blockNumber, this.payload = payload, this.signature = signature, this.proposerSignature = proposerSignature;
27
+ constructor(/** The payload of the message, and what the signature is over */ payload, /** The signature of the block attester */ signature, /** The signature from the block proposer */ proposerSignature){
28
+ super(), this.payload = payload, this.signature = signature, this.proposerSignature = proposerSignature;
31
29
  }
32
30
  static get schema() {
33
31
  return z.object({
34
- blockNumber: schemas.UInt32,
35
32
  payload: ConsensusPayload.schema,
36
33
  signature: Signature.schema,
37
34
  proposerSignature: Signature.schema
38
- }).transform((obj)=>new BlockAttestation(obj.blockNumber, obj.payload, obj.signature, obj.proposerSignature));
35
+ }).transform((obj)=>new BlockAttestation(obj.payload, obj.signature, obj.proposerSignature));
39
36
  }
40
37
  generateP2PMessageIdentifier() {
41
38
  return Promise.resolve(new BlockAttestationHash(keccak256(this.signature.toBuffer())));
@@ -48,27 +45,17 @@ export class BlockAttestationHash extends Buffer32 {
48
45
  }
49
46
  /**
50
47
  * Lazily evaluate and cache the signer of the attestation
51
- * @returns The signer of the attestation
48
+ * @returns The signer of the attestation, or undefined if signature recovery fails
52
49
  */ getSender() {
53
50
  if (!this.sender) {
54
51
  // Recover the sender from the attestation
55
52
  const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockAttestation);
56
53
  // Cache the sender for later use
57
- this.sender = recoverAddress(hashed, this.signature);
54
+ this.sender = tryRecoverAddress(hashed, this.signature);
58
55
  }
59
56
  return this.sender;
60
57
  }
61
58
  /**
62
- * Tries to get the sender of the attestation
63
- * @returns The sender of the attestation or undefined if it fails during recovery
64
- */ tryGetSender() {
65
- try {
66
- return this.getSender();
67
- } catch {
68
- return undefined;
69
- }
70
- }
71
- /**
72
59
  * Lazily evaluate and cache the proposer of the block
73
60
  * @returns The proposer of the block
74
61
  */ getProposer() {
@@ -76,7 +63,7 @@ export class BlockAttestationHash extends Buffer32 {
76
63
  // Recover the proposer from the proposal signature
77
64
  const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockProposal);
78
65
  // Cache the proposer for later use
79
- this.proposer = recoverAddress(hashed, this.proposerSignature);
66
+ this.proposer = tryRecoverAddress(hashed, this.proposerSignature);
80
67
  }
81
68
  return this.proposer;
82
69
  }
@@ -85,7 +72,6 @@ export class BlockAttestationHash extends Buffer32 {
85
72
  }
86
73
  toBuffer() {
87
74
  return serializeToBuffer([
88
- this.blockNumber,
89
75
  this.payload,
90
76
  this.signature,
91
77
  this.proposerSignature
@@ -93,20 +79,19 @@ export class BlockAttestationHash extends Buffer32 {
93
79
  }
94
80
  static fromBuffer(buf) {
95
81
  const reader = BufferReader.asReader(buf);
96
- return new BlockAttestation(reader.readNumber(), reader.readObject(ConsensusPayload), reader.readObject(Signature), reader.readObject(Signature));
82
+ return new BlockAttestation(reader.readObject(ConsensusPayload), reader.readObject(Signature), reader.readObject(Signature));
97
83
  }
98
84
  static empty() {
99
- return new BlockAttestation(0, ConsensusPayload.empty(), Signature.empty(), Signature.empty());
85
+ return new BlockAttestation(ConsensusPayload.empty(), Signature.empty(), Signature.empty());
100
86
  }
101
87
  static random() {
102
- return new BlockAttestation(Math.floor(Math.random() * 1000) + 1, ConsensusPayload.random(), Signature.random(), Signature.random());
88
+ return new BlockAttestation(ConsensusPayload.random(), Signature.random(), Signature.random());
103
89
  }
104
90
  getSize() {
105
- return 4 /* blockNumber */ + this.payload.getSize() + this.signature.getSize() + this.proposerSignature.getSize();
91
+ return this.payload.getSize() + this.signature.getSize() + this.proposerSignature.getSize();
106
92
  }
107
93
  toInspect() {
108
94
  return {
109
- blockNumber: this.blockNumber,
110
95
  payload: this.payload.toInspect(),
111
96
  signature: this.signature.toString(),
112
97
  proposerSignature: this.proposerSignature.toString()
@@ -6,7 +6,6 @@ import { BufferReader } from '@aztec/foundation/serialize';
6
6
  import type { L2BlockInfo } from '../block/l2_block_info.js';
7
7
  import { TxHash } from '../tx/index.js';
8
8
  import { Tx } from '../tx/tx.js';
9
- import type { UInt32 } from '../types/index.js';
10
9
  import { ConsensusPayload } from './consensus_payload.js';
11
10
  import { Gossipable } from './gossipable.js';
12
11
  import { TopicType } from './topic_type.js';
@@ -23,8 +22,6 @@ export type BlockProposalOptions = {
23
22
  * be included in the head of the chain
24
23
  */
25
24
  export declare class BlockProposal extends Gossipable {
26
- /** The number of the block */
27
- readonly blockNumber: UInt32;
28
25
  /** The payload of the message, and what the signature is over */
29
26
  readonly payload: ConsensusPayload;
30
27
  /** The signer of the BlockProposal over the header of the new block*/
@@ -36,8 +33,6 @@ export declare class BlockProposal extends Gossipable {
36
33
  static p2pTopic: TopicType;
37
34
  private sender;
38
35
  constructor(
39
- /** The number of the block */
40
- blockNumber: UInt32,
41
36
  /** The payload of the message, and what the signature is over */
42
37
  payload: ConsensusPayload,
43
38
  /** The signer of the BlockProposal over the header of the new block*/
@@ -49,12 +44,13 @@ export declare class BlockProposal extends Gossipable {
49
44
  generateP2PMessageIdentifier(): Promise<Buffer32>;
50
45
  get archive(): Fr;
51
46
  get slotNumber(): Fr;
52
- toBlockInfo(): L2BlockInfo;
53
- static createProposalFromSigner(blockNumber: UInt32, payload: ConsensusPayload, txHashes: TxHash[], txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
47
+ toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'>;
48
+ static createProposalFromSigner(payload: ConsensusPayload, txHashes: TxHash[], txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
54
49
  /**Get Sender
55
50
  * Lazily evaluate the sender of the proposal; result is cached
51
+ * @returns The sender address, or undefined if signature recovery fails
56
52
  */
57
- getSender(): EthAddress;
53
+ getSender(): EthAddress | undefined;
58
54
  getPayload(): Buffer<ArrayBufferLike>;
59
55
  toBuffer(): Buffer;
60
56
  static fromBuffer(buf: Buffer | BufferReader): BlockProposal;
@@ -1 +1 @@
1
- {"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC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;IAGlC,oCAAoC;aACpB,GAAG,CAAC,EAAE,EAAE,EAAE;IAhB5B,OAAgB,QAAQ,YAA4B;IAEpD,OAAO,CAAC,MAAM,CAAyB;;IAGrC,iEAAiE;IACjD,OAAO,EAAE,gBAAgB;IAEzC,sEAAsE;IACtD,SAAS,EAAE,SAAS;IAEpC,gDAAgD;IAChC,QAAQ,EAAE,MAAM,EAAE;IAGlC,oCAAoC;IACpB,GAAG,CAAC,EAAE,EAAE,EAAE,YAAA;IAKnB,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI1D,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,EAAE,CAEnB;IAED,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;WAUlC,wBAAwB,CACnC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,MAAM,EAAE,EAElB,GAAG,EAAE,EAAE,EAAE,GAAG,SAAS,EACrB,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,SAAS,CAAC;IAQ1D;;;OAGG;IACH,SAAS,IAAI,UAAU,GAAG,SAAS;IAUnC,UAAU;IAIV,QAAQ,IAAI,MAAM;IASlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa;IAe5D,OAAO,IAAI,MAAM;CASlB"}
@@ -1,5 +1,5 @@
1
1
  import { Buffer32 } from '@aztec/foundation/buffer';
2
- import { keccak256, recoverAddress } from '@aztec/foundation/crypto';
2
+ import { keccak256, tryRecoverAddress } from '@aztec/foundation/crypto';
3
3
  import { Signature } from '@aztec/foundation/eth-signature';
4
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
5
  import { TxHash } from '../tx/index.js';
@@ -19,16 +19,15 @@ export class BlockProposalHash extends Buffer32 {
19
19
  * A block proposal is created by the leader of the chain proposing a sequence of transactions to
20
20
  * be included in the head of the chain
21
21
  */ export class BlockProposal extends Gossipable {
22
- blockNumber;
23
22
  payload;
24
23
  signature;
25
24
  txHashes;
26
25
  txs;
27
26
  static p2pTopic = TopicType.block_proposal;
28
27
  sender;
29
- constructor(/** The number of the block */ blockNumber, /** The payload of the message, and what the signature is over */ payload, /** The signer of the BlockProposal over the header of the new block*/ signature, /** The sequence of transactions in the block */ txHashes, // Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
28
+ constructor(/** The payload of the message, and what the signature is over */ payload, /** The signer of the BlockProposal over the header of the new block*/ signature, /** The sequence of transactions in the block */ txHashes, // Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
30
29
  /** The transactions in the block */ txs){
31
- super(), this.blockNumber = blockNumber, this.payload = payload, this.signature = signature, this.txHashes = txHashes, this.txs = txs;
30
+ super(), this.payload = payload, this.signature = signature, this.txHashes = txHashes, this.txs = txs;
32
31
  }
33
32
  generateP2PMessageIdentifier() {
34
33
  return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
@@ -41,7 +40,6 @@ export class BlockProposalHash extends Buffer32 {
41
40
  }
42
41
  toBlockInfo() {
43
42
  return {
44
- blockNumber: this.blockNumber,
45
43
  slotNumber: this.slotNumber.toNumber(),
46
44
  lastArchive: this.payload.header.lastArchiveRoot,
47
45
  timestamp: this.payload.header.timestamp,
@@ -49,19 +47,20 @@ export class BlockProposalHash extends Buffer32 {
49
47
  txCount: this.txHashes.length
50
48
  };
51
49
  }
52
- static async createProposalFromSigner(blockNumber, payload, txHashes, // Note(md): Provided separately to tx hashes such that this function can be optional
50
+ static async createProposalFromSigner(payload, txHashes, // Note(md): Provided separately to tx hashes such that this function can be optional
53
51
  txs, payloadSigner) {
54
52
  const hashed = getHashedSignaturePayload(payload, SignatureDomainSeparator.blockProposal);
55
53
  const sig = await payloadSigner(hashed);
56
- return new BlockProposal(blockNumber, payload, sig, txHashes, txs);
54
+ return new BlockProposal(payload, sig, txHashes, txs);
57
55
  }
58
56
  /**Get Sender
59
57
  * Lazily evaluate the sender of the proposal; result is cached
58
+ * @returns The sender address, or undefined if signature recovery fails
60
59
  */ getSender() {
61
60
  if (!this.sender) {
62
61
  const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockProposal);
63
62
  // Cache the sender for later use
64
- this.sender = recoverAddress(hashed, this.signature);
63
+ this.sender = tryRecoverAddress(hashed, this.signature);
65
64
  }
66
65
  return this.sender;
67
66
  }
@@ -70,7 +69,6 @@ export class BlockProposalHash extends Buffer32 {
70
69
  }
71
70
  toBuffer() {
72
71
  const buffer = [
73
- this.blockNumber,
74
72
  this.payload,
75
73
  this.signature,
76
74
  this.txHashes.length,
@@ -84,17 +82,16 @@ export class BlockProposalHash extends Buffer32 {
84
82
  }
85
83
  static fromBuffer(buf) {
86
84
  const reader = BufferReader.asReader(buf);
87
- const blockNumber = reader.readNumber();
88
85
  const payload = reader.readObject(ConsensusPayload);
89
86
  const sig = reader.readObject(Signature);
90
87
  const txHashes = reader.readArray(reader.readNumber(), TxHash);
91
88
  if (!reader.isEmpty()) {
92
89
  const txs = reader.readArray(reader.readNumber(), Tx);
93
- return new BlockProposal(blockNumber, payload, sig, txHashes, txs);
90
+ return new BlockProposal(payload, sig, txHashes, txs);
94
91
  }
95
- return new BlockProposal(blockNumber, payload, sig, txHashes);
92
+ return new BlockProposal(payload, sig, txHashes);
96
93
  }
97
94
  getSize() {
98
- return 4 /* blockNumber */ + this.payload.getSize() + this.signature.getSize() + 4 /* txHashes.length */ + this.txHashes.length * TxHash.SIZE + (this.txs ? 4 /* txs.length */ + this.txs.reduce((acc, tx)=>acc + tx.getSize(), 0) : 0);
95
+ return this.payload.getSize() + this.signature.getSize() + 4 /* txHashes.length */ + this.txHashes.length * TxHash.SIZE + (this.txs ? 4 /* txs.length */ + this.txs.reduce((acc, tx)=>acc + tx.getSize(), 0) : 0);
99
96
  }
100
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"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,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;CACZ;AAqBD,eAAO,MAAM,0CAA0C,GACrD,wBAAwB,+BAA+B,EACvD,SAAQ,eAA0C,0CAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,2BAA2B,KAAG,aAIzE,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,UAAU,2BAA2B,KAAG,gBAyB5E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,OAAO,OAAO,EACd,iBAAiB,eAAe,EAChC,iBAAiB,eAAe,KAC/B,gBAsBF,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
@@ -153,7 +153,7 @@ export const makeAndSignCommitteeAttestationsAndSigners = (attestationsAndSigner
153
153
  return signer.sign(hash);
154
154
  };
155
155
  export const makeBlockProposal = (options)=>{
156
- const { blockNumber, payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
156
+ const { payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
157
157
  const txHashes = options?.txHashes ?? [
158
158
  0,
159
159
  1,
@@ -162,7 +162,7 @@ export const makeBlockProposal = (options)=>{
162
162
  4,
163
163
  5
164
164
  ].map(()=>TxHash.random());
165
- return new BlockProposal(blockNumber, payload, signature, txHashes, options?.txs ?? []);
165
+ return new BlockProposal(payload, signature, txHashes, options?.txs ?? []);
166
166
  };
167
167
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
168
168
  export const makeBlockAttestation = (options)=>{
@@ -179,7 +179,7 @@ export const makeBlockAttestation = (options)=>{
179
179
  // Sign as proposer
180
180
  const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
181
181
  const proposerSignature = proposerSigner.sign(proposalHash);
182
- return new BlockAttestation(header.globalVariables.blockNumber, payload, attestationSignature, proposerSignature);
182
+ return new BlockAttestation(payload, attestationSignature, proposerSignature);
183
183
  };
184
184
  export const makeBlockAttestationFromBlock = (block, attesterSigner, proposerSigner)=>{
185
185
  const header = block.header;
@@ -198,7 +198,7 @@ export const makeBlockAttestationFromBlock = (block, attesterSigner, proposerSig
198
198
  const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
199
199
  const proposalSignerToUse = proposerSigner ?? Secp256k1Signer.random();
200
200
  const proposerSignature = proposalSignerToUse.sign(proposalHash);
201
- return new BlockAttestation(header.globalVariables.blockNumber, payload, attestationSignature, proposerSignature);
201
+ return new BlockAttestation(payload, attestationSignature, proposerSignature);
202
202
  };
203
203
  export async function randomPublishedL2Block(l2BlockNumber, opts = {}) {
204
204
  const block = await L2Block.random(l2BlockNumber);
@@ -1,15 +1,21 @@
1
1
  import { Buffer32 } from '@aztec/foundation/buffer';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  export type ViemZkPassportProofParams = {
4
- vkeyHash: `0x${string}`;
5
- proof: `0x${string}`;
6
- publicInputs: `0x${string}`[];
7
- committedInputs: `0x${string}`;
8
- committedInputCounts: bigint[];
9
- validityPeriodInSeconds: bigint;
10
- domain: string;
11
- scope: string;
12
- devMode: boolean;
4
+ proofVerificationData: {
5
+ vkeyHash: `0x${string}`;
6
+ proof: `0x${string}`;
7
+ publicInputs: `0x${string}`[];
8
+ };
9
+ commitments: {
10
+ committedInputs: `0x${string}`;
11
+ committedInputCounts: bigint[];
12
+ };
13
+ serviceConfig: {
14
+ validityPeriodInSeconds: bigint;
15
+ domain: string;
16
+ scope: string;
17
+ devMode: boolean;
18
+ };
13
19
  };
14
20
  export declare class ZkPassportProofParams {
15
21
  devMode: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zkpassport/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;IAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF,qBAAa,qBAAqB;IAEvB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,EAAE,EAAE;IAClB,eAAe,EAAE,MAAM;IACvB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,uBAAuB,EAAE,MAAM;IAC/B,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;gBARb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,EAAE,EAAE,EAClB,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAAE,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,MAAM,EAAE,MAAM,EACd,KAAK,EAA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EAAE,MAAM,EAAE,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM;IAGtB,QAAQ;IAkBR,MAAM,CAAC,MAAM;IAqBb,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;IAehC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB;IAcjD,MAAM,IAAI,yBAAyB;CAmBpC"}
@@ -56,26 +56,32 @@ export class ZkPassportProofParams {
56
56
  const publicInputs = Array.from({
57
57
  length: Number(publicInputsCount)
58
58
  }, ()=>Fr.random());
59
- return new ZkPassportProofParams(false, Buffer32.random(), randomBytes(1024), publicInputs, committedInputs, committedInputCounts, BigInt(100 * 60 * 60 * 24), 'sequencer.alpha-testnet.aztec.network', 'personhood');
59
+ return new ZkPassportProofParams(false, Buffer32.random(), randomBytes(1024), publicInputs, committedInputs, committedInputCounts, BigInt(7 * 24 * 60 * 60), 'sequencer.alpha-testnet.aztec.network', 'personhood');
60
60
  }
61
61
  static fromBuffer(buffer) {
62
62
  const reader = BufferReader.asReader(buffer);
63
63
  return new ZkPassportProofParams(reader.readBoolean(), reader.readObject(Buffer32), reader.readBuffer(), reader.readVector(Fr), reader.readBuffer(), reader.readUint256Vector(), reader.readUInt256(), reader.readString(), reader.readString());
64
64
  }
65
65
  static fromViem(params) {
66
- return new ZkPassportProofParams(params.devMode, Buffer32.fromString(params.vkeyHash), Buffer.from(withoutHexPrefix(params.proof), 'hex'), params.publicInputs.map((input)=>Fr.fromString(input)), Buffer.from(withoutHexPrefix(params.committedInputs), 'hex'), params.committedInputCounts, params.validityPeriodInSeconds, params.domain, params.scope);
66
+ return new ZkPassportProofParams(params.serviceConfig.devMode, Buffer32.fromString(params.proofVerificationData.vkeyHash), Buffer.from(withoutHexPrefix(params.proofVerificationData.proof), 'hex'), params.proofVerificationData.publicInputs.map((input)=>Fr.fromString(input)), Buffer.from(withoutHexPrefix(params.commitments.committedInputs), 'hex'), params.commitments.committedInputCounts, params.serviceConfig.validityPeriodInSeconds, params.serviceConfig.domain, params.serviceConfig.scope);
67
67
  }
68
68
  toViem() {
69
69
  return {
70
- devMode: this.devMode,
71
- vkeyHash: this.vkeyHash.toString(),
72
- proof: `0x${this.proof.toString('hex')}`,
73
- publicInputs: this.publicInputs.map((input)=>input.toString()),
74
- committedInputs: `0x${this.committedInputs.toString('hex')}`,
75
- committedInputCounts: this.committedInputCounts,
76
- validityPeriodInSeconds: this.validityPeriodInSeconds,
77
- domain: this.domain,
78
- scope: this.scope
70
+ serviceConfig: {
71
+ devMode: this.devMode,
72
+ validityPeriodInSeconds: this.validityPeriodInSeconds,
73
+ domain: this.domain,
74
+ scope: this.scope
75
+ },
76
+ proofVerificationData: {
77
+ vkeyHash: this.vkeyHash.toString(),
78
+ proof: `0x${this.proof.toString('hex')}`,
79
+ publicInputs: this.publicInputs.map((input)=>input.toString())
80
+ },
81
+ commitments: {
82
+ committedInputs: `0x${this.committedInputs.toString('hex')}`,
83
+ committedInputCounts: this.committedInputCounts
84
+ }
79
85
  };
80
86
  }
81
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "2.1.0-rc.20",
3
+ "version": "2.1.0-rc.22",
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.20",
74
- "@aztec/blob-lib": "2.1.0-rc.20",
75
- "@aztec/constants": "2.1.0-rc.20",
76
- "@aztec/ethereum": "2.1.0-rc.20",
77
- "@aztec/foundation": "2.1.0-rc.20",
78
- "@aztec/l1-artifacts": "2.1.0-rc.20",
79
- "@aztec/noir-noirc_abi": "2.1.0-rc.20",
73
+ "@aztec/bb.js": "2.1.0-rc.22",
74
+ "@aztec/blob-lib": "2.1.0-rc.22",
75
+ "@aztec/constants": "2.1.0-rc.22",
76
+ "@aztec/ethereum": "2.1.0-rc.22",
77
+ "@aztec/foundation": "2.1.0-rc.22",
78
+ "@aztec/l1-artifacts": "2.1.0-rc.22",
79
+ "@aztec/noir-noirc_abi": "2.1.0-rc.22",
80
80
  "@google-cloud/storage": "^7.15.0",
81
81
  "axios": "^1.12.0",
82
82
  "json-stringify-deterministic": "1.0.12",
@@ -1,4 +1,5 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import type { Fr } from '@aztec/foundation/fields';
2
3
  import type { TypedEventEmitter } from '@aztec/foundation/types';
3
4
 
4
5
  import { z } from 'zod';
@@ -66,6 +67,34 @@ export interface L2BlockSource {
66
67
  /** Equivalent to getBlocks but includes publish data. */
67
68
  getPublishedBlocks(from: number, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
68
69
 
70
+ /**
71
+ * Gets a published block by its hash.
72
+ * @param blockHash - The block hash to retrieve.
73
+ * @returns The requested published block (or undefined if not found).
74
+ */
75
+ getPublishedBlockByHash(blockHash: Fr): Promise<PublishedL2Block | undefined>;
76
+
77
+ /**
78
+ * Gets a published block by its archive root.
79
+ * @param archive - The archive root to retrieve.
80
+ * @returns The requested published block (or undefined if not found).
81
+ */
82
+ getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined>;
83
+
84
+ /**
85
+ * Gets a block header by its hash.
86
+ * @param blockHash - The block hash to retrieve.
87
+ * @returns The requested block header (or undefined if not found).
88
+ */
89
+ getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
90
+
91
+ /**
92
+ * Gets a block header by its archive root.
93
+ * @param archive - The archive root to retrieve.
94
+ * @returns The requested block header (or undefined if not found).
95
+ */
96
+ getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
97
+
69
98
  /**
70
99
  * Gets a tx effect.
71
100
  * @param txHash - The hash of the tx corresponding to the tx effect.
@@ -120,6 +149,9 @@ export interface L2BlockSource {
120
149
  */
121
150
  getL1Constants(): Promise<L1RollupConstants>;
122
151
 
152
+ /** Returns values for the genesis block */
153
+ getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }>;
154
+
123
155
  /** Latest synced L1 timestamp. */
124
156
  getL1Timestamp(): Promise<bigint>;
125
157
 
@@ -44,7 +44,7 @@ export type ArchiverSpecificConfig = {
44
44
  /** The max number of logs that can be obtained in 1 "getPublicLogs" call. */
45
45
  maxLogs?: number;
46
46
 
47
- /** The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKB. */
47
+ /** The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb. */
48
48
  archiverStoreMapSizeKb?: number;
49
49
 
50
50
  /** Whether to skip validating block attestations (use only for testing). */
@@ -83,6 +83,10 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
83
83
  .function()
84
84
  .args(schemas.Integer, schemas.Integer, optional(z.boolean()))
85
85
  .returns(z.array(PublishedL2Block.schema)),
86
+ getPublishedBlockByHash: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
87
+ getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
88
+ getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
89
+ getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
86
90
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
87
91
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
88
92
  getL2SlotNumber: z.function().args().returns(schemas.BigInt),
@@ -110,6 +114,10 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
110
114
  getL1ToL2MessageIndex: z.function().args(schemas.Fr).returns(schemas.BigInt.optional()),
111
115
  getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
112
116
  getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
117
+ getGenesisValues: z
118
+ .function()
119
+ .args()
120
+ .returns(z.object({ genesisArchiveRoot: schemas.Fr })),
113
121
  getL1Timestamp: z.function().args().returns(schemas.BigInt),
114
122
  syncImmediate: z.function().args().returns(z.void()),
115
123
  isPendingChainInvalid: z.function().args().returns(z.boolean()),
@@ -9,7 +9,7 @@ import { type ArchiverSpecificConfig, ArchiverSpecificConfigSchema } from './arc
9
9
  import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
10
10
  import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
11
11
  import { type SlasherConfig, SlasherConfigSchema } from './slasher.js';
12
- import { ValidatorClientConfigSchema, type ValidatorClientFullConfig } from './validator.js';
12
+ import { type ValidatorClientFullConfig, ValidatorClientFullConfigSchema } from './validator.js';
13
13
 
14
14
  /**
15
15
  * Aztec node admin API.
@@ -62,7 +62,7 @@ export type AztecNodeAdminConfig = ValidatorClientFullConfig &
62
62
 
63
63
  export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
64
64
  .merge(SlasherConfigSchema)
65
- .merge(ValidatorClientConfigSchema)
65
+ .merge(ValidatorClientFullConfigSchema)
66
66
  .merge(
67
67
  ArchiverSpecificConfigSchema.pick({
68
68
  archiverPollingIntervalMS: true,
@@ -224,6 +224,20 @@ export interface AztecNode
224
224
  */
225
225
  getBlock(number: L2BlockNumber): Promise<L2Block | undefined>;
226
226
 
227
+ /**
228
+ * Get a block specified by its hash.
229
+ * @param blockHash - The block hash being requested.
230
+ * @returns The requested block.
231
+ */
232
+ getBlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
233
+
234
+ /**
235
+ * Get a block specified by its archive root.
236
+ * @param archive - The archive root being requested.
237
+ * @returns The requested block.
238
+ */
239
+ getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
240
+
227
241
  /**
228
242
  * Method to fetch the latest block number synchronized by the node.
229
243
  * @returns The block number.
@@ -399,6 +413,20 @@ export interface AztecNode
399
413
  */
400
414
  getBlockHeader(blockNumber?: L2BlockNumber): Promise<BlockHeader | undefined>;
401
415
 
416
+ /**
417
+ * Get a block header specified by its hash.
418
+ * @param blockHash - The block hash being requested.
419
+ * @returns The requested block header.
420
+ */
421
+ getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
422
+
423
+ /**
424
+ * Get a block header specified by its archive root.
425
+ * @param archive - The archive root being requested.
426
+ * @returns The requested block header.
427
+ */
428
+ getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
429
+
402
430
  /** Returns stats for validators if enabled. */
403
431
  getValidatorsStats(): Promise<ValidatorsStats>;
404
432
 
@@ -516,6 +544,10 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
516
544
 
517
545
  getBlock: z.function().args(L2BlockNumberSchema).returns(L2Block.schema.optional()),
518
546
 
547
+ getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
548
+
549
+ getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
550
+
519
551
  getBlockNumber: z.function().returns(z.number()),
520
552
 
521
553
  getProvenBlockNumber: z.function().returns(z.number()),
@@ -589,6 +621,10 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
589
621
 
590
622
  getBlockHeader: z.function().args(optional(L2BlockNumberSchema)).returns(BlockHeader.schema.optional()),
591
623
 
624
+ getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
625
+
626
+ getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
627
+
592
628
  getValidatorsStats: z.function().returns(ValidatorsStatsSchema),
593
629
 
594
630
  getValidatorStats: z
@@ -9,6 +9,7 @@ export interface ITxProvider {
9
9
 
10
10
  getTxsForBlockProposal(
11
11
  blockProposal: BlockProposal,
12
+ blockNumber: number,
12
13
  opts: { pinnedPeer: PeerId | undefined; deadline: Date },
13
14
  ): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
14
15
 
@@ -11,6 +11,7 @@ import type { PeerId } from '@libp2p/interface';
11
11
  import { z } from 'zod';
12
12
 
13
13
  import type { CommitteeAttestationsAndSigners } from '../block/index.js';
14
+ import { AllowedElementSchema } from './allowed_element.js';
14
15
 
15
16
  /**
16
17
  * Validator client configuration
@@ -43,7 +44,13 @@ export interface ValidatorClientConfig {
43
44
 
44
45
  export type ValidatorClientFullConfig = ValidatorClientConfig &
45
46
  Pick<SequencerConfig, 'txPublicSetupAllowList'> &
46
- Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'>;
47
+ Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'> & {
48
+ /**
49
+ * Whether transactions are disabled for this node
50
+ * @remarks This should match the property in P2PConfig. It's not picked from there to avoid circular dependencies.
51
+ */
52
+ disableTransactions?: boolean;
53
+ };
47
54
 
48
55
  export const ValidatorClientConfigSchema = z.object({
49
56
  validatorAddresses: z.array(schemas.EthAddress).optional(),
@@ -55,6 +62,12 @@ export const ValidatorClientConfigSchema = z.object({
55
62
  alwaysReexecuteBlockProposals: z.boolean().optional(),
56
63
  }) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
57
64
 
65
+ export const ValidatorClientFullConfigSchema = ValidatorClientConfigSchema.extend({
66
+ txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
67
+ slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
68
+ disableTransactions: z.boolean().optional(),
69
+ }) satisfies ZodFor<Omit<ValidatorClientFullConfig, 'validatorPrivateKeys'>>;
70
+
58
71
  export interface Validator {
59
72
  start(): Promise<void>;
60
73
  updateConfig(config: Partial<ValidatorClientFullConfig>): void;