@aztec/aztec 0.0.1-commit.c80b6263 → 0.0.1-commit.cd76b27
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/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 +44 -8
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +22 -6
- 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 +9 -5
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +62 -10
- package/dest/cli/cmds/start_prover_agent.js +2 -2
- 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 +2 -2
- package/dest/cli/util.d.ts +5 -14
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +10 -5
- package/dest/examples/token.js +2 -2
- package/dest/local-network/local-network.d.ts +4 -2
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +17 -13
- package/package.json +34 -34
- package/scripts/aztec.sh +1 -2
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +48 -4
- package/src/cli/aztec_start_options.ts +24 -5
- package/src/cli/cmds/start_bot.ts +8 -5
- package/src/cli/cmds/start_node.ts +51 -9
- package/src/cli/cmds/start_prover_agent.ts +2 -2
- package/src/cli/cmds/start_prover_broker.ts +5 -1
- package/src/cli/util.ts +14 -19
- package/src/examples/token.ts +2 -2
- package/src/local-network/local-network.ts +25 -14
- 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/src/cli/cmds/start_prover_node.ts +0 -124
package/dest/cli/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAq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;;;;GAIG;AACH,wBAAsB,kCAAkC,CACtD,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAChD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC9C,eAAe,EAAE,GAAG,EACpB,sBAAsB,EAAE,OAAO,EAC/B,YAAY,EAAE,UAAU,EACxB,uBAAuB,EAAE,UAAU,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAC1C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,iBA+ErD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
package/dest/cli/util.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import { getTelemetryClient } from '@aztec/telemetry-client/start';
|
|
3
4
|
import chalk from 'chalk';
|
|
@@ -63,19 +64,20 @@ export const installSignalHandlers = (logFn, cb)=>{
|
|
|
63
64
|
/**
|
|
64
65
|
* Creates logs for the initial accounts
|
|
65
66
|
* @param accounts - The initial accounts
|
|
66
|
-
* @param wallet - A
|
|
67
|
+
* @param wallet - A EmbeddedWallet instance to get the registered accounts
|
|
67
68
|
* @returns A string array containing the initial accounts details
|
|
68
|
-
*/ export async function createAccountLogs(
|
|
69
|
+
*/ export async function createAccountLogs(accountManagers, wallet) {
|
|
69
70
|
const registeredAccounts = await wallet.getAccounts();
|
|
70
71
|
const accountLogStrings = [
|
|
71
72
|
`Initial Accounts:\n\n`
|
|
72
73
|
];
|
|
73
|
-
for (const
|
|
74
|
-
const
|
|
74
|
+
for (const accountManager of accountManagers){
|
|
75
|
+
const account = await accountManager.getAccount();
|
|
76
|
+
const completeAddress = account.getCompleteAddress();
|
|
75
77
|
if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
|
|
76
78
|
accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
|
|
77
79
|
accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
|
|
78
|
-
accountLogStrings.push(` Secret Key: ${
|
|
80
|
+
accountLogStrings.push(` Secret Key: ${account.getSecretKey().toString()}\n`);
|
|
79
81
|
accountLogStrings.push(` Master nullifier public key: ${completeAddress.publicKeys.masterNullifierPublicKey.toString()}\n`);
|
|
80
82
|
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.masterIncomingViewingPublicKey.toString()}\n\n`);
|
|
81
83
|
accountLogStrings.push(` Master outgoing viewing public key: ${completeAddress.publicKeys.masterOutgoingViewingPublicKey.toString()}\n\n`);
|
|
@@ -322,3 +324,6 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
322
324
|
});
|
|
323
325
|
checker.start();
|
|
324
326
|
}
|
|
327
|
+
export function stringifyConfig(config) {
|
|
328
|
+
return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
|
|
329
|
+
}
|
package/dest/examples/token.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
|
2
2
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
|
-
import {
|
|
5
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
6
6
|
const logger = createLogger('example:token');
|
|
7
7
|
const nodeUrl = 'http://localhost:8080';
|
|
8
8
|
const node = createAztecNodeClient(nodeUrl);
|
|
@@ -12,7 +12,7 @@ const TRANSFER_AMOUNT = 33n;
|
|
|
12
12
|
* Main function.
|
|
13
13
|
*/ async function main() {
|
|
14
14
|
logger.info('Running token contract test on HTTP interface.');
|
|
15
|
-
const wallet = await
|
|
15
|
+
const wallet = await EmbeddedWallet.create(node);
|
|
16
16
|
// During local network setup we deploy a few accounts. Below we add them to our wallet.
|
|
17
17
|
const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
|
|
18
18
|
await wallet.createSchnorrAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
|
|
@@ -6,6 +6,7 @@ import { type BlobClientInterface } from '@aztec/blob-client/client';
|
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
|
+
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
9
10
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
11
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
11
12
|
import { type Hex } from 'viem';
|
|
@@ -38,7 +39,7 @@ export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, pr
|
|
|
38
39
|
dateGatedRelayerAddress?: EthAddress | undefined;
|
|
39
40
|
} & {
|
|
40
41
|
rollupAddress: EthAddress;
|
|
41
|
-
} & {
|
|
42
|
+
} & Pick<import("@aztec/ethereum/l1-contract-addresses").L1ContractAddresses, "rollupAddress"> & {
|
|
42
43
|
rollupAddress: EthAddress;
|
|
43
44
|
}>;
|
|
44
45
|
/** Local network settings. */
|
|
@@ -65,7 +66,8 @@ export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?
|
|
|
65
66
|
telemetry?: TelemetryClient;
|
|
66
67
|
blobClient?: BlobClientInterface;
|
|
67
68
|
dateProvider?: DateProvider;
|
|
69
|
+
proverBroker?: ProvingJobBroker;
|
|
68
70
|
}, options?: {
|
|
69
71
|
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
70
72
|
}): Promise<AztecN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;;;;;;;;;;;;;;;;;;;;;GAoBP;AAED,8BAA8B;AAC9B,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IACjD,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,yCAAkC,EAAE,OAAO,EAAE,KAAK;;;GAiIhG;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC5B,EACN,OAAO,GAAE;IAAE,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAO,6BAe7D"}
|
|
@@ -18,7 +18,8 @@ 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
20
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
21
|
-
import {
|
|
21
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
22
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
22
23
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
23
24
|
import { createPublicClient, fallback, http as httpViemTransport } from 'viem';
|
|
24
25
|
import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
|
|
@@ -70,9 +71,9 @@ const localAnvil = foundry;
|
|
|
70
71
|
...config
|
|
71
72
|
};
|
|
72
73
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
73
|
-
if (aztecNodeConfig.
|
|
74
|
+
if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
|
|
74
75
|
const privKey = hdAccount.getHdKey().privateKey;
|
|
75
|
-
aztecNodeConfig.
|
|
76
|
+
aztecNodeConfig.sequencerPublisherPrivateKeys = [
|
|
76
77
|
new SecretValue(`0x${Buffer.from(privKey).toString('hex')}`)
|
|
77
78
|
];
|
|
78
79
|
}
|
|
@@ -148,17 +149,15 @@ const localAnvil = foundry;
|
|
|
148
149
|
await epochTestSettler.start();
|
|
149
150
|
}
|
|
150
151
|
if (initialAccounts.length) {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
const wallet = await EmbeddedWallet.create(node, {
|
|
153
|
+
pxeConfig: {
|
|
154
|
+
proverEnabled: aztecNodeConfig.realProofs
|
|
155
|
+
},
|
|
156
|
+
ephemeral: true
|
|
157
|
+
});
|
|
155
158
|
userLog('Setting up funded test accounts...');
|
|
156
159
|
const accountManagers = await deployFundedSchnorrAccounts(wallet, initialAccounts);
|
|
157
|
-
const
|
|
158
|
-
account: manager,
|
|
159
|
-
secretKey: initialAccounts[i].secret
|
|
160
|
-
}));
|
|
161
|
-
const accLogs = await createAccountLogs(accountsWithSecrets, wallet);
|
|
160
|
+
const accLogs = await createAccountLogs(accountManagers, wallet);
|
|
162
161
|
userLog(accLogs.join(''));
|
|
163
162
|
await setupBananaFPC(initialAccounts, wallet, userLog);
|
|
164
163
|
userLog(`SponsoredFPC: ${await getSponsoredFPCAddress()}`);
|
|
@@ -189,6 +188,11 @@ const localAnvil = foundry;
|
|
|
189
188
|
...config.l1Contracts
|
|
190
189
|
}
|
|
191
190
|
};
|
|
192
|
-
const node = await AztecNodeService.createAndSync(aztecNodeConfig,
|
|
191
|
+
const node = await AztecNodeService.createAndSync(aztecNodeConfig, {
|
|
192
|
+
...deps,
|
|
193
|
+
proverNodeDeps: {
|
|
194
|
+
broker: deps.proverBroker
|
|
195
|
+
}
|
|
196
|
+
}, options);
|
|
193
197
|
return node;
|
|
194
198
|
}
|
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.cd76b27",
|
|
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/
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
63
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.cd76b27",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.cd76b27",
|
|
33
|
+
"@aztec/aztec-faucet": "0.0.1-commit.cd76b27",
|
|
34
|
+
"@aztec/aztec-node": "0.0.1-commit.cd76b27",
|
|
35
|
+
"@aztec/aztec.js": "0.0.1-commit.cd76b27",
|
|
36
|
+
"@aztec/bb-prover": "0.0.1-commit.cd76b27",
|
|
37
|
+
"@aztec/bb.js": "0.0.1-commit.cd76b27",
|
|
38
|
+
"@aztec/blob-client": "0.0.1-commit.cd76b27",
|
|
39
|
+
"@aztec/bot": "0.0.1-commit.cd76b27",
|
|
40
|
+
"@aztec/builder": "0.0.1-commit.cd76b27",
|
|
41
|
+
"@aztec/cli": "0.0.1-commit.cd76b27",
|
|
42
|
+
"@aztec/constants": "0.0.1-commit.cd76b27",
|
|
43
|
+
"@aztec/entrypoints": "0.0.1-commit.cd76b27",
|
|
44
|
+
"@aztec/ethereum": "0.0.1-commit.cd76b27",
|
|
45
|
+
"@aztec/foundation": "0.0.1-commit.cd76b27",
|
|
46
|
+
"@aztec/kv-store": "0.0.1-commit.cd76b27",
|
|
47
|
+
"@aztec/l1-artifacts": "0.0.1-commit.cd76b27",
|
|
48
|
+
"@aztec/node-lib": "0.0.1-commit.cd76b27",
|
|
49
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.cd76b27",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.cd76b27",
|
|
51
|
+
"@aztec/p2p": "0.0.1-commit.cd76b27",
|
|
52
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.cd76b27",
|
|
53
|
+
"@aztec/protocol-contracts": "0.0.1-commit.cd76b27",
|
|
54
|
+
"@aztec/prover-client": "0.0.1-commit.cd76b27",
|
|
55
|
+
"@aztec/prover-node": "0.0.1-commit.cd76b27",
|
|
56
|
+
"@aztec/pxe": "0.0.1-commit.cd76b27",
|
|
57
|
+
"@aztec/sequencer-client": "0.0.1-commit.cd76b27",
|
|
58
|
+
"@aztec/stdlib": "0.0.1-commit.cd76b27",
|
|
59
|
+
"@aztec/telemetry-client": "0.0.1-commit.cd76b27",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.cd76b27",
|
|
61
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.cd76b27",
|
|
62
|
+
"@aztec/wallets": "0.0.1-commit.cd76b27",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.cd76b27",
|
|
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,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
|
-
shopt -s inherit_errexit
|
|
4
3
|
|
|
5
4
|
# Re-execute using correct version if we have an .aztecrc file.
|
|
6
5
|
if [ "${AZTEC_VERSIONED:-0}" -eq 0 ] && [ -f .aztecrc ] && command -v aztec-up &>/dev/null; then
|
|
@@ -21,7 +20,7 @@ function aztec {
|
|
|
21
20
|
|
|
22
21
|
case $cmd in
|
|
23
22
|
test)
|
|
24
|
-
export LOG_LEVEL="${LOG_LEVEL:-error}"
|
|
23
|
+
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract_log"}"
|
|
25
24
|
aztec start --txe --port 8081 &
|
|
26
25
|
server_pid=$!
|
|
27
26
|
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
|
+
import { sha256Hash } from '@aztec/foundation/json-rpc/server';
|
|
3
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
+
|
|
5
|
+
import { promises as fs } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
/** Subdirectory under dataDirectory for admin API key storage. */
|
|
9
|
+
const ADMIN_STORE_DIR = 'admin';
|
|
10
|
+
const HASH_FILE_NAME = 'api_key_hash';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Result of resolving the admin API key.
|
|
14
|
+
* Contains the SHA-256 hex hash of the API key to be used by the auth middleware,
|
|
15
|
+
* and optionally the raw key when newly generated (so the caller can display it).
|
|
16
|
+
*/
|
|
17
|
+
export interface AdminApiKeyResolution {
|
|
18
|
+
/** The SHA-256 hash of the API key. */
|
|
19
|
+
apiKeyHash: Buffer;
|
|
20
|
+
/**
|
|
21
|
+
* The raw API key, only present when a new key was generated during this call.
|
|
22
|
+
* The caller MUST display this to the operator — it will not be stored or returned again.
|
|
23
|
+
*/
|
|
24
|
+
rawKey?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ResolveAdminApiKeyOptions {
|
|
28
|
+
/** SHA-256 hex hash of a pre-generated API key. When set, the node uses this hash directly. */
|
|
29
|
+
adminApiKeyHash?: string;
|
|
30
|
+
/** If true, disable admin API key auth entirely. */
|
|
31
|
+
noAdminApiKey?: boolean;
|
|
32
|
+
/** If true, force-generate a new key even if one is already persisted. */
|
|
33
|
+
resetAdminApiKey?: boolean;
|
|
34
|
+
/** Root data directory for persistent storage. */
|
|
35
|
+
dataDirectory?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the admin API key for the admin RPC endpoint.
|
|
40
|
+
*
|
|
41
|
+
* Strategy:
|
|
42
|
+
* 1. If opt-out flag is set (`noAdminApiKey`), return undefined (no auth).
|
|
43
|
+
* 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly.
|
|
44
|
+
* 3. If a data directory exists, look for a persisted hash file
|
|
45
|
+
* at `<dataDirectory>/admin/api_key_hash`:
|
|
46
|
+
* - If `resetAdminApiKey` is set, skip loading and force-generate a new key.
|
|
47
|
+
* - Found: use the stored hash (operator already saved the key from first run).
|
|
48
|
+
* - Not found: auto-generate a random key, display it once, persist the hash.
|
|
49
|
+
* 3. If no data directory: generate a random key
|
|
50
|
+
* each run and display it (cannot persist).
|
|
51
|
+
*
|
|
52
|
+
* @param options - The options for resolving the admin API key.
|
|
53
|
+
* @param log - Logger for outputting the key and status messages.
|
|
54
|
+
* @returns The resolved API key hash, or undefined if auth is disabled.
|
|
55
|
+
*/
|
|
56
|
+
export async function resolveAdminApiKey(
|
|
57
|
+
options: ResolveAdminApiKeyOptions,
|
|
58
|
+
log: Logger,
|
|
59
|
+
): Promise<AdminApiKeyResolution | undefined> {
|
|
60
|
+
// Operator explicitly opted out of admin auth
|
|
61
|
+
if (options.noAdminApiKey) {
|
|
62
|
+
log.warn('Admin API key authentication is DISABLED (--no-admin-api-key / AZTEC_NO_ADMIN_API_KEY)');
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Operator provided a pre-generated hash (e.g. via AZTEC_ADMIN_API_KEY_HASH env var)
|
|
67
|
+
if (options.adminApiKeyHash) {
|
|
68
|
+
const hex = options.adminApiKeyHash.trim();
|
|
69
|
+
if (hex.length !== 64 || !/^[0-9a-f]{64}$/.test(hex)) {
|
|
70
|
+
throw new Error(`Invalid admin API key hash: expected 64-char hex string, got "${hex}"`);
|
|
71
|
+
}
|
|
72
|
+
log.info('Admin API key authentication enabled (using pre-configured key hash)');
|
|
73
|
+
return { apiKeyHash: Buffer.from(hex, 'hex') };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Persistent storage available, load or generate key
|
|
77
|
+
if (options.dataDirectory) {
|
|
78
|
+
const adminDir = join(options.dataDirectory, ADMIN_STORE_DIR);
|
|
79
|
+
const hashFilePath = join(adminDir, HASH_FILE_NAME);
|
|
80
|
+
|
|
81
|
+
// Unless a reset is forced, try to load the existing hash from disk
|
|
82
|
+
if (!options.resetAdminApiKey) {
|
|
83
|
+
try {
|
|
84
|
+
const storedHash = (await fs.readFile(hashFilePath, 'utf-8')).trim();
|
|
85
|
+
if (storedHash.length === 64) {
|
|
86
|
+
log.info('Admin API key authentication enabled (loaded stored key hash from disk)');
|
|
87
|
+
return { apiKeyHash: Buffer.from(storedHash, 'hex') };
|
|
88
|
+
}
|
|
89
|
+
log.warn(`Invalid stored admin API key hash at ${hashFilePath}, regenerating...`);
|
|
90
|
+
} catch (err: any) {
|
|
91
|
+
if (err.code !== 'ENOENT') {
|
|
92
|
+
log.warn(`Failed to read admin API key hash from ${hashFilePath}: ${err.message}`);
|
|
93
|
+
}
|
|
94
|
+
// File doesn't exist — fall through to generate
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
log.warn('Admin API key reset requested — generating a new key');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Generate a new key, persist the hash, and return the raw key for the caller to display
|
|
101
|
+
const { rawKey, hash } = generateApiKey();
|
|
102
|
+
await fs.mkdir(adminDir, { recursive: true });
|
|
103
|
+
await fs.writeFile(hashFilePath, hash.toString('hex'), 'utf-8');
|
|
104
|
+
// Set restrictive permissions (owner read/write only)
|
|
105
|
+
await fs.chmod(hashFilePath, 0o600);
|
|
106
|
+
|
|
107
|
+
log.info('Admin API key authentication enabled (new key generated and hash persisted to disk)');
|
|
108
|
+
return { apiKeyHash: hash, rawKey };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// No data directory, generate a temporary key per session
|
|
112
|
+
const { rawKey, hash } = generateApiKey();
|
|
113
|
+
|
|
114
|
+
log.warn('No data directory configured — admin API key cannot be persisted.');
|
|
115
|
+
log.warn('A temporary key has been generated for this session only.');
|
|
116
|
+
|
|
117
|
+
return { apiKeyHash: hash, rawKey };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Generates a cryptographically random API key and its SHA-256 hash.
|
|
122
|
+
* @returns The raw key (hex string) and its SHA-256 hash as a Buffer.
|
|
123
|
+
*/
|
|
124
|
+
function generateApiKey(): { rawKey: string; hash: Buffer } {
|
|
125
|
+
const rawKey = randomBytes(32).toString('hex');
|
|
126
|
+
const hash = sha256Hash(rawKey);
|
|
127
|
+
return { rawKey, hash };
|
|
128
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type NamespacedApiHandlers,
|
|
3
3
|
createNamespacedSafeJsonRpcServer,
|
|
4
|
+
getApiKeyAuthMiddleware,
|
|
4
5
|
startHttpRpcServer,
|
|
5
6
|
} from '@aztec/foundation/json-rpc/server';
|
|
6
7
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
@@ -11,6 +12,7 @@ import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
|
11
12
|
|
|
12
13
|
import { createLocalNetwork } from '../local-network/index.js';
|
|
13
14
|
import { github, splash } from '../splash.js';
|
|
15
|
+
import { resolveAdminApiKey } from './admin_api_key_store.js';
|
|
14
16
|
import { getCliVersion } from './release_version.js';
|
|
15
17
|
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
|
|
16
18
|
import { getVersions } from './versioning.js';
|
|
@@ -48,15 +50,17 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
48
50
|
signalHandlers.push(stop);
|
|
49
51
|
services.node = [node, AztecNodeApiSchema];
|
|
50
52
|
} else {
|
|
53
|
+
// Route --prover-node through startNode
|
|
54
|
+
if (options.proverNode && !options.node) {
|
|
55
|
+
options.node = true;
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
if (options.node) {
|
|
52
59
|
const { startNode } = await import('./cmds/start_node.js');
|
|
53
60
|
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog));
|
|
54
61
|
} else if (options.bot) {
|
|
55
62
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
56
63
|
await startBot(options, signalHandlers, services, userLog);
|
|
57
|
-
} else if (options.proverNode) {
|
|
58
|
-
const { startProverNode } = await import('./cmds/start_prover_node.js');
|
|
59
|
-
({ config } = await startProverNode(options, signalHandlers, services, userLog));
|
|
60
64
|
} else if (options.archiver) {
|
|
61
65
|
const { startArchiver } = await import('./cmds/start_archiver.js');
|
|
62
66
|
({ config } = await startArchiver(options, signalHandlers, services));
|
|
@@ -99,14 +103,54 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
99
103
|
|
|
100
104
|
// If there are any admin services, start a separate JSON-RPC server for them
|
|
101
105
|
if (Object.entries(adminServices).length > 0) {
|
|
106
|
+
const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)];
|
|
107
|
+
|
|
108
|
+
// Resolve the admin API key (auto-generated and persisted, or opt-out)
|
|
109
|
+
const apiKeyResolution = await resolveAdminApiKey(
|
|
110
|
+
{
|
|
111
|
+
adminApiKeyHash: options.adminApiKeyHash,
|
|
112
|
+
noAdminApiKey: options.noAdminApiKey,
|
|
113
|
+
resetAdminApiKey: options.resetAdminApiKey,
|
|
114
|
+
dataDirectory: options.dataDirectory,
|
|
115
|
+
},
|
|
116
|
+
debugLogger,
|
|
117
|
+
);
|
|
118
|
+
if (apiKeyResolution) {
|
|
119
|
+
adminMiddlewares.unshift(getApiKeyAuthMiddleware(apiKeyResolution.apiKeyHash));
|
|
120
|
+
} else {
|
|
121
|
+
debugLogger.warn('No admin API key set — admin endpoint is unauthenticated');
|
|
122
|
+
}
|
|
123
|
+
|
|
102
124
|
const rpcServer = createNamespacedSafeJsonRpcServer(adminServices, {
|
|
103
125
|
http200OnError: false,
|
|
104
126
|
log: debugLogger,
|
|
105
|
-
middlewares:
|
|
127
|
+
middlewares: adminMiddlewares,
|
|
106
128
|
maxBatchSize: options.rpcMaxBatchSize,
|
|
107
129
|
maxBodySizeBytes: options.rpcMaxBodySize,
|
|
108
130
|
});
|
|
109
131
|
const { port } = await startHttpRpcServer(rpcServer, { port: options.adminPort });
|
|
110
132
|
debugLogger.info(`Aztec Server admin API listening on port ${port}`, versions);
|
|
133
|
+
|
|
134
|
+
// Display the API key after the server has started
|
|
135
|
+
// Uses userLog which is never filtered by LOG_LEVEL.
|
|
136
|
+
if (apiKeyResolution?.rawKey) {
|
|
137
|
+
const separator = '='.repeat(70);
|
|
138
|
+
userLog('');
|
|
139
|
+
userLog(separator);
|
|
140
|
+
userLog(' ADMIN API KEY (save this — it will NOT be shown again)');
|
|
141
|
+
userLog('');
|
|
142
|
+
userLog(` ${apiKeyResolution.rawKey}`);
|
|
143
|
+
userLog('');
|
|
144
|
+
userLog(` Use via header: x-api-key: <key>`);
|
|
145
|
+
userLog(` Or via header: Authorization: Bearer <key>`);
|
|
146
|
+
if (options.dataDirectory) {
|
|
147
|
+
userLog('');
|
|
148
|
+
userLog(' The key hash has been persisted — on next restart, the same key will be used.');
|
|
149
|
+
}
|
|
150
|
+
userLog('');
|
|
151
|
+
userLog(' To disable admin auth: --no-admin-api-key or AZTEC_NO_ADMIN_API_KEY=true');
|
|
152
|
+
userLog(separator);
|
|
153
|
+
userLog('');
|
|
154
|
+
}
|
|
111
155
|
}
|
|
112
156
|
}
|
|
@@ -142,6 +142,29 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
142
142
|
env: 'AZTEC_ADMIN_PORT',
|
|
143
143
|
parseVal: val => parseInt(val, 10),
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
flag: '--admin-api-key-hash <value>',
|
|
147
|
+
description:
|
|
148
|
+
'SHA-256 hex hash of a pre-generated admin API key. When set, the node uses this hash for authentication instead of auto-generating a key.',
|
|
149
|
+
defaultValue: undefined,
|
|
150
|
+
env: 'AZTEC_ADMIN_API_KEY_HASH',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
flag: '--no-admin-api-key',
|
|
154
|
+
description:
|
|
155
|
+
'Disable API key authentication on the admin RPC endpoint. By default, a key is auto-generated, displayed once, and its hash is persisted.',
|
|
156
|
+
defaultValue: false,
|
|
157
|
+
env: 'AZTEC_NO_ADMIN_API_KEY',
|
|
158
|
+
parseVal: val => val === 'true' || val === '1',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
flag: '--reset-admin-api-key',
|
|
162
|
+
description:
|
|
163
|
+
'Force-generate a new admin API key, replacing any previously persisted key hash. The new key is displayed once at startup.',
|
|
164
|
+
defaultValue: false,
|
|
165
|
+
env: 'AZTEC_RESET_ADMIN_API_KEY',
|
|
166
|
+
parseVal: val => val === 'true' || val === '1',
|
|
167
|
+
},
|
|
145
168
|
{
|
|
146
169
|
flag: '--api-prefix <value>',
|
|
147
170
|
description: 'Prefix for API routes on any service that is started',
|
|
@@ -170,7 +193,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
170
193
|
'WORLD STATE': [
|
|
171
194
|
configToFlag('--world-state-data-directory', worldStateConfigMappings.worldStateDataDirectory),
|
|
172
195
|
configToFlag('--world-state-db-map-size-kb', worldStateConfigMappings.worldStateDbMapSizeKb),
|
|
173
|
-
configToFlag('--world-state-
|
|
196
|
+
configToFlag('--world-state-checkpoint-history', worldStateConfigMappings.worldStateCheckpointHistory),
|
|
174
197
|
],
|
|
175
198
|
// We can't easily auto-generate node options as they're parts of modules defined below
|
|
176
199
|
'AZTEC NODE': [
|
|
@@ -222,12 +245,8 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
222
245
|
'proverNode',
|
|
223
246
|
omitConfigMappings(proverNodeConfigMappings, [
|
|
224
247
|
// filter out options passed separately
|
|
225
|
-
...getKeys(archiverConfigMappings),
|
|
226
248
|
...getKeys(proverBrokerConfigMappings),
|
|
227
249
|
...getKeys(proverAgentConfigMappings),
|
|
228
|
-
...getKeys(p2pConfigMappings),
|
|
229
|
-
...getKeys(worldStateConfigMappings),
|
|
230
|
-
...getKeys(sharedNodeConfigMappings),
|
|
231
250
|
]),
|
|
232
251
|
),
|
|
233
252
|
],
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
initTelemetryClient,
|
|
11
11
|
makeTracedFetch,
|
|
12
12
|
} from '@aztec/telemetry-client';
|
|
13
|
-
import {
|
|
13
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
14
14
|
|
|
15
|
-
import { extractRelevantOptions } from '../util.js';
|
|
15
|
+
import { extractRelevantOptions, stringifyConfig } from '../util.js';
|
|
16
16
|
import { getVersions } from '../versioning.js';
|
|
17
17
|
|
|
18
18
|
export async function startBot(
|
|
@@ -38,22 +38,25 @@ export async function startBot(
|
|
|
38
38
|
const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
|
|
39
39
|
|
|
40
40
|
const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
41
|
-
|
|
41
|
+
userLog(`Creating bot wallet with config ${stringifyConfig(pxeConfig)}`);
|
|
42
|
+
const wallet = await EmbeddedWallet.create(aztecNode, { pxeConfig });
|
|
42
43
|
|
|
43
44
|
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
44
|
-
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
|
|
45
|
+
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined, userLog);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export async function addBot(
|
|
48
49
|
options: any,
|
|
49
50
|
signalHandlers: (() => Promise<void>)[],
|
|
50
51
|
services: NamespacedApiHandlers,
|
|
51
|
-
wallet:
|
|
52
|
+
wallet: EmbeddedWallet,
|
|
52
53
|
aztecNode: AztecNode,
|
|
53
54
|
telemetry: TelemetryClient,
|
|
54
55
|
aztecNodeAdmin?: AztecNodeAdmin,
|
|
56
|
+
userLog?: LogFn,
|
|
55
57
|
) {
|
|
56
58
|
const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
|
|
59
|
+
userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
|
|
57
60
|
|
|
58
61
|
const db = await (config.dataDirectory
|
|
59
62
|
? createStore('bot', BotStore.SCHEMA_VERSION, config)
|