@aztec/node-lib 2.1.8 → 2.1.9

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.
@@ -16,7 +16,7 @@ export declare function createL1TxUtilsWithBlobsFromViemWallet(clients: Extended
16
16
  dateProvider?: DateProvider;
17
17
  }): Promise<import("@aztec/ethereum/l1-tx-utils-with-blobs").L1TxUtilsWithBlobs[]>;
18
18
  /**
19
- * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics.
19
+ * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics. Removes duplicates
20
20
  */
21
21
  export declare function createL1TxUtilsWithBlobsFromEthSigner(client: ViemClient, signers: EthSigner[], config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
22
22
  debugMaxGasLimit?: boolean;
@@ -39,7 +39,7 @@ export declare function createL1TxUtilsFromViemWalletWithStore(clients: Extended
39
39
  scope?: L1TxScope;
40
40
  }): Promise<import("@aztec/ethereum").L1TxUtils[]>;
41
41
  /**
42
- * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics.
42
+ * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics. Removes duplicates.
43
43
  */
44
44
  export declare function createL1TxUtilsFromEthSignerWithStore(client: ViemClient, signers: EthSigner[], config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
45
45
  debugMaxGasLimit?: boolean;
@@ -50,4 +50,28 @@ export declare function createL1TxUtilsFromEthSignerWithStore(client: ViemClient
50
50
  dateProvider?: DateProvider;
51
51
  scope?: L1TxScope;
52
52
  }): Promise<import("@aztec/ethereum").L1TxUtils[]>;
53
+ /**
54
+ * Creates ForwarderL1TxUtils from multiple Viem wallets, sharing store and metrics.
55
+ * This wraps all transactions through a forwarder contract for testing purposes.
56
+ */
57
+ export declare function createForwarderL1TxUtilsFromViemWallet(clients: ExtendedViemWalletClient[], forwarderAddress: import('@aztec/foundation/eth-address').EthAddress, config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
58
+ debugMaxGasLimit?: boolean;
59
+ scope?: L1TxScope;
60
+ }, deps: {
61
+ telemetry: TelemetryClient;
62
+ logger?: ReturnType<typeof createLogger>;
63
+ dateProvider?: DateProvider;
64
+ }): Promise<import("@aztec/ethereum/l1-tx-utils-with-blobs").ForwarderL1TxUtils[]>;
65
+ /**
66
+ * Creates ForwarderL1TxUtils from multiple EthSigners, sharing store and metrics.
67
+ * This wraps all transactions through a forwarder contract for testing purposes.
68
+ */
69
+ export declare function createForwarderL1TxUtilsFromEthSigner(client: ViemClient, signers: EthSigner[], forwarderAddress: import('@aztec/foundation/eth-address').EthAddress, config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
70
+ debugMaxGasLimit?: boolean;
71
+ scope?: L1TxScope;
72
+ }, deps: {
73
+ telemetry: TelemetryClient;
74
+ logger?: ReturnType<typeof createLogger>;
75
+ dateProvider?: DateProvider;
76
+ }): Promise<import("@aztec/ethereum/l1-tx-utils-with-blobs").ForwarderL1TxUtils[]>;
53
77
  //# sourceMappingURL=l1_tx_utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../../src/factories/l1_tx_utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAwB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMxG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AA+B7D;;GAEG;AACH,wBAAsB,sCAAsC,CAC1D,OAAO,EAAE,wBAAwB,EAAE,EACnC,MAAM,EAAE,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,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,EACtG,IAAI,EAAE;IACJ,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,kFAOF;AAED;;;GAGG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,SAAS,EAAE,EACpB,gBAAgB,EAAE,OAAO,+BAA+B,EAAE,UAAU,EACpE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,EACtG,IAAI,EAAE;IACJ,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,kFAcF"}
@@ -1,5 +1,5 @@
1
1
  import { createL1TxUtilsFromEthSigner as createL1TxUtilsFromEthSignerBase, createL1TxUtilsFromViemWallet as createL1TxUtilsFromViemWalletBase } from '@aztec/ethereum';
