@aztec/aztec 0.0.1-commit.2f68f620 → 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 +2 -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 +6 -27
- package/dest/cli/aztec_start_options.js +1 -1
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +25 -17
- 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 +28 -2
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +45 -2
- package/dest/cli/cmds/start_bot.d.ts +1 -1
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +5 -1
- 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 +13 -22
- package/dest/cli/cmds/utils/artifacts.d.ts +6 -1
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -1
- package/dest/cli/util.d.ts +10 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +20 -49
- package/dest/examples/token.js +3 -3
- package/dest/local-network/local-network.d.ts +4 -5
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +32 -75
- package/dest/testing/cheat_codes.d.ts +16 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +20 -82
- 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 +5 -26
- package/dest/testing/index.d.ts +1 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +0 -1
- package/dest/testing/token_allowed_setup.d.ts +9 -4
- package/dest/testing/token_allowed_setup.d.ts.map +1 -1
- package/dest/testing/token_allowed_setup.js +12 -8
- package/package.json +34 -34
- package/scripts/templates/counter/contract/src/main.nr +4 -4
- package/src/bin/index.ts +2 -0
- package/src/cli/aztec_start_action.ts +3 -14
- package/src/cli/aztec_start_options.ts +1 -1
- package/src/cli/cmds/compile.ts +29 -16
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +55 -3
- package/src/cli/cmds/start_bot.ts +6 -1
- package/src/cli/cmds/start_node.ts +16 -22
- package/src/cli/cmds/utils/artifacts.ts +5 -0
- package/src/cli/util.ts +21 -62
- package/src/examples/token.ts +11 -3
- package/src/local-network/local-network.ts +34 -87
- package/src/testing/cheat_codes.ts +19 -103
- package/src/testing/epoch_test_settler.ts +8 -30
- package/src/testing/index.ts +0 -1
- package/src/testing/token_allowed_setup.ts +15 -8
- package/dest/testing/anvil_test_watcher.d.ts +0 -54
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -235
- package/src/testing/anvil_test_watcher.ts +0 -273
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { AnvilTestWatcher, type AnvilTestWatcherOpts } 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';
|
|
5
4
|
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,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
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
1
2
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
2
3
|
/**
|
|
3
|
-
* Returns
|
|
4
|
-
*
|
|
4
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
5
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
6
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
7
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
8
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
9
|
+
* mainnet alpha.
|
|
5
10
|
*/
|
|
6
|
-
export declare function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
export declare function getTokenAllowedSetupFunctions(artifact?: ContractArtifact): Promise<AllowedElement[]>;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRTFELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXRFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELFFBQVEsR0FBRSxnQkFBd0MsR0FDakQsT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUzNCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,GAAE,gBAAwC,GACjD,OAAO,CAAC,cAAc,EAAE,CAAC,CAS3B"}
|
|
@@ -2,19 +2,23 @@ import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
|
2
2
|
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
3
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
4
4
|
/**
|
|
5
|
-
* Returns
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
6
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
7
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
8
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
9
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
10
|
+
* mainnet alpha.
|
|
11
|
+
*/ export async function getTokenAllowedSetupFunctions(artifact = TokenContractArtifact) {
|
|
12
|
+
const tokenClassId = (await getContractClassFromArtifact(artifact)).id;
|
|
9
13
|
const target = {
|
|
10
14
|
classId: tokenClassId
|
|
11
15
|
};
|
|
12
16
|
return Promise.all([
|
|
13
|
-
//
|
|
14
|
-
buildAllowedElement(
|
|
17
|
+
// needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
18
|
+
buildAllowedElement(artifact, target, '_increase_public_balance', {
|
|
15
19
|
onlySelf: true
|
|
16
20
|
}),
|
|
17
|
-
//
|
|
18
|
-
buildAllowedElement(
|
|
21
|
+
// needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
22
|
+
buildAllowedElement(artifact, target, 'transfer_in_public')
|
|
19
23
|
]);
|
|
20
24
|
}
|
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.3100065",
|
|
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-node": "0.0.1-commit.
|
|
34
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
35
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
36
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
37
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
38
|
-
"@aztec/bot": "0.0.1-commit.
|
|
39
|
-
"@aztec/builder": "0.0.1-commit.
|
|
40
|
-
"@aztec/cli": "0.0.1-commit.
|
|
41
|
-
"@aztec/constants": "0.0.1-commit.
|
|
42
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
43
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
44
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
45
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
46
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
47
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
48
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
50
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
51
|
-
"@aztec/p2p-bootstrap": "0.0.1-commit.
|
|
52
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
53
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
54
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
55
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
56
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
57
|
-
"@aztec/standard-contracts": "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.3100065",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.3100065",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.3100065",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.3100065",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.3100065",
|
|
36
|
+
"@aztec/bb.js": "0.0.1-commit.3100065",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.3100065",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.3100065",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.3100065",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.3100065",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.3100065",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.3100065",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.3100065",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.3100065",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.3100065",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.3100065",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.3100065",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3100065",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.3100065",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.3100065",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.3100065",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.3100065",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.3100065",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.3100065",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.3100065",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.3100065",
|
|
57
|
+
"@aztec/standard-contracts": "0.0.1-commit.3100065",
|
|
58
|
+
"@aztec/stdlib": "0.0.1-commit.3100065",
|
|
59
|
+
"@aztec/telemetry-client": "0.0.1-commit.3100065",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.3100065",
|
|
61
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.3100065",
|
|
62
|
+
"@aztec/wallets": "0.0.1-commit.3100065",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.3100065",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@types/chalk": "^2.2.0",
|
|
66
66
|
"abitype": "^0.8.11",
|
|
@@ -4,7 +4,7 @@ use aztec::macros::aztec;
|
|
|
4
4
|
pub contract Counter {
|
|
5
5
|
use aztec::{
|
|
6
6
|
macros::{functions::{external, initializer}, storage::storage},
|
|
7
|
-
messages::
|
|
7
|
+
messages::delivery::MessageDelivery,
|
|
8
8
|
protocol::address::AztecAddress,
|
|
9
9
|
state_vars::Owned,
|
|
10
10
|
};
|
|
@@ -24,17 +24,17 @@ pub contract Counter {
|
|
|
24
24
|
#[initializer]
|
|
25
25
|
#[external("private")]
|
|
26
26
|
fn constructor(initial_value: u128, owner: AztecAddress) {
|
|
27
|
-
// Delivers the note to the recipient onchain
|
|
27
|
+
// Delivers the note to the recipient onchain.
|
|
28
28
|
// Without delivery, the recipient can't find or decrypt the note.
|
|
29
29
|
self.storage.counters.at(owner).add(initial_value).deliver(
|
|
30
|
-
MessageDelivery::
|
|
30
|
+
MessageDelivery::onchain_unconstrained(),
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Adds 1 to the owner's counter.
|
|
35
35
|
#[external("private")]
|
|
36
36
|
fn increment(owner: AztecAddress) {
|
|
37
|
-
self.storage.counters.at(owner).add(1).deliver(MessageDelivery::
|
|
37
|
+
self.storage.counters.at(owner).add(1).deliver(MessageDelivery::onchain_unconstrained());
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// Returns the current value of the owner's counter.
|
package/src/bin/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { Command } from 'commander';
|
|
|
18
18
|
import { injectCompileCommand } from '../cli/cmds/compile.js';
|
|
19
19
|
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
20
20
|
import { injectProfileCommand } from '../cli/cmds/profile.js';
|
|
21
|
+
import { injectProverCommand } from '../cli/cmds/prover.js';
|
|
21
22
|
import { injectAztecCommands } from '../cli/index.js';
|
|
22
23
|
|
|
23
24
|
const NETWORK_FLAG = 'network';
|
|
@@ -61,6 +62,7 @@ async function main() {
|
|
|
61
62
|
program = injectCompileCommand(program, userLog);
|
|
62
63
|
program = injectProfileCommand(program, userLog);
|
|
63
64
|
program = injectMigrateCommand(program, userLog);
|
|
65
|
+
program = injectProverCommand(program, userLog);
|
|
64
66
|
|
|
65
67
|
await program.parseAsync(process.argv);
|
|
66
68
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerAztecNodeRpcHandlers } from '@aztec/aztec-node';
|
|
1
2
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
2
3
|
import {
|
|
3
4
|
type NamespacedApiHandlers,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
} from '@aztec/foundation/json-rpc/server';
|
|
8
9
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
10
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
|
-
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
12
12
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
13
13
|
import { getOtelJsonRpcDiagnosticsMiddleware, getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
@@ -36,21 +36,13 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
36
36
|
l1Mnemonic: localNetwork.l1Mnemonic,
|
|
37
37
|
l1RpcUrls: options.l1RpcUrls,
|
|
38
38
|
testAccounts: localNetwork.testAccounts,
|
|
39
|
-
realProofs: false,
|
|
40
|
-
// Setting the epoch duration to 2 by default for local network. This allows the epoch to be "proven" faster, so
|
|
41
|
-
// the users can consume out hash without having to wait for a long time.
|
|
42
|
-
// Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
|
|
43
|
-
// the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
|
|
44
|
-
aztecEpochDuration: 2,
|
|
45
39
|
},
|
|
46
40
|
userLog,
|
|
47
41
|
);
|
|
48
42
|
|
|
49
43
|
// Start Node and PXE JSON-RPC server
|
|
50
44
|
signalHandlers.push(stop);
|
|
51
|
-
|
|
52
|
-
adminServices.node = [node, AztecNodeAdminApiSchema];
|
|
53
|
-
services.nodeDebug = [node, AztecNodeDebugApiSchema];
|
|
45
|
+
registerAztecNodeRpcHandlers(node, services, adminServices, { debug: true });
|
|
54
46
|
} else {
|
|
55
47
|
// Route --prover-node through startNode
|
|
56
48
|
if (options.proverNode && !options.node) {
|
|
@@ -61,9 +53,6 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
61
53
|
const { startNode } = await import('./cmds/start_node.js');
|
|
62
54
|
const networkName = getActiveNetworkName(options.network);
|
|
63
55
|
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
64
|
-
if (options.nodeDebug && services.node) {
|
|
65
|
-
services.nodeDebug = [services.node[0], AztecNodeDebugApiSchema];
|
|
66
|
-
}
|
|
67
56
|
} else if (options.bot) {
|
|
68
57
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
69
58
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -94,7 +83,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
94
83
|
|
|
95
84
|
// Start the main JSON-RPC server
|
|
96
85
|
if (Object.entries(services).length > 0) {
|
|
97
|
-
if (services.
|
|
86
|
+
if (services.aztec) {
|
|
98
87
|
const { BarretenbergSync } = await import('@aztec/bb.js');
|
|
99
88
|
// JSON-RPC schema parsing may decompress compressed Chonk proofs before the node handler runs.
|
|
100
89
|
await BarretenbergSync.initSingleton();
|
|
@@ -109,7 +109,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
109
109
|
env: 'NETWORK',
|
|
110
110
|
},
|
|
111
111
|
|
|
112
|
-
configToFlag('--enable-
|
|
112
|
+
configToFlag('--enable-auto-shutdown', sharedNodeConfigMappings.enableAutoShutdown),
|
|
113
113
|
|
|
114
114
|
configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
|
|
115
115
|
configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
|
package/src/cli/cmds/compile.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { needsRecompile } from './utils/needs_recompile.js';
|
|
|
12
12
|
import { run } from './utils/spawn.js';
|
|
13
13
|
import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismatch.js';
|
|
14
14
|
|
|
15
|
-
/** Returns
|
|
16
|
-
async function collectContractArtifacts(): Promise<
|
|
15
|
+
/** Returns contract artifacts in the target directory along with whether each has already been postprocessed. */
|
|
16
|
+
async function collectContractArtifacts(): Promise<ContractArtifactInfo[]> {
|
|
17
17
|
let files;
|
|
18
18
|
try {
|
|
19
19
|
files = await readArtifactFiles('target');
|
|
@@ -23,7 +23,9 @@ async function collectContractArtifacts(): Promise<string[]> {
|
|
|
23
23
|
}
|
|
24
24
|
throw err;
|
|
25
25
|
}
|
|
26
|
-
return files
|
|
26
|
+
return files
|
|
27
|
+
.filter(f => Array.isArray(f.content.functions))
|
|
28
|
+
.map(f => ({ filePath: f.filePath, transpiled: f.content.transpiled === true }));
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/** Stamps the Aztec stack version into the contract artifacts. */
|
|
@@ -141,30 +143,34 @@ async function checkNoTestsInContracts(nargo: string, log: LogFn): Promise<void>
|
|
|
141
143
|
async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<void> {
|
|
142
144
|
await warnIfAztecVersionMismatch(log);
|
|
143
145
|
|
|
144
|
-
if (!(await needsRecompile())) {
|
|
145
|
-
log('No source changes detected, skipping compilation.');
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
146
|
const nargo = process.env.NARGO ?? 'nargo';
|
|
150
147
|
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
151
148
|
|
|
152
|
-
await
|
|
149
|
+
const shouldRecompile = await needsRecompile();
|
|
150
|
+
if (shouldRecompile) {
|
|
151
|
+
await run(nargo, ['compile', ...nargoArgs]);
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
// Ensure contract crates contain no tests (tests belong in the test crate).
|
|
154
|
+
await checkNoTestsInContracts(nargo, log);
|
|
155
|
+
}
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
// Postprocess any untranspiled artifacts: those just produced by nargo above, and any left behind by a bare
|
|
158
|
+
// `nargo compile` run outside `aztec compile`.
|
|
159
|
+
const unprocessed = (await collectContractArtifacts()).filter(a => !a.transpiled).map(a => a.filePath);
|
|
158
160
|
|
|
159
|
-
if (
|
|
161
|
+
if (unprocessed.length > 0) {
|
|
160
162
|
log('Postprocessing contracts...');
|
|
161
|
-
const bbArgs =
|
|
163
|
+
const bbArgs = unprocessed.flatMap(a => ['-i', a]);
|
|
162
164
|
await run(bb, ['aztec_process', ...bbArgs]);
|
|
163
165
|
|
|
164
|
-
await stampAztecVersion(
|
|
166
|
+
await stampAztecVersion(unprocessed);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
|
|
169
|
+
if (shouldRecompile || unprocessed.length > 0) {
|
|
170
|
+
log('Compilation complete!');
|
|
171
|
+
} else {
|
|
172
|
+
log('No source changes detected, skipping compilation.');
|
|
173
|
+
}
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
export function injectCompileCommand(program: Command, log: LogFn): Command {
|
|
@@ -190,3 +196,10 @@ export function injectCompileCommand(program: Command, log: LogFn): Command {
|
|
|
190
196
|
|
|
191
197
|
return program;
|
|
192
198
|
}
|
|
199
|
+
|
|
200
|
+
interface ContractArtifactInfo {
|
|
201
|
+
/** Path to the artifact JSON in the target directory. */
|
|
202
|
+
filePath: string;
|
|
203
|
+
/** Whether the artifact has already been transpiled and had its verification keys generated. */
|
|
204
|
+
transpiled: boolean;
|
|
205
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { createProverNodeAdminClient } from '@aztec/stdlib/interfaces/server';
|
|
4
|
+
|
|
5
|
+
import { type Command, InvalidArgumentError } from 'commander';
|
|
6
|
+
|
|
7
|
+
function parseEpoch(value: string): number {
|
|
8
|
+
const parsed = Number(value);
|
|
9
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
10
|
+
throw new InvalidArgumentError('Epoch must be a non-negative integer.');
|
|
11
|
+
}
|
|
12
|
+
return parsed;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function injectProverCommand(program: Command, log: LogFn): Command {
|
|
16
|
+
const proverCommand = program.command('prover').description('Operate a prover node via its admin JSON-RPC endpoint');
|
|
17
|
+
|
|
18
|
+
proverCommand
|
|
19
|
+
.command('start-proof')
|
|
20
|
+
.description('Schedules proving for the given epoch')
|
|
21
|
+
.requiredOption('--epoch <n>', 'Epoch number to prove', parseEpoch)
|
|
22
|
+
.requiredOption('--admin-url <url>', 'URL of the prover node admin JSON-RPC endpoint')
|
|
23
|
+
.option('--api-key <key>', 'Admin API key', process.env.AZTEC_ADMIN_API_KEY)
|
|
24
|
+
.action(async options => {
|
|
25
|
+
const client = createProverNodeAdminClient(options.adminUrl, {}, undefined, options.apiKey);
|
|
26
|
+
const jobId = await client.startProof(options.epoch);
|
|
27
|
+
log(`Started proving job ${jobId} for epoch ${options.epoch}`);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
proverCommand
|
|
31
|
+
.command('get-jobs')
|
|
32
|
+
.description('Lists the prover node proving jobs')
|
|
33
|
+
.requiredOption('--admin-url <url>', 'URL of the prover node admin JSON-RPC endpoint')
|
|
34
|
+
.option('--api-key <key>', 'Admin API key', process.env.AZTEC_ADMIN_API_KEY)
|
|
35
|
+
.action(async options => {
|
|
36
|
+
const client = createProverNodeAdminClient(options.adminUrl, {}, undefined, options.apiKey);
|
|
37
|
+
const jobs = await client.getJobs();
|
|
38
|
+
log(jsonStringify(jobs, true));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return program;
|
|
42
|
+
}
|
package/src/cli/cmds/standby.ts
CHANGED
|
@@ -6,13 +6,16 @@ import type { GenesisStateConfig } from '@aztec/ethereum/config';
|
|
|
6
6
|
import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
7
7
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
8
|
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
9
|
-
import type
|
|
9
|
+
import { type LogFn, createLogger } from '@aztec/foundation/log';
|
|
10
10
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
+
import type { VersionCheck } from '@aztec/stdlib/update-checker';
|
|
12
13
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
13
14
|
|
|
14
15
|
import Koa from 'koa';
|
|
15
16
|
|
|
17
|
+
import { isShuttingDown, softShutdown } from '../util.js';
|
|
18
|
+
|
|
16
19
|
const ROLLUP_POLL_INTERVAL_S = 60;
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -23,7 +26,7 @@ const ROLLUP_POLL_INTERVAL_S = 60;
|
|
|
23
26
|
export async function computeExpectedGenesisRoot(config: GenesisStateConfig, userLog: LogFn) {
|
|
24
27
|
const testAccounts = config.testAccounts ? (await getInitialTestAccountsData()).map(a => a.address) : [];
|
|
25
28
|
const sponsoredFPCAccounts = config.sponsoredFPC ? [await getSponsoredFPCAddress()] : [];
|
|
26
|
-
const prefundAddresses = (config.prefundAddresses ?? []).map(a => AztecAddress.
|
|
29
|
+
const prefundAddresses = (config.prefundAddresses ?? []).map(a => AztecAddress.fromStringUnsafe(a));
|
|
27
30
|
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts).concat(prefundAddresses);
|
|
28
31
|
|
|
29
32
|
userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
|
|
@@ -35,7 +38,12 @@ export async function computeExpectedGenesisRoot(config: GenesisStateConfig, use
|
|
|
35
38
|
return { genesisArchiveRoot, genesis };
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Compares the rollup's on-chain protocol constants (genesis archive root, VK tree root, protocol
|
|
43
|
+
* contracts hash) against the node's expected local values. Returns a list of human-readable mismatch
|
|
44
|
+
* descriptions, empty if the rollup is compatible.
|
|
45
|
+
*/
|
|
46
|
+
export async function checkRollupCompatibility(
|
|
39
47
|
rollup: RollupContract,
|
|
40
48
|
expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
|
|
41
49
|
): Promise<string[]> {
|
|
@@ -130,3 +138,47 @@ export async function waitForCompatibleRollup(
|
|
|
130
138
|
await new Promise<void>((resolve, reject) => standbyServer.close(err => (err ? reject(err) : resolve())));
|
|
131
139
|
}
|
|
132
140
|
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Polls the canonical rollup's protocol constants every 10 minutes and soft-shuts-down the node once they
|
|
144
|
+
* diverge from the node's expected local values (i.e. an incompatible rollup has become canonical on L1).
|
|
145
|
+
* The HTTP health server is left running so K8s probes keep passing on the wound-down pod. This is the
|
|
146
|
+
* inverse of {@link waitForCompatibleRollup}; it should only be set up for nodes following the canonical
|
|
147
|
+
* rollup. Reuses the {@link checkRollupCompatibility} diff and the generic VersionChecker poll primitive.
|
|
148
|
+
*/
|
|
149
|
+
export async function setupAutoShutdown(
|
|
150
|
+
config: { l1RpcUrls: string[]; l1ChainId: number },
|
|
151
|
+
registryAddress: EthAddress,
|
|
152
|
+
rollupVersion: number | 'canonical',
|
|
153
|
+
expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
|
|
154
|
+
signalHandlers: Array<() => Promise<void>>,
|
|
155
|
+
): Promise<void> {
|
|
156
|
+
const { VersionChecker } = await import('@aztec/stdlib/update-checker');
|
|
157
|
+
|
|
158
|
+
const logger = createLogger('auto_shutdown');
|
|
159
|
+
const publicClient = getPublicClient(config);
|
|
160
|
+
const registry = new RegistryContract(publicClient, registryAddress);
|
|
161
|
+
|
|
162
|
+
const check: VersionCheck = {
|
|
163
|
+
name: 'rollup',
|
|
164
|
+
currentVersion: 'compatible',
|
|
165
|
+
getLatestVersion: async () => {
|
|
166
|
+
const rollupAddress = await registry.getRollupAddress(rollupVersion);
|
|
167
|
+
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
168
|
+
const mismatches = await checkRollupCompatibility(rollup, expected);
|
|
169
|
+
return mismatches.length === 0 ? 'compatible' : `incompatible: ${mismatches.join('; ')}`;
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const checker = new VersionChecker([check], 600_000, logger);
|
|
174
|
+
checker.on('newVersion', ({ latestVersion }) => {
|
|
175
|
+
if (isShuttingDown()) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
logger.warn('Canonical rollup is no longer compatible; auto-shutting down node', { latestVersion });
|
|
179
|
+
// softShutdown never rejects (it awaits handlers via allSettled); fire-and-forget from the listener.
|
|
180
|
+
void softShutdown(logger.info.bind(logger), signalHandlers);
|
|
181
|
+
});
|
|
182
|
+
checker.start();
|
|
183
|
+
signalHandlers.push(() => checker.stop());
|
|
184
|
+
}
|
|
@@ -56,6 +56,11 @@ export async function addBot(
|
|
|
56
56
|
const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
|
|
57
57
|
userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
|
|
58
58
|
|
|
59
|
+
// The bot wallet's embedded PXE syncs to this tip (see start_bot.ts/start_node.ts which build the wallet from the
|
|
60
|
+
// same options). L1-to-L2 readiness checks must be evaluated at this tip rather than at 'latest', or the bot can
|
|
61
|
+
// consider a message ready while the PXE simulation anchors to an older block that cannot prove its membership yet.
|
|
62
|
+
const { syncChainTip } = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
63
|
+
|
|
59
64
|
const db = await (config.dataDirectory
|
|
60
65
|
? createStore('bot', BotStore.SCHEMA_VERSION, config)
|
|
61
66
|
: openTmpStore('bot', true, config.dataStoreMapSizeKb));
|
|
@@ -63,7 +68,7 @@ export async function addBot(
|
|
|
63
68
|
const store = new BotStore(db);
|
|
64
69
|
await store.cleanupOldClaims();
|
|
65
70
|
|
|
66
|
-
const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store);
|
|
71
|
+
const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store, syncChainTip);
|
|
67
72
|
if (!config.noStart) {
|
|
68
73
|
void botRunner.start(); // Do not block since bot setup takes time
|
|
69
74
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AztecNodeConfig,
|
|
3
|
+
aztecNodeConfigMappings,
|
|
4
|
+
getConfigEnvVars,
|
|
5
|
+
registerAztecNodeRpcHandlers,
|
|
6
|
+
} from '@aztec/aztec-node';
|
|
2
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
8
|
import { getL1Config } from '@aztec/cli/config';
|
|
4
|
-
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
9
|
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
6
10
|
import { type NetworkNames, SecretValue } from '@aztec/foundation/config';
|
|
7
11
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
@@ -15,8 +19,7 @@ import {
|
|
|
15
19
|
proverBrokerBackoff,
|
|
16
20
|
} from '@aztec/prover-client/broker';
|
|
17
21
|
import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
|
|
18
|
-
import {
|
|
19
|
-
import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
22
|
+
import { ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
20
23
|
import {
|
|
21
24
|
type TelemetryClientConfig,
|
|
22
25
|
initTelemetryClient,
|
|
@@ -26,14 +29,9 @@ import {
|
|
|
26
29
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
27
30
|
|
|
28
31
|
import { createAztecNode } from '../../local-network/index.js';
|
|
29
|
-
import {
|
|
30
|
-
extractNamespacedOptions,
|
|
31
|
-
extractRelevantOptions,
|
|
32
|
-
preloadCrsDataForVerifying,
|
|
33
|
-
setupVersionChecker,
|
|
34
|
-
} from '../util.js';
|
|
32
|
+
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
|
|
35
33
|
import { getVersions } from '../versioning.js';
|
|
36
|
-
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
34
|
+
import { computeExpectedGenesisRoot, setupAutoShutdown, waitForCompatibleRollup } from './standby.js';
|
|
37
35
|
import { startProverBroker } from './start_prover_broker.js';
|
|
38
36
|
|
|
39
37
|
export async function startNode(
|
|
@@ -156,10 +154,7 @@ export async function startNode(
|
|
|
156
154
|
// Create and start Aztec Node
|
|
157
155
|
const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
|
|
158
156
|
|
|
159
|
-
|
|
160
|
-
services.node = [node, AztecNodeApiSchema];
|
|
161
|
-
services.p2p = [node.getP2P(), P2PApiSchema];
|
|
162
|
-
adminServices.nodeAdmin = [node, AztecNodeAdminApiSchema];
|
|
157
|
+
registerAztecNodeRpcHandlers(node, services, adminServices, { debug: options.nodeDebug });
|
|
163
158
|
|
|
164
159
|
// Register prover-node services if the prover node subsystem is running
|
|
165
160
|
const proverNode = node.getProverNode();
|
|
@@ -183,15 +178,14 @@ export async function startNode(
|
|
|
183
178
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
184
179
|
}
|
|
185
180
|
|
|
186
|
-
if (nodeConfig.
|
|
187
|
-
const cacheDir = process.env.DATA_DIRECTORY ? `${process.env.DATA_DIRECTORY}/cache` : undefined;
|
|
181
|
+
if (nodeConfig.enableAutoShutdown && networkName !== 'local' && followsCanonicalRollup) {
|
|
188
182
|
try {
|
|
189
|
-
await
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
await setupAutoShutdown(
|
|
184
|
+
nodeConfig,
|
|
185
|
+
nodeConfig.registryAddress,
|
|
186
|
+
(nodeConfig.rollupVersion as number | 'canonical') ?? 'canonical',
|
|
187
|
+
{ genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
|
|
193
188
|
signalHandlers,
|
|
194
|
-
cacheDir,
|
|
195
189
|
);
|
|
196
190
|
} catch {
|
|
197
191
|
/* no-op */
|
|
@@ -6,6 +6,11 @@ export interface CompiledArtifact {
|
|
|
6
6
|
file_map: unknown;
|
|
7
7
|
functions: ContractFunction[];
|
|
8
8
|
bytecode?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Set to true by the AVM transpiler (invoked via `bb aztec_process`) once the contract has been transpiled and its
|
|
11
|
+
* verification keys generated. Absent on raw `nargo compile` output, hence optional.
|
|
12
|
+
*/
|
|
13
|
+
transpiled?: boolean;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
export interface ContractFunction {
|