@aztec/node-lib 0.0.1-commit.fce3e4f → 0.0.1-commit.ffe5b04ea
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.js +2 -2
- 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 +7 -5
- 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 +7 -5
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +16 -9
- 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/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/l1_tx_store.d.ts +4 -4
- package/dest/stores/l1_tx_store.d.ts.map +1 -1
- package/dest/stores/l1_tx_store.js +19 -11
- package/package.json +35 -24
- package/src/actions/build-snapshot-metadata.ts +2 -2
- package/src/actions/snapshot-sync.ts +14 -7
- package/src/actions/upload-snapshot.ts +1 -1
- package/src/config/index.ts +29 -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,10 +1,10 @@
|
|
|
1
1
|
export async function buildSnapshotMetadata(archiver, config) {
|
|
2
|
-
const [rollupAddress, l1BlockNumber,
|
|
2
|
+
const [rollupAddress, l1BlockNumber, tips] = await Promise.all([
|
|
3
3
|
archiver.getRollupAddress(),
|
|
4
4
|
archiver.getL1BlockNumber(),
|
|
5
5
|
archiver.getL2Tips()
|
|
6
6
|
]);
|
|
7
|
-
const { number: l2BlockNumber, hash: l2BlockHash } =
|
|
7
|
+
const { number: l2BlockNumber, hash: l2BlockHash } = tips.proposed;
|
|
8
8
|
if (!l2BlockHash) {
|
|
9
9
|
throw new Error(`Failed to get L2 block hash from archiver.`);
|
|
10
10
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ArchiverConfig } from '@aztec/archiver';
|
|
2
|
-
import { type EthereumClientConfig } from '@aztec/ethereum';
|
|
2
|
+
import { type EthereumClientConfig } from '@aztec/ethereum/client';
|
|
3
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
6
6
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
7
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
7
8
|
import { type SnapshotMetadata } from '@aztec/stdlib/snapshots';
|
|
8
9
|
import type { SharedNodeConfig } from '../config/index.js';
|
|
9
|
-
type SnapshotSyncConfig = Pick<SharedNodeConfig, 'syncMode'> & Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> & Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> & Required<DataStoreConfig
|
|
10
|
+
type SnapshotSyncConfig = Pick<SharedNodeConfig, 'syncMode'> & Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> & Pick<L1ContractsConfig, 'aztecEpochDuration'> & Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> & DataStoreConfig & Required<Pick<DataStoreConfig, 'l1Contracts'>> & EthereumClientConfig & {
|
|
10
11
|
snapshotsUrls?: string[];
|
|
11
12
|
minL1BlocksToTriggerReplace?: number;
|
|
12
13
|
};
|
|
@@ -24,4 +25,4 @@ export declare function snapshotSync(snapshot: Pick<SnapshotMetadata, 'dataUrls'
|
|
|
24
25
|
snapshotsUrl: string;
|
|
25
26
|
}): Promise<void>;
|
|
26
27
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dCQUF3QixHQUFHLFNBQVMsQ0FBQyxHQUMxRCxlQUFlLEdBQ2YsUUFBUSxDQUFDLElBQUksQ0FBQyxlQUFlLEVBQUUsYUFBYSxDQUFDLENBQUMsR0FDOUMsb0JBQW9CLEdBQUc7SUFDckIsYUFBYSxDQUFDLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDekIsMkJBQTJCLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDdEMsQ0FBQztBQUVKOzs7R0FHRztBQUNILHdCQUFzQixlQUFlLENBQUMsTUFBTSxFQUFFLGtCQUFrQixFQUFFLEdBQUcsRUFBRSxNQUFNLG9CQXFLNUU7QUFFRDs7R0FFRztBQUNILHdCQUFzQixZQUFZLENBQ2hDLFFBQVEsRUFBRSxJQUFJLENBQUMsZ0JBQWdCLEVBQUUsVUFBVSxDQUFDLEVBQzVDLEdBQUcsRUFBRSxNQUFNLEVBQ1gsTUFBTSxFQUFFO0lBQUUsYUFBYSxFQUFFLE1BQU0sQ0FBQztJQUFDLGFBQWEsRUFBRSxVQUFVLENBQUM7SUFBQyxZQUFZLEVBQUUsTUFBTSxDQUFBO0NBQUUsaUJBcURuRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-sync.d.ts","sourceRoot":"","sources":["../../src/actions/snapshot-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAErH,OAAO,EAAE,KAAK,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshot-sync.d.ts","sourceRoot":"","sources":["../../src/actions/snapshot-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAErH,OAAO,EAAE,KAAK,oBAAoB,EAAmB,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE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M } from '@aztec/constants';
|
|
3
|
-
import { getPublicClient } from '@aztec/ethereum';
|
|
3
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
4
4
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
5
5
|
import { P2P_STORE_NAME } from '@aztec/p2p';
|
|
6
|
-
import { DatabaseVersionManager } from '@aztec/stdlib/database-version';
|
|
6
|
+
import { DatabaseVersionManager } from '@aztec/stdlib/database-version/manager';
|
|
7
7
|
import { createReadOnlyFileStore } from '@aztec/stdlib/file-store';
|
|
8
8
|
import { downloadSnapshot, getLatestSnapshotMetadata, makeSnapshotPaths } from '@aztec/stdlib/snapshots';
|
|
9
9
|
import { NATIVE_WORLD_STATE_DBS, WORLD_STATE_DB_VERSION, WORLD_STATE_DIR } from '@aztec/world-state';
|
|
@@ -32,13 +32,15 @@ const MIN_L1_BLOCKS_TO_TRIGGER_REPLACE = 86400 / 2 / 12;
|
|
|
32
32
|
}
|
|
33
33
|
// Create an archiver store to check the current state (do this only once)
|
|
34
34
|
log.verbose(`Creating temporary archiver data store`);
|
|
35
|
-
const archiverStore = await createArchiverStore(config
|
|
35
|
+
const archiverStore = await createArchiverStore(config, {
|
|
36
|
+
epochDuration: config.aztecEpochDuration
|
|
37
|
+
});
|
|
36
38
|
let archiverL1BlockNumber;
|
|
37
39
|
let archiverL2BlockNumber;
|
|
38
40
|
try {
|
|
39
41
|
[archiverL1BlockNumber, archiverL2BlockNumber] = await Promise.all([
|
|
40
42
|
archiverStore.getSynchPoint().then((s)=>s.blocksSynchedTo),
|
|
41
|
-
archiverStore.
|
|
43
|
+
archiverStore.getLatestBlockNumber()
|
|
42
44
|
]);
|
|
43
45
|
} finally{
|
|
44
46
|
log.verbose(`Closing temporary archiver data store`, {
|
|
@@ -53,7 +55,7 @@ const MIN_L1_BLOCKS_TO_TRIGGER_REPLACE = 86400 / 2 / 12;
|
|
|
53
55
|
return false;
|
|
54
56
|
}
|
|
55
57
|
const currentL1BlockNumber = await getPublicClient(config).getBlockNumber();
|
|
56
|
-
if (archiverL1BlockNumber && currentL1BlockNumber - archiverL1BlockNumber < minL1BlocksToTriggerReplace) {
|
|
58
|
+
if (archiverL1BlockNumber && currentL1BlockNumber >= archiverL1BlockNumber && currentL1BlockNumber - archiverL1BlockNumber < minL1BlocksToTriggerReplace) {
|
|
57
59
|
log.verbose(`Skipping snapshot sync as archiver is less than ${currentL1BlockNumber - archiverL1BlockNumber} L1 blocks behind.`, {
|
|
58
60
|
archiverL1BlockNumber,
|
|
59
61
|
currentL1BlockNumber,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Archiver } from '@aztec/archiver';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
3
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
5
4
|
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
6
6
|
export type UploadSnapshotConfig = Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> & Pick<DataStoreConfig, 'dataDirectory'>;
|
|
7
7
|
/**
|
|
8
8
|
* Pauses the archiver and world state sync, creates backups of the archiver and world state lmdb environments,
|
|
9
9
|
* and uploads them to the specified location. Location must be a URL supported by our file store (eg `gs://bucketname/path`).
|
|
10
10
|
*/
|
|
11
11
|
export declare function uploadSnapshot(location: string, archiver: Archiver, worldState: WorldStateSynchronizer, config: UploadSnapshotConfig, log: Logger): Promise<void>;
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBsb2FkLXNuYXBzaG90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWN0aW9ucy91cGxvYWQtc25hcHNob3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixLQUFLLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXJFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRXhELE9BQU8sS0FBSyxFQUFFLHNCQUFzQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFXOUQsTUFBTSxNQUFNLG9CQUFvQixHQUFHLElBQUksQ0FBQyxXQUFXLEVBQUUsV0FBVyxHQUFHLGVBQWUsQ0FBQyxHQUNqRixJQUFJLENBQUMsZUFBZSxFQUFFLGVBQWUsQ0FBQyxDQUFDO0FBRXpDOzs7R0FHRztBQUNILHdCQUFzQixjQUFjLENBQ2xDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLFFBQVEsRUFBRSxRQUFRLEVBQ2xCLFVBQVUsRUFBRSxzQkFBc0IsRUFDbEMsTUFBTSxFQUFFLG9CQUFvQixFQUM1QixHQUFHLEVBQUUsTUFBTSxpQkFvQloifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-snapshot.d.ts","sourceRoot":"","sources":["../../src/actions/upload-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"upload-snapshot.d.ts","sourceRoot":"","sources":["../../src/actions/upload-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAW9D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,CAAC,GACjF,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAEzC;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,sBAAsB,EAClC,MAAM,EAAE,oBAAoB,EAC5B,GAAG,EAAE,MAAM,iBAoBZ"}
|
package/dest/config/index.d.ts
CHANGED
|
@@ -4,18 +4,20 @@ export type SharedNodeConfig = {
|
|
|
4
4
|
testAccounts: boolean;
|
|
5
5
|
/** Whether to populate the genesis state with initial fee juice for the sponsored FPC */
|
|
6
6
|
sponsoredFPC: boolean;
|
|
7
|
+
/** Additional addresses to prefund with fee juice at genesis */
|
|
8
|
+
prefundAddresses: string[];
|
|
7
9
|
/** Sync mode: full to always sync via L1, snapshot to download a snapshot if there is no local data, force-snapshot to download even if there is local data. */
|
|
8
10
|
syncMode: 'full' | 'snapshot' | 'force-snapshot';
|
|
9
11
|
/** Base URLs for snapshots index. Index file will be searched at `SNAPSHOTS_BASE_URL/aztec-L1_CHAIN_ID-VERSION-ROLLUP_ADDRESS/index.json` */
|
|
10
12
|
snapshotsUrls?: string[];
|
|
11
|
-
/** Auto update mode: disabled - to completely ignore remote signals to update the node. enabled - to respect the signals (potentially shutting this node down). log - check for updates but log a warning instead of applying them*/
|
|
12
|
-
autoUpdate?: 'disabled' | 'notify' | 'config' | 'config-and-version';
|
|
13
|
-
/** The base URL against which to check for updates */
|
|
14
|
-
autoUpdateUrl?: string;
|
|
15
13
|
/** URL of the Web3Signer instance */
|
|
16
14
|
web3SignerUrl?: string;
|
|
17
15
|
/** Whether to run in fisherman mode */
|
|
18
16
|
fishermanMode?: boolean;
|
|
17
|
+
/** Force verification of tx Chonk proofs. Only used for testnet */
|
|
18
|
+
debugForceTxProofVerification: boolean;
|
|
19
|
+
/** Check if the node version matches the latest version for the network */
|
|
20
|
+
enableVersionCheck: boolean;
|
|
19
21
|
};
|
|
20
22
|
export declare const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig>;
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssa0JBQWtCLEVBQXVCLE1BQU0sMEJBQTBCLENBQUM7QUFFeEYsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQzdCLHlGQUF5RjtJQUN6RixZQUFZLEVBQUUsT0FBTyxDQUFDO0lBQ3RCLHlGQUF5RjtJQUN6RixZQUFZLEVBQUUsT0FBTyxDQUFDO0lBQ3RCLGdFQUFnRTtJQUNoRSxnQkFBZ0IsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUMzQixnS0FBZ0s7SUFDaEssUUFBUSxFQUFFLE1BQU0sR0FBRyxVQUFVLEdBQUcsZ0JBQWdCLENBQUM7SUFDakQsNklBQTZJO0lBQzdJLGFBQWEsQ0FBQyxFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQ3pCLHFDQUFxQztJQUNyQyxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDdkIsdUNBQXVDO0lBQ3ZDLGFBQWEsQ0FBQyxFQUFFLE9BQU8sQ0FBQztJQUV4QixtRUFBbUU7SUFDbkUsNkJBQTZCLEVBQUUsT0FBTyxDQUFDO0lBRXZDLDJFQUEyRTtJQUMzRSxrQkFBa0IsRUFBRSxPQUFPLENBQUM7Q0FDN0IsQ0FBQztBQUVGLGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxrQkFBa0IsQ0FBQyxnQkFBZ0IsQ0EyRHpFLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,0BAA0B,CAAC;AAExF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,gKAAgK;IAChK,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACjD,6IAA6I;IAC7I,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,0BAA0B,CAAC;AAExF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gKAAgK;IAChK,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACjD,6IAA6I;IAC7I,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,mEAAmE;IACnE,6BAA6B,EAAE,OAAO,CAAC;IAEvC,2EAA2E;IAC3E,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,kBAAkB,CAAC,gBAAgB,CA2DzE,CAAC"}
|
package/dest/config/index.js
CHANGED
|
@@ -10,6 +10,12 @@ export const sharedNodeConfigMappings = {
|
|
|
10
10
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
11
11
|
...booleanConfigHelper(false)
|
|
12
12
|
},
|
|
13
|
+
prefundAddresses: {
|
|
14
|
+
env: 'PREFUND_ADDRESSES',
|
|
15
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
16
|
+
parseEnv: (val)=>val.split(',').map((a)=>a.trim()).filter((a)=>a.length > 0),
|
|
17
|
+
defaultValue: []
|
|
18
|
+
},
|
|
13
19
|
syncMode: {
|
|
14
20
|
env: 'SYNC_MODE',
|
|
15
21
|
description: 'Set sync mode to `full` to always sync via L1, `snapshot` to download a snapshot if there is no local data, `force-snapshot` to download even if there is local data.',
|
|
@@ -24,15 +30,6 @@ export const sharedNodeConfigMappings = {
|
|
|
24
30
|
],
|
|
25
31
|
defaultValue: []
|
|
26
32
|
},
|
|
27
|
-
autoUpdate: {
|
|
28
|
-
env: 'AUTO_UPDATE',
|
|
29
|
-
description: 'The auto update mode for this node',
|
|
30
|
-
defaultValue: 'disabled'
|
|
31
|
-
},
|
|
32
|
-
autoUpdateUrl: {
|
|
33
|
-
env: 'AUTO_UPDATE_URL',
|
|
34
|
-
description: 'Base URL to check for updates'
|
|
35
|
-
},
|
|
36
33
|
web3SignerUrl: {
|
|
37
34
|
env: 'WEB3_SIGNER_URL',
|
|
38
35
|
description: 'URL of the Web3Signer instance',
|
|
@@ -42,5 +39,15 @@ export const sharedNodeConfigMappings = {
|
|
|
42
39
|
env: 'FISHERMAN_MODE',
|
|
43
40
|
description: 'Whether to run in fisherman mode.',
|
|
44
41
|
...booleanConfigHelper(false)
|
|
42
|
+
},
|
|
43
|
+
debugForceTxProofVerification: {
|
|
44
|
+
env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
|
|
45
|
+
description: 'Whether to force tx proof verification. Only has an effect if real proving is turned off',
|
|
46
|
+
...booleanConfigHelper(false)
|
|
47
|
+
},
|
|
48
|
+
enableVersionCheck: {
|
|
49
|
+
env: 'ENABLE_VERSION_CHECK',
|
|
50
|
+
description: 'Check if the node is running the latest version and is following the latest rollup',
|
|
51
|
+
...booleanConfigHelper(true)
|
|
45
52
|
}
|
|
46
53
|
};
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlobKzgInstance } from '@aztec/blob-lib/types';
|
|
2
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
3
|
+
import type { L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils';
|
|
4
|
+
import type { ExtendedViemWalletClient, ViemClient } from '@aztec/ethereum/types';
|
|
5
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
7
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
4
|
-
import type { DataStoreConfig } from '@aztec/kv-store
|
|
8
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
5
9
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
6
10
|
import type { L1TxScope } from '../metrics/l1_tx_metrics.js';
|
|
7
11
|
/**
|
|
8
|
-
* Creates L1TxUtils
|
|
12
|
+
* Creates L1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
13
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
9
14
|
*/
|
|
10
|
-
export declare function
|
|
15
|
+
export declare function createL1TxUtilsFromWallets(clients: ExtendedViemWalletClient[], config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
|
|
11
16
|
debugMaxGasLimit?: boolean;
|
|
12
17
|
scope?: L1TxScope;
|
|
13
18
|
}, deps: {
|
|
14
19
|
telemetry: TelemetryClient;
|
|
15
20
|
logger?: ReturnType<typeof createLogger>;
|
|
16
|
-
dateProvider
|
|
17
|
-
|
|
21
|
+
dateProvider: DateProvider;
|
|
22
|
+
kzg?: BlobKzgInstance;
|
|
23
|
+
}): Promise<import("@aztec/ethereum/l1-tx-utils").L1TxUtils[]>;
|
|
18
24
|
/**
|
|
19
|
-
* Creates L1TxUtils
|
|
25
|
+
* Creates L1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
26
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
27
|
+
* Deduplicates signers by address to avoid creating multiple instances for the same publisher.
|
|
20
28
|
*/
|
|
21
|
-
export declare function
|
|
29
|
+
export declare function createL1TxUtilsFromSigners(client: ViemClient, signers: EthSigner[], config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
|
|
22
30
|
debugMaxGasLimit?: boolean;
|
|
23
31
|
scope?: L1TxScope;
|
|
24
32
|
}, deps: {
|
|
25
33
|
telemetry: TelemetryClient;
|
|
26
34
|
logger?: ReturnType<typeof createLogger>;
|
|
27
|
-
dateProvider
|
|
28
|
-
|
|
35
|
+
dateProvider: DateProvider;
|
|
36
|
+
kzg?: BlobKzgInstance;
|
|
37
|
+
}): Promise<import("@aztec/ethereum/l1-tx-utils").L1TxUtils[]>;
|
|
29
38
|
/**
|
|
30
|
-
* Creates
|
|
39
|
+
* Creates ForwarderL1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
40
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
41
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
31
42
|
*/
|
|
32
|
-
export declare function
|
|
43
|
+
export declare function createForwarderL1TxUtilsFromWallets(clients: ExtendedViemWalletClient[], forwarderAddress: EthAddress, config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
|
|
33
44
|
debugMaxGasLimit?: boolean;
|
|
34
45
|
scope?: L1TxScope;
|
|
35
46
|
}, deps: {
|
|
36
47
|
telemetry: TelemetryClient;
|
|
37
48
|
logger?: ReturnType<typeof createLogger>;
|
|
38
|
-
dateProvider
|
|
39
|
-
|
|
40
|
-
}): Promise<import("@aztec/ethereum").
|
|
49
|
+
dateProvider: DateProvider;
|
|
50
|
+
kzg?: BlobKzgInstance;
|
|
51
|
+
}): Promise<import("@aztec/ethereum/l1-tx-utils-with-blobs").ForwarderL1TxUtils[]>;
|
|
41
52
|
/**
|
|
42
|
-
* Creates
|
|
53
|
+
* Creates ForwarderL1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
54
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
55
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
43
56
|
*/
|
|
44
|
-
export declare function
|
|
57
|
+
export declare function createForwarderL1TxUtilsFromSigners(client: ViemClient, signers: EthSigner[], forwarderAddress: EthAddress, config: DataStoreConfig & Partial<L1TxUtilsConfig> & {
|
|
45
58
|
debugMaxGasLimit?: boolean;
|
|
46
59
|
scope?: L1TxScope;
|
|
47
60
|
}, deps: {
|
|
48
61
|
telemetry: TelemetryClient;
|
|
49
62
|
logger?: ReturnType<typeof createLogger>;
|
|
50
|
-
dateProvider
|
|
51
|
-
|
|
52
|
-
}): Promise<import("@aztec/ethereum").
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
dateProvider: DateProvider;
|
|
64
|
+
kzg?: BlobKzgInstance;
|
|
65
|
+
}): Promise<import("@aztec/ethereum/l1-tx-utils-with-blobs").ForwarderL1TxUtils[]>;
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdHhfdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mYWN0b3JpZXMvbDFfdHhfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7Q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QUFPLEVBQUUsU0FBUyxFQUFFLEVBQ3BCLGdCQUFnQixFQUFFLFVBQVUsRUFDNUIsTUFBTSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsZUFBZSxDQUFDLEdBQUc7SUFBRSxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQztJQUFDLEtBQUssQ0FBQyxFQUFFLFNBQVMsQ0FBQTtDQUFFLEVBQ3RHLElBQUksRUFBRTtJQUNKLFNBQVMsRUFBRSxlQUFlLENBQUM7SUFDM0IsTUFBTSxDQUFDLEVBQUUsVUFBVSxDQUFDLE9BQU8sWUFBWSxDQUFDLENBQUM7SUFDekMsWUFBWSxFQUFFLFlBQVksQ0FBQztJQUMzQixHQUFHLENBQUMsRUFBRSxlQUFlLENBQUM7Q0FDdkIsa0ZBT0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../../src/factories/l1_tx_utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../../src/factories/l1_tx_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAElF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAA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AY,CAAC,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,kFAOF;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,SAAS,EAAE,EACpB,gBAAgB,EAAE,UAAU,EAC5B,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,EAAE,YAAY,CAAC;IAC3B,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,kFAOF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createDelayer, createL1TxUtils as createL1TxUtilsBase } from '@aztec/ethereum/l1-tx-utils';
|
|
2
|
+
import { createForwarderL1TxUtils as createForwarderL1TxUtilsBase } 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';
|
|
@@ -7,44 +7,88 @@ import { L1TxMetrics } from '../metrics/l1_tx_metrics.js';
|
|
|
7
7
|
import { L1TxStore } from '../stores/l1_tx_store.js';
|
|
8
8
|
const L1_TX_STORE_NAME = 'l1-tx-utils';
|
|
9
9
|
/**
|
|
10
|
-
* Creates shared dependencies (logger, store, metrics) for L1TxUtils instances.
|
|
10
|
+
* Creates shared dependencies (logger, store, metrics, delayer) for L1TxUtils instances.
|
|
11
|
+
* When enableDelayer is set in config, a single shared delayer is created and passed to all instances.
|
|
11
12
|
*/ async function createSharedDeps(config, deps) {
|
|
12
13
|
const logger = deps.logger ?? createLogger('l1-tx-utils');
|
|
13
14
|
// Note that we do NOT bind them to the rollup address, since we still need to
|
|
14
15
|
// monitor and cancel txs for previous rollups to free up our nonces.
|
|
15
16
|
const noRollupConfig = omit(config, 'l1Contracts');
|
|
16
|
-
const kvStore = await createStore(L1_TX_STORE_NAME, L1TxStore.SCHEMA_VERSION, noRollupConfig, logger);
|
|
17
|
+
const kvStore = await createStore(L1_TX_STORE_NAME, L1TxStore.SCHEMA_VERSION, noRollupConfig, logger.getBindings());
|
|
17
18
|
const store = new L1TxStore(kvStore, logger);
|
|
18
19
|
const meter = deps.telemetry.getMeter('L1TxUtils');
|
|
19
20
|
const metrics = new L1TxMetrics(meter, config.scope ?? 'other', logger);
|
|
21
|
+
// Create a single shared delayer for all L1TxUtils instances in this group
|
|
22
|
+
const delayer = config.enableDelayer && config.ethereumSlotDuration !== undefined ? createDelayer(deps.dateProvider, {
|
|
23
|
+
ethereumSlotDuration: config.ethereumSlotDuration
|
|
24
|
+
}, logger.getBindings()) : undefined;
|
|
20
25
|
return {
|
|
21
26
|
logger,
|
|
22
27
|
store,
|
|
23
28
|
metrics,
|
|
24
|
-
dateProvider: deps.dateProvider
|
|
29
|
+
dateProvider: deps.dateProvider,
|
|
30
|
+
delayer
|
|
25
31
|
};
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
|
-
* Creates L1TxUtils
|
|
29
|
-
|
|
34
|
+
* Creates L1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
35
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
36
|
+
*/ export async function createL1TxUtilsFromWallets(clients, config, deps) {
|
|
30
37
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
31
|
-
return clients.map((client)=>
|
|
38
|
+
return clients.map((client)=>createL1TxUtilsBase(client, {
|
|
39
|
+
...sharedDeps,
|
|
40
|
+
kzg: deps.kzg
|
|
41
|
+
}, config));
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
* Creates L1TxUtils
|
|
35
|
-
|
|
44
|
+
* Creates L1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
45
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
46
|
+
* Deduplicates signers by address to avoid creating multiple instances for the same publisher.
|
|
47
|
+
*/ export async function createL1TxUtilsFromSigners(client, signers, config, deps) {
|
|
36
48
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
37
|
-
|
|
49
|
+
// Deduplicate signers by address to avoid creating multiple L1TxUtils instances
|
|
50
|
+
// for the same publisher address (e.g., when multiple attesters share the same publisher key)
|
|
51
|
+
const signersByAddress = new Map();
|
|
52
|
+
for (const signer of signers){
|
|
53
|
+
const addressKey = signer.address.toString().toLowerCase();
|
|
54
|
+
if (!signersByAddress.has(addressKey)) {
|
|
55
|
+
signersByAddress.set(addressKey, signer);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const uniqueSigners = Array.from(signersByAddress.values());
|
|
59
|
+
if (uniqueSigners.length < signers.length) {
|
|
60
|
+
sharedDeps.logger.info(`Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`);
|
|
61
|
+
}
|
|
62
|
+
return uniqueSigners.map((signer)=>createL1TxUtilsBase({
|
|
63
|
+
client,
|
|
64
|
+
signer
|
|
65
|
+
}, {
|
|
66
|
+
...sharedDeps,
|
|
67
|
+
kzg: deps.kzg
|
|
68
|
+
}, config));
|
|
38
69
|
}
|
|
39
70
|
/**
|
|
40
|
-
* Creates
|
|
41
|
-
|
|
71
|
+
* Creates ForwarderL1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
72
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
73
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
74
|
+
*/ export async function createForwarderL1TxUtilsFromWallets(clients, forwarderAddress, config, deps) {
|
|
42
75
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
43
|
-
return clients.map((client)=>
|
|
76
|
+
return clients.map((client)=>createForwarderL1TxUtilsBase(client, forwarderAddress, {
|
|
77
|
+
...sharedDeps,
|
|
78
|
+
kzg: deps.kzg
|
|
79
|
+
}, config));
|
|
44
80
|
}
|
|
45
81
|
/**
|
|
46
|
-
* Creates
|
|
47
|
-
|
|
82
|
+
* Creates ForwarderL1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
83
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
84
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
85
|
+
*/ export async function createForwarderL1TxUtilsFromSigners(client, signers, forwarderAddress, config, deps) {
|
|
48
86
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
49
|
-
return signers.map((signer)=>
|
|
87
|
+
return signers.map((signer)=>createForwarderL1TxUtilsBase({
|
|
88
|
+
client,
|
|
89
|
+
signer
|
|
90
|
+
}, forwarderAddress, {
|
|
91
|
+
...sharedDeps,
|
|
92
|
+
kzg: deps.kzg
|
|
93
|
+
}, config));
|
|
50
94
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IL1TxMetrics, L1TxState } from '@aztec/ethereum';
|
|
1
|
+
import type { IL1TxMetrics, L1TxState } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import { type Meter } from '@aztec/telemetry-client';
|
|
3
3
|
export type L1TxScope = 'sequencer' | 'prover' | 'other';
|
|
4
4
|
/**
|
|
@@ -26,4 +26,4 @@ export declare class L1TxMetrics implements IL1TxMetrics {
|
|
|
26
26
|
recordMinedTx(state: L1TxState, l1Timestamp: Date): void;
|
|
27
27
|
recordDroppedTx(state: L1TxState): void;
|
|
28
28
|
}
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdHhfbWV0cmljcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21ldH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|
|
|
1
|
-
{"version":3,"file":"l1_tx_metrics.d.ts","sourceRoot":"","sources":["../../src/metrics/l1_tx_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"l1_tx_metrics.d.ts","sourceRoot":"","sources":["../../src/metrics/l1_tx_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG3E,OAAO,EAGL,KAAK,KAAK,EAIX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD;;GAEG;AACH,qBAAa,WAAY,YAAW,YAAY;IAmB5C,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IAnBhB,OAAO,CAAC,eAAe,CAAY;IAGnC,OAAO,CAAC,oBAAoB,CAAY;IAGxC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,eAAe,CAAgB;IAGvC,OAAO,CAAC,uBAAuB,CAAY;IAC3C,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,gBAAgB,CAAY;IAEpC,YACU,KAAK,EAAE,KAAK,EACZ,KAAK,GAAE,SAAmB,EAC1B,MAAM,yCAAsC,EAoBrD;IAED;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,GAAG,IAAI,CAoD9D;IAEM,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAiB7C;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TxUtilsState } from '@aztec/ethereum';
|
|
1
|
+
import { TxUtilsState } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { Attributes, Metrics,
|
|
3
|
+
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
4
4
|
/**
|
|
5
5
|
* Metrics for L1 transaction utils tracking tx lifecycle and gas costs.
|
|
6
6
|
*/ export class L1TxMetrics {
|
|
@@ -24,47 +24,20 @@ import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
|
|
|
24
24
|
this.meter = meter;
|
|
25
25
|
this.scope = scope;
|
|
26
26
|
this.logger = logger;
|
|
27
|
-
this.txMinedDuration = this.meter.createHistogram(Metrics.L1_TX_MINED_DURATION
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.txRevertedCount = this.meter.createUpDownCounter(Metrics.L1_TX_REVERTED_COUNT, {
|
|
42
|
-
description: 'Count of transactions that reverted',
|
|
43
|
-
valueType: ValueType.INT
|
|
44
|
-
});
|
|
45
|
-
this.txCancelledCount = this.meter.createUpDownCounter(Metrics.L1_TX_CANCELLED_COUNT, {
|
|
46
|
-
description: 'Count of transactions cancelled',
|
|
47
|
-
valueType: ValueType.INT
|
|
48
|
-
});
|
|
49
|
-
this.txNotMinedCount = this.meter.createUpDownCounter(Metrics.L1_TX_NOT_MINED_COUNT, {
|
|
50
|
-
description: 'Count of transactions not mined (timed out)',
|
|
51
|
-
valueType: ValueType.INT
|
|
52
|
-
});
|
|
53
|
-
this.maxPriorityFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_PRIORITY_FEE, {
|
|
54
|
-
description: 'Max priority fee per gas at tx end state (in wei)',
|
|
55
|
-
unit: 'wei',
|
|
56
|
-
valueType: ValueType.INT
|
|
57
|
-
});
|
|
58
|
-
this.maxFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_FEE, {
|
|
59
|
-
description: 'Max fee per gas at tx end state (in wei)',
|
|
60
|
-
unit: 'wei',
|
|
61
|
-
valueType: ValueType.INT
|
|
62
|
-
});
|
|
63
|
-
this.blobFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_BLOB_FEE, {
|
|
64
|
-
description: 'Max fee per blob gas at tx end state (in wei)',
|
|
65
|
-
unit: 'wei',
|
|
66
|
-
valueType: ValueType.INT
|
|
67
|
-
});
|
|
27
|
+
this.txMinedDuration = this.meter.createHistogram(Metrics.L1_TX_MINED_DURATION);
|
|
28
|
+
this.txAttemptsUntilMined = this.meter.createHistogram(Metrics.L1_TX_ATTEMPTS_UNTIL_MINED);
|
|
29
|
+
const scopeAttributes = [
|
|
30
|
+
{
|
|
31
|
+
[Attributes.L1_TX_SCOPE]: this.scope
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
this.txMinedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_MINED_COUNT, scopeAttributes);
|
|
35
|
+
this.txRevertedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_REVERTED_COUNT, scopeAttributes);
|
|
36
|
+
this.txCancelledCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_CANCELLED_COUNT, scopeAttributes);
|
|
37
|
+
this.txNotMinedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_NOT_MINED_COUNT, scopeAttributes);
|
|
38
|
+
this.maxPriorityFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_PRIORITY_FEE);
|
|
39
|
+
this.maxFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_FEE);
|
|
40
|
+
this.blobFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_BLOB_FEE);
|
|
68
41
|
}
|
|
69
42
|
/**
|
|
70
43
|
* Records metrics when a transaction is mined.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IL1TxStore, L1BlobInputs, L1TxState } from '@aztec/ethereum';
|
|
1
|
+
import type { IL1TxStore, L1BlobInputs, L1TxState } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
|
9
9
|
export declare class L1TxStore implements IL1TxStore {
|
|
10
10
|
private readonly store;
|
|
11
11
|
private readonly log;
|
|
12
|
-
static readonly SCHEMA_VERSION
|
|
12
|
+
static readonly SCHEMA_VERSION = 2;
|
|
13
13
|
private readonly states;
|
|
14
14
|
private readonly blobs;
|
|
15
15
|
private readonly stateIdCounter;
|
|
@@ -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,
|
|
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
|
|
@@ -86,4 +86,4 @@ export declare class L1TxStore implements IL1TxStore {
|
|
|
86
86
|
*/
|
|
87
87
|
private deserializeBlobInputs;
|
|
88
88
|
}
|
|
89
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
89
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdHhfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yZXMvbDFfdHhfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLFlBQVksRUFBYyxTQUFTLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVuRyxPQUFPLEtBQUssRUFBRSxNQUFNLE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s7OztPQUtHO0lBQ1UsU0FBUyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsU0FBUyxHQUFHLFNBQVMsQ0FBQyxDQTBCdkY7SUFFRDs7OztPQUlHO0lBQ1UsV0FBVyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsR0FBRyxRQUFRLEVBQUUsTUFBTSxFQUFFLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVk5RTtJQUVEOzs7T0FHRztJQUNVLFdBQVcsQ0FBQyxPQUFPLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FXdkQ7SUFFRDs7O09BR0c7SUFDVSxjQUFjLElBQUksT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBUy9DO0lBRUQ7O09BRUc7SUFDVSxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUdsQztJQUVEOztPQUVHO0lBQ0gsT0FBTyxDQUFDLGNBQWM7SUFrQ3RCOztPQUVHO0lBQ0gsT0FBTyxDQUFDLGdCQUFnQjtJQTJDeEI7O09BRUc7SUFDSCxPQUFPLENBQUMsbUJBQW1CO0lBTzNCOztPQUVHO0lBQ0gsT0FBTyxDQUFDLHFCQUFxQjtDQVk5QiJ9
|
|
@@ -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,
|
|
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,6BAA6B,CAAC;AAEnG,OAAO,KAAK,EAAE,MAAM,EAAE,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,CAAC,CAWvD;IAED;;;OAGG;IACU,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAS/C;IAED;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlC;IAED;;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,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/node-lib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.ffe5b04ea",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"typedocOptions": {
|
|
6
|
+
"entryPoints": [
|
|
7
|
+
"./src/actions/index.ts",
|
|
8
|
+
"./src/config/index.ts",
|
|
9
|
+
"./src/factories/index.ts"
|
|
10
|
+
],
|
|
11
|
+
"name": "Node Library",
|
|
12
|
+
"tsconfig": "./tsconfig.json"
|
|
13
|
+
},
|
|
5
14
|
"exports": {
|
|
6
15
|
"./actions": "./dest/actions/index.js",
|
|
7
16
|
"./config": "./dest/config/index.js",
|
|
@@ -13,8 +22,8 @@
|
|
|
13
22
|
"../package.common.json"
|
|
14
23
|
],
|
|
15
24
|
"scripts": {
|
|
16
|
-
"build": "yarn clean &&
|
|
17
|
-
"build:dev": "
|
|
25
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
26
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
18
27
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
19
28
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
20
29
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
@@ -57,36 +66,38 @@
|
|
|
57
66
|
]
|
|
58
67
|
},
|
|
59
68
|
"dependencies": {
|
|
60
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
61
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
62
|
-
"@aztec/blob-
|
|
63
|
-
"@aztec/constants": "0.0.1-commit.
|
|
64
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
65
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
66
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
67
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
68
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
69
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
70
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
71
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
72
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
73
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
74
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
75
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
76
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
69
|
+
"@aztec/archiver": "0.0.1-commit.ffe5b04ea",
|
|
70
|
+
"@aztec/bb-prover": "0.0.1-commit.ffe5b04ea",
|
|
71
|
+
"@aztec/blob-client": "0.0.1-commit.ffe5b04ea",
|
|
72
|
+
"@aztec/constants": "0.0.1-commit.ffe5b04ea",
|
|
73
|
+
"@aztec/epoch-cache": "0.0.1-commit.ffe5b04ea",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.ffe5b04ea",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.ffe5b04ea",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.ffe5b04ea",
|
|
77
|
+
"@aztec/merkle-tree": "0.0.1-commit.ffe5b04ea",
|
|
78
|
+
"@aztec/p2p": "0.0.1-commit.ffe5b04ea",
|
|
79
|
+
"@aztec/protocol-contracts": "0.0.1-commit.ffe5b04ea",
|
|
80
|
+
"@aztec/prover-client": "0.0.1-commit.ffe5b04ea",
|
|
81
|
+
"@aztec/sequencer-client": "0.0.1-commit.ffe5b04ea",
|
|
82
|
+
"@aztec/simulator": "0.0.1-commit.ffe5b04ea",
|
|
83
|
+
"@aztec/stdlib": "0.0.1-commit.ffe5b04ea",
|
|
84
|
+
"@aztec/telemetry-client": "0.0.1-commit.ffe5b04ea",
|
|
85
|
+
"@aztec/validator-client": "0.0.1-commit.ffe5b04ea",
|
|
86
|
+
"@aztec/world-state": "0.0.1-commit.ffe5b04ea",
|
|
78
87
|
"tslib": "^2.4.0"
|
|
79
88
|
},
|
|
80
89
|
"devDependencies": {
|
|
81
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
90
|
+
"@aztec/blob-lib": "0.0.1-commit.ffe5b04ea",
|
|
91
|
+
"@aztec/node-keystore": "0.0.1-commit.ffe5b04ea",
|
|
82
92
|
"@jest/globals": "^30.0.0",
|
|
83
93
|
"@types/jest": "^30.0.0",
|
|
84
94
|
"@types/node": "^22.15.17",
|
|
85
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
95
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
86
96
|
"jest": "^30.0.0",
|
|
87
97
|
"jest-mock-extended": "^4.0.0",
|
|
88
98
|
"ts-node": "^10.9.1",
|
|
89
|
-
"typescript": "^5.3.3"
|
|
99
|
+
"typescript": "^5.3.3",
|
|
100
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
90
101
|
},
|
|
91
102
|
"files": [
|
|
92
103
|
"dest",
|
|
@@ -7,13 +7,13 @@ export async function buildSnapshotMetadata(
|
|
|
7
7
|
archiver: Archiver,
|
|
8
8
|
config: UploadSnapshotConfig,
|
|
9
9
|
): Promise<UploadSnapshotMetadata> {
|
|
10
|
-
const [rollupAddress, l1BlockNumber,
|
|
10
|
+
const [rollupAddress, l1BlockNumber, tips] = await Promise.all([
|
|
11
11
|
archiver.getRollupAddress(),
|
|
12
12
|
archiver.getL1BlockNumber(),
|
|
13
13
|
archiver.getL2Tips(),
|
|
14
14
|
] as const);
|
|
15
15
|
|
|
16
|
-
const { number: l2BlockNumber, hash: l2BlockHash } =
|
|
16
|
+
const { number: l2BlockNumber, hash: l2BlockHash } = tips.proposed;
|
|
17
17
|
if (!l2BlockHash) {
|
|
18
18
|
throw new Error(`Failed to get L2 block hash from archiver.`);
|
|
19
19
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ARCHIVER_DB_VERSION, ARCHIVER_STORE_NAME, type ArchiverConfig, createArchiverStore } from '@aztec/archiver';
|
|
2
2
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
3
|
-
import { type EthereumClientConfig, getPublicClient } from '@aztec/ethereum';
|
|
3
|
+
import { type EthereumClientConfig, getPublicClient } from '@aztec/ethereum/client';
|
|
4
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
4
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
6
7
|
import type { Logger } from '@aztec/foundation/log';
|
|
7
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
8
8
|
import { P2P_STORE_NAME } from '@aztec/p2p';
|
|
9
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
|
-
import { DatabaseVersionManager } from '@aztec/stdlib/database-version';
|
|
10
|
+
import { DatabaseVersionManager } from '@aztec/stdlib/database-version/manager';
|
|
11
11
|
import { type ReadOnlyFileStore, createReadOnlyFileStore } from '@aztec/stdlib/file-store';
|
|
12
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
12
13
|
import {
|
|
13
14
|
type SnapshotMetadata,
|
|
14
15
|
type SnapshotsIndexMetadata,
|
|
@@ -28,8 +29,10 @@ const MIN_L1_BLOCKS_TO_TRIGGER_REPLACE = 86400 / 2 / 12;
|
|
|
28
29
|
|
|
29
30
|
type SnapshotSyncConfig = Pick<SharedNodeConfig, 'syncMode'> &
|
|
30
31
|
Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> &
|
|
32
|
+
Pick<L1ContractsConfig, 'aztecEpochDuration'> &
|
|
31
33
|
Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> &
|
|
32
|
-
|
|
34
|
+
DataStoreConfig &
|
|
35
|
+
Required<Pick<DataStoreConfig, 'l1Contracts'>> &
|
|
33
36
|
EthereumClientConfig & {
|
|
34
37
|
snapshotsUrls?: string[];
|
|
35
38
|
minL1BlocksToTriggerReplace?: number;
|
|
@@ -58,13 +61,13 @@ export async function trySnapshotSync(config: SnapshotSyncConfig, log: Logger) {
|
|
|
58
61
|
|
|
59
62
|
// Create an archiver store to check the current state (do this only once)
|
|
60
63
|
log.verbose(`Creating temporary archiver data store`);
|
|
61
|
-
const archiverStore = await createArchiverStore(config);
|
|
64
|
+
const archiverStore = await createArchiverStore(config, { epochDuration: config.aztecEpochDuration });
|
|
62
65
|
let archiverL1BlockNumber: bigint | undefined;
|
|
63
66
|
let archiverL2BlockNumber: number | undefined;
|
|
64
67
|
try {
|
|
65
68
|
[archiverL1BlockNumber, archiverL2BlockNumber] = await Promise.all([
|
|
66
69
|
archiverStore.getSynchPoint().then(s => s.blocksSynchedTo),
|
|
67
|
-
archiverStore.
|
|
70
|
+
archiverStore.getLatestBlockNumber(),
|
|
68
71
|
] as const);
|
|
69
72
|
} finally {
|
|
70
73
|
log.verbose(`Closing temporary archiver data store`, { archiverL1BlockNumber, archiverL2BlockNumber });
|
|
@@ -80,7 +83,11 @@ export async function trySnapshotSync(config: SnapshotSyncConfig, log: Logger) {
|
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
const currentL1BlockNumber = await getPublicClient(config).getBlockNumber();
|
|
83
|
-
if (
|
|
86
|
+
if (
|
|
87
|
+
archiverL1BlockNumber &&
|
|
88
|
+
currentL1BlockNumber >= archiverL1BlockNumber &&
|
|
89
|
+
currentL1BlockNumber - archiverL1BlockNumber < minL1BlocksToTriggerReplace
|
|
90
|
+
) {
|
|
84
91
|
log.verbose(
|
|
85
92
|
`Skipping snapshot sync as archiver is less than ${
|
|
86
93
|
currentL1BlockNumber - archiverL1BlockNumber
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ARCHIVER_DB_VERSION, type Archiver } from '@aztec/archiver';
|
|
2
2
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
5
4
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
6
5
|
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
7
6
|
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
7
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
8
8
|
import { uploadSnapshotToIndex } from '@aztec/stdlib/snapshots';
|
|
9
9
|
import { WORLD_STATE_DB_VERSION } from '@aztec/world-state';
|
|
10
10
|
|
package/src/config/index.ts
CHANGED
|
@@ -5,20 +5,22 @@ export type SharedNodeConfig = {
|
|
|
5
5
|
testAccounts: boolean;
|
|
6
6
|
/** Whether to populate the genesis state with initial fee juice for the sponsored FPC */
|
|
7
7
|
sponsoredFPC: boolean;
|
|
8
|
+
/** Additional addresses to prefund with fee juice at genesis */
|
|
9
|
+
prefundAddresses: string[];
|
|
8
10
|
/** Sync mode: full to always sync via L1, snapshot to download a snapshot if there is no local data, force-snapshot to download even if there is local data. */
|
|
9
11
|
syncMode: 'full' | 'snapshot' | 'force-snapshot';
|
|
10
12
|
/** Base URLs for snapshots index. Index file will be searched at `SNAPSHOTS_BASE_URL/aztec-L1_CHAIN_ID-VERSION-ROLLUP_ADDRESS/index.json` */
|
|
11
13
|
snapshotsUrls?: string[];
|
|
12
|
-
|
|
13
|
-
/** Auto update mode: disabled - to completely ignore remote signals to update the node. enabled - to respect the signals (potentially shutting this node down). log - check for updates but log a warning instead of applying them*/
|
|
14
|
-
autoUpdate?: 'disabled' | 'notify' | 'config' | 'config-and-version';
|
|
15
|
-
/** The base URL against which to check for updates */
|
|
16
|
-
autoUpdateUrl?: string;
|
|
17
|
-
|
|
18
14
|
/** URL of the Web3Signer instance */
|
|
19
15
|
web3SignerUrl?: string;
|
|
20
16
|
/** Whether to run in fisherman mode */
|
|
21
17
|
fishermanMode?: boolean;
|
|
18
|
+
|
|
19
|
+
/** Force verification of tx Chonk proofs. Only used for testnet */
|
|
20
|
+
debugForceTxProofVerification: boolean;
|
|
21
|
+
|
|
22
|
+
/** Check if the node version matches the latest version for the network */
|
|
23
|
+
enableVersionCheck: boolean;
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig> = {
|
|
@@ -32,6 +34,16 @@ export const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig> = {
|
|
|
32
34
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
33
35
|
...booleanConfigHelper(false),
|
|
34
36
|
},
|
|
37
|
+
prefundAddresses: {
|
|
38
|
+
env: 'PREFUND_ADDRESSES',
|
|
39
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
40
|
+
parseEnv: (val: string) =>
|
|
41
|
+
val
|
|
42
|
+
.split(',')
|
|
43
|
+
.map(a => a.trim())
|
|
44
|
+
.filter(a => a.length > 0),
|
|
45
|
+
defaultValue: [],
|
|
46
|
+
},
|
|
35
47
|
syncMode: {
|
|
36
48
|
env: 'SYNC_MODE',
|
|
37
49
|
description:
|
|
@@ -49,15 +61,6 @@ export const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig> = {
|
|
|
49
61
|
fallback: ['SYNC_SNAPSHOTS_URL'],
|
|
50
62
|
defaultValue: [],
|
|
51
63
|
},
|
|
52
|
-
autoUpdate: {
|
|
53
|
-
env: 'AUTO_UPDATE',
|
|
54
|
-
description: 'The auto update mode for this node',
|
|
55
|
-
defaultValue: 'disabled',
|
|
56
|
-
},
|
|
57
|
-
autoUpdateUrl: {
|
|
58
|
-
env: 'AUTO_UPDATE_URL',
|
|
59
|
-
description: 'Base URL to check for updates',
|
|
60
|
-
},
|
|
61
64
|
web3SignerUrl: {
|
|
62
65
|
env: 'WEB3_SIGNER_URL',
|
|
63
66
|
description: 'URL of the Web3Signer instance',
|
|
@@ -68,4 +71,15 @@ export const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig> = {
|
|
|
68
71
|
description: 'Whether to run in fisherman mode.',
|
|
69
72
|
...booleanConfigHelper(false),
|
|
70
73
|
},
|
|
74
|
+
debugForceTxProofVerification: {
|
|
75
|
+
env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
|
|
76
|
+
description: 'Whether to force tx proof verification. Only has an effect if real proving is turned off',
|
|
77
|
+
...booleanConfigHelper(false),
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
enableVersionCheck: {
|
|
81
|
+
env: 'ENABLE_VERSION_CHECK',
|
|
82
|
+
description: 'Check if the node is running the latest version and is following the latest rollup',
|
|
83
|
+
...booleanConfigHelper(true),
|
|
84
|
+
},
|
|
71
85
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '@aztec/ethereum';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
createL1TxUtilsWithBlobsFromEthSigner as createL1TxUtilsWithBlobsFromEthSignerBase,
|
|
8
|
-
createL1TxUtilsWithBlobsFromViemWallet as createL1TxUtilsWithBlobsFromViemWalletBase,
|
|
9
|
-
} from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
1
|
+
import type { BlobKzgInstance } from '@aztec/blob-lib/types';
|
|
2
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
3
|
+
import { createDelayer, createL1TxUtils as createL1TxUtilsBase } from '@aztec/ethereum/l1-tx-utils';
|
|
4
|
+
import type { L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils';
|
|
5
|
+
import { createForwarderL1TxUtils as createForwarderL1TxUtilsBase } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
6
|
+
import type { ExtendedViemWalletClient, ViemClient } from '@aztec/ethereum/types';
|
|
10
7
|
import { omit } from '@aztec/foundation/collection';
|
|
8
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
12
10
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
13
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
14
11
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
12
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
15
13
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
16
14
|
|
|
17
15
|
import type { L1TxScope } from '../metrics/l1_tx_metrics.js';
|
|
@@ -21,14 +19,15 @@ import { L1TxStore } from '../stores/l1_tx_store.js';
|
|
|
21
19
|
const L1_TX_STORE_NAME = 'l1-tx-utils';
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
|
-
* Creates shared dependencies (logger, store, metrics) for L1TxUtils instances.
|
|
22
|
+
* Creates shared dependencies (logger, store, metrics, delayer) for L1TxUtils instances.
|
|
23
|
+
* When enableDelayer is set in config, a single shared delayer is created and passed to all instances.
|
|
25
24
|
*/
|
|
26
25
|
async function createSharedDeps(
|
|
27
|
-
config: DataStoreConfig & { scope?: L1TxScope },
|
|
26
|
+
config: DataStoreConfig & Partial<L1TxUtilsConfig> & { scope?: L1TxScope },
|
|
28
27
|
deps: {
|
|
29
28
|
telemetry: TelemetryClient;
|
|
30
29
|
logger?: ReturnType<typeof createLogger>;
|
|
31
|
-
dateProvider
|
|
30
|
+
dateProvider: DateProvider;
|
|
32
31
|
},
|
|
33
32
|
) {
|
|
34
33
|
const logger = deps.logger ?? createLogger('l1-tx-utils');
|
|
@@ -36,87 +35,122 @@ async function createSharedDeps(
|
|
|
36
35
|
// Note that we do NOT bind them to the rollup address, since we still need to
|
|
37
36
|
// monitor and cancel txs for previous rollups to free up our nonces.
|
|
38
37
|
const noRollupConfig = omit(config, 'l1Contracts');
|
|
39
|
-
const kvStore = await createStore(L1_TX_STORE_NAME, L1TxStore.SCHEMA_VERSION, noRollupConfig, logger);
|
|
38
|
+
const kvStore = await createStore(L1_TX_STORE_NAME, L1TxStore.SCHEMA_VERSION, noRollupConfig, logger.getBindings());
|
|
40
39
|
const store = new L1TxStore(kvStore, logger);
|
|
41
40
|
|
|
42
41
|
const meter = deps.telemetry.getMeter('L1TxUtils');
|
|
43
42
|
const metrics = new L1TxMetrics(meter, config.scope ?? 'other', logger);
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
// Create a single shared delayer for all L1TxUtils instances in this group
|
|
45
|
+
const delayer =
|
|
46
|
+
config.enableDelayer && config.ethereumSlotDuration !== undefined
|
|
47
|
+
? createDelayer(deps.dateProvider, { ethereumSlotDuration: config.ethereumSlotDuration }, logger.getBindings())
|
|
48
|
+
: undefined;
|
|
49
|
+
|
|
50
|
+
return { logger, store, metrics, dateProvider: deps.dateProvider, delayer };
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
/**
|
|
49
|
-
* Creates L1TxUtils
|
|
54
|
+
* Creates L1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
55
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
50
56
|
*/
|
|
51
|
-
export async function
|
|
57
|
+
export async function createL1TxUtilsFromWallets(
|
|
52
58
|
clients: ExtendedViemWalletClient[],
|
|
53
59
|
config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
|
|
54
60
|
deps: {
|
|
55
61
|
telemetry: TelemetryClient;
|
|
56
62
|
logger?: ReturnType<typeof createLogger>;
|
|
57
|
-
dateProvider
|
|
63
|
+
dateProvider: DateProvider;
|
|
64
|
+
kzg?: BlobKzgInstance;
|
|
58
65
|
},
|
|
59
66
|
) {
|
|
60
67
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
61
68
|
|
|
62
|
-
return clients.map(client =>
|
|
63
|
-
createL1TxUtilsWithBlobsFromViemWalletBase(client, sharedDeps, config, config.debugMaxGasLimit),
|
|
64
|
-
);
|
|
69
|
+
return clients.map(client => createL1TxUtilsBase(client, { ...sharedDeps, kzg: deps.kzg }, config));
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
|
-
* Creates L1TxUtils
|
|
73
|
+
* Creates L1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
74
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
75
|
+
* Deduplicates signers by address to avoid creating multiple instances for the same publisher.
|
|
69
76
|
*/
|
|
70
|
-
export async function
|
|
77
|
+
export async function createL1TxUtilsFromSigners(
|
|
71
78
|
client: ViemClient,
|
|
72
79
|
signers: EthSigner[],
|
|
73
80
|
config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
|
|
74
81
|
deps: {
|
|
75
82
|
telemetry: TelemetryClient;
|
|
76
83
|
logger?: ReturnType<typeof createLogger>;
|
|
77
|
-
dateProvider
|
|
84
|
+
dateProvider: DateProvider;
|
|
85
|
+
kzg?: BlobKzgInstance;
|
|
78
86
|
},
|
|
79
87
|
) {
|
|
80
88
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
81
89
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
);
|
|
90
|
+
// Deduplicate signers by address to avoid creating multiple L1TxUtils instances
|
|
91
|
+
// for the same publisher address (e.g., when multiple attesters share the same publisher key)
|
|
92
|
+
const signersByAddress = new Map<string, EthSigner>();
|
|
93
|
+
for (const signer of signers) {
|
|
94
|
+
const addressKey = signer.address.toString().toLowerCase();
|
|
95
|
+
if (!signersByAddress.has(addressKey)) {
|
|
96
|
+
signersByAddress.set(addressKey, signer);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const uniqueSigners = Array.from(signersByAddress.values());
|
|
101
|
+
|
|
102
|
+
if (uniqueSigners.length < signers.length) {
|
|
103
|
+
sharedDeps.logger.info(
|
|
104
|
+
`Deduplicated ${signers.length} signers to ${uniqueSigners.length} unique publisher addresses`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return uniqueSigners.map(signer => createL1TxUtilsBase({ client, signer }, { ...sharedDeps, kzg: deps.kzg }, config));
|
|
85
109
|
}
|
|
86
110
|
|
|
87
111
|
/**
|
|
88
|
-
* Creates
|
|
112
|
+
* Creates ForwarderL1TxUtils from multiple Viem wallet clients, sharing store, metrics, and delayer.
|
|
113
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
114
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
89
115
|
*/
|
|
90
|
-
export async function
|
|
116
|
+
export async function createForwarderL1TxUtilsFromWallets(
|
|
91
117
|
clients: ExtendedViemWalletClient[],
|
|
118
|
+
forwarderAddress: EthAddress,
|
|
92
119
|
config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
|
|
93
120
|
deps: {
|
|
94
121
|
telemetry: TelemetryClient;
|
|
95
122
|
logger?: ReturnType<typeof createLogger>;
|
|
96
|
-
dateProvider
|
|
97
|
-
|
|
123
|
+
dateProvider: DateProvider;
|
|
124
|
+
kzg?: BlobKzgInstance;
|
|
98
125
|
},
|
|
99
126
|
) {
|
|
100
127
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
101
128
|
|
|
102
|
-
return clients.map(client =>
|
|
129
|
+
return clients.map(client =>
|
|
130
|
+
createForwarderL1TxUtilsBase(client, forwarderAddress, { ...sharedDeps, kzg: deps.kzg }, config),
|
|
131
|
+
);
|
|
103
132
|
}
|
|
104
133
|
|
|
105
134
|
/**
|
|
106
|
-
* Creates
|
|
135
|
+
* Creates ForwarderL1TxUtils from multiple EthSigners, sharing store, metrics, and delayer.
|
|
136
|
+
* Wraps all transactions through a forwarder contract for testing purposes.
|
|
137
|
+
* When kzg is provided in deps, blob support is enabled.
|
|
107
138
|
*/
|
|
108
|
-
export async function
|
|
139
|
+
export async function createForwarderL1TxUtilsFromSigners(
|
|
109
140
|
client: ViemClient,
|
|
110
141
|
signers: EthSigner[],
|
|
142
|
+
forwarderAddress: EthAddress,
|
|
111
143
|
config: DataStoreConfig & Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean; scope?: L1TxScope },
|
|
112
144
|
deps: {
|
|
113
145
|
telemetry: TelemetryClient;
|
|
114
146
|
logger?: ReturnType<typeof createLogger>;
|
|
115
|
-
dateProvider
|
|
116
|
-
|
|
147
|
+
dateProvider: DateProvider;
|
|
148
|
+
kzg?: BlobKzgInstance;
|
|
117
149
|
},
|
|
118
150
|
) {
|
|
119
151
|
const sharedDeps = await createSharedDeps(config, deps);
|
|
120
152
|
|
|
121
|
-
return signers.map(signer =>
|
|
153
|
+
return signers.map(signer =>
|
|
154
|
+
createForwarderL1TxUtilsBase({ client, signer }, forwarderAddress, { ...sharedDeps, kzg: deps.kzg }, config),
|
|
155
|
+
);
|
|
122
156
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IL1TxMetrics, L1TxState } from '@aztec/ethereum';
|
|
2
|
-
import { TxUtilsState } from '@aztec/ethereum';
|
|
1
|
+
import type { IL1TxMetrics, L1TxState } from '@aztec/ethereum/l1-tx-utils';
|
|
2
|
+
import { TxUtilsState } from '@aztec/ethereum/l1-tx-utils';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import {
|
|
5
5
|
Attributes,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type Meter,
|
|
8
8
|
Metrics,
|
|
9
9
|
type UpDownCounter,
|
|
10
|
-
|
|
10
|
+
createUpDownCounterWithDefault,
|
|
11
11
|
} from '@aztec/telemetry-client';
|
|
12
12
|
|
|
13
13
|
export type L1TxScope = 'sequencer' | 'prover' | 'other';
|
|
@@ -38,55 +38,24 @@ export class L1TxMetrics implements IL1TxMetrics {
|
|
|
38
38
|
private scope: L1TxScope = 'other',
|
|
39
39
|
private logger = createLogger('l1-tx-utils:metrics'),
|
|
40
40
|
) {
|
|
41
|
-
this.txMinedDuration = this.meter.createHistogram(Metrics.L1_TX_MINED_DURATION
|
|
42
|
-
description: 'Time from initial tx send until mined',
|
|
43
|
-
unit: 's',
|
|
44
|
-
valueType: ValueType.INT,
|
|
45
|
-
});
|
|
41
|
+
this.txMinedDuration = this.meter.createHistogram(Metrics.L1_TX_MINED_DURATION);
|
|
46
42
|
|
|
47
|
-
this.txAttemptsUntilMined = this.meter.createHistogram(Metrics.L1_TX_ATTEMPTS_UNTIL_MINED
|
|
48
|
-
description: 'Number of tx attempts (including speed-ups) until mined',
|
|
49
|
-
unit: 'attempts',
|
|
50
|
-
valueType: ValueType.INT,
|
|
51
|
-
});
|
|
43
|
+
this.txAttemptsUntilMined = this.meter.createHistogram(Metrics.L1_TX_ATTEMPTS_UNTIL_MINED);
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
valueType: ValueType.INT,
|
|
56
|
-
});
|
|
45
|
+
const scopeAttributes = [{ [Attributes.L1_TX_SCOPE]: this.scope }];
|
|
46
|
+
this.txMinedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_MINED_COUNT, scopeAttributes);
|
|
57
47
|
|
|
58
|
-
this.txRevertedCount = this.meter
|
|
59
|
-
description: 'Count of transactions that reverted',
|
|
60
|
-
valueType: ValueType.INT,
|
|
61
|
-
});
|
|
48
|
+
this.txRevertedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_REVERTED_COUNT, scopeAttributes);
|
|
62
49
|
|
|
63
|
-
this.txCancelledCount = this.meter
|
|
64
|
-
description: 'Count of transactions cancelled',
|
|
65
|
-
valueType: ValueType.INT,
|
|
66
|
-
});
|
|
50
|
+
this.txCancelledCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_CANCELLED_COUNT, scopeAttributes);
|
|
67
51
|
|
|
68
|
-
this.txNotMinedCount = this.meter
|
|
69
|
-
description: 'Count of transactions not mined (timed out)',
|
|
70
|
-
valueType: ValueType.INT,
|
|
71
|
-
});
|
|
52
|
+
this.txNotMinedCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_TX_NOT_MINED_COUNT, scopeAttributes);
|
|
72
53
|
|
|
73
|
-
this.maxPriorityFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_PRIORITY_FEE
|
|
74
|
-
description: 'Max priority fee per gas at tx end state (in wei)',
|
|
75
|
-
unit: 'wei',
|
|
76
|
-
valueType: ValueType.INT,
|
|
77
|
-
});
|
|
54
|
+
this.maxPriorityFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_PRIORITY_FEE);
|
|
78
55
|
|
|
79
|
-
this.maxFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_FEE
|
|
80
|
-
description: 'Max fee per gas at tx end state (in wei)',
|
|
81
|
-
unit: 'wei',
|
|
82
|
-
valueType: ValueType.INT,
|
|
83
|
-
});
|
|
56
|
+
this.maxFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_MAX_FEE);
|
|
84
57
|
|
|
85
|
-
this.blobFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_BLOB_FEE
|
|
86
|
-
description: 'Max fee per blob gas at tx end state (in wei)',
|
|
87
|
-
unit: 'wei',
|
|
88
|
-
valueType: ValueType.INT,
|
|
89
|
-
});
|
|
58
|
+
this.blobFeeHistogram = this.meter.createHistogram(Metrics.L1_TX_BLOB_FEE);
|
|
90
59
|
}
|
|
91
60
|
|
|
92
61
|
/**
|
|
@@ -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
|
/**
|