@aztec/aztec-node 0.86.0-starknet.1 → 0.87.0
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/aztec-node/config.d.ts +2 -5
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +2 -10
- package/dest/aztec-node/server.d.ts +6 -3
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +70 -16
- package/dest/sentinel/store.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/aztec-node/config.ts +4 -17
- package/src/aztec-node/server.ts +93 -20
- package/src/sentinel/store.ts +4 -1
|
@@ -6,6 +6,7 @@ import { type SharedNodeConfig } from '@aztec/node-lib/config';
|
|
|
6
6
|
import { type P2PConfig } from '@aztec/p2p/config';
|
|
7
7
|
import { type ProverClientUserConfig } from '@aztec/prover-client/config';
|
|
8
8
|
import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
9
|
+
import { type NodeRPCConfig } from '@aztec/stdlib/config';
|
|
9
10
|
import { type ValidatorClientConfig } from '@aztec/validator-client/config';
|
|
10
11
|
import { type WorldStateConfig } from '@aztec/world-state/config';
|
|
11
12
|
import { type SentinelConfig } from '../sentinel/config.js';
|
|
@@ -13,7 +14,7 @@ export { sequencerClientConfigMappings, type SequencerClientConfig };
|
|
|
13
14
|
/**
|
|
14
15
|
* The configuration the aztec node.
|
|
15
16
|
*/
|
|
16
|
-
export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & ValidatorClientConfig & ProverClientUserConfig & WorldStateConfig & Pick<ProverClientUserConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> & P2PConfig & DataStoreConfig & SentinelConfig & SharedNodeConfig & GenesisStateConfig & {
|
|
17
|
+
export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & ValidatorClientConfig & ProverClientUserConfig & WorldStateConfig & Pick<ProverClientUserConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> & P2PConfig & DataStoreConfig & SentinelConfig & SharedNodeConfig & GenesisStateConfig & NodeRPCConfig & {
|
|
17
18
|
/** L1 contracts addresses */
|
|
18
19
|
l1Contracts: L1ContractAddresses;
|
|
19
20
|
/** Whether the validator is disabled for this node */
|
|
@@ -25,8 +26,4 @@ export declare const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig
|
|
|
25
26
|
* @returns A valid aztec node config.
|
|
26
27
|
*/
|
|
27
28
|
export declare function getConfigEnvVars(): AztecNodeConfig;
|
|
28
|
-
/**
|
|
29
|
-
* Returns package version.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getPackageVersion(): any;
|
|
32
29
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/aztec-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,0BAA0B,CAAC;AAC/G,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,sBAAsB,EAA8B,MAAM,6BAA6B,CAAC;AACtG,OAAO,EAAE,KAAK,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC3G,OAAO,EAAE,KAAK,qBAAqB,EAAiC,MAAM,gCAAgC,CAAC;AAC3G,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d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eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAqBvE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAElD"}
|
|
@@ -6,11 +6,9 @@ import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
|
6
6
|
import { p2pConfigMappings } from '@aztec/p2p/config';
|
|
7
7
|
import { proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
8
8
|
import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
9
|
+
import { nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
9
10
|
import { validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
10
11
|
import { worldStateConfigMappings } from '@aztec/world-state/config';
|
|
11
|
-
import { readFileSync } from 'fs';
|
|
12
|
-
import { dirname, resolve } from 'path';
|
|
13
|
-
import { fileURLToPath } from 'url';
|
|
14
12
|
import { sentinelConfigMappings } from '../sentinel/config.js';
|
|
15
13
|
export { sequencerClientConfigMappings };
|
|
16
14
|
export const aztecNodeConfigMappings = {
|
|
@@ -24,6 +22,7 @@ export const aztecNodeConfigMappings = {
|
|
|
24
22
|
...sentinelConfigMappings,
|
|
25
23
|
...sharedNodeConfigMappings,
|
|
26
24
|
...genesisStateConfigMappings,
|
|
25
|
+
...nodeRpcConfigMappings,
|
|
27
26
|
l1Contracts: {
|
|
28
27
|
description: 'The deployed L1 contract addresses',
|
|
29
28
|
nested: l1ContractAddressesMapping
|
|
@@ -40,10 +39,3 @@ export const aztecNodeConfigMappings = {
|
|
|
40
39
|
*/ export function getConfigEnvVars() {
|
|
41
40
|
return getConfigFromMappings(aztecNodeConfigMappings);
|
|
42
41
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns package version.
|
|
45
|
-
*/ export function getPackageVersion() {
|
|
46
|
-
const releasePleaseManifestPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
|
|
47
|
-
const version = JSON.parse(readFileSync(releasePleaseManifestPath).toString());
|
|
48
|
-
return version['.'];
|
|
49
|
-
}
|
|
@@ -21,7 +21,7 @@ import { type BlockHeader, type GlobalVariableBuilder as GlobalVariableBuilderIn
|
|
|
21
21
|
import type { ValidatorsStats } from '@aztec/stdlib/validators';
|
|
22
22
|
import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
23
23
|
import { Sentinel } from '../sentinel/sentinel.js';
|
|
24
|
-
import {
|
|
24
|
+
import type { AztecNodeConfig } from './config.js';
|
|
25
25
|
/**
|
|
26
26
|
* The aztec node.
|
|
27
27
|
*/
|
|
@@ -39,15 +39,15 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
39
39
|
protected readonly l1ChainId: number;
|
|
40
40
|
protected readonly version: number;
|
|
41
41
|
protected readonly globalVariableBuilder: GlobalVariableBuilderInterface;
|
|
42
|
+
private readonly packageVersion;
|
|
42
43
|
private proofVerifier;
|
|
43
44
|
private telemetry;
|
|
44
45
|
private log;
|
|
45
|
-
private packageVersion;
|
|
46
46
|
private metrics;
|
|
47
47
|
private isUploadingSnapshot;
|
|
48
48
|
private txQueue;
|
|
49
49
|
readonly tracer: Tracer;
|
|
50
|
-
constructor(config: AztecNodeConfig, p2pClient: P2P, blockSource: L2BlockSource & Partial<Service>, logsSource: L2LogsSource, contractDataSource: ContractDataSource, l1ToL2MessageSource: L1ToL2MessageSource, worldStateSynchronizer: WorldStateSynchronizer, sequencer: SequencerClient | undefined, validatorsSentinel: Sentinel | undefined, l1ChainId: number, version: number, globalVariableBuilder: GlobalVariableBuilderInterface, proofVerifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, log?: Logger);
|
|
50
|
+
constructor(config: AztecNodeConfig, p2pClient: P2P, blockSource: L2BlockSource & Partial<Service>, logsSource: L2LogsSource, contractDataSource: ContractDataSource, l1ToL2MessageSource: L1ToL2MessageSource, worldStateSynchronizer: WorldStateSynchronizer, sequencer: SequencerClient | undefined, validatorsSentinel: Sentinel | undefined, l1ChainId: number, version: number, globalVariableBuilder: GlobalVariableBuilderInterface, packageVersion: string, proofVerifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, log?: Logger);
|
|
51
51
|
getWorldStateSyncStatus(): Promise<WorldStateSyncStatus>;
|
|
52
52
|
getL2Tips(): Promise<import("@aztec/stdlib/block").L2Tips>;
|
|
53
53
|
/**
|
|
@@ -297,5 +297,8 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
297
297
|
flushTxs(): Promise<void>;
|
|
298
298
|
getValidatorsStats(): Promise<ValidatorsStats>;
|
|
299
299
|
startSnapshotUpload(location: string): Promise<void>;
|
|
300
|
+
rollbackTo(targetBlock: number, force?: boolean): Promise<void>;
|
|
301
|
+
pauseSync(): Promise<void>;
|
|
302
|
+
resumeSync(): Promise<void>;
|
|
300
303
|
}
|
|
301
304
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/aztec-node/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,mBAAmB,EAAyC,MAAM,iBAAiB,CAAC;AAGlG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/aztec-node/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EA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AsB,CAAC;IAqExF,SAAS,CACpB,EAAE,EAAE,EAAE,EACN,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAO,GAClG,OAAO,CAAC,kBAAkB,CAAC;IAgBjB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,GAAG,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/E,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,CAAC;IASlE,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/F,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAQzB,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIxC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCpD,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/D,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CA6CnC"}
|
|
@@ -13,8 +13,10 @@ import { RegistryContract, createEthereumChain } from '@aztec/ethereum';
|
|
|
13
13
|
import { compactArray } from '@aztec/foundation/collection';
|
|
14
14
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
15
|
import { Fr } from '@aztec/foundation/fields';
|
|
16
|
+
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
16
17
|
import { createLogger } from '@aztec/foundation/log';
|
|
17
18
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
19
|
+
import { count } from '@aztec/foundation/string';
|
|
18
20
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
19
21
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
20
22
|
import { openTmpStore } from '@aztec/kv-store/lmdb';
|
|
@@ -31,12 +33,12 @@ import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
|
31
33
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
32
34
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
33
35
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
36
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
34
37
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
35
38
|
import { createValidatorClient } from '@aztec/validator-client';
|
|
36
39
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
37
40
|
import { createPublicClient, fallback, getContract, http } from 'viem';
|
|
38
41
|
import { createSentinel } from '../sentinel/factory.js';
|
|
39
|
-
import { getPackageVersion } from './config.js';
|
|
40
42
|
import { NodeMetrics } from './node_metrics.js';
|
|
41
43
|
/**
|
|
42
44
|
* The aztec node.
|
|
@@ -53,17 +55,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
53
55
|
l1ChainId;
|
|
54
56
|
version;
|
|
55
57
|
globalVariableBuilder;
|
|
58
|
+
packageVersion;
|
|
56
59
|
proofVerifier;
|
|
57
60
|
telemetry;
|
|
58
61
|
log;
|
|
59
|
-
packageVersion;
|
|
60
62
|
metrics;
|
|
61
63
|
// Prevent two snapshot operations to happen simultaneously
|
|
62
64
|
isUploadingSnapshot;
|
|
63
65
|
// Serial queue to ensure that we only send one tx at a time
|
|
64
66
|
txQueue;
|
|
65
67
|
tracer;
|
|
66
|
-
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, validatorsSentinel, l1ChainId, version, globalVariableBuilder, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node')){
|
|
68
|
+
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, validatorsSentinel, l1ChainId, version, globalVariableBuilder, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node')){
|
|
67
69
|
this.config = config;
|
|
68
70
|
this.p2pClient = p2pClient;
|
|
69
71
|
this.blockSource = blockSource;
|
|
@@ -76,12 +78,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
76
78
|
this.l1ChainId = l1ChainId;
|
|
77
79
|
this.version = version;
|
|
78
80
|
this.globalVariableBuilder = globalVariableBuilder;
|
|
81
|
+
this.packageVersion = packageVersion;
|
|
79
82
|
this.proofVerifier = proofVerifier;
|
|
80
83
|
this.telemetry = telemetry;
|
|
81
84
|
this.log = log;
|
|
82
85
|
this.isUploadingSnapshot = false;
|
|
83
86
|
this.txQueue = new SerialQueue();
|
|
84
|
-
this.packageVersion = getPackageVersion();
|
|
85
87
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
86
88
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
87
89
|
this.txQueue.start();
|
|
@@ -100,8 +102,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
100
102
|
* @param config - The configuration to be used by the aztec node.
|
|
101
103
|
* @returns - A fully synced Aztec Node for use in development/testing.
|
|
102
104
|
*/ static async createAndSync(config, deps = {}, options = {}) {
|
|
103
|
-
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
104
105
|
const log = deps.logger ?? createLogger('node');
|
|
106
|
+
const packageVersion = getPackageVersion() ?? '';
|
|
107
|
+
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
105
108
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
106
109
|
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
107
110
|
logger: createLogger('node:blob-sink:client')
|
|
@@ -147,7 +150,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
147
150
|
dateProvider
|
|
148
151
|
});
|
|
149
152
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
150
|
-
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, telemetry);
|
|
153
|
+
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, telemetry);
|
|
151
154
|
// Start world state and wait for it to sync to the archiver.
|
|
152
155
|
await worldStateSynchronizer.start();
|
|
153
156
|
// Start p2p. Note that it depends on world state to be running.
|
|
@@ -178,7 +181,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
178
181
|
dateProvider,
|
|
179
182
|
blobSinkClient
|
|
180
183
|
});
|
|
181
|
-
return new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, validatorsSentinel, ethereumChain.chainInfo.id, config.rollupVersion, new GlobalVariableBuilder(config), proofVerifier, telemetry, log);
|
|
184
|
+
return new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, validatorsSentinel, ethereumChain.chainInfo.id, config.rollupVersion, new GlobalVariableBuilder(config), packageVersion, proofVerifier, telemetry, log);
|
|
182
185
|
}
|
|
183
186
|
/**
|
|
184
187
|
* Returns the sequencer client instance.
|
|
@@ -376,9 +379,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
376
379
|
*/ getPendingTxs() {
|
|
377
380
|
return this.p2pClient.getPendingTxs();
|
|
378
381
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return pendingTxs.length;
|
|
382
|
+
getPendingTxCount() {
|
|
383
|
+
return this.p2pClient.getPendingTxCount();
|
|
382
384
|
}
|
|
383
385
|
/**
|
|
384
386
|
* Method to retrieve a single tx from the mempool or unfinalised chain.
|
|
@@ -519,14 +521,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
519
521
|
}
|
|
520
522
|
const tempStores = [];
|
|
521
523
|
// Construct message subtrees
|
|
522
|
-
const l2toL1Subtrees =
|
|
524
|
+
const l2toL1Subtrees = l2ToL1Messages.map((msgs, i)=>{
|
|
523
525
|
const store = openTmpStore(true);
|
|
524
526
|
tempStores.push(store);
|
|
525
527
|
const treeHeight = msgs.length <= 1 ? 1 : Math.ceil(Math.log2(msgs.length));
|
|
526
528
|
const tree = new StandardTree(store, new SHA256Trunc(), `temp_msgs_subtrees_${i}`, treeHeight, 0n, Fr);
|
|
527
|
-
|
|
529
|
+
tree.appendLeaves(msgs);
|
|
528
530
|
return tree;
|
|
529
|
-
})
|
|
531
|
+
});
|
|
530
532
|
// path of the input msg from leaf -> first out hash calculated in base rolllup
|
|
531
533
|
const subtreePathOfL2ToL1Message = await l2toL1Subtrees[indexOfMsgTx].getSiblingPath(BigInt(indexOfMsgInSubtree), true);
|
|
532
534
|
const numTxs = block.body.txEffects.length;
|
|
@@ -536,7 +538,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
536
538
|
subtreePathOfL2ToL1Message
|
|
537
539
|
];
|
|
538
540
|
}
|
|
539
|
-
|
|
541
|
+
// For a tx with no messages, we have to set an out hash of 0 to match the circuit/contract behavior
|
|
542
|
+
const l2toL1SubtreeRoots = l2toL1Subtrees.map((t)=>t.getNumLeaves(true) == 0n ? Fr.ZERO : Fr.fromBuffer(t.getRoot(true)));
|
|
540
543
|
const maxTreeHeight = Math.ceil(Math.log2(l2toL1SubtreeRoots.length));
|
|
541
544
|
// The root of this tree is the out_hash calculated in Noir => we truncate to match Noir's SHA
|
|
542
545
|
const outHashTree = new UnbalancedTree(new SHA256Trunc(), 'temp_outhash_sibling_path', maxTreeHeight, Fr);
|
|
@@ -663,6 +666,13 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
663
666
|
* Simulates the public part of a transaction with the current state.
|
|
664
667
|
* @param tx - The transaction to simulate.
|
|
665
668
|
**/ async simulatePublicCalls(tx, skipFeeEnforcement = false) {
|
|
669
|
+
// Check total gas limit for simulation
|
|
670
|
+
const gasSettings = tx.data.constants.txContext.gasSettings;
|
|
671
|
+
const txGasLimit = gasSettings.gasLimits.l2Gas;
|
|
672
|
+
const teardownGasLimit = gasSettings.teardownGasLimits.l2Gas;
|
|
673
|
+
if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
|
|
674
|
+
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
675
|
+
}
|
|
666
676
|
const txHash = await tx.getTxHash();
|
|
667
677
|
const blockNumber = await this.blockSource.getBlockNumber() + 1;
|
|
668
678
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
@@ -677,9 +687,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
677
687
|
});
|
|
678
688
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
679
689
|
try {
|
|
680
|
-
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, skipFeeEnforcement);
|
|
690
|
+
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, skipFeeEnforcement, /*clientInitiatedSimulation*/ true);
|
|
681
691
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
682
|
-
const [processedTxs, failedTxs, returns] = await processor.process([
|
|
692
|
+
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
683
693
|
tx
|
|
684
694
|
]);
|
|
685
695
|
// REFACTOR: Consider returning the error rather than throwing
|
|
@@ -774,6 +784,50 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
774
784
|
});
|
|
775
785
|
return Promise.resolve();
|
|
776
786
|
}
|
|
787
|
+
async rollbackTo(targetBlock, force) {
|
|
788
|
+
const archiver = this.blockSource;
|
|
789
|
+
if (!('rollbackTo' in archiver)) {
|
|
790
|
+
throw new Error('Archiver implementation does not support rollbacks.');
|
|
791
|
+
}
|
|
792
|
+
const finalizedBlock = await archiver.getL2Tips().then((tips)=>tips.finalized.number);
|
|
793
|
+
if (targetBlock < finalizedBlock) {
|
|
794
|
+
if (force) {
|
|
795
|
+
this.log.warn(`Clearing world state database to allow rolling back behind finalized block ${finalizedBlock}`);
|
|
796
|
+
await this.worldStateSynchronizer.clear();
|
|
797
|
+
await this.p2pClient.clear();
|
|
798
|
+
} else {
|
|
799
|
+
throw new Error(`Cannot rollback to block ${targetBlock} as it is before finalized ${finalizedBlock}`);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
try {
|
|
803
|
+
this.log.info(`Pausing archiver and world state sync to start rollback`);
|
|
804
|
+
await archiver.stop();
|
|
805
|
+
await this.worldStateSynchronizer.stopSync();
|
|
806
|
+
const currentBlock = await archiver.getBlockNumber();
|
|
807
|
+
const blocksToUnwind = currentBlock - targetBlock;
|
|
808
|
+
this.log.info(`Unwinding ${count(blocksToUnwind, 'block')} from L2 block ${currentBlock} to ${targetBlock}`);
|
|
809
|
+
await archiver.rollbackTo(targetBlock);
|
|
810
|
+
this.log.info(`Unwinding complete.`);
|
|
811
|
+
} catch (err) {
|
|
812
|
+
this.log.error(`Error during rollback`, err);
|
|
813
|
+
throw err;
|
|
814
|
+
} finally{
|
|
815
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
816
|
+
this.worldStateSynchronizer.resumeSync();
|
|
817
|
+
archiver.resume();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
async pauseSync() {
|
|
821
|
+
this.log.info(`Pausing archiver and world state sync`);
|
|
822
|
+
await this.blockSource.stop();
|
|
823
|
+
await this.worldStateSynchronizer.stopSync();
|
|
824
|
+
}
|
|
825
|
+
resumeSync() {
|
|
826
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
827
|
+
this.worldStateSynchronizer.resumeSync();
|
|
828
|
+
this.blockSource.resume();
|
|
829
|
+
return Promise.resolve();
|
|
830
|
+
}
|
|
777
831
|
/**
|
|
778
832
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
779
833
|
* @param blockNumber - The block number at which to get the data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sentinel/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,qBAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sentinel/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,qBAAa,aAAa;IAMtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IANhB,gBAAuB,cAAc,KAAK;IAE1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAuC;gBAGjD,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;IAKpC,gBAAgB;IAIV,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAAC;YAUhG,0BAA0B;IAU3B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;YAQrE,UAAU;IAKxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,gBAAgB;CAgBzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -61,27 +61,27 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/archiver": "0.
|
|
65
|
-
"@aztec/bb-prover": "0.
|
|
66
|
-
"@aztec/blob-sink": "0.
|
|
67
|
-
"@aztec/constants": "0.
|
|
68
|
-
"@aztec/epoch-cache": "0.
|
|
69
|
-
"@aztec/ethereum": "0.
|
|
70
|
-
"@aztec/foundation": "0.
|
|
71
|
-
"@aztec/kv-store": "0.
|
|
72
|
-
"@aztec/l1-artifacts": "0.
|
|
73
|
-
"@aztec/merkle-tree": "0.
|
|
74
|
-
"@aztec/node-lib": "0.
|
|
75
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
76
|
-
"@aztec/p2p": "0.
|
|
77
|
-
"@aztec/protocol-contracts": "0.
|
|
78
|
-
"@aztec/prover-client": "0.
|
|
79
|
-
"@aztec/sequencer-client": "0.
|
|
80
|
-
"@aztec/simulator": "0.
|
|
81
|
-
"@aztec/stdlib": "0.
|
|
82
|
-
"@aztec/telemetry-client": "0.
|
|
83
|
-
"@aztec/validator-client": "0.
|
|
84
|
-
"@aztec/world-state": "0.
|
|
64
|
+
"@aztec/archiver": "0.87.0",
|
|
65
|
+
"@aztec/bb-prover": "0.87.0",
|
|
66
|
+
"@aztec/blob-sink": "0.87.0",
|
|
67
|
+
"@aztec/constants": "0.87.0",
|
|
68
|
+
"@aztec/epoch-cache": "0.87.0",
|
|
69
|
+
"@aztec/ethereum": "0.87.0",
|
|
70
|
+
"@aztec/foundation": "0.87.0",
|
|
71
|
+
"@aztec/kv-store": "0.87.0",
|
|
72
|
+
"@aztec/l1-artifacts": "0.87.0",
|
|
73
|
+
"@aztec/merkle-tree": "0.87.0",
|
|
74
|
+
"@aztec/node-lib": "0.87.0",
|
|
75
|
+
"@aztec/noir-protocol-circuits-types": "0.87.0",
|
|
76
|
+
"@aztec/p2p": "0.87.0",
|
|
77
|
+
"@aztec/protocol-contracts": "0.87.0",
|
|
78
|
+
"@aztec/prover-client": "0.87.0",
|
|
79
|
+
"@aztec/sequencer-client": "0.87.0",
|
|
80
|
+
"@aztec/simulator": "0.87.0",
|
|
81
|
+
"@aztec/stdlib": "0.87.0",
|
|
82
|
+
"@aztec/telemetry-client": "0.87.0",
|
|
83
|
+
"@aztec/validator-client": "0.87.0",
|
|
84
|
+
"@aztec/world-state": "0.87.0",
|
|
85
85
|
"koa": "^2.16.1",
|
|
86
86
|
"koa-router": "^12.0.0",
|
|
87
87
|
"tslib": "^2.4.0",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@jest/globals": "^29.5.0",
|
|
92
92
|
"@types/jest": "^29.5.0",
|
|
93
|
-
"@types/node": "^
|
|
93
|
+
"@types/node": "^22.15.17",
|
|
94
94
|
"jest": "^29.5.0",
|
|
95
95
|
"jest-mock-extended": "^3.0.3",
|
|
96
96
|
"ts-node": "^10.9.1",
|
|
97
|
-
"typescript": "^5.
|
|
97
|
+
"typescript": "^5.3.3"
|
|
98
98
|
},
|
|
99
99
|
"files": [
|
|
100
100
|
"dest",
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
],
|
|
104
104
|
"types": "./dest/index.d.ts",
|
|
105
105
|
"engines": {
|
|
106
|
-
"node": ">=
|
|
106
|
+
"node": ">=20.10"
|
|
107
107
|
}
|
|
108
108
|
}
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -11,13 +11,10 @@ import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib
|
|
|
11
11
|
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
12
12
|
import { type ProverClientUserConfig, proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
13
13
|
import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
14
|
+
import { type NodeRPCConfig, nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
14
15
|
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
15
16
|
import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state/config';
|
|
16
17
|
|
|
17
|
-
import { readFileSync } from 'fs';
|
|
18
|
-
import { dirname, resolve } from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
|
|
21
18
|
import { type SentinelConfig, sentinelConfigMappings } from '../sentinel/config.js';
|
|
22
19
|
|
|
23
20
|
export { sequencerClientConfigMappings, type SequencerClientConfig };
|
|
@@ -35,7 +32,8 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
35
32
|
DataStoreConfig &
|
|
36
33
|
SentinelConfig &
|
|
37
34
|
SharedNodeConfig &
|
|
38
|
-
GenesisStateConfig &
|
|
35
|
+
GenesisStateConfig &
|
|
36
|
+
NodeRPCConfig & {
|
|
39
37
|
/** L1 contracts addresses */
|
|
40
38
|
l1Contracts: L1ContractAddresses;
|
|
41
39
|
/** Whether the validator is disabled for this node */
|
|
@@ -53,6 +51,7 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
53
51
|
...sentinelConfigMappings,
|
|
54
52
|
...sharedNodeConfigMappings,
|
|
55
53
|
...genesisStateConfigMappings,
|
|
54
|
+
...nodeRpcConfigMappings,
|
|
56
55
|
l1Contracts: {
|
|
57
56
|
description: 'The deployed L1 contract addresses',
|
|
58
57
|
nested: l1ContractAddressesMapping,
|
|
@@ -71,15 +70,3 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
71
70
|
export function getConfigEnvVars(): AztecNodeConfig {
|
|
72
71
|
return getConfigFromMappings<AztecNodeConfig>(aztecNodeConfigMappings);
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns package version.
|
|
77
|
-
*/
|
|
78
|
-
export function getPackageVersion() {
|
|
79
|
-
const releasePleaseManifestPath = resolve(
|
|
80
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
81
|
-
'../../../../.release-please-manifest.json',
|
|
82
|
-
);
|
|
83
|
-
const version = JSON.parse(readFileSync(releasePleaseManifestPath).toString());
|
|
84
|
-
return version['.'];
|
|
85
|
-
}
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -14,8 +14,10 @@ import { type L1ContractAddresses, RegistryContract, createEthereumChain } from
|
|
|
14
14
|
import { compactArray } from '@aztec/foundation/collection';
|
|
15
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
16
|
import { Fr } from '@aztec/foundation/fields';
|
|
17
|
+
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
17
18
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
18
19
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
20
|
+
import { count } from '@aztec/foundation/string';
|
|
19
21
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
20
22
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
21
23
|
import type { AztecKVStore } from '@aztec/kv-store';
|
|
@@ -76,6 +78,7 @@ import {
|
|
|
76
78
|
TxStatus,
|
|
77
79
|
type TxValidationResult,
|
|
78
80
|
} from '@aztec/stdlib/tx';
|
|
81
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
79
82
|
import type { ValidatorsStats } from '@aztec/stdlib/validators';
|
|
80
83
|
import {
|
|
81
84
|
Attributes,
|
|
@@ -92,14 +95,13 @@ import { createPublicClient, fallback, getContract, http } from 'viem';
|
|
|
92
95
|
|
|
93
96
|
import { createSentinel } from '../sentinel/factory.js';
|
|
94
97
|
import { Sentinel } from '../sentinel/sentinel.js';
|
|
95
|
-
import {
|
|
98
|
+
import type { AztecNodeConfig } from './config.js';
|
|
96
99
|
import { NodeMetrics } from './node_metrics.js';
|
|
97
100
|
|
|
98
101
|
/**
|
|
99
102
|
* The aztec node.
|
|
100
103
|
*/
|
|
101
104
|
export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
102
|
-
private packageVersion: string;
|
|
103
105
|
private metrics: NodeMetrics;
|
|
104
106
|
|
|
105
107
|
// Prevent two snapshot operations to happen simultaneously
|
|
@@ -123,11 +125,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
123
125
|
protected readonly l1ChainId: number,
|
|
124
126
|
protected readonly version: number,
|
|
125
127
|
protected readonly globalVariableBuilder: GlobalVariableBuilderInterface,
|
|
128
|
+
private readonly packageVersion: string,
|
|
126
129
|
private proofVerifier: ClientProtocolCircuitVerifier,
|
|
127
130
|
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
128
131
|
private log = createLogger('node'),
|
|
129
132
|
) {
|
|
130
|
-
this.packageVersion = getPackageVersion();
|
|
131
133
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
132
134
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
133
135
|
this.txQueue.start();
|
|
@@ -163,8 +165,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
163
165
|
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
164
166
|
} = {},
|
|
165
167
|
): Promise<AztecNodeService> {
|
|
166
|
-
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
167
168
|
const log = deps.logger ?? createLogger('node');
|
|
169
|
+
const packageVersion = getPackageVersion() ?? '';
|
|
170
|
+
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
168
171
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
169
172
|
const blobSinkClient =
|
|
170
173
|
deps.blobSinkClient ?? createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
|
|
@@ -235,6 +238,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
235
238
|
proofVerifier,
|
|
236
239
|
worldStateSynchronizer,
|
|
237
240
|
epochCache,
|
|
241
|
+
packageVersion,
|
|
238
242
|
telemetry,
|
|
239
243
|
);
|
|
240
244
|
|
|
@@ -290,6 +294,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
290
294
|
ethereumChain.chainInfo.id,
|
|
291
295
|
config.rollupVersion,
|
|
292
296
|
new GlobalVariableBuilder(config),
|
|
297
|
+
packageVersion,
|
|
293
298
|
proofVerifier,
|
|
294
299
|
telemetry,
|
|
295
300
|
log,
|
|
@@ -541,9 +546,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
541
546
|
return this.p2pClient!.getPendingTxs();
|
|
542
547
|
}
|
|
543
548
|
|
|
544
|
-
public
|
|
545
|
-
|
|
546
|
-
return pendingTxs.length;
|
|
549
|
+
public getPendingTxCount() {
|
|
550
|
+
return this.p2pClient!.getPendingTxCount();
|
|
547
551
|
}
|
|
548
552
|
|
|
549
553
|
/**
|
|
@@ -731,16 +735,14 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
731
735
|
const tempStores: AztecKVStore[] = [];
|
|
732
736
|
|
|
733
737
|
// Construct message subtrees
|
|
734
|
-
const l2toL1Subtrees =
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}),
|
|
743
|
-
);
|
|
738
|
+
const l2toL1Subtrees = l2ToL1Messages.map((msgs, i) => {
|
|
739
|
+
const store = openTmpStore(true);
|
|
740
|
+
tempStores.push(store);
|
|
741
|
+
const treeHeight = msgs.length <= 1 ? 1 : Math.ceil(Math.log2(msgs.length));
|
|
742
|
+
const tree = new StandardTree(store, new SHA256Trunc(), `temp_msgs_subtrees_${i}`, treeHeight, 0n, Fr);
|
|
743
|
+
tree.appendLeaves(msgs);
|
|
744
|
+
return tree;
|
|
745
|
+
});
|
|
744
746
|
|
|
745
747
|
// path of the input msg from leaf -> first out hash calculated in base rolllup
|
|
746
748
|
const subtreePathOfL2ToL1Message = await l2toL1Subtrees[indexOfMsgTx].getSiblingPath(
|
|
@@ -753,7 +755,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
753
755
|
return [BigInt(indexOfMsgInSubtree), subtreePathOfL2ToL1Message];
|
|
754
756
|
}
|
|
755
757
|
|
|
756
|
-
|
|
758
|
+
// For a tx with no messages, we have to set an out hash of 0 to match the circuit/contract behavior
|
|
759
|
+
const l2toL1SubtreeRoots = l2toL1Subtrees.map(t =>
|
|
760
|
+
t.getNumLeaves(true) == 0n ? Fr.ZERO : Fr.fromBuffer(t.getRoot(true)),
|
|
761
|
+
);
|
|
757
762
|
const maxTreeHeight = Math.ceil(Math.log2(l2toL1SubtreeRoots.length));
|
|
758
763
|
// The root of this tree is the out_hash calculated in Noir => we truncate to match Noir's SHA
|
|
759
764
|
const outHashTree = new UnbalancedTree(new SHA256Trunc(), 'temp_outhash_sibling_path', maxTreeHeight, Fr);
|
|
@@ -933,6 +938,20 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
933
938
|
[Attributes.TX_HASH]: (await tx.getTxHash()).toString(),
|
|
934
939
|
}))
|
|
935
940
|
public async simulatePublicCalls(tx: Tx, skipFeeEnforcement = false): Promise<PublicSimulationOutput> {
|
|
941
|
+
// Check total gas limit for simulation
|
|
942
|
+
const gasSettings = tx.data.constants.txContext.gasSettings;
|
|
943
|
+
const txGasLimit = gasSettings.gasLimits.l2Gas;
|
|
944
|
+
const teardownGasLimit = gasSettings.teardownGasLimits.l2Gas;
|
|
945
|
+
if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
|
|
946
|
+
throw new BadRequestError(
|
|
947
|
+
`Transaction total gas limit ${
|
|
948
|
+
txGasLimit + teardownGasLimit
|
|
949
|
+
} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${
|
|
950
|
+
this.config.rpcSimulatePublicMaxGasLimit
|
|
951
|
+
} for simulation`,
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
|
|
936
955
|
const txHash = await tx.getTxHash();
|
|
937
956
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
938
957
|
|
|
@@ -959,10 +978,15 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
959
978
|
|
|
960
979
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
961
980
|
try {
|
|
962
|
-
const processor = publicProcessorFactory.create(
|
|
981
|
+
const processor = publicProcessorFactory.create(
|
|
982
|
+
merkleTreeFork,
|
|
983
|
+
newGlobalVariables,
|
|
984
|
+
skipFeeEnforcement,
|
|
985
|
+
/*clientInitiatedSimulation*/ true,
|
|
986
|
+
);
|
|
963
987
|
|
|
964
988
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
965
|
-
const [processedTxs, failedTxs, returns] = await processor.process([tx]);
|
|
989
|
+
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([tx]);
|
|
966
990
|
// REFACTOR: Consider returning the error rather than throwing
|
|
967
991
|
if (failedTxs.length) {
|
|
968
992
|
this.log.warn(`Simulated tx ${txHash} fails: ${failedTxs[0].error}`, { txHash });
|
|
@@ -1075,6 +1099,55 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1075
1099
|
return Promise.resolve();
|
|
1076
1100
|
}
|
|
1077
1101
|
|
|
1102
|
+
public async rollbackTo(targetBlock: number, force?: boolean): Promise<void> {
|
|
1103
|
+
const archiver = this.blockSource as Archiver;
|
|
1104
|
+
if (!('rollbackTo' in archiver)) {
|
|
1105
|
+
throw new Error('Archiver implementation does not support rollbacks.');
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
const finalizedBlock = await archiver.getL2Tips().then(tips => tips.finalized.number);
|
|
1109
|
+
if (targetBlock < finalizedBlock) {
|
|
1110
|
+
if (force) {
|
|
1111
|
+
this.log.warn(`Clearing world state database to allow rolling back behind finalized block ${finalizedBlock}`);
|
|
1112
|
+
await this.worldStateSynchronizer.clear();
|
|
1113
|
+
await this.p2pClient.clear();
|
|
1114
|
+
} else {
|
|
1115
|
+
throw new Error(`Cannot rollback to block ${targetBlock} as it is before finalized ${finalizedBlock}`);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
try {
|
|
1120
|
+
this.log.info(`Pausing archiver and world state sync to start rollback`);
|
|
1121
|
+
await archiver.stop();
|
|
1122
|
+
await this.worldStateSynchronizer.stopSync();
|
|
1123
|
+
const currentBlock = await archiver.getBlockNumber();
|
|
1124
|
+
const blocksToUnwind = currentBlock - targetBlock;
|
|
1125
|
+
this.log.info(`Unwinding ${count(blocksToUnwind, 'block')} from L2 block ${currentBlock} to ${targetBlock}`);
|
|
1126
|
+
await archiver.rollbackTo(targetBlock);
|
|
1127
|
+
this.log.info(`Unwinding complete.`);
|
|
1128
|
+
} catch (err) {
|
|
1129
|
+
this.log.error(`Error during rollback`, err);
|
|
1130
|
+
throw err;
|
|
1131
|
+
} finally {
|
|
1132
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
1133
|
+
this.worldStateSynchronizer.resumeSync();
|
|
1134
|
+
archiver.resume();
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
public async pauseSync(): Promise<void> {
|
|
1139
|
+
this.log.info(`Pausing archiver and world state sync`);
|
|
1140
|
+
await (this.blockSource as Archiver).stop();
|
|
1141
|
+
await this.worldStateSynchronizer.stopSync();
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
public resumeSync(): Promise<void> {
|
|
1145
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
1146
|
+
this.worldStateSynchronizer.resumeSync();
|
|
1147
|
+
(this.blockSource as Archiver).resume();
|
|
1148
|
+
return Promise.resolve();
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1078
1151
|
/**
|
|
1079
1152
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
1080
1153
|
* @param blockNumber - The block number at which to get the data.
|
package/src/sentinel/store.ts
CHANGED
|
@@ -7,7 +7,10 @@ export class SentinelStore {
|
|
|
7
7
|
|
|
8
8
|
private readonly map: AztecAsyncMap<`0x${string}`, Buffer>;
|
|
9
9
|
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(
|
|
11
|
+
private store: AztecAsyncKVStore,
|
|
12
|
+
private config: { historyLength: number },
|
|
13
|
+
) {
|
|
11
14
|
this.map = store.openMap('sentinel-validator-status');
|
|
12
15
|
}
|
|
13
16
|
|