@aztec/aztec 0.0.1-commit.cd76b27 → 0.0.1-commit.d0fcfb7f
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 +7 -3
- package/dest/cli/admin_api_key_store.d.ts +3 -3
- package/dest/cli/admin_api_key_store.d.ts.map +1 -1
- package/dest/cli/admin_api_key_store.js +3 -3
- 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 +15 -10
- package/dest/cli/aztec_start_options.js +5 -5
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +0 -1
- 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 +68 -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 +51 -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 +57 -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/standby.d.ts +32 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- 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 +21 -17
- 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 +12 -6
- package/dest/cli/cmds/utils/artifacts.d.ts +21 -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/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/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -78
- package/dest/examples/token.js +4 -4
- package/dest/local-network/banana_fpc.js +1 -1
- package/dest/local-network/local-network.d.ts +1 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +33 -5
- package/dest/testing/anvil_test_watcher.d.ts +9 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +52 -15
- package/dest/testing/epoch_test_settler.d.ts +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +3 -4
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +34 -34
- package/scripts/aztec.sh +7 -2
- package/src/bin/index.ts +7 -3
- package/src/cli/admin_api_key_store.ts +4 -4
- package/src/cli/aztec_start_action.ts +13 -10
- package/src/cli/aztec_start_options.ts +5 -5
- package/src/cli/cli.ts +0 -1
- package/src/cli/cmds/compile.ts +80 -0
- package/src/cli/cmds/profile.ts +25 -0
- package/src/cli/cmds/profile_flamegraph.ts +63 -0
- package/src/cli/cmds/profile_gates.ts +67 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_node.ts +32 -24
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/cmds/utils/artifacts.ts +44 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/util.ts +41 -74
- package/src/examples/token.ts +6 -4
- package/src/local-network/banana_fpc.ts +1 -1
- package/src/local-network/local-network.ts +29 -3
- package/src/testing/anvil_test_watcher.ts +59 -15
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- 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/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/src/cli/release_version.ts +0 -21
|
@@ -17,6 +17,8 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
17
17
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
18
18
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
19
19
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
20
|
+
import { SequencerState } from '@aztec/sequencer-client';
|
|
21
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
20
22
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
21
23
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
22
24
|
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
@@ -28,6 +30,7 @@ import { createAccountLogs } from '../cli/util.js';
|
|
|
28
30
|
import { DefaultMnemonic } from '../mnemonic.js';
|
|
29
31
|
import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
|
|
30
32
|
import { EpochTestSettler } from '../testing/epoch_test_settler.js';
|
|
33
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
31
34
|
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
32
35
|
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
33
36
|
const logger = createLogger('local-network');
|
|
@@ -66,9 +69,16 @@ const localAnvil = foundry;
|
|
|
66
69
|
if ((config.l1RpcUrls?.length || 0) > 1) {
|
|
67
70
|
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
68
71
|
}
|
|
72
|
+
// The local network deploys a banana FPC with Token contracts, so include Token entries
|
|
73
|
+
// in the setup allowlist so FPC-based fee payments work out of the box.
|
|
74
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
69
75
|
const aztecNodeConfig = {
|
|
70
76
|
...getConfigEnvVars(),
|
|
71
|
-
...config
|
|
77
|
+
...config,
|
|
78
|
+
txPublicSetupAllowListExtend: [
|
|
79
|
+
...tokenAllowList,
|
|
80
|
+
...config.txPublicSetupAllowListExtend ?? []
|
|
81
|
+
]
|
|
72
82
|
};
|
|
73
83
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
74
84
|
if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
|
|
@@ -97,11 +107,15 @@ const localAnvil = foundry;
|
|
|
97
107
|
})();
|
|
98
108
|
const bananaFPC = await getBananaFPCAddress(initialAccounts);
|
|
99
109
|
const sponsoredFPC = await getSponsoredFPCAddress();
|
|
100
|
-
const
|
|
110
|
+
const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromString(a));
|
|
111
|
+
const fundedAddresses = [
|
|
101
112
|
...initialAccounts.map((a)=>a.address),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
...initialAccounts.length ? [
|
|
114
|
+
bananaFPC,
|
|
115
|
+
sponsoredFPC
|
|
116
|
+
] : [],
|
|
117
|
+
...prefundAddresses
|
|
118
|
+
];
|
|
105
119
|
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
|
|
106
120
|
const dateProvider = new TestDateProvider();
|
|
107
121
|
let cheatcodes;
|
|
@@ -141,6 +155,20 @@ const localAnvil = foundry;
|
|
|
141
155
|
}, {
|
|
142
156
|
prefilledPublicData
|
|
143
157
|
});
|
|
158
|
+
// Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
|
|
159
|
+
// transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
|
|
160
|
+
// warping time out from under an in-progress block.
|
|
161
|
+
watcher?.setGetPendingTxCount(()=>node.getPendingTxCount());
|
|
162
|
+
const sequencer = node.getSequencer()?.getSequencer();
|
|
163
|
+
if (sequencer) {
|
|
164
|
+
const idleStates = new Set([
|
|
165
|
+
SequencerState.STOPPED,
|
|
166
|
+
SequencerState.STOPPING,
|
|
167
|
+
SequencerState.IDLE,
|
|
168
|
+
SequencerState.SYNCHRONIZING
|
|
169
|
+
]);
|
|
170
|
+
watcher?.setIsSequencerBuilding(()=>!idleStates.has(sequencer.getState()));
|
|
171
|
+
}
|
|
144
172
|
let epochTestSettler;
|
|
145
173
|
if (!aztecNodeConfig.p2pEnabled) {
|
|
146
174
|
epochTestSettler = new EpochTestSettler(cheatcodes, rollupAddress, node.getBlockSource(), logger.createChild('epoch-settler'), {
|
|
@@ -21,14 +21,22 @@ export declare class AnvilTestWatcher {
|
|
|
21
21
|
private markingAsProvenRunningPromise?;
|
|
22
22
|
private logger;
|
|
23
23
|
private isMarkingAsProven;
|
|
24
|
+
private getPendingTxCount?;
|
|
25
|
+
private isSequencerBuilding?;
|
|
26
|
+
private unfilledSlotFirstSeen?;
|
|
24
27
|
constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined);
|
|
25
28
|
setIsMarkingAsProven(isMarkingAsProven: boolean): void;
|
|
26
29
|
setisLocalNetwork(isLocalNetwork: boolean): void;
|
|
30
|
+
/** Sets a callback to check for pending txs, used to skip unfilled slots faster when txs are waiting. */
|
|
31
|
+
setGetPendingTxCount(fn: () => Promise<number>): void;
|
|
32
|
+
/** Sets a callback to check if the sequencer is actively building, to avoid warping while it works. */
|
|
33
|
+
setIsSequencerBuilding(fn: () => boolean): void;
|
|
27
34
|
start(): Promise<void>;
|
|
28
35
|
stop(): Promise<void>;
|
|
29
36
|
trigger(): Promise<void>;
|
|
30
37
|
markAsProven(): Promise<void>;
|
|
31
38
|
syncDateProviderToL1IfBehind(): Promise<void>;
|
|
32
39
|
warpTimeIfNeeded(): Promise<void>;
|
|
40
|
+
private warpToTimestamp;
|
|
33
41
|
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUFnQjtJQXlCekIsT0FBTyxDQUFDLFVBQVU7SUFHbEIsT0FBTyxDQUFDLFlBQVksQ0FBQztJQTNCdkIsT0FBTyxDQUFDLGNBQWMsQ0FBa0I7SUFFeEMsT0FBTyxDQUFDLE1BQU0sQ0FBc0Q7SUFDcEUsT0FBTyxDQUFDLGdCQUFnQixDQUFtQjtJQUMzQyxPQUFPLENBQUMsY0FBYyxDQUFVO0lBRWhDLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFpQjtJQUM5QyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBaUI7SUFDakQsT0FBTyxDQUFDLDZCQUE2QixDQUFDLENBQWlCO0lBRXZELE9BQU8sQ0FBQyxNQUFNLENBQWlEO0lBRS9ELE9BQU8sQ0FBQyxpQkFBaUIsQ0FBUTtJQUdqQyxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBd0I7SUFHbEQsT0FBTyxDQUFDLG1CQUFtQixDQUFDLENBQWdCO0lBRzVDLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxDQUFxQztJQUVuRSxZQUNVLFVBQVUsRUFBRSxhQUFhLEVBQ2pDLGFBQWEsRUFBRSxVQUFVLEVBQ3pCLFFBQVEsRUFBRSxVQUFVLEVBQ1osWUFBWSxDQUFDLDhCQUFrQixFQWF4QztJQUVELG9CQUFvQixDQUFDLGlCQUFpQixFQUFFLE9BQU8sUUFHOUM7SUFFRCxpQkFBaUIsQ0FBQyxjQUFjLEVBQUUsT0FBTyxRQUV4QztJQUVELHlHQUF5RztJQUN6RyxvQkFBb0IsQ0FBQyxFQUFFLEVBQUUsTUFBTSxPQUFPLENBQUMsTUFBTSxDQUFDLFFBRTdDO0lBRUQsdUdBQXVHO0lBQ3ZHLHNCQUFzQixDQUFDLEVBQUUsRUFBRSxNQUFNLE9BQU8sUUFFdkM7SUFFSyxLQUFLLGtCQXlCVjtJQUVLLElBQUksa0JBSVQ7SUFFSyxPQUFPLGtCQUlaO0lBRUssWUFBWSxrQkFLakI7SUFFSyw0QkFBNEIsa0JBZWpDO0lBRUssZ0JBQWdCLGtCQXlEckI7WUFFYSxlQUFlO0NBTzlCIn0=
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAyBzB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IA3BvB,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;IAGjC,OAAO,CAAC,iBAAiB,CAAC,CAAwB;IAGlD,OAAO,CAAC,mBAAmB,CAAC,CAAgB;IAG5C,OAAO,CAAC,qBAAqB,CAAC,CAAqC;IAEnE,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;IAED,yGAAyG;IACzG,oBAAoB,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,QAE7C;IAED,uGAAuG;IACvG,sBAAsB,CAAC,EAAE,EAAE,MAAM,OAAO,QAEvC;IAEK,KAAK,kBAyBV;IAEK,IAAI,kBAIT;IAEK,OAAO,kBAIZ;IAEK,YAAY,kBAKjB;IAEK,4BAA4B,kBAejC;IAEK,gBAAgB,kBAyDrB;YAEa,eAAe;CAO9B"}
|
|
@@ -22,6 +22,12 @@ import { getAddress, getContract } from 'viem';
|
|
|
22
22
|
markingAsProvenRunningPromise;
|
|
23
23
|
logger;
|
|
24
24
|
isMarkingAsProven;
|
|
25
|
+
// Optional callback to check if there are pending txs in the mempool.
|
|
26
|
+
getPendingTxCount;
|
|
27
|
+
// Optional callback to check if the sequencer is actively building a block.
|
|
28
|
+
isSequencerBuilding;
|
|
29
|
+
// Tracks when we first observed the current unfilled slot with pending txs (real wall time).
|
|
30
|
+
unfilledSlotFirstSeen;
|
|
25
31
|
constructor(cheatcodes, rollupAddress, l1Client, dateProvider){
|
|
26
32
|
this.cheatcodes = cheatcodes;
|
|
27
33
|
this.dateProvider = dateProvider;
|
|
@@ -45,6 +51,12 @@ import { getAddress, getContract } from 'viem';
|
|
|
45
51
|
setisLocalNetwork(isLocalNetwork) {
|
|
46
52
|
this.isLocalNetwork = isLocalNetwork;
|
|
47
53
|
}
|
|
54
|
+
/** Sets a callback to check for pending txs, used to skip unfilled slots faster when txs are waiting. */ setGetPendingTxCount(fn) {
|
|
55
|
+
this.getPendingTxCount = fn;
|
|
56
|
+
}
|
|
57
|
+
/** Sets a callback to check if the sequencer is actively building, to avoid warping while it works. */ setIsSequencerBuilding(fn) {
|
|
58
|
+
this.isSequencerBuilding = fn;
|
|
59
|
+
}
|
|
48
60
|
async start() {
|
|
49
61
|
if (this.filledRunningPromise) {
|
|
50
62
|
throw new Error('Watcher already watching for filled slot');
|
|
@@ -111,14 +123,8 @@ import { getAddress, getContract } from 'viem';
|
|
|
111
123
|
BigInt(nextSlot)
|
|
112
124
|
]));
|
|
113
125
|
if (BigInt(currentSlot) === checkpointLog.slotNumber) {
|
|
114
|
-
//
|
|
115
|
-
|
|
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
|
-
}
|
|
126
|
+
// The current slot has been filled, we should jump to the next slot.
|
|
127
|
+
await this.warpToTimestamp(nextSlotTimestamp);
|
|
122
128
|
this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
|
|
123
129
|
return;
|
|
124
130
|
}
|
|
@@ -126,19 +132,50 @@ import { getAddress, getContract } from 'viem';
|
|
|
126
132
|
if (!this.isLocalNetwork) {
|
|
127
133
|
return;
|
|
128
134
|
}
|
|
135
|
+
// If there are pending txs and the sequencer missed them, warp quickly (after a 2s real-time debounce) so the
|
|
136
|
+
// sequencer can retry in the next slot. Without this, we'd have to wait a full real-time slot duration (~36s) for
|
|
137
|
+
// the dateProvider to catch up to the next slot timestamp. We skip the warp if the sequencer is actively building
|
|
138
|
+
// to avoid invalidating its in-progress work.
|
|
139
|
+
if (this.getPendingTxCount) {
|
|
140
|
+
const pendingTxs = await this.getPendingTxCount();
|
|
141
|
+
if (pendingTxs > 0) {
|
|
142
|
+
if (this.isSequencerBuilding?.()) {
|
|
143
|
+
this.unfilledSlotFirstSeen = undefined;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const realNow = Date.now();
|
|
147
|
+
if (!this.unfilledSlotFirstSeen || this.unfilledSlotFirstSeen.slot !== currentSlot) {
|
|
148
|
+
this.unfilledSlotFirstSeen = {
|
|
149
|
+
slot: currentSlot,
|
|
150
|
+
realTime: realNow
|
|
151
|
+
};
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (realNow - this.unfilledSlotFirstSeen.realTime > 2000) {
|
|
155
|
+
await this.warpToTimestamp(nextSlotTimestamp);
|
|
156
|
+
this.unfilledSlotFirstSeen = undefined;
|
|
157
|
+
this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Fallback: warp when the dateProvider time has passed the next slot timestamp.
|
|
129
163
|
const currentTimestamp = this.dateProvider?.now() ?? Date.now();
|
|
130
164
|
if (currentTimestamp > nextSlotTimestamp * 1000) {
|
|
131
|
-
|
|
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
|
-
}
|
|
165
|
+
await this.warpToTimestamp(nextSlotTimestamp);
|
|
138
166
|
this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
|
|
139
167
|
}
|
|
140
168
|
} catch {
|
|
141
169
|
this.logger.error('mineIfSlotFilled failed');
|
|
142
170
|
}
|
|
143
171
|
}
|
|
172
|
+
async warpToTimestamp(timestamp) {
|
|
173
|
+
try {
|
|
174
|
+
await this.cheatcodes.warp(timestamp, {
|
|
175
|
+
resetBlockInterval: true
|
|
176
|
+
});
|
|
177
|
+
} catch (e) {
|
|
178
|
+
this.logger.error(`Failed to warp to timestamp ${timestamp}: ${e}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
144
181
|
}
|
|
@@ -16,4 +16,4 @@ export declare class EpochTestSettler {
|
|
|
16
16
|
stop(): Promise<void>;
|
|
17
17
|
handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLHNCQUFzQixDQUFDO0FBQzVFLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBYyxNQUFNLGlDQUFpQyxDQUFDO0FBQy9FLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUdyRSxxQkFBYSxnQkFBZ0I7SUFPekIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLEdBQUc7SUFDWCxPQUFPLENBQUMsT0FBTztJQVJqQixPQUFPLENBQUMsZ0JBQWdCLENBQW1CO0lBQzNDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBZTtJQUVwQyxZQUNFLFVBQVUsRUFBRSxhQUFhLEVBQ3pCLGFBQWEsRUFBRSxVQUFVLEVBQ2pCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLEdBQUcsRUFBRSxNQUFNLEVBQ1gsT0FBTyxFQUFFO1FBQUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO1FBQUMsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUUsRUFHeEU7SUFFSyxLQUFLLGtCQUlWO0lBRUssSUFBSSxrQkFFVDtJQUVLLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQW9DbEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAoClE;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
2
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
4
|
-
import {
|
|
4
|
+
import { computeEpochOutHash } from '@aztec/stdlib/messaging';
|
|
5
5
|
export class EpochTestSettler {
|
|
6
6
|
l2BlockSource;
|
|
7
7
|
log;
|
|
@@ -44,9 +44,8 @@ export class EpochTestSettler {
|
|
|
44
44
|
}
|
|
45
45
|
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
|
|
47
|
+
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
48
|
+
if (!outHash.isZero()) {
|
|
50
49
|
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
51
50
|
} else {
|
|
52
51
|
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
|
2
2
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
4
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
5
|
-
|
|
5
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dest/testing/index.js
CHANGED
|
@@ -2,3 +2,4 @@ export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
|
2
2
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
4
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
5
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
2
|
+
/**
|
|
3
|
+
* Returns Token-specific allowlist entries needed for FPC-based fee payments.
|
|
4
|
+
* These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]>;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUV0RTs7O0dBR0c7QUFDSCx3QkFBc0IsNkJBQTZCLElBQUksT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUy9FIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAS/E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
2
|
+
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
4
|
+
/**
|
|
5
|
+
* Returns Token-specific allowlist entries needed for FPC-based fee payments.
|
|
6
|
+
* These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
7
|
+
*/ export async function getTokenAllowedSetupFunctions() {
|
|
8
|
+
const tokenClassId = (await getContractClassFromArtifact(TokenContractArtifact)).id;
|
|
9
|
+
const target = {
|
|
10
|
+
classId: tokenClassId
|
|
11
|
+
};
|
|
12
|
+
return Promise.all([
|
|
13
|
+
// Token: needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
14
|
+
buildAllowedElement(TokenContractArtifact, target, '_increase_public_balance', {
|
|
15
|
+
onlySelf: true
|
|
16
|
+
}),
|
|
17
|
+
// Token: needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
18
|
+
buildAllowedElement(TokenContractArtifact, target, 'transfer_in_public')
|
|
19
|
+
]);
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d0fcfb7f",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-faucet": "0.0.1-commit.
|
|
34
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
35
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
36
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
37
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
38
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
39
|
-
"@aztec/bot": "0.0.1-commit.
|
|
40
|
-
"@aztec/builder": "0.0.1-commit.
|
|
41
|
-
"@aztec/cli": "0.0.1-commit.
|
|
42
|
-
"@aztec/constants": "0.0.1-commit.
|
|
43
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
44
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
45
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
46
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
47
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
48
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
50
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
51
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
52
|
-
"@aztec/p2p-bootstrap": "0.0.1-commit.
|
|
53
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
54
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
55
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
56
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
57
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
58
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
59
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
60
|
-
"@aztec/txe": "0.0.1-commit.
|
|
61
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
62
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
63
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.d0fcfb7f",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.d0fcfb7f",
|
|
33
|
+
"@aztec/aztec-faucet": "0.0.1-commit.d0fcfb7f",
|
|
34
|
+
"@aztec/aztec-node": "0.0.1-commit.d0fcfb7f",
|
|
35
|
+
"@aztec/aztec.js": "0.0.1-commit.d0fcfb7f",
|
|
36
|
+
"@aztec/bb-prover": "0.0.1-commit.d0fcfb7f",
|
|
37
|
+
"@aztec/bb.js": "0.0.1-commit.d0fcfb7f",
|
|
38
|
+
"@aztec/blob-client": "0.0.1-commit.d0fcfb7f",
|
|
39
|
+
"@aztec/bot": "0.0.1-commit.d0fcfb7f",
|
|
40
|
+
"@aztec/builder": "0.0.1-commit.d0fcfb7f",
|
|
41
|
+
"@aztec/cli": "0.0.1-commit.d0fcfb7f",
|
|
42
|
+
"@aztec/constants": "0.0.1-commit.d0fcfb7f",
|
|
43
|
+
"@aztec/entrypoints": "0.0.1-commit.d0fcfb7f",
|
|
44
|
+
"@aztec/ethereum": "0.0.1-commit.d0fcfb7f",
|
|
45
|
+
"@aztec/foundation": "0.0.1-commit.d0fcfb7f",
|
|
46
|
+
"@aztec/kv-store": "0.0.1-commit.d0fcfb7f",
|
|
47
|
+
"@aztec/l1-artifacts": "0.0.1-commit.d0fcfb7f",
|
|
48
|
+
"@aztec/node-lib": "0.0.1-commit.d0fcfb7f",
|
|
49
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d0fcfb7f",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.d0fcfb7f",
|
|
51
|
+
"@aztec/p2p": "0.0.1-commit.d0fcfb7f",
|
|
52
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.d0fcfb7f",
|
|
53
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d0fcfb7f",
|
|
54
|
+
"@aztec/prover-client": "0.0.1-commit.d0fcfb7f",
|
|
55
|
+
"@aztec/prover-node": "0.0.1-commit.d0fcfb7f",
|
|
56
|
+
"@aztec/pxe": "0.0.1-commit.d0fcfb7f",
|
|
57
|
+
"@aztec/sequencer-client": "0.0.1-commit.d0fcfb7f",
|
|
58
|
+
"@aztec/stdlib": "0.0.1-commit.d0fcfb7f",
|
|
59
|
+
"@aztec/telemetry-client": "0.0.1-commit.d0fcfb7f",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.d0fcfb7f",
|
|
61
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.d0fcfb7f",
|
|
62
|
+
"@aztec/wallets": "0.0.1-commit.d0fcfb7f",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.d0fcfb7f",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
|
66
66
|
"chalk": "^5.3.0",
|
package/scripts/aztec.sh
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
|
+
shopt -s inherit_errexit
|
|
3
4
|
|
|
4
5
|
# Re-execute using correct version if we have an .aztecrc file.
|
|
5
6
|
if [ "${AZTEC_VERSIONED:-0}" -eq 0 ] && [ -f .aztecrc ] && command -v aztec-up &>/dev/null; then
|
|
@@ -26,7 +27,7 @@ case $cmd in
|
|
|
26
27
|
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
27
28
|
while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
|
|
28
29
|
export NARGO_FOREIGN_CALL_TIMEOUT=300000
|
|
29
|
-
nargo test --silence-warnings
|
|
30
|
+
nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081 --test-threads 16 "$@"
|
|
30
31
|
;;
|
|
31
32
|
start)
|
|
32
33
|
if [ "${1:-}" == "--local-network" ]; then
|
|
@@ -53,9 +54,13 @@ case $cmd in
|
|
|
53
54
|
|
|
54
55
|
aztec start "$@"
|
|
55
56
|
;;
|
|
56
|
-
|
|
57
|
+
new|init)
|
|
57
58
|
$script_dir/${cmd}.sh "$@"
|
|
58
59
|
;;
|
|
60
|
+
flamegraph)
|
|
61
|
+
echo "Warning: 'aztec flamegraph' is deprecated. Use 'aztec profile flamegraph' instead." >&2
|
|
62
|
+
aztec profile flamegraph "$@"
|
|
63
|
+
;;
|
|
59
64
|
*)
|
|
60
65
|
aztec $cmd "$@"
|
|
61
66
|
;;
|
package/src/bin/index.ts
CHANGED
|
@@ -11,12 +11,14 @@ import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
|
|
|
11
11
|
import { injectCommands as injectValidatorKeysCommands } from '@aztec/cli/validator_keys';
|
|
12
12
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
13
13
|
import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
|
|
14
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
14
15
|
|
|
15
16
|
import { Command } from 'commander';
|
|
16
17
|
|
|
18
|
+
import { injectCompileCommand } from '../cli/cmds/compile.js';
|
|
17
19
|
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
20
|
+
import { injectProfileCommand } from '../cli/cmds/profile.js';
|
|
18
21
|
import { injectAztecCommands } from '../cli/index.js';
|
|
19
|
-
import { getCliVersion } from '../cli/release_version.js';
|
|
20
22
|
|
|
21
23
|
const NETWORK_FLAG = 'network';
|
|
22
24
|
|
|
@@ -45,9 +47,9 @@ async function main() {
|
|
|
45
47
|
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
46
48
|
enrichEnvironmentWithChainName(networkName);
|
|
47
49
|
|
|
48
|
-
const cliVersion =
|
|
50
|
+
const cliVersion = getPackageVersion() ?? 'unknown';
|
|
49
51
|
let program = new Command('aztec');
|
|
50
|
-
program.description('Aztec command line interface').version(cliVersion);
|
|
52
|
+
program.description('Aztec command line interface').version(cliVersion).enablePositionalOptions();
|
|
51
53
|
program = injectAztecCommands(program, userLog, debugLogger);
|
|
52
54
|
program = injectBuilderCommands(program);
|
|
53
55
|
program = injectContractCommands(program, userLog, debugLogger);
|
|
@@ -56,6 +58,8 @@ async function main() {
|
|
|
56
58
|
program = injectAztecNodeCommands(program, userLog, debugLogger);
|
|
57
59
|
program = injectMiscCommands(program, userLog);
|
|
58
60
|
program = injectValidatorKeysCommands(program, userLog);
|
|
61
|
+
program = injectCompileCommand(program, userLog);
|
|
62
|
+
program = injectProfileCommand(program, userLog);
|
|
59
63
|
program = injectMigrateCommand(program, userLog);
|
|
60
64
|
|
|
61
65
|
await program.parseAsync(process.argv);
|
|
@@ -28,7 +28,7 @@ export interface ResolveAdminApiKeyOptions {
|
|
|
28
28
|
/** SHA-256 hex hash of a pre-generated API key. When set, the node uses this hash directly. */
|
|
29
29
|
adminApiKeyHash?: string;
|
|
30
30
|
/** If true, disable admin API key auth entirely. */
|
|
31
|
-
|
|
31
|
+
disableAdminApiKey?: boolean;
|
|
32
32
|
/** If true, force-generate a new key even if one is already persisted. */
|
|
33
33
|
resetAdminApiKey?: boolean;
|
|
34
34
|
/** Root data directory for persistent storage. */
|
|
@@ -39,7 +39,7 @@ export interface ResolveAdminApiKeyOptions {
|
|
|
39
39
|
* Resolves the admin API key for the admin RPC endpoint.
|
|
40
40
|
*
|
|
41
41
|
* Strategy:
|
|
42
|
-
* 1. If opt-out flag is set (`
|
|
42
|
+
* 1. If opt-out flag is set (`disableAdminApiKey`), return undefined (no auth).
|
|
43
43
|
* 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly.
|
|
44
44
|
* 3. If a data directory exists, look for a persisted hash file
|
|
45
45
|
* at `<dataDirectory>/admin/api_key_hash`:
|
|
@@ -58,8 +58,8 @@ export async function resolveAdminApiKey(
|
|
|
58
58
|
log: Logger,
|
|
59
59
|
): Promise<AdminApiKeyResolution | undefined> {
|
|
60
60
|
// Operator explicitly opted out of admin auth
|
|
61
|
-
if (options.
|
|
62
|
-
log.warn('Admin API key authentication is DISABLED (--
|
|
61
|
+
if (options.disableAdminApiKey) {
|
|
62
|
+
log.warn('Admin API key authentication is DISABLED (--disable-admin-api-key / AZTEC_DISABLE_ADMIN_API_KEY)');
|
|
63
63
|
return undefined;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
1
2
|
import {
|
|
2
3
|
type NamespacedApiHandlers,
|
|
3
4
|
createNamespacedSafeJsonRpcServer,
|
|
@@ -7,13 +8,13 @@ import {
|
|
|
7
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
8
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
10
|
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
10
12
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
11
13
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
12
14
|
|
|
13
15
|
import { createLocalNetwork } from '../local-network/index.js';
|
|
14
16
|
import { github, splash } from '../splash.js';
|
|
15
17
|
import { resolveAdminApiKey } from './admin_api_key_store.js';
|
|
16
|
-
import { getCliVersion } from './release_version.js';
|
|
17
18
|
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
|
|
18
19
|
import { getVersions } from './versioning.js';
|
|
19
20
|
|
|
@@ -22,14 +23,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
22
23
|
const signalHandlers: Array<() => Promise<void>> = [];
|
|
23
24
|
const services: NamespacedApiHandlers = {};
|
|
24
25
|
const adminServices: NamespacedApiHandlers = {};
|
|
26
|
+
const packageVersion = getPackageVersion();
|
|
25
27
|
let config: ChainConfig | undefined = undefined;
|
|
26
28
|
|
|
27
29
|
if (options.localNetwork) {
|
|
28
|
-
const cliVersion = getCliVersion();
|
|
29
30
|
const localNetwork = extractNamespacedOptions(options, 'local-network');
|
|
30
31
|
localNetwork.testAccounts = true;
|
|
31
32
|
userLog(`${splash}\n${github}\n\n`);
|
|
32
|
-
userLog(`Setting up Aztec local network ${
|
|
33
|
+
userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
|
|
33
34
|
|
|
34
35
|
const { node, stop } = await createLocalNetwork(
|
|
35
36
|
{
|
|
@@ -37,11 +38,11 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
37
38
|
l1RpcUrls: options.l1RpcUrls,
|
|
38
39
|
testAccounts: localNetwork.testAccounts,
|
|
39
40
|
realProofs: false,
|
|
40
|
-
// Setting the epoch duration to
|
|
41
|
+
// Setting the epoch duration to 2 by default for local network. This allows the epoch to be "proven" faster, so
|
|
41
42
|
// the users can consume out hash without having to wait for a long time.
|
|
42
43
|
// Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
|
|
43
44
|
// the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
|
|
44
|
-
aztecEpochDuration:
|
|
45
|
+
aztecEpochDuration: 2,
|
|
45
46
|
},
|
|
46
47
|
userLog,
|
|
47
48
|
);
|
|
@@ -57,7 +58,8 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
57
58
|
|
|
58
59
|
if (options.node) {
|
|
59
60
|
const { startNode } = await import('./cmds/start_node.js');
|
|
60
|
-
|
|
61
|
+
const networkName = getActiveNetworkName(options.network);
|
|
62
|
+
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
61
63
|
} else if (options.bot) {
|
|
62
64
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
63
65
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -87,13 +89,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
87
89
|
|
|
88
90
|
installSignalHandlers(debugLogger.info, signalHandlers);
|
|
89
91
|
const versions = getVersions(config);
|
|
92
|
+
const versioningOpts = { packageVersion };
|
|
90
93
|
|
|
91
94
|
// Start the main JSON-RPC server
|
|
92
95
|
if (Object.entries(services).length > 0) {
|
|
93
96
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
94
97
|
http200OnError: false,
|
|
95
98
|
log: debugLogger,
|
|
96
|
-
middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
|
|
99
|
+
middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)],
|
|
97
100
|
maxBatchSize: options.rpcMaxBatchSize,
|
|
98
101
|
maxBodySizeBytes: options.rpcMaxBodySize,
|
|
99
102
|
});
|
|
@@ -103,13 +106,13 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
103
106
|
|
|
104
107
|
// If there are any admin services, start a separate JSON-RPC server for them
|
|
105
108
|
if (Object.entries(adminServices).length > 0) {
|
|
106
|
-
const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)];
|
|
109
|
+
const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)];
|
|
107
110
|
|
|
108
111
|
// Resolve the admin API key (auto-generated and persisted, or opt-out)
|
|
109
112
|
const apiKeyResolution = await resolveAdminApiKey(
|
|
110
113
|
{
|
|
111
114
|
adminApiKeyHash: options.adminApiKeyHash,
|
|
112
|
-
|
|
115
|
+
disableAdminApiKey: options.disableAdminApiKey,
|
|
113
116
|
resetAdminApiKey: options.resetAdminApiKey,
|
|
114
117
|
dataDirectory: options.dataDirectory,
|
|
115
118
|
},
|
|
@@ -148,7 +151,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
148
151
|
userLog(' The key hash has been persisted — on next restart, the same key will be used.');
|
|
149
152
|
}
|
|
150
153
|
userLog('');
|
|
151
|
-
userLog(' To disable admin auth: --
|
|
154
|
+
userLog(' To disable admin auth: --disable-admin-api-key or AZTEC_DISABLE_ADMIN_API_KEY=true');
|
|
152
155
|
userLog(separator);
|
|
153
156
|
userLog('');
|
|
154
157
|
}
|
|
@@ -105,8 +105,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
105
105
|
env: 'NETWORK',
|
|
106
106
|
},
|
|
107
107
|
|
|
108
|
-
configToFlag('--
|
|
109
|
-
configToFlag('--auto-update-url', sharedNodeConfigMappings.autoUpdateUrl),
|
|
108
|
+
configToFlag('--enable-version-check', sharedNodeConfigMappings.enableVersionCheck),
|
|
110
109
|
|
|
111
110
|
configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
|
|
112
111
|
configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
|
|
@@ -150,12 +149,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
150
149
|
env: 'AZTEC_ADMIN_API_KEY_HASH',
|
|
151
150
|
},
|
|
152
151
|
{
|
|
153
|
-
flag: '--
|
|
152
|
+
flag: '--disable-admin-api-key',
|
|
154
153
|
description:
|
|
155
154
|
'Disable API key authentication on the admin RPC endpoint. By default, a key is auto-generated, displayed once, and its hash is persisted.',
|
|
156
155
|
defaultValue: false,
|
|
157
|
-
env: '
|
|
158
|
-
|
|
156
|
+
env: 'AZTEC_DISABLE_ADMIN_API_KEY',
|
|
157
|
+
// undefined means the flag was passed without a value (boolean toggle), treat as true.
|
|
158
|
+
parseVal: val => val === undefined || val === 'true' || val === '1',
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
flag: '--reset-admin-api-key',
|
package/src/cli/cli.ts
CHANGED
|
@@ -39,7 +39,6 @@ Additional commands:
|
|
|
39
39
|
|
|
40
40
|
init [folder] [options] creates a new Aztec Noir project.
|
|
41
41
|
new <path> [options] creates a new Aztec Noir project in a new directory.
|
|
42
|
-
compile [options] compiles Aztec Noir contracts.
|
|
43
42
|
test [options] starts a TXE and runs "nargo test" using it as the oracle resolver.
|
|
44
43
|
`,
|
|
45
44
|
);
|