@aztec/node-lib 0.0.1-fake-c83136db25 → 0.0.1-private.d0bedffd
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.
- package/dest/actions/build-snapshot-metadata.d.ts +1 -1
- package/dest/actions/build-snapshot-metadata.js +2 -2
- package/dest/actions/create-backups.d.ts +1 -1
- package/dest/actions/index.d.ts +1 -1
- package/dest/actions/snapshot-sync.d.ts +5 -4
- package/dest/actions/snapshot-sync.d.ts.map +1 -1
- package/dest/actions/snapshot-sync.js +10 -8
- package/dest/actions/upload-snapshot.d.ts +2 -2
- package/dest/actions/upload-snapshot.d.ts.map +1 -1
- package/dest/config/index.d.ts +9 -5
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +21 -9
- package/dest/factories/index.d.ts +1 -1
- package/dest/factories/l1_tx_utils.d.ts +34 -21
- package/dest/factories/l1_tx_utils.d.ts.map +1 -1
- package/dest/factories/l1_tx_utils.js +61 -17
- package/dest/metrics/index.d.ts +1 -1
- package/dest/metrics/l1_tx_metrics.d.ts +2 -2
- package/dest/metrics/l1_tx_metrics.d.ts.map +1 -1
- package/dest/metrics/l1_tx_metrics.js +16 -43
- package/dest/stores/index.d.ts +1 -1
- package/dest/stores/l1_tx_store.d.ts +3 -3
- package/dest/stores/l1_tx_store.d.ts.map +1 -1
- package/dest/stores/l1_tx_store.js +19 -11
- package/package.json +35 -23
- package/src/actions/build-snapshot-metadata.ts +2 -2
- package/src/actions/snapshot-sync.ts +17 -10
- package/src/actions/upload-snapshot.ts +1 -1
- package/src/config/index.ts +36 -15
- package/src/factories/l1_tx_utils.ts +71 -37
- package/src/metrics/l1_tx_metrics.ts +13 -44
- package/src/stores/l1_tx_store.ts +21 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IL1TxStore, L1BlobInputs, L1TxConfig, L1TxState } from '@aztec/ethereum';
|
|
1
|
+
import type { IL1TxStore, L1BlobInputs, L1TxConfig, L1TxState } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -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,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
253
|
+
await this.store.transactionAsync(async () => {
|
|
254
|
+
const states = await this.loadStates(account);
|
|
247
255
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
256
|
+
for (const state of states) {
|
|
257
|
+
await this.deleteState(account, state.id);
|
|
258
|
+
}
|
|
251
259
|
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
await this.stateIdCounter.delete(account);
|
|
261
|
+
this.log.info(`Cleared all tx states for account ${account}`);
|
|
262
|
+
});
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
/**
|