@aztec/aztec 0.0.1-commit.2ed92850 → 0.0.1-commit.3100065
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/bin/index.js +9 -3
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +69 -32
- package/dest/cli/aztec_start_options.d.ts +2 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +39 -23
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +3 -4
- package/dest/cli/cmds/compile.d.ts +4 -0
- package/dest/cli/cmds/compile.d.ts.map +1 -0
- package/dest/cli/cmds/compile.js +174 -0
- package/dest/cli/cmds/profile.d.ts +4 -0
- package/dest/cli/cmds/profile.d.ts.map +1 -0
- package/dest/cli/cmds/profile.js +8 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
- package/dest/cli/cmds/profile_flamegraph.js +52 -0
- package/dest/cli/cmds/profile_gates.d.ts +4 -0
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
- package/dest/cli/cmds/profile_gates.js +76 -0
- package/dest/cli/cmds/profile_utils.d.ts +18 -0
- package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
- package/dest/cli/cmds/profile_utils.js +50 -0
- package/dest/cli/cmds/prover.d.ts +4 -0
- package/dest/cli/cmds/prover.d.ts.map +1 -0
- package/dest/cli/cmds/prover.js +24 -0
- package/dest/cli/cmds/standby.d.ts +56 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +140 -0
- package/dest/cli/cmds/start_bot.d.ts +3 -3
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +17 -9
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +82 -51
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +1 -2
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +6 -18
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +24 -15
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +6 -5
- package/dest/cli/cmds/utils/artifacts.d.ts +26 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
- package/dest/cli/cmds/utils/needs_recompile.js +90 -0
- package/dest/cli/cmds/utils/spawn.d.ts +3 -0
- package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
- package/dest/cli/cmds/utils/spawn.js +16 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
- package/dest/cli/util.d.ts +13 -19
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -100
- package/dest/examples/token.js +9 -9
- package/dest/local-network/auth_registry.d.ts +5 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +17 -0
- package/dest/local-network/banana_fpc.d.ts +3 -2
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +12 -8
- package/dest/local-network/local-network.d.ts +10 -32
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +83 -72
- package/dest/testing/cheat_codes.d.ts +17 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +17 -43
- package/dest/testing/epoch_test_settler.d.ts +2 -2
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +6 -26
- package/dest/testing/index.d.ts +2 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -1
- package/dest/testing/token_allowed_setup.d.ts +12 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +24 -0
- package/package.json +35 -34
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +15 -5
- package/scripts/init.sh +23 -19
- package/scripts/new.sh +48 -24
- package/scripts/setup_workspace.sh +69 -0
- package/scripts/templates/blank/contract/Nargo.toml +6 -0
- package/scripts/templates/blank/contract/src/main.nr +10 -0
- package/scripts/templates/blank/test/Nargo.toml +7 -0
- package/scripts/templates/blank/test/src/lib.nr +11 -0
- package/scripts/templates/counter/contract/Nargo.toml +7 -0
- package/scripts/templates/counter/contract/src/main.nr +48 -0
- package/scripts/templates/counter/test/Nargo.toml +7 -0
- package/scripts/templates/counter/test/src/lib.nr +32 -0
- package/src/bin/index.ts +9 -3
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +69 -24
- package/src/cli/aztec_start_options.ts +48 -30
- package/src/cli/cli.ts +3 -4
- package/src/cli/cmds/compile.ts +205 -0
- package/src/cli/cmds/profile.ts +26 -0
- package/src/cli/cmds/profile_flamegraph.ts +64 -0
- package/src/cli/cmds/profile_gates.ts +84 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +184 -0
- package/src/cli/cmds/start_bot.ts +17 -11
- package/src/cli/cmds/start_node.ts +92 -52
- package/src/cli/cmds/start_p2p_bootstrap.ts +2 -2
- package/src/cli/cmds/start_prover_agent.ts +7 -10
- package/src/cli/cmds/start_prover_broker.ts +28 -25
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +49 -0
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +98 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/util.ts +39 -118
- package/src/examples/token.ts +19 -9
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +13 -9
- package/src/local-network/local-network.ts +91 -81
- package/src/testing/cheat_codes.ts +18 -49
- package/src/testing/epoch_test_settler.ts +8 -32
- package/src/testing/index.ts +1 -1
- package/src/testing/token_allowed_setup.ts +26 -0
- package/dest/cli/cmds/start_archiver.d.ts +0 -9
- package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
- package/dest/cli/cmds/start_archiver.js +0 -48
- package/dest/cli/cmds/start_prover_node.d.ts +0 -7
- package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
- package/dest/cli/cmds/start_prover_node.js +0 -108
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/dest/testing/anvil_test_watcher.d.ts +0 -34
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -144
- package/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/scripts/setup_project.sh +0 -31
- package/src/cli/cmds/start_archiver.ts +0 -50
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
- package/src/testing/anvil_test_watcher.ts +0 -166
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
5
|
-
import type {
|
|
6
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @deprecated
|
|
11
|
-
* they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
|
|
12
|
-
* codes, please consider whether it makes sense to just introduce new utils in your tests instead.
|
|
6
|
+
* Wrapper for Aztec Debug API.
|
|
7
|
+
* @deprecated use the AztecNode debug API directly.
|
|
13
8
|
*/
|
|
14
9
|
export class CheatCodes {
|
|
15
10
|
constructor(
|
|
@@ -29,51 +24,25 @@ export class CheatCodes {
|
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
/**
|
|
32
|
-
* Warps the L1 timestamp to
|
|
33
|
-
* the target
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
38
|
-
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
27
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
28
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
29
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
30
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
31
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
39
32
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// We warp the L1 timestamp
|
|
44
|
-
await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
|
|
45
|
-
|
|
46
|
-
// Wait until an L2 block is mined
|
|
47
|
-
const sequencer = sequencerClient.getSequencer();
|
|
48
|
-
const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
|
|
49
|
-
sequencer.updateConfig({ minTxsPerBlock: 0 });
|
|
50
|
-
|
|
51
|
-
await retryUntil(
|
|
52
|
-
async () => {
|
|
53
|
-
const newL2BlockNumber: BlockNumber = await node.getBlockNumber();
|
|
54
|
-
return newL2BlockNumber > currentL2BlockNumber;
|
|
55
|
-
},
|
|
56
|
-
'new block after warping L2 time',
|
|
57
|
-
36,
|
|
58
|
-
1,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// Restore original minTxsPerBlock
|
|
62
|
-
sequencer.updateConfig({ minTxsPerBlock });
|
|
33
|
+
warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void> {
|
|
34
|
+
return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
|
|
63
35
|
}
|
|
64
36
|
|
|
65
37
|
/**
|
|
66
|
-
* Warps the L1 timestamp forward by
|
|
67
|
-
* least by the duration.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param
|
|
71
|
-
* @
|
|
72
|
-
* @param duration - The duration to advance time by (in seconds)
|
|
38
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
39
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
40
|
+
* queue.
|
|
41
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
42
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
43
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
73
44
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
77
|
-
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
45
|
+
warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void> {
|
|
46
|
+
return node.warpL2TimeAtLeastBy(Number(duration));
|
|
78
47
|
}
|
|
79
48
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
1
|
import { type EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
|
-
import {
|
|
2
|
+
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
4
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
+
import { settleEpochOutbox } from '@aztec/prover-client/test';
|
|
5
5
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
6
6
|
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
-
import { computeL2ToL1MembershipWitnessFromMessagesInEpoch } from '@aztec/stdlib/messaging';
|
|
8
7
|
|
|
9
8
|
export class EpochTestSettler {
|
|
10
9
|
private rollupCheatCodes: RollupCheatCodes;
|
|
@@ -31,35 +30,12 @@ export class EpochTestSettler {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
async handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean> {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
40
|
-
const messagesInEpoch: Fr[][][][] = [];
|
|
41
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
42
|
-
let checkpointIndex = -1;
|
|
43
|
-
|
|
44
|
-
for (const block of blocks) {
|
|
45
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
46
|
-
if (slotNumber !== previousSlotNumber) {
|
|
47
|
-
checkpointIndex++;
|
|
48
|
-
messagesInEpoch[checkpointIndex] = [];
|
|
49
|
-
previousSlotNumber = slotNumber;
|
|
50
|
-
}
|
|
51
|
-
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const [firstMessage] = messagesInEpoch.flat(3);
|
|
55
|
-
if (firstMessage) {
|
|
56
|
-
const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
|
|
57
|
-
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
58
|
-
} else {
|
|
59
|
-
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const lastCheckpoint = checkpointedBlocks.at(-1)?.checkpointNumber;
|
|
33
|
+
const lastCheckpoint = await settleEpochOutbox({
|
|
34
|
+
rollupCheatCodes: this.rollupCheatCodes,
|
|
35
|
+
l2BlockSource: this.l2BlockSource,
|
|
36
|
+
epoch,
|
|
37
|
+
log: this.log,
|
|
38
|
+
});
|
|
63
39
|
if (lastCheckpoint !== undefined) {
|
|
64
40
|
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
65
41
|
} else {
|
package/src/testing/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
2
1
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
2
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
3
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
4
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
2
|
+
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
|
+
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
9
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
10
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
11
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
12
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
13
|
+
* mainnet alpha.
|
|
14
|
+
*/
|
|
15
|
+
export async function getTokenAllowedSetupFunctions(
|
|
16
|
+
artifact: ContractArtifact = TokenContractArtifact,
|
|
17
|
+
): Promise<AllowedElement[]> {
|
|
18
|
+
const tokenClassId = (await getContractClassFromArtifact(artifact)).id;
|
|
19
|
+
const target = { classId: tokenClassId };
|
|
20
|
+
return Promise.all([
|
|
21
|
+
// needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
22
|
+
buildAllowedElement(artifact, target, '_increase_public_balance', { onlySelf: true }),
|
|
23
|
+
// needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
24
|
+
buildAllowedElement(artifact, target, 'transfer_in_public'),
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ArchiverConfig } from '@aztec/archiver';
|
|
2
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
|
-
export type { ArchiverConfig, DataStoreConfig };
|
|
5
|
-
/** Starts a standalone archiver. */
|
|
6
|
-
export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
|
|
7
|
-
config: ArchiverConfig & DataStoreConfig;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFNbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAMlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from '@aztec/archiver';
|
|
2
|
-
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
-
import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
|
|
4
|
-
import { getL1Config } from '@aztec/cli/config';
|
|
5
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
6
|
-
import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
7
|
-
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
8
|
-
import { extractRelevantOptions } from '../util.js';
|
|
9
|
-
/** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
|
|
10
|
-
const envConfig = getArchiverConfigFromEnv();
|
|
11
|
-
const cliOptions = extractRelevantOptions(options, {
|
|
12
|
-
...archiverConfigMappings,
|
|
13
|
-
...dataConfigMappings,
|
|
14
|
-
...blobClientConfigMapping
|
|
15
|
-
}, 'archiver');
|
|
16
|
-
let archiverConfig = {
|
|
17
|
-
...envConfig,
|
|
18
|
-
...cliOptions
|
|
19
|
-
};
|
|
20
|
-
archiverConfig.dataStoreMapSizeKb = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKb;
|
|
21
|
-
if (!archiverConfig.l1Contracts.registryAddress || archiverConfig.l1Contracts.registryAddress.isZero()) {
|
|
22
|
-
throw new Error('L1 registry address is required to start an Archiver');
|
|
23
|
-
}
|
|
24
|
-
const { addresses, config: l1Config } = await getL1Config(archiverConfig.l1Contracts.registryAddress, archiverConfig.l1RpcUrls, archiverConfig.l1ChainId);
|
|
25
|
-
archiverConfig.l1Contracts = addresses;
|
|
26
|
-
archiverConfig = {
|
|
27
|
-
...archiverConfig,
|
|
28
|
-
...l1Config
|
|
29
|
-
};
|
|
30
|
-
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
31
|
-
const blobClient = createBlobClient(archiverConfig, {
|
|
32
|
-
logger: createLogger('archiver:blob-client:client')
|
|
33
|
-
});
|
|
34
|
-
const archiver = await createArchiver(archiverConfig, {
|
|
35
|
-
telemetry,
|
|
36
|
-
blobClient
|
|
37
|
-
}, {
|
|
38
|
-
blockUntilSync: true
|
|
39
|
-
});
|
|
40
|
-
services.archiver = [
|
|
41
|
-
archiver,
|
|
42
|
-
ArchiverApiSchema
|
|
43
|
-
];
|
|
44
|
-
signalHandlers.push(archiver.stop);
|
|
45
|
-
return {
|
|
46
|
-
config: archiverConfig
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import { type ProverNodeConfig } from '@aztec/prover-node';
|
|
4
|
-
export declare function startProverNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<{
|
|
5
|
-
config: ProverNodeConfig;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX25vZGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9wcm92ZXJfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRS9FLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRW5ELE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQUl0QixNQUFNLG9CQUFvQixDQUFDO0FBUzVCLHdCQUFzQixlQUFlLENBQ25DLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLE9BQU8sRUFBRSxLQUFLLEdBQ2IsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGdCQUFnQixDQUFBO0NBQUUsQ0FBQyxDQStGdkMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,oBAAoB,CAAC;AAS5B,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA+FvC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
|
|
4
|
-
import { getL1Config } from '@aztec/cli/config';
|
|
5
|
-
import { getPublicClient } from '@aztec/ethereum/client';
|
|
6
|
-
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
7
|
-
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
|
|
8
|
-
import { createProverNode, getProverNodeConfigFromEnv, proverNodeConfigMappings } from '@aztec/prover-node';
|
|
9
|
-
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
11
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
12
|
-
import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
|
|
13
|
-
import { getVersions } from '../versioning.js';
|
|
14
|
-
import { startProverBroker } from './start_prover_broker.js';
|
|
15
|
-
export async function startProverNode(options, signalHandlers, services, userLog) {
|
|
16
|
-
if (options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
17
|
-
userLog(`Starting a prover-node with --node, --sequencer, --pxe, --p2p-bootstrap, or --txe is not supported.`);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
let proverConfig = {
|
|
21
|
-
...getProverNodeConfigFromEnv(),
|
|
22
|
-
...extractRelevantOptions(options, proverNodeConfigMappings, 'proverNode')
|
|
23
|
-
};
|
|
24
|
-
if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
|
|
25
|
-
throw new Error('L1 registry address is required to start a Prover Node');
|
|
26
|
-
}
|
|
27
|
-
const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
|
|
28
|
-
const { addresses, config } = await getL1Config(proverConfig.l1Contracts.registryAddress, proverConfig.l1RpcUrls, proverConfig.l1ChainId, proverConfig.rollupVersion);
|
|
29
|
-
process.env.ROLLUP_CONTRACT_ADDRESS ??= addresses.rollupAddress.toString();
|
|
30
|
-
proverConfig.l1Contracts = addresses;
|
|
31
|
-
proverConfig = {
|
|
32
|
-
...proverConfig,
|
|
33
|
-
...config
|
|
34
|
-
};
|
|
35
|
-
const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
|
|
36
|
-
const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [
|
|
37
|
-
await getSponsoredFPCAddress()
|
|
38
|
-
] : [];
|
|
39
|
-
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
|
|
40
|
-
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
41
|
-
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
42
|
-
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
43
|
-
if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
|
|
44
|
-
throw new Error(`The computed genesis archive tree root ${genesisArchiveRoot} does not match the expected genesis archive tree root ${config.genesisArchiveTreeRoot} for the rollup deployed at ${addresses.rollupAddress}`);
|
|
45
|
-
}
|
|
46
|
-
const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
|
|
47
|
-
let broker;
|
|
48
|
-
if (proverConfig.proverBrokerUrl) {
|
|
49
|
-
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
50
|
-
// set a lower connection limit such that we don't overload the server
|
|
51
|
-
// Keep retrying up to 30s
|
|
52
|
-
const fetch = makeTracedFetch([
|
|
53
|
-
1,
|
|
54
|
-
2,
|
|
55
|
-
3,
|
|
56
|
-
3,
|
|
57
|
-
3,
|
|
58
|
-
3,
|
|
59
|
-
3,
|
|
60
|
-
3,
|
|
61
|
-
3,
|
|
62
|
-
3,
|
|
63
|
-
3
|
|
64
|
-
], false, makeUndiciFetch(new Agent({
|
|
65
|
-
connections: 100
|
|
66
|
-
})));
|
|
67
|
-
broker = createProvingJobBrokerClient(proverConfig.proverBrokerUrl, getVersions(proverConfig), fetch);
|
|
68
|
-
} else if (options.proverBroker) {
|
|
69
|
-
({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
|
|
70
|
-
} else {
|
|
71
|
-
userLog(`--prover-broker-url or --prover-broker is required to start a Prover Node`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
if (proverConfig.proverAgentCount === 0) {
|
|
75
|
-
userLog(`Running prover node without local prover agent. Connect one or more prover agents to this node or pass --proverAgent.proverAgentCount`);
|
|
76
|
-
}
|
|
77
|
-
await preloadCrsDataForVerifying(proverConfig, userLog);
|
|
78
|
-
const proverNode = await createProverNode(proverConfig, {
|
|
79
|
-
telemetry,
|
|
80
|
-
broker
|
|
81
|
-
}, {
|
|
82
|
-
prefilledPublicData
|
|
83
|
-
});
|
|
84
|
-
services.proverNode = [
|
|
85
|
-
proverNode,
|
|
86
|
-
ProverNodeApiSchema
|
|
87
|
-
];
|
|
88
|
-
if (proverNode.getP2P()) {
|
|
89
|
-
services.p2p = [
|
|
90
|
-
proverNode.getP2P(),
|
|
91
|
-
P2PApiSchema
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
if (!proverConfig.proverBrokerUrl) {
|
|
95
|
-
services.provingJobSource = [
|
|
96
|
-
proverNode.getProver().getProvingJobSource(),
|
|
97
|
-
ProvingJobConsumerSchema
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
signalHandlers.push(proverNode.stop.bind(proverNode));
|
|
101
|
-
await proverNode.start();
|
|
102
|
-
if (proverConfig.autoUpdate !== 'disabled' && proverConfig.autoUpdateUrl) {
|
|
103
|
-
await setupUpdateMonitor(proverConfig.autoUpdate, new URL(proverConfig.autoUpdateUrl), followsCanonicalRollup, getPublicClient(proverConfig), proverConfig.l1Contracts.registryAddress, signalHandlers);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
config: proverConfig
|
|
107
|
-
};
|
|
108
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const getCliVersion: () => any;
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVsZWFzZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL3JlbGVhc2VfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxlQUFPLE1BQU0sYUFBYSxXQWV6QixDQUFDIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release_version.d.ts","sourceRoot":"","sources":["../../src/cli/release_version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,WAezB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { dirname, resolve } from 'path';
|
|
4
|
-
export const getCliVersion = ()=>{
|
|
5
|
-
const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
6
|
-
const cliVersion = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
7
|
-
// If the version is 0.1.0, this is a placeholder version and we are in a docker container; query release please for the latest version
|
|
8
|
-
if (cliVersion === '0.1.0') {
|
|
9
|
-
const releasePleasePath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
|
|
10
|
-
const releaseVersion = JSON.parse(readFileSync(releasePleasePath).toString())['.'];
|
|
11
|
-
return releaseVersion;
|
|
12
|
-
}
|
|
13
|
-
return cliVersion;
|
|
14
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import type { ViemClient } from '@aztec/ethereum/types';
|
|
3
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a watcher for a rollup contract.
|
|
7
|
-
*
|
|
8
|
-
* It started on a network like anvil where time traveling is allowed, and auto-mine is turned on
|
|
9
|
-
* it will periodically check if the current slot have already been filled, e.g., there was an L2
|
|
10
|
-
* block within the slot. And if so, it will time travel into the next slot.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AnvilTestWatcher {
|
|
13
|
-
private cheatcodes;
|
|
14
|
-
private dateProvider?;
|
|
15
|
-
private isLocalNetwork;
|
|
16
|
-
private rollup;
|
|
17
|
-
private rollupCheatCodes;
|
|
18
|
-
private l2SlotDuration;
|
|
19
|
-
private filledRunningPromise?;
|
|
20
|
-
private syncDateProviderPromise?;
|
|
21
|
-
private markingAsProvenRunningPromise?;
|
|
22
|
-
private logger;
|
|
23
|
-
private isMarkingAsProven;
|
|
24
|
-
constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined);
|
|
25
|
-
setIsMarkingAsProven(isMarkingAsProven: boolean): void;
|
|
26
|
-
setisLocalNetwork(isLocalNetwork: boolean): void;
|
|
27
|
-
start(): Promise<void>;
|
|
28
|
-
stop(): Promise<void>;
|
|
29
|
-
trigger(): Promise<void>;
|
|
30
|
-
markAsProven(): Promise<void>;
|
|
31
|
-
syncDateProviderToL1IfBehind(): Promise<void>;
|
|
32
|
-
warpTimeIfNeeded(): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUFnQjtJQWdCekIsT0FBTyxDQUFDLFVBQVU7SUFHbEIsT0FBTyxDQUFDLFlBQVksQ0FBQztJQWxCdkIsT0FBTyxDQUFDLGNBQWMsQ0FBa0I7SUFFeEMsT0FBTyxDQUFDLE1BQU0sQ0FBc0Q7SUFDcEUsT0FBTyxDQUFDLGdCQUFnQixDQUFtQjtJQUMzQyxPQUFPLENBQUMsY0FBYyxDQUFVO0lBRWhDLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFpQjtJQUM5QyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBaUI7SUFDakQsT0FBTyxDQUFDLDZCQUE2QixDQUFDLENBQWlCO0lBRXZELE9BQU8sQ0FBQyxNQUFNLENBQWlEO0lBRS9ELE9BQU8sQ0FBQyxpQkFBaUIsQ0FBUTtJQUVqQyxZQUNVLFVBQVUsRUFBRSxhQUFhLEVBQ2pDLGFBQWEsRUFBRSxVQUFVLEVBQ3pCLFFBQVEsRUFBRSxVQUFVLEVBQ1osWUFBWSxDQUFDLDhCQUFrQixFQWF4QztJQUVELG9CQUFvQixDQUFDLGlCQUFpQixFQUFFLE9BQU8sUUFHOUM7SUFFRCxpQkFBaUIsQ0FBQyxjQUFjLEVBQUUsT0FBTyxRQUV4QztJQUVLLEtBQUssa0JBeUJWO0lBRUssSUFBSSxrQkFJVDtJQUVLLE9BQU8sa0JBSVo7SUFFSyxZQUFZLGtCQUtqQjtJQUVLLDRCQUE0QixrQkFlakM7SUFFSyxnQkFBZ0Isa0JBd0NyQjtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anvil_test_watcher.d.ts","sourceRoot":"","sources":["../../src/testing/anvil_test_watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAgBzB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IAlBvB,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAU;IAEhC,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAC9C,OAAO,CAAC,uBAAuB,CAAC,CAAiB;IACjD,OAAO,CAAC,6BAA6B,CAAC,CAAiB;IAEvD,OAAO,CAAC,MAAM,CAAiD;IAE/D,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,YACU,UAAU,EAAE,aAAa,EACjC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,UAAU,EACZ,YAAY,CAAC,8BAAkB,EAaxC;IAED,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,QAG9C;IAED,iBAAiB,CAAC,cAAc,EAAE,OAAO,QAExC;IAEK,KAAK,kBAyBV;IAEK,IAAI,kBAIT;IAEK,OAAO,kBAIZ;IAEK,YAAY,kBAKjB;IAEK,4BAA4B,kBAejC;IAEK,gBAAgB,kBAwCrB;CACF"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
|
-
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
6
|
-
import { getAddress, getContract } from 'viem';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a watcher for a rollup contract.
|
|
9
|
-
*
|
|
10
|
-
* It started on a network like anvil where time traveling is allowed, and auto-mine is turned on
|
|
11
|
-
* it will periodically check if the current slot have already been filled, e.g., there was an L2
|
|
12
|
-
* block within the slot. And if so, it will time travel into the next slot.
|
|
13
|
-
*/ export class AnvilTestWatcher {
|
|
14
|
-
cheatcodes;
|
|
15
|
-
dateProvider;
|
|
16
|
-
isLocalNetwork;
|
|
17
|
-
rollup;
|
|
18
|
-
rollupCheatCodes;
|
|
19
|
-
l2SlotDuration;
|
|
20
|
-
filledRunningPromise;
|
|
21
|
-
syncDateProviderPromise;
|
|
22
|
-
markingAsProvenRunningPromise;
|
|
23
|
-
logger;
|
|
24
|
-
isMarkingAsProven;
|
|
25
|
-
constructor(cheatcodes, rollupAddress, l1Client, dateProvider){
|
|
26
|
-
this.cheatcodes = cheatcodes;
|
|
27
|
-
this.dateProvider = dateProvider;
|
|
28
|
-
this.isLocalNetwork = false;
|
|
29
|
-
this.logger = createLogger(`aztecjs:utils:watcher`);
|
|
30
|
-
this.isMarkingAsProven = true;
|
|
31
|
-
this.rollup = getContract({
|
|
32
|
-
address: getAddress(rollupAddress.toString()),
|
|
33
|
-
abi: RollupAbi,
|
|
34
|
-
client: l1Client
|
|
35
|
-
});
|
|
36
|
-
this.rollupCheatCodes = new RollupCheatCodes(this.cheatcodes, {
|
|
37
|
-
rollupAddress
|
|
38
|
-
});
|
|
39
|
-
this.logger.debug(`Watcher created for rollup at ${rollupAddress}`);
|
|
40
|
-
}
|
|
41
|
-
setIsMarkingAsProven(isMarkingAsProven) {
|
|
42
|
-
this.logger.warn(`Watcher is now ${isMarkingAsProven ? 'marking' : 'not marking'} blocks as proven`);
|
|
43
|
-
this.isMarkingAsProven = isMarkingAsProven;
|
|
44
|
-
}
|
|
45
|
-
setisLocalNetwork(isLocalNetwork) {
|
|
46
|
-
this.isLocalNetwork = isLocalNetwork;
|
|
47
|
-
}
|
|
48
|
-
async start() {
|
|
49
|
-
if (this.filledRunningPromise) {
|
|
50
|
-
throw new Error('Watcher already watching for filled slot');
|
|
51
|
-
}
|
|
52
|
-
const config = await this.rollupCheatCodes.getConfig();
|
|
53
|
-
this.l2SlotDuration = config.slotDuration;
|
|
54
|
-
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
55
|
-
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
56
|
-
// the local network and tests don't break because time is frozen and we never get to
|
|
57
|
-
// the next slot.
|
|
58
|
-
const isAutoMining = await this.cheatcodes.isAutoMining();
|
|
59
|
-
if (isAutoMining) {
|
|
60
|
-
this.filledRunningPromise = new RunningPromise(()=>this.warpTimeIfNeeded(), this.logger, 200);
|
|
61
|
-
this.filledRunningPromise.start();
|
|
62
|
-
this.syncDateProviderPromise = new RunningPromise(()=>this.syncDateProviderToL1IfBehind(), this.logger, 200);
|
|
63
|
-
this.syncDateProviderPromise.start();
|
|
64
|
-
this.markingAsProvenRunningPromise = new RunningPromise(()=>this.markAsProven(), this.logger, 200);
|
|
65
|
-
this.markingAsProvenRunningPromise.start();
|
|
66
|
-
this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
|
|
67
|
-
} else {
|
|
68
|
-
this.logger.info(`Watcher not started because not auto mining`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async stop() {
|
|
72
|
-
await this.filledRunningPromise?.stop();
|
|
73
|
-
await this.syncDateProviderPromise?.stop();
|
|
74
|
-
await this.markingAsProvenRunningPromise?.stop();
|
|
75
|
-
}
|
|
76
|
-
async trigger() {
|
|
77
|
-
await this.filledRunningPromise?.trigger();
|
|
78
|
-
await this.syncDateProviderPromise?.trigger();
|
|
79
|
-
await this.markingAsProvenRunningPromise?.trigger();
|
|
80
|
-
}
|
|
81
|
-
async markAsProven() {
|
|
82
|
-
if (!this.isMarkingAsProven) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
await this.rollupCheatCodes.markAsProven();
|
|
86
|
-
}
|
|
87
|
-
async syncDateProviderToL1IfBehind() {
|
|
88
|
-
// this doesn't apply to the local network, because we don't have a date provider in the local network
|
|
89
|
-
if (!this.dateProvider) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const l1Time = await this.cheatcodes.timestamp() * 1000;
|
|
93
|
-
const wallTime = this.dateProvider.now();
|
|
94
|
-
if (l1Time > wallTime) {
|
|
95
|
-
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
96
|
-
this.dateProvider.setTime(l1Time);
|
|
97
|
-
} else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
|
|
98
|
-
this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
|
|
99
|
-
await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async warpTimeIfNeeded() {
|
|
103
|
-
try {
|
|
104
|
-
const currentSlot = SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
105
|
-
const pendingCheckpointNumber = await this.rollup.read.getPendingCheckpointNumber();
|
|
106
|
-
const checkpointLog = await this.rollup.read.getCheckpoint([
|
|
107
|
-
pendingCheckpointNumber
|
|
108
|
-
]);
|
|
109
|
-
const nextSlot = SlotNumber(currentSlot + 1);
|
|
110
|
-
const nextSlotTimestamp = Number(await this.rollup.read.getTimestampForSlot([
|
|
111
|
-
BigInt(nextSlot)
|
|
112
|
-
]));
|
|
113
|
-
if (BigInt(currentSlot) === checkpointLog.slotNumber) {
|
|
114
|
-
// We should jump to the next slot
|
|
115
|
-
try {
|
|
116
|
-
await this.cheatcodes.warp(nextSlotTimestamp, {
|
|
117
|
-
resetBlockInterval: true
|
|
118
|
-
});
|
|
119
|
-
} catch (e) {
|
|
120
|
-
this.logger.error(`Failed to warp to timestamp ${nextSlotTimestamp}: ${e}`);
|
|
121
|
-
}
|
|
122
|
-
this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
// If we are not in local network, we don't need to warp time
|
|
126
|
-
if (!this.isLocalNetwork) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const currentTimestamp = this.dateProvider?.now() ?? Date.now();
|
|
130
|
-
if (currentTimestamp > nextSlotTimestamp * 1000) {
|
|
131
|
-
try {
|
|
132
|
-
await this.cheatcodes.warp(nextSlotTimestamp, {
|
|
133
|
-
resetBlockInterval: true
|
|
134
|
-
});
|
|
135
|
-
} catch (e) {
|
|
136
|
-
this.logger.error(`Failed to warp to timestamp ${nextSlotTimestamp}: ${e}`);
|
|
137
|
-
}
|
|
138
|
-
this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
|
|
139
|
-
}
|
|
140
|
-
} catch {
|
|
141
|
-
this.logger.error('mineIfSlotFilled failed');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
package/scripts/compile.sh
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
NARGO=${NARGO:-nargo}
|
|
5
|
-
BB=${BB:-bb}
|
|
6
|
-
|
|
7
|
-
# If help is requested, show Aztec-specific info then run nargo compile help and then exit in order to not trigger
|
|
8
|
-
# transpilation
|
|
9
|
-
for arg in "$@"; do
|
|
10
|
-
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
|
11
|
-
cat << 'EOF'
|
|
12
|
-
Aztec Compile - Compile Aztec Noir contracts
|
|
13
|
-
|
|
14
|
-
This command compiles Aztec Noir contracts using nargo and then automatically
|
|
15
|
-
postprocesses them to generate Aztec specific artifacts including:
|
|
16
|
-
- Transpiled contract artifacts
|
|
17
|
-
- Verification keys
|
|
18
|
-
|
|
19
|
-
The compiled contracts will be placed in the target/ directory by default.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
Underlying nargo compile options:
|
|
23
|
-
|
|
24
|
-
EOF
|
|
25
|
-
nargo compile --help
|
|
26
|
-
exit 0
|
|
27
|
-
fi
|
|
28
|
-
done
|
|
29
|
-
|
|
30
|
-
# Run nargo compile.
|
|
31
|
-
$NARGO compile "$@"
|
|
32
|
-
|
|
33
|
-
echo "Postprocessing contract..."
|
|
34
|
-
$BB aztec_process
|
|
35
|
-
|
|
36
|
-
# Strip internal prefixes from all compiled contract JSONs in target directory
|
|
37
|
-
# TODO: This should be part of bb aztec_process!
|
|
38
|
-
for json in target/*.json; do
|
|
39
|
-
temp_file="${json}.tmp"
|
|
40
|
-
jq '.functions |= map(.name |= sub("^__aztec_nr_internals__"; ""))' "$json" > "$temp_file"
|
|
41
|
-
mv "$temp_file" "$json"
|
|
42
|
-
done
|
|
43
|
-
|
|
44
|
-
echo "Compilation complete!"
|