2
- import { createL1TxUtilsWithBlobsFromEthSigner as createL1TxUtilsWithBlobsFromEthSignerBase, createL1TxUtilsWithBlobsFromViemWallet as createL1TxUtilsWithBlobsFromViemWalletBase } from '@aztec/ethereum/l1-tx-utils-with-blobs';
2
+ import { createForwarderL1TxUtilsFromEthSigner as createForwarderL1TxUtilsFromEthSignerBase, createForwarderL1TxUtilsFromViemWallet as createForwarderL1TxUtilsFromViemWalletBase, createL1TxUtilsWithBlobsFromEthSigner as createL1TxUtilsWithBlobsFromEthSignerBase, createL1TxUtilsWithBlobsFromViemWallet as createL1TxUtilsWithBlobsFromViemWalletBase } from '@aztec/ethereum/l1-tx-utils-with-blobs';
3
3
  import { omit } from '@aztec/foundation/collection';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { createStore } from '@aztec/kv-store/lmdb-v2';
@@ -31,10 +31,23 @@ const L1_TX_STORE_NAME = 'l1-tx-utils';
31
31
  return clients.map((client)=>createL1TxUtilsWithBlobsFromViemWalletBase(client, sharedDeps, config, config.debugMaxGasLimit));
32
32
  }
33
33
  /**
34
- * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics.
34
+ * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics. Removes duplicates
35
35
  */ export async function createL1TxUtilsWithBlobsFromEthSigner(client, signers, config, deps) {
36
36
  const sharedDeps = await createSharedDeps(config, deps);
37
- return signers.map((signer)=>createL1TxUtilsWithBlobsFromEthSignerBase(client, signer, sharedDeps, config, config.debugMaxGasLimit));
37
+ // Deduplicate signers by address to avoid creating multiple L1TxUtils instances
38
+ // for the same publisher address (e.g., when multiple attesters share the same publisher key)
39
+ const signersByAddress = new Map();
40
+ for (const signer of signers){
41
+ const addressKey = signer.address.toString().toLowerCase();
42
+ if (!signersByAddress.has(addressKey)) {
43
+ signersByAddress.set(addressKey, signer);
44
+ }
45
+ }
46
+ const uniqueSigners = Array.from(signersByAddress.values());
47
+ if (uniqueSigners.length < signers.length) {
48
+ sharedDeps.logger.info(`Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`);
49
+ }
50
+ return uniqueSigners.map((signer)=>createL1TxUtilsWithBlobsFromEthSignerBase(client, signer, sharedDeps, config, config.debugMaxGasLimit));
38
51
  }
