@aztec/stdlib 3.0.0-nightly.20251015 → 3.0.0-nightly.20251022

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 (66) hide show
  1. package/dest/block/attestation_info.d.ts +30 -0
  2. package/dest/block/attestation_info.d.ts.map +1 -0
  3. package/dest/block/attestation_info.js +39 -0
  4. package/dest/block/index.d.ts +1 -0
  5. package/dest/block/index.d.ts.map +1 -1
  6. package/dest/block/index.js +1 -0
  7. package/dest/block/published_l2_block.d.ts +0 -2
  8. package/dest/block/published_l2_block.d.ts.map +1 -1
  9. package/dest/block/published_l2_block.js +0 -6
  10. package/dest/interfaces/aztec-node-admin.d.ts +3 -0
  11. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  12. package/dest/interfaces/configs.d.ts +5 -0
  13. package/dest/interfaces/configs.d.ts.map +1 -1
  14. package/dest/interfaces/configs.js +2 -1
  15. package/dest/interfaces/p2p.d.ts +2 -0
  16. package/dest/interfaces/p2p.d.ts.map +1 -1
  17. package/dest/interfaces/p2p.js +2 -1
  18. package/dest/logs/directional_app_tagging_secret.d.ts +1 -1
  19. package/dest/logs/directional_app_tagging_secret.js +1 -1
  20. package/dest/logs/index.d.ts +1 -1
  21. package/dest/logs/index.d.ts.map +1 -1
  22. package/dest/logs/index.js +1 -1
  23. package/dest/logs/{indexed_tagging_secret.d.ts → pre_tag.d.ts} +3 -3
  24. package/dest/logs/pre_tag.d.ts.map +1 -0
  25. package/dest/logs/{indexed_tagging_secret.js → pre_tag.js} +1 -1
  26. package/dest/note/notes_filter.d.ts +0 -5
  27. package/dest/note/notes_filter.d.ts.map +1 -1
  28. package/dest/note/notes_filter.js +0 -3
  29. package/dest/p2p/block_attestation.d.ts +44 -3
  30. package/dest/p2p/block_attestation.d.ts.map +1 -1
  31. package/dest/p2p/block_attestation.js +36 -12
  32. package/dest/p2p/block_proposal.d.ts +2 -1
  33. package/dest/p2p/block_proposal.d.ts.map +1 -1
  34. package/dest/p2p/block_proposal.js +3 -2
  35. package/dest/tests/mocks.d.ts +3 -1
  36. package/dest/tests/mocks.d.ts.map +1 -1
  37. package/dest/tests/mocks.js +31 -9
  38. package/dest/tx/private_execution_result.d.ts +5 -5
  39. package/dest/tx/private_execution_result.d.ts.map +1 -1
  40. package/dest/tx/private_execution_result.js +6 -6
  41. package/dest/tx/tx.d.ts +6 -0
  42. package/dest/tx/tx.d.ts.map +1 -1
  43. package/dest/tx/tx.js +8 -0
  44. package/dest/versioning/versioning.d.ts.map +1 -1
  45. package/dest/versioning/versioning.js +10 -5
  46. package/dest/zkpassport/index.d.ts +15 -9
  47. package/dest/zkpassport/index.d.ts.map +1 -1
  48. package/dest/zkpassport/index.js +17 -11
  49. package/package.json +9 -9
  50. package/src/block/attestation_info.ts +62 -0
  51. package/src/block/index.ts +1 -0
  52. package/src/block/published_l2_block.ts +0 -11
  53. package/src/interfaces/configs.ts +3 -0
  54. package/src/interfaces/p2p.ts +4 -0
  55. package/src/logs/directional_app_tagging_secret.ts +1 -1
  56. package/src/logs/index.ts +1 -1
  57. package/src/logs/{indexed_tagging_secret.ts → pre_tag.ts} +2 -2
  58. package/src/note/notes_filter.ts +0 -7
  59. package/src/p2p/block_attestation.ts +49 -10
  60. package/src/p2p/block_proposal.ts +4 -3
  61. package/src/tests/mocks.ts +51 -12
  62. package/src/tx/private_execution_result.ts +5 -5
  63. package/src/tx/tx.ts +10 -0
  64. package/src/versioning/versioning.ts +10 -5
  65. package/src/zkpassport/index.ts +40 -28
  66. package/dest/logs/indexed_tagging_secret.d.ts.map +0 -1