39
52
  /**
40
53
  * Creates L1TxUtils (without blobs) from multiple Viem wallets, sharing store and metrics.
@@ -43,8 +56,35 @@ const L1_TX_STORE_NAME = 'l1-tx-utils';
43
56
  return clients.map((client)=>createL1TxUtilsFromViemWalletBase(client, sharedDeps, config));
44
57
  }
45
58
  /**
46
- * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics.
59
+ * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics. Removes duplicates.
47
60
  */ export async function createL1TxUtilsFromEthSignerWithStore(client, signers, config, deps) {
48
61
  const sharedDeps = await createSharedDeps(config, deps);
49
- return signers.map((signer)=>createL1TxUtilsFromEthSignerBase(client, signer, sharedDeps, config));
62
+ // Deduplicate signers by address to avoid creating multiple L1TxUtils instances
63
+ // for the same publisher address (e.g., when multiple attesters share the same publisher key)
64
+ const signersByAddress = new Map();
65
+ for (const signer of signers){
66
+ const addressKey = signer.address.toString().toLowerCase();
67
+ if (!signersByAddress.has(addressKey)) {
68
+ signersByAddress.set(addressKey, signer);
69
+ }
70
+ }
71
+ const uniqueSigners = Array.from(signersByAddress.values());
72
+ if (uniqueSigners.length < signers.length) {
73
+ sharedDeps.logger.info(`Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`);
74
+ }
75
+ return uniqueSigners.map((signer)=>createL1TxUtilsFromEthSignerBase(client, signer, sharedDeps, config));
76
+ }
77
+ /**
78
+ * Creates ForwarderL1TxUtils from multiple Viem wallets, sharing store and metrics.
79
+ * This wraps all transactions through a forwarder contract for testing purposes.
80
+ */ export async function createForwarderL1TxUtilsFromViemWallet(clients, forwarderAddress, config, deps) {
81
+ const sharedDeps = await createSharedDeps(config, deps);
82
+ return clients.map((client)=>createForwarderL1TxUtilsFromViemWalletBase(client, forwarderAddress, sharedDeps, config, config.debugMaxGasLimit));
83
+ }
84
+ /**
85
+ * Creates ForwarderL1TxUtils from multiple EthSigners, sharing store and metrics.
86
+ * This wraps all transactions through a forwarder contract for testing purposes.
87
+ */ export async function createForwarderL1TxUtilsFromEthSigner(client, signers, forwarderAddress, config, deps) {
88
+ const sharedDeps = await createSharedDeps(config, deps);
89
+ return signers.map((signer)=>createForwarderL1TxUtilsFromEthSignerBase(client, signer, forwarderAddress, sharedDeps, config, config.debugMaxGasLimit));
50
90
  }