@@ -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,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CA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A2B;IAC1C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,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,aAOzE,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"}
@@ -168,17 +168,39 @@ export const makeBlockProposal = (options)=>{
168
168
  };
169
169
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
170
170
  export const makeBlockAttestation = (options)=>{
171
- const { blockNumber, payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockAttestation, options);
172
- return new BlockAttestation(blockNumber, payload, signature);
171
+ const header = options?.header ?? makeL2BlockHeader(1);
172
+ const { signer, attesterSigner = signer ?? Secp256k1Signer.random(), proposerSigner = signer ?? Secp256k1Signer.random(), archive = Fr.random(), stateReference = header.state } = options ?? {};
173
+ const payload = ConsensusPayload.fromFields({
174
+ header: header.toCheckpointHeader(),
175
+ archive,
176
+ stateReference
177
+ });
178
+ // Sign as attester
179
+ const attestationHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockAttestation);
180
+ const attestationSignature = attesterSigner.sign(attestationHash);
181
+ // Sign as proposer
182
+ const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
183
+ const proposerSignature = proposerSigner.sign(proposalHash);
184
+ return new BlockAttestation(header.globalVariables.blockNumber, payload, attestationSignature, proposerSignature);
173
185
  };
174
- export const makeBlockAttestationFromBlock = (block, signer)=>{
175
- return 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)
186
+ export const makeBlockAttestationFromBlock = (block, attesterSigner, proposerSigner)=>{
187
+ const header = block.header;
188
+ const archive = block.archive.root;
189
+ const stateReference = block.header.state;
190
+ const payload = ConsensusPayload.fromFields({
191
+ header: header.toCheckpointHeader(),
192
+ archive,
193
+ stateReference
181
194
  });
195
+ // Sign as attester
196
+ const attestationHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockAttestation);
197
+ const attestationSigner = attesterSigner ?? Secp256k1Signer.random();
198
+ const attestationSignature = attestationSigner.sign(attestationHash);
199
+ // Sign as proposer
200
+ const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
201
+ const proposalSignerToUse = proposerSigner ?? Secp256k1Signer.random();
202
+ const proposerSignature = proposalSignerToUse.sign(proposalHash);
203
+ return new BlockAttestation(header.globalVariables.blockNumber, payload, attestationSignature, proposerSignature);
182
204
  };
183
205
  export async function randomPublishedL2Block(l2BlockNumber, opts = {}) {
184
206
  const block = await L2Block.random(l2BlockNumber);
@@ -5,7 +5,7 @@ import { NoteSelector } from '../abi/note_selector.js';
5
5
  import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
6
6
  import type { IsEmpty } from '../kernel/utils/interfaces.js';
7
7
  import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
8
- import { type IndexedTaggingSecret } from '../logs/indexed_tagging_secret.js';
8
+ import { type PreTag } from '../logs/pre_tag.js';
9
9
  import { Note } from '../note/note.js';
10
10
  import { type ZodFor } from '../schemas/index.js';
11
11
  import type { UInt32 } from '../types/index.js';
@@ -123,8 +123,8 @@ export declare class PrivateCallExecutionResult {
123
123
  offchainEffects: {
124
124
  data: Fr[];
125
125
  }[];
126
- /** The tagging indexes incremented by this execution along with the directional app tagging secrets. */
127
- indexedTaggingSecrets: IndexedTaggingSecret[];
126
+ /** The pre tags used in this tx to compute tags for private logs */
127
+ preTags: PreTag[];
128
128
  /** The nested executions. */
129
129
  nestedExecutionResults: PrivateCallExecutionResult[];
130
130
  /**
@@ -155,8 +155,8 @@ export declare class PrivateCallExecutionResult {
155
155
  offchainEffects: {
156
156
  data: Fr[];
157
157
  }[],
158
- /** The tagging indexes incremented by this execution along with the directional app tagging secrets. */
159
- indexedTaggingSecrets: IndexedTaggingSecret[],
158
+ /** The pre tags used in this tx to compute tags for private logs */
159
+ preTags: PreTag[],
160
160
  /** The nested executions. */
161
161
  nestedExecutionResults: PrivateCallExecutionResult[],
162
162
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"private_execution_result.d.ts","sourceRoot":"","sources":["../../src/tx/private_execution_result.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CA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EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;CAC9F"}
@@ -6,7 +6,7 @@ import { NoteSelector } from '../abi/note_selector.js';
6
6
  import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
7
7
  import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
8
8
  import { ContractClassLog } from '../logs/contract_class_log.js';
9
- import { IndexedTaggingSecretSchema } from '../logs/indexed_tagging_secret.js';
9
+ import { PreTagSchema } from '../logs/pre_tag.js';
10
10
  import { Note } from '../note/note.js';
11
11
  import { mapSchema, schemas } from '../schemas/index.js';
12
12
  import { HashedValues } from './hashed_values.js';
@@ -98,13 +98,13 @@ export class PrivateExecutionResult {
98
98
  noteHashNullifierCounterMap;
99
99
  returnValues;
100
100
  offchainEffects;
101
- indexedTaggingSecrets;
101
+ preTags;
102
102
  nestedExecutionResults;
103
103
  contractClassLogs;
104
104
  profileResult;
105
105
  constructor(// Needed for prover
106
106
  /** The ACIR bytecode. */ acir, /** The verification key. */ vk, /** The partial witness. */ partialWitness, // Needed for the verifier (kernel)
107
- /** The call stack item. */ publicInputs, /** Mapping of note hash to its index in the note hash tree. Used for building hints for note hash read requests. */ noteHashLeafIndexMap, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The tagging indexes incremented by this execution along with the directional app tagging secrets. */ indexedTaggingSecrets, /** The nested executions. */ nestedExecutionResults, /**
107
+ /** The call stack item. */ publicInputs, /** Mapping of note hash to its index in the note hash tree. Used for building hints for note hash read requests. */ noteHashLeafIndexMap, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The pre tags used in this tx to compute tags for private logs */ preTags, /** The nested executions. */ nestedExecutionResults, /**
108
108
  * Contract class logs emitted during execution of this function call.
109
109
  * Note: We only need to collect the ContractClassLogFields as preimages for the tx.
110
110
  * But keep them as ContractClassLog so that we can verify the log hashes before submitting the tx (TODO).
@@ -118,7 +118,7 @@ export class PrivateExecutionResult {
118
118
  this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
119
119
  this.returnValues = returnValues;
120
120
  this.offchainEffects = offchainEffects;
121
- this.indexedTaggingSecrets = indexedTaggingSecrets;
121
+ this.preTags = preTags;
122
122
  this.nestedExecutionResults = nestedExecutionResults;
123
123
  this.contractClassLogs = contractClassLogs;
124
124
  this.profileResult = profileResult;
@@ -136,13 +136,13 @@ export class PrivateExecutionResult {
136
136
  offchainEffects: z.array(z.object({
137
137
  data: z.array(schemas.Fr)
138
138
  })),
139
- indexedTaggingSecrets: z.array(IndexedTaggingSecretSchema),
139
+ preTags: z.array(PreTagSchema),
140
140
  nestedExecutionResults: z.array(z.lazy(()=>PrivateCallExecutionResult.schema)),
141
141
  contractClassLogs: z.array(CountedContractClassLog.schema)
142
142
  }).transform(PrivateCallExecutionResult.from);
143
143
  }
144
144
  static from(fields) {
145
- return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.indexedTaggingSecrets, fields.nestedExecutionResults, fields.contractClassLogs);
145
+ return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.preTags, fields.nestedExecutionResults, fields.contractClassLogs);
146
146
  }
147
147
  static async random(nested = 1) {
148
148
  return new PrivateCallExecutionResult(randomBytes(4), randomBytes(4), new Map([
package/dest/tx/tx.d.ts CHANGED
@@ -87,6 +87,12 @@ export declare class Tx extends Gossipable {
87
87
  static computeTxHash(fields: Pick<FieldsOf<Tx>, 'data'>): Promise<TxHash>;
88
88
  static create(fields: Omit<FieldsOf<Tx>, 'txHash'>): Promise<Tx>;
89
89
  static from(fields: FieldsOf<Tx>): Tx;
90
+ /**
91
+ * Validates that the tx hash matches the computed hash from the tx data.
92
+ * This should be called when deserializing a tx from an untrusted source.
93
+ * @returns true if the hash is valid, false otherwise
94
+ */
95
+ validateTxHash(): Promise<boolean>;
90
96
  /**
91
97
  * Gets public logs emitted by this tx.
92
98
  * @param logsSource - An instance of `L2LogsSource` which can be used to obtain the logs.
@@ -1 +1 @@
1
- {"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/tx/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAyD,MAAM,6BAA6B,CAAC;AAClH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAA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CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE;IAUxB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,GAAG,EAAE;IAUjF,oGAAoG;IACvF,aAAa;CAW3B;AAED;;GAEG;AACH,qBAAa,OAAQ,SAAQ,KAAK,CAAC,EAAE,CAAC;IACpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO;IAWlD,QAAQ,IAAI,MAAM;CAG1B"}
package/dest/tx/tx.js CHANGED
@@ -114,6 +114,14 @@ import { TxHash } from './tx_hash.js';
114
114
  return new Tx(fields.txHash, fields.data, fields.clientIvcProof, fields.contractClassLogFields, fields.publicFunctionCalldata);
115
115
  }
116
116
  /**
117
+ * Validates that the tx hash matches the computed hash from the tx data.
118
+ * This should be called when deserializing a tx from an untrusted source.
119
+ * @returns true if the hash is valid, false otherwise
120
+ */ async validateTxHash() {
121
+ const expectedHash = await Tx.computeTxHash(this);
122
+ return this.txHash.equals(expectedHash);
123
+ }
124
+ /**
117
125
  * Gets public logs emitted by this tx.
118
126
  * @param logsSource - An instance of `L2LogsSource` which can be used to obtain the logs.
119
127
  * @returns The requested logs.
@@ -1 +1 @@
1
- {"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../../src/versioning/versioning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,8IAA8I;AAC9I,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAIl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B,CAAC,IACxE,aAAa;IAAE,OAAO,EAAE;QAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,mBAYzF"}
@@ -67,11 +67,16 @@ export class ComponentsVersionsError extends Error {
67
67
  }
68
68
  /** Returns a Koa middleware that injects the versioning info as headers. */ export function getVersioningMiddleware(versions) {
69
69
  return async (ctx, next)=>{
70
- await next();
71
- for(const key in versions){
72
- const value = versions[key];
73
- if (value !== undefined) {
74
- ctx.set(`x-aztec-${key}`, value.toString());
70
+ try {
71
+ await next();
72
+ } finally{
73
+ // Always add version headers, even if there was an error
74
+ // This allows the client to detect version mismatches before processing other errors
75
+ for(const key in versions){
76
+ const value = versions[key];
77
+ if (value !== undefined) {
78
+ ctx.set(`x-aztec-${key}`, value.toString());
79
+ }
75
80
  }
76
81
  }
77
82
  };
@@ -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,O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BpC"}
@@ -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": "3.0.0-nightly.20251015",
3
+ "version": "3.0.0-nightly.20251022",
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": "3.0.0-nightly.20251015",
74
- "@aztec/blob-lib": "3.0.0-nightly.20251015",
75
- "@aztec/constants": "3.0.0-nightly.20251015",
76
- "@aztec/ethereum": "3.0.0-nightly.20251015",
77
- "@aztec/foundation": "3.0.0-nightly.20251015",
78
- "@aztec/l1-artifacts": "3.0.0-nightly.20251015",
79
- "@aztec/noir-noirc_abi": "3.0.0-nightly.20251015",
73
+ "@aztec/bb.js": "3.0.0-nightly.20251022",
74
+ "@aztec/blob-lib": "3.0.0-nightly.20251022",
75
+ "@aztec/constants": "3.0.0-nightly.20251022",
76
+ "@aztec/ethereum": "3.0.0-nightly.20251022",
77
+ "@aztec/foundation": "3.0.0-nightly.20251022",
78
+ "@aztec/l1-artifacts": "3.0.0-nightly.20251022",
79
+ "@aztec/noir-noirc_abi": "3.0.0-nightly.20251022",
80
80
  "@google-cloud/storage": "^7.15.0",
81
81
  "axios": "^1.12.0",
82
82
  "json-stringify-deterministic": "1.0.12",
@@ -87,7 +87,7 @@
87
87
  "msgpackr": "^1.11.2",
88
88
  "pako": "^2.1.0",
89
89
  "tslib": "^2.4.0",
90
- "viem": "2.23.7",
90
+ "viem": "npm:@spalladino/viem@2.38.2-eip7594.0",
91
91
  "zod": "^3.23.8"
92
92
  },
93
93
  "devDependencies": {
@@ -0,0 +1,62 @@
1
+ import { recoverAddress } from '@aztec/foundation/crypto';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
+
4
+ import { ConsensusPayload } from '../p2p/consensus_payload.js';
5
+ import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
6
+ import type { L2Block } from './l2_block.js';
7
+ import type { CommitteeAttestation } from './proposal/committee_attestation.js';
8
+
9
+ /**
10
+ * Status indicating how the attestation address was determined
11
+ */
12
+ export type AttestationStatus = 'recovered-from-signature' | 'provided-as-address' | 'invalid-signature' | 'empty';
13
+
14
+ /**
15
+ * Information about an attestation extracted from a published block
16
+ */
17
+ export type AttestationInfo =
18
+ | {
19
+ /** The validator's address, undefined if signature recovery failed or empty */
20
+ address?: undefined;
21
+ /** How the attestation address was determined */
22
+ status: Extract<AttestationStatus, 'invalid-signature' | 'empty'>;
23
+ }
24
+ | {
25
+ /** The validator's address */
26
+ address: EthAddress;
27
+ /** How the attestation address was determined */
28
+ status: Extract<AttestationStatus, 'provided-as-address' | 'recovered-from-signature'>;
29
+ };
30
+
31
+ /**
32
+ * Extracts attestation information from a published L2 block.
33
+ * Returns info for each attestation, preserving array indices.
34
+ */
35
+ export function getAttestationInfoFromPublishedL2Block(block: {
36
+ attestations: CommitteeAttestation[];
37
+ block: L2Block;
38
+ }): AttestationInfo[] {
39
+ const payload = ConsensusPayload.fromBlock(block.block);
40
+ const hashedPayload = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockAttestation);
41
+
42
+ return block.attestations.map(attestation => {
43
+ // If signature is empty, check if we have an address directly
44
+ if (attestation.signature.isEmpty()) {
45
+ if (attestation.address.isZero()) {
46
+ // No signature and no address - empty
47
+ return { status: 'empty' as const };
48
+ }
49
+ // Address provided without signature
50
+ return { address: attestation.address, status: 'provided-as-address' as const };
51
+ }
52
+
53
+ // Try to recover address from signature
54
+ try {
55
+ const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
56
+ return { address: recoveredAddress, status: 'recovered-from-signature' as const };
57
+ } catch {
58
+ // Signature present but recovery failed
59
+ return { status: 'invalid-signature' as const };
60
+ }
61
+ });
62
+ }
@@ -10,3 +10,4 @@ export * from './published_l2_block.js';
10
10
  export * from './proposal/index.js';
11
11
  export * from './validate_block_result.js';
12
12
  export * from './l2_block_info.js';
13
+ export * from './attestation_info.js';
@@ -7,8 +7,6 @@ import type { FieldsOf } from '@aztec/foundation/types';
7
7
 
8
8
  import { z } from 'zod';
9
9
 
10
- import { BlockAttestation } from '../p2p/block_attestation.js';
11
- import { ConsensusPayload } from '../p2p/consensus_payload.js';
12
10
  import { L2Block } from './l2_block.js';
13
11
  import { CommitteeAttestation } from './proposal/committee_attestation.js';
14
12
 
@@ -82,12 +80,3 @@ export class PublishedL2Block {
82
80
  );
83
81
  }
84
82
  }
85
-
86
- export function getAttestationsFromPublishedL2Block(
87
- block: Pick<PublishedL2Block, 'attestations' | 'block'>,
88
- ): BlockAttestation[] {
89
- const payload = ConsensusPayload.fromBlock(block.block);
90
- return block.attestations
91
- .filter(attestation => !attestation.signature.isEmpty())
92
- .map(attestation => new BlockAttestation(block.block.number, payload, attestation.signature));
93
- }
@@ -54,6 +54,8 @@ export interface SequencerConfig {
54
54
  skipInvalidateBlockAsProposer?: boolean;
55
55
  /** Broadcast invalid block proposals with corrupted state (for testing only) */
56
56
  broadcastInvalidBlockProposal?: boolean;
57
+ /** Inject a fake attestation (for testing only) */
58
+ injectFakeAttestation?: boolean;
57
59
  }
58
60
 
59
61
  export const SequencerConfigSchema = z.object({
@@ -78,4 +80,5 @@ export const SequencerConfigSchema = z.object({
78
80
  secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
79
81
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
80
82
  broadcastInvalidBlockProposal: z.boolean().optional(),
83
+ injectFakeAttestation: z.boolean().optional(),
81
84
  }) satisfies ZodFor<SequencerConfig>;
@@ -57,6 +57,9 @@ export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
57
57
  * @returns BlockAttestations
58
58
  */
59
59
  getAttestationsForSlot(slot: bigint, proposalId?: string): Promise<BlockAttestation[]>;
60
+
61
+ /** Deletes a given attestation manually from the p2p client attestation pool. */
62
+ deleteAttestation(attestation: BlockAttestation): Promise<void>;
60
63
  }
61
64
 
62
65
  export interface P2PClient extends P2PApiWithAttestations {
@@ -85,4 +88,5 @@ export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
85
88
  getPendingTxCount: z.function().returns(schemas.Integer),
86
89
  getEncodedEnr: z.function().returns(z.string().optional()),
87
90
  getPeers: z.function().args(optional(z.boolean())).returns(z.array(PeerInfoSchema)),
91
+ deleteAttestation: z.function().args(BlockAttestation.schema).returns(z.void()),
88
92
  };
@@ -14,7 +14,7 @@ import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
14
14
  * address: A→B differs from B→A even with the same participants and app.
15
15
  *
16
16
  * Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides
17
- * in `pxe/src/tagging`. We need to use this type in `IndexedTaggingSecret` that in turn is used by other types
17
+ * in `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types
18
18
  * in stdlib hence there doesn't seem to be a good way around this.
19
19
  */
20
20
  export class DirectionalAppTaggingSecret {
package/src/logs/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './log_with_tx_data.js';
2
2
  export * from './directional_app_tagging_secret.js';
3
- export * from './indexed_tagging_secret.js';
3
+ export * from './pre_tag.js';
4
4
  export * from './contract_class_log.js';
5
5
  export * from './public_log.js';
6
6
  export * from './private_log.js';
@@ -14,12 +14,12 @@ import {
14
14
  * in `pxe/src/tagging`. But this type is used by other types in stdlib hence there doesn't seem to be a good way
15
15
  * around this.
16
16
  */
17
- export type IndexedTaggingSecret = {
17
+ export type PreTag = {
18
18
  secret: DirectionalAppTaggingSecret;
19
19
  index: number;
20
20
  };
21
21
 
22
- export const IndexedTaggingSecretSchema = z.object({
22
+ export const PreTagSchema = z.object({
23
23
  secret: DirectionalAppTaggingSecretSchema,
24
24
  index: schemas.Integer,
25
25
  });
@@ -4,7 +4,6 @@ import { z } from 'zod';
4
4
 
5
5
  import type { AztecAddress } from '../aztec-address/index.js';
6
6
  import { type ZodFor, schemas } from '../schemas/index.js';
7
- import { TxHash } from '../tx/tx_hash.js';
8
7
  import { NoteStatus } from './note_status.js';
9
8
 
10
9
  /**
@@ -17,12 +16,8 @@ export type NotesFilter = {
17
16
  * @remarks Providing a contract address is required as we need that information to trigger private state sync.
18
17
  */
19
18
  contractAddress: AztecAddress;
20
- /** Hash of a transaction from which to fetch the notes. */
21
- txHash?: TxHash;
22
19
  /** The specific storage location of the note on the contract. */
23
20
  storageSlot?: Fr;
24
- /** The recipient of the note (whose public key was used to encrypt the note). */
25
- recipient?: AztecAddress;
26
21
  /** The status of the note. Defaults to 'ACTIVE'. */
27
22
  status?: NoteStatus;
28
23
  /** The siloed nullifier for the note. */
@@ -33,9 +28,7 @@ export type NotesFilter = {
33
28
 
34
29
  export const NotesFilterSchema: ZodFor<NotesFilter> = z.object({
35
30
  contractAddress: schemas.AztecAddress,
36
- txHash: TxHash.schema.optional(),
37
31
  storageSlot: schemas.Fr.optional(),
38
- recipient: schemas.AztecAddress.optional(),
39
32
  status: z.nativeEnum(NoteStatus).optional(),
40
33
  siloedNullifier: schemas.Fr.optional(),
41
34
  scopes: z.array(schemas.AztecAddress).optional(),