@@ -54,7 +54,7 @@ export declare class L1TxStore implements IL1TxStore {
54
54
  * @param account - The sender account address
55
55
  * @param stateId - The state ID to delete
56
56
  */
57
- deleteState(account: string, stateId: number): Promise<void>;
57
+ deleteState(account: string, ...stateIds: number[]): Promise<void>;
58
58
  /**
59
59
  * Clears all transaction states for a specific account.
60
60
  * @param account - The sender account address
@@ -1 +1 @@
1
- {"version":3,"file":"l1_tx_store.d.ts","sourceRoot":"","sources":["../../src/stores/l1_tx_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AA2ExE;;;;GAIG;AACH,qBAAa,SAAU,YAAW,UAAU;IAQxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARtB,gBAAuB,cAAc,KAAK;IAE1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgC;gBAG5C,KAAK,EAAE,iBAAiB,EACxB,GAAG,GAAE,MAA0C;IAOlE;;OAEG;IACI,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS3D;;OAEG;IACH,OAAO,CAAC,OAAO;IAIf;;;;;OAKG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAU7E;;;;;OAKG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7G;;;;OAIG;IACU,UAAU,CAAC,OAAO,EAAE,MAAM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xB,GAAG,GAAE,MAA0C;IAOlE;;OAEG;IACI,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS3D;;OAEG;IACH,OAAO,CAAC,OAAO;IAIf;;;;;OAKG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAU7E;;;;;OAKG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7G;;;;OAIG;IACU,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAsC9D;;;;;OAKG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IA4BxF;;;;OAIG;IACU,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAc/E;;;OAGG;IACU,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxD;;;OAGG;IACU,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAWhD;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;OAEG;IACH,OAAO,CAAC,cAAc;IAkCtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA2CxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAY9B"}
@@ -134,22 +134,30 @@ import { createLogger } from '@aztec/foundation/log';
134
134
  * Deletes a specific state and its associated blobs.
135
135
  * @param account - The sender account address
136
136
  * @param stateId - The state ID to delete
137
- */ async deleteState(account, stateId) {
138
- const key = this.makeKey(account, stateId);
139
- await this.states.delete(key);
140
- await this.blobs.delete(key);
141
- this.log.debug(`Deleted state ${stateId} for account ${account}`);
137
+ */ async deleteState(account, ...stateIds) {
138
+ if (stateIds.length === 0) {
139
+ return;
140
+ }
141
+ await this.store.transactionAsync(async ()=>{
142
+ for (const stateId of stateIds){
143
+ const key = this.makeKey(account, stateId);
144
+ await this.states.delete(key);
145
+ await this.blobs.delete(key);
146
+ }
147
+ });
142
148
  }
143
149
  /**
144
150
  * Clears all transaction states for a specific account.
145
151
  * @param account - The sender account address
146
152
  */ async clearStates(account) {
147
- const states = await this.loadStates(account);
148
- for (const state of states){
149
- await this.deleteState(account, state.id);
150
- }
151
- await this.stateIdCounter.delete(account);
152
- this.log.info(`Cleared all tx states for account ${account}`);
153
+ await this.store.transactionAsync(async ()=>{
154
+ const states = await this.loadStates(account);
155
+ for (const state of states){
156
+ await this.deleteState(account, state.id);
157
+ }
158
+ await this.stateIdCounter.delete(account);
159
+ this.log.info(`Cleared all tx states for account ${account}`);
160
+ });
153
161
  }
154
162
  /**
155
163
  * Gets all accounts that have stored states.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/node-lib",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./actions": "./dest/actions/index.js",
@@ -57,35 +57,37 @@
57
57
  ]
58
58
  },
59
59
  "dependencies": {
60
- "@aztec/archiver": "2.1.8",
61
- "@aztec/bb-prover": "2.1.8",
62
- "@aztec/blob-sink": "2.1.8",
63
- "@aztec/constants": "2.1.8",
64
- "@aztec/epoch-cache": "2.1.8",
65
- "@aztec/ethereum": "2.1.8",
66
- "@aztec/foundation": "2.1.8",
67
- "@aztec/kv-store": "2.1.8",
68
- "@aztec/merkle-tree": "2.1.8",
69
- "@aztec/p2p": "2.1.8",
70
- "@aztec/protocol-contracts": "2.1.8",
71
- "@aztec/prover-client": "2.1.8",
72
- "@aztec/sequencer-client": "2.1.8",
73
- "@aztec/simulator": "2.1.8",
74
- "@aztec/stdlib": "2.1.8",
75
- "@aztec/telemetry-client": "2.1.8",
76
- "@aztec/validator-client": "2.1.8",
77
- "@aztec/world-state": "2.1.8",
60
+ "@aztec/archiver": "2.1.9",
61
+ "@aztec/bb-prover": "2.1.9",
62
+ "@aztec/blob-sink": "2.1.9",
63
+ "@aztec/constants": "2.1.9",
64
+ "@aztec/epoch-cache": "2.1.9",
65
+ "@aztec/ethereum": "2.1.9",
66
+ "@aztec/foundation": "2.1.9",
67
+ "@aztec/kv-store": "2.1.9",
68
+ "@aztec/merkle-tree": "2.1.9",
69
+ "@aztec/p2p": "2.1.9",
70
+ "@aztec/protocol-contracts": "2.1.9",
71
+ "@aztec/prover-client": "2.1.9",
72
+ "@aztec/sequencer-client": "2.1.9",
73
+ "@aztec/simulator": "2.1.9",
74
+ "@aztec/stdlib": "2.1.9",
75
+ "@aztec/telemetry-client": "2.1.9",
76
+ "@aztec/validator-client": "2.1.9",
77
+ "@aztec/world-state": "2.1.9",
78
78
  "tslib": "^2.4.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@aztec/blob-lib": "2.1.8",
81
+ "@aztec/blob-lib": "2.1.9",
82
+ "@aztec/node-keystore": "2.1.9",
82
83
  "@jest/globals": "^30.0.0",
83
84
  "@types/jest": "^30.0.0",
84
85
  "@types/node": "^22.15.17",
85
86
  "jest": "^30.0.0",
86
87
  "jest-mock-extended": "^4.0.0",
87
88
  "ts-node": "^10.9.1",
88
- "typescript": "^5.3.3"
89
+ "typescript": "^5.3.3",
90
+ "viem": "npm:@aztec/viem@2.38.2"
89
91
  },
90
92
  "files": [
91
93
  "dest",
@@ -4,6 +4,8 @@ import {
4
4
  } from '@aztec/ethereum';
5
5
  import type { EthSigner, ExtendedViemWalletClient, L1TxUtilsConfig, ViemClient } from '@aztec/ethereum';
6
6
  import {
7
+ createForwarderL1TxUtilsFromEthSigner as createForwarderL1TxUtilsFromEthSignerBase,
8
+ createForwarderL1TxUtilsFromViemWallet as createForwarderL1TxUtilsFromViemWalletBase,
7
9
  createL1TxUtilsWithBlobsFromEthSigner as createL1TxUtilsWithBlobsFromEthSignerBase,
8
10
  createL1TxUtilsWithBlobsFromViemWallet as createL1TxUtilsWithBlobsFromViemWalletBase,
9
11
  } from '@aztec/ethereum/l1-tx-utils-with-blobs';
@@ -65,7 +67,7 @@ export async function createL1TxUtilsWithBlobsFromViemWallet(
65
67
  }
66
68
 
67
69
  /**
68
- * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics.
70
+ * Creates L1TxUtils with blobs from multiple EthSigners, sharing store and metrics. Removes duplicates
69
71
  */
70
72
  export async function createL1TxUtilsWithBlobsFromEthSigner(
71
73
  client: ViemClient,
@@ -79,7 +81,25 @@ export async function createL1TxUtilsWithBlobsFromEthSigner(
79
81
  ) {
80
82
  const sharedDeps = await createSharedDeps(config, deps);
81
83
 
82
- return signers.map(signer =>
84
+ // Deduplicate signers by address to avoid creating multiple L1TxUtils instances
85
+ // for the same publisher address (e.g., when multiple attesters share the same publisher key)
86
+ const signersByAddress = new Map<string, EthSigner>();
87
+ for (const signer of signers) {
88
+ const addressKey = signer.address.toString().toLowerCase();
89
+ if (!signersByAddress.has(addressKey)) {
90
+ signersByAddress.set(addressKey, signer);
91
+ }
92
+ }
93
+
94
+ const uniqueSigners = Array.from(signersByAddress.values());
95
+
96
+ if (uniqueSigners.length < signers.length) {
97
+ sharedDeps.logger.info(
98
+ `Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`,
99
+ );
100
+ }
101
+
102
+ return uniqueSigners.map(signer =>
83
103
  createL1TxUtilsWithBlobsFromEthSignerBase(client, signer, sharedDeps, config, config.debugMaxGasLimit),
84
104
  );
85
105
  }
@@ -103,7 +123,7 @@ export async function createL1TxUtilsFromViemWalletWithStore(
103
123
  }
104
124
 
105
125
  /**
106
- * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics.
126
+ * Creates L1TxUtils (without blobs) from multiple EthSigners, sharing store and metrics. Removes duplicates.
107
127
  */
108
128
  export async function createL1TxUtilsFromEthSignerWithStore(
109
129
  client: ViemClient,
@@ -118,5 +138,73 @@ export async function createL1TxUtilsFromEthSignerWithStore(
118
138
  ) {
119
139
  const sharedDeps = await createSharedDeps(config, deps);
120
140
 
121
- return signers.map(signer => createL1TxUtilsFromEthSignerBase(client, signer, sharedDeps, config));
141
+ // Deduplicate signers by address to avoid creating multiple L1TxUtils instances
142
+ // for the same publisher address (e.g., when multiple attesters share the same publisher key)
143
+ const signersByAddress = new Map<string, EthSigner>();
144
+ for (const signer of signers) {
145
+ const addressKey = signer.address.toString().toLowerCase();
146
+ if (!signersByAddress.has(addressKey)) {
147
+ signersByAddress.set(addressKey, signer);
148
+ }
149
+ }
150
+
151
+ const uniqueSigners = Array.from(signersByAddress.values());
152
+
153
+ if (uniqueSigners.length < signers.length) {
154
+ sharedDeps.logger.info(
155
+ `Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`,
156
+ );
157
+ }
158
+
159
+ return uniqueSigners.map(signer => createL1TxUtilsFromEthSignerBase(client, signer, sharedDeps, config));
160
+ }
161
+
162
+ /**
163
+ * Creates ForwarderL1TxUtils from multiple Viem wallets, sharing store and metrics.
164
+ * This wraps all transactions through a forwarder contract for testing purposes.
165
+ */
166
+ export async function createForwarderL1TxUtilsFromViemWallet(
167
+ clients: ExtendedViemWalletClient[],
168
+ forwarderAddress: import('@aztec/foundation/eth-address').EthAddress,
169
+ config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
170
+ deps: {
171
+ telemetry: TelemetryClient;
172
+ logger?: ReturnType<typeof createLogger>;
173
+ dateProvider?: DateProvider;
174
+ },
175
+ ) {
176
+ const sharedDeps = await createSharedDeps(config, deps);
177
+
178
+ return clients.map(client =>
179
+ createForwarderL1TxUtilsFromViemWalletBase(client, forwarderAddress, sharedDeps, config, config.debugMaxGasLimit),
180
+ );
181
+ }
182
+
183
+ /**
184
+ * Creates ForwarderL1TxUtils from multiple EthSigners, sharing store and metrics.
185
+ * This wraps all transactions through a forwarder contract for testing purposes.
186
+ */
187
+ export async function createForwarderL1TxUtilsFromEthSigner(
188
+ client: ViemClient,
189
+ signers: EthSigner[],
190
+ forwarderAddress: import('@aztec/foundation/eth-address').EthAddress,
191
+ config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
192
+ deps: {
193
+ telemetry: TelemetryClient;
194
+ logger?: ReturnType<typeof createLogger>;
195
+ dateProvider?: DateProvider;
196
+ },
197
+ ) {
198
+ const sharedDeps = await createSharedDeps(config, deps);
199
+
200
+ return signers.map(signer =>
201
+ createForwarderL1TxUtilsFromEthSignerBase(
202
+ client,
203
+ signer,
204
+ forwarderAddress,
205
+ sharedDeps,
206
+ config,
207
+ config.debugMaxGasLimit,
208
+ ),
209
+ );
122
210
  }
@@ -231,11 +231,18 @@ export class L1TxStore implements IL1TxStore {
231
231
  * @param account - The sender account address
232
232
  * @param stateId - The state ID to delete
233
233
  */
234
- public async deleteState(account: string, stateId: number): Promise<void> {
235
- const key = this.makeKey(account, stateId);
236
- await this.states.delete(key);
237
- await this.blobs.delete(key);
238
- this.log.debug(`Deleted state ${stateId} for account ${account}`);
234
+ public async deleteState(account: string, ...stateIds: number[]): Promise<void> {
235
+ if (stateIds.length === 0) {
236
+ return;
237
+ }
238
+
239
+ await this.store.transactionAsync(async () => {
240
+ for (const stateId of stateIds) {
241
+ const key = this.makeKey(account, stateId);
242
+ await this.states.delete(key);
243
+ await this.blobs.delete(key);
244
+ }
245
+ });
239
246
  }
240
247
 
241
248
  /**
@@ -243,14 +250,16 @@ export class L1TxStore implements IL1TxStore {
243
250
  * @param account - The sender account address
244
251
  */
245
252
  public async clearStates(account: string): Promise<void> {
246
- const states = await this.loadStates(account);
253
+ await this.store.transactionAsync(async () => {
254
+ const states = await this.loadStates(account);
247
255
 
248
- for (const state of states) {
249
- await this.deleteState(account, state.id);
250
- }
256
+ for (const state of states) {
257
+ await this.deleteState(account, state.id);
258
+ }
251
259
 
252
- await this.stateIdCounter.delete(account);
253
- this.log.info(`Cleared all tx states for account ${account}`);
260
+ await this.stateIdCounter.delete(account);
261
+ this.log.info(`Cleared all tx states for account ${account}`);
262
+ });
254
263
  }
255
264
 
256
265
  /**