@aztec/aztec 0.0.1-commit.b655e406 → 0.0.1-commit.fce3e4f
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/README.md +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +2 -2
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.js +9 -9
- 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 +9 -7
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +35 -2
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_blob_sink.d.ts +1 -1
- package/dest/cli/cmds/start_bot.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.js +2 -2
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_node.d.ts +1 -1
- package/dest/cli/cmds/start_txe.d.ts +1 -1
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +1 -1
- package/dest/cli/release_version.d.ts +1 -1
- package/dest/cli/util.d.ts +4 -4
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +1 -1
- package/dest/examples/util.d.ts +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/banana_fpc.d.ts +10 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/index.js +1 -1
- package/dest/{sandbox/sandbox.d.ts → local-network/local-network.d.ts} +14 -14
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/{sandbox/sandbox.js → local-network/local-network.js} +8 -8
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +3 -3
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +16 -14
- package/dest/testing/cheat_codes.d.ts +1 -3
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/index.d.ts +1 -1
- package/package.json +39 -37
- package/scripts/aztec.sh +56 -0
- package/scripts/compile.sh +44 -0
- package/scripts/extract_function.js +47 -0
- package/scripts/flamegraph.sh +59 -0
- package/scripts/init.sh +35 -0
- package/scripts/new.sh +59 -0
- package/scripts/setup_project.sh +31 -0
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +9 -9
- package/src/cli/aztec_start_options.ts +9 -6
- package/src/cli/cli.ts +38 -5
- package/src/cli/cmds/start_node.ts +2 -2
- package/src/examples/token.ts +1 -1
- package/src/index.ts +2 -2
- package/src/{sandbox → local-network}/index.ts +1 -1
- package/src/{sandbox/sandbox.ts → local-network/local-network.ts} +13 -13
- package/src/{sandbox → local-network}/sponsored_fpc.ts +3 -2
- package/src/testing/anvil_test_watcher.ts +15 -13
- package/dest/sandbox/banana_fpc.d.ts +0 -10
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -4
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fpc.d.ts +0 -4
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- /package/dest/{sandbox → local-network}/banana_fpc.js +0 -0
- /package/dest/{sandbox → local-network}/sponsored_fpc.js +0 -0
- /package/src/{sandbox → local-network}/banana_fpc.ts +0 -0
|
@@ -12,7 +12,7 @@ import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
|
12
12
|
export declare class AnvilTestWatcher {
|
|
13
13
|
private cheatcodes;
|
|
14
14
|
private dateProvider?;
|
|
15
|
-
private
|
|
15
|
+
private isLocalNetwork;
|
|
16
16
|
private rollup;
|
|
17
17
|
private rollupCheatCodes;
|
|
18
18
|
private l2SlotDuration;
|
|
@@ -23,7 +23,7 @@ export declare class AnvilTestWatcher {
|
|
|
23
23
|
private isMarkingAsProven;
|
|
24
24
|
constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined);
|
|
25
25
|
setIsMarkingAsProven(isMarkingAsProven: boolean): void;
|
|
26
|
-
|
|
26
|
+
setisLocalNetwork(isLocalNetwork: boolean): void;
|
|
27
27
|
start(): Promise<void>;
|
|
28
28
|
stop(): Promise<void>;
|
|
29
29
|
trigger(): Promise<void>;
|
|
@@ -31,4 +31,4 @@ export declare class AnvilTestWatcher {
|
|
|
31
31
|
syncDateProviderToL1IfBehind(): Promise<void>;
|
|
32
32
|
warpTimeIfNeeded(): Promise<void>;
|
|
33
33
|
}
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDbEQsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUV2RSxPQUFPLEtBQUssRUFBRSxVQUF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
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
5
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
@@ -12,7 +13,7 @@ import { getAddress, getContract } from 'viem';
|
|
|
12
13
|
*/ export class AnvilTestWatcher {
|
|
13
14
|
cheatcodes;
|
|
14
15
|
dateProvider;
|
|
15
|
-
|
|
16
|
+
isLocalNetwork;
|
|
16
17
|
rollup;
|
|
17
18
|
rollupCheatCodes;
|
|
18
19
|
l2SlotDuration;
|
|
@@ -24,7 +25,7 @@ import { getAddress, getContract } from 'viem';
|
|
|
24
25
|
constructor(cheatcodes, rollupAddress, l1Client, dateProvider){
|
|
25
26
|
this.cheatcodes = cheatcodes;
|
|
26
27
|
this.dateProvider = dateProvider;
|
|
27
|
-
this.
|
|
28
|
+
this.isLocalNetwork = false;
|
|
28
29
|
this.logger = createLogger(`aztecjs:utils:watcher`);
|
|
29
30
|
this.isMarkingAsProven = true;
|
|
30
31
|
this.rollup = getContract({
|
|
@@ -41,8 +42,8 @@ import { getAddress, getContract } from 'viem';
|
|
|
41
42
|
this.logger.warn(`Watcher is now ${isMarkingAsProven ? 'marking' : 'not marking'} blocks as proven`);
|
|
42
43
|
this.isMarkingAsProven = isMarkingAsProven;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
this.
|
|
45
|
+
setisLocalNetwork(isLocalNetwork) {
|
|
46
|
+
this.isLocalNetwork = isLocalNetwork;
|
|
46
47
|
}
|
|
47
48
|
async start() {
|
|
48
49
|
if (this.filledRunningPromise) {
|
|
@@ -52,7 +53,7 @@ import { getAddress, getContract } from 'viem';
|
|
|
52
53
|
this.l2SlotDuration = config.slotDuration;
|
|
53
54
|
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
54
55
|
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
55
|
-
// the
|
|
56
|
+
// the local network and tests don't break because time is frozen and we never get to
|
|
56
57
|
// the next slot.
|
|
57
58
|
const isAutoMining = await this.cheatcodes.isAutoMining();
|
|
58
59
|
if (isAutoMining) {
|
|
@@ -84,7 +85,7 @@ import { getAddress, getContract } from 'viem';
|
|
|
84
85
|
await this.rollupCheatCodes.markAsProven();
|
|
85
86
|
}
|
|
86
87
|
async syncDateProviderToL1IfBehind() {
|
|
87
|
-
// this doesn't apply to the
|
|
88
|
+
// this doesn't apply to the local network, because we don't have a date provider in the local network
|
|
88
89
|
if (!this.dateProvider) {
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
@@ -100,15 +101,16 @@ import { getAddress, getContract } from 'viem';
|
|
|
100
101
|
}
|
|
101
102
|
async warpTimeIfNeeded() {
|
|
102
103
|
try {
|
|
103
|
-
const currentSlot = await this.rollup.read.getCurrentSlot();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
104
|
+
const currentSlot = SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
105
|
+
const pendingCheckpointNumber = BigInt(await this.rollup.read.getPendingCheckpointNumber());
|
|
106
|
+
const checkpointLog = await this.rollup.read.getCheckpoint([
|
|
107
|
+
pendingCheckpointNumber
|
|
107
108
|
]);
|
|
109
|
+
const nextSlot = SlotNumber(currentSlot + 1);
|
|
108
110
|
const nextSlotTimestamp = Number(await this.rollup.read.getTimestampForSlot([
|
|
109
|
-
|
|
111
|
+
BigInt(nextSlot)
|
|
110
112
|
]));
|
|
111
|
-
if (currentSlot ===
|
|
113
|
+
if (BigInt(currentSlot) === checkpointLog.slotNumber) {
|
|
112
114
|
// We should jump to the next slot
|
|
113
115
|
try {
|
|
114
116
|
await this.cheatcodes.warp(nextSlotTimestamp, {
|
|
@@ -120,8 +122,8 @@ import { getAddress, getContract } from 'viem';
|
|
|
120
122
|
this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
|
|
121
123
|
return;
|
|
122
124
|
}
|
|
123
|
-
// If we are not in
|
|
124
|
-
if (!this.
|
|
125
|
+
// If we are not in local network, we don't need to warp time
|
|
126
|
+
if (!this.isLocalNetwork) {
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
129
|
const currentTimestamp = this.dateProvider?.now() ?? Date.now();
|
|
@@ -9,9 +9,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
9
9
|
* codes, please consider whether it makes sense to just introduce new utils in your tests instead.
|
|
10
10
|
*/
|
|
11
11
|
export declare class CheatCodes {
|
|
12
|
-
/** Cheat codes for L1.*/
|
|
13
12
|
eth: EthCheatCodes;
|
|
14
|
-
/** Cheat codes for the Aztec Rollup contract on L1. */
|
|
15
13
|
rollup: RollupCheatCodes;
|
|
16
14
|
constructor(
|
|
17
15
|
/** Cheat codes for L1.*/
|
|
@@ -40,4 +38,4 @@ export declare class CheatCodes {
|
|
|
40
38
|
*/
|
|
41
39
|
warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
|
|
42
40
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTU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oot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,UAAU;IAGZ,GAAG,EAAE,aAAa;IAElB,MAAM,EAAE,gBAAgB;IAJjC;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,iBAuB5G;IAED;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAIrG;CACF"}
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
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
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUMifQ==
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.fce3e4f",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
7
7
|
"./testing": "./dest/testing/index.js"
|
|
8
8
|
},
|
|
9
|
-
"bin": "./
|
|
9
|
+
"bin": "./scripts/aztec.sh",
|
|
10
10
|
"typedocOptions": {
|
|
11
11
|
"entryPoints": [
|
|
12
12
|
"./src/index.ts"
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"tsconfig": "./tsconfig.json"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "yarn clean &&
|
|
18
|
+
"build": "yarn clean && tsgo -b",
|
|
19
19
|
"start": "node --no-warnings ./dest/bin",
|
|
20
20
|
"start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin",
|
|
21
|
-
"start:
|
|
21
|
+
"start:local-network": "ETHEREUM_HOSTS=http://0.0.0.0:8545/ && yarn start start --local-network",
|
|
22
22
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
23
|
-
"build:dev": "
|
|
23
|
+
"build:dev": "tsgo -b --watch",
|
|
24
24
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
25
25
|
"run:example:token": "LOG_LEVEL='verbose' node ./dest/examples/token.js"
|
|
26
26
|
},
|
|
@@ -28,47 +28,48 @@
|
|
|
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-sink": "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/stdlib": "0.0.1-commit.
|
|
58
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
59
|
-
"@aztec/test-wallet": "0.0.1-commit.
|
|
60
|
-
"@aztec/txe": "0.0.1-commit.
|
|
61
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.fce3e4f",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.fce3e4f",
|
|
33
|
+
"@aztec/aztec-faucet": "0.0.1-commit.fce3e4f",
|
|
34
|
+
"@aztec/aztec-node": "0.0.1-commit.fce3e4f",
|
|
35
|
+
"@aztec/aztec.js": "0.0.1-commit.fce3e4f",
|
|
36
|
+
"@aztec/bb-prover": "0.0.1-commit.fce3e4f",
|
|
37
|
+
"@aztec/bb.js": "0.0.1-commit.fce3e4f",
|
|
38
|
+
"@aztec/blob-sink": "0.0.1-commit.fce3e4f",
|
|
39
|
+
"@aztec/bot": "0.0.1-commit.fce3e4f",
|
|
40
|
+
"@aztec/builder": "0.0.1-commit.fce3e4f",
|
|
41
|
+
"@aztec/cli": "0.0.1-commit.fce3e4f",
|
|
42
|
+
"@aztec/constants": "0.0.1-commit.fce3e4f",
|
|
43
|
+
"@aztec/entrypoints": "0.0.1-commit.fce3e4f",
|
|
44
|
+
"@aztec/ethereum": "0.0.1-commit.fce3e4f",
|
|
45
|
+
"@aztec/foundation": "0.0.1-commit.fce3e4f",
|
|
46
|
+
"@aztec/kv-store": "0.0.1-commit.fce3e4f",
|
|
47
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fce3e4f",
|
|
48
|
+
"@aztec/node-lib": "0.0.1-commit.fce3e4f",
|
|
49
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.fce3e4f",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.fce3e4f",
|
|
51
|
+
"@aztec/p2p": "0.0.1-commit.fce3e4f",
|
|
52
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.fce3e4f",
|
|
53
|
+
"@aztec/protocol-contracts": "0.0.1-commit.fce3e4f",
|
|
54
|
+
"@aztec/prover-client": "0.0.1-commit.fce3e4f",
|
|
55
|
+
"@aztec/prover-node": "0.0.1-commit.fce3e4f",
|
|
56
|
+
"@aztec/pxe": "0.0.1-commit.fce3e4f",
|
|
57
|
+
"@aztec/stdlib": "0.0.1-commit.fce3e4f",
|
|
58
|
+
"@aztec/telemetry-client": "0.0.1-commit.fce3e4f",
|
|
59
|
+
"@aztec/test-wallet": "0.0.1-commit.fce3e4f",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.fce3e4f",
|
|
61
|
+
"@aztec/world-state": "0.0.1-commit.fce3e4f",
|
|
62
62
|
"@types/chalk": "^2.2.0",
|
|
63
63
|
"abitype": "^0.8.11",
|
|
64
64
|
"chalk": "^5.3.0",
|
|
65
65
|
"commander": "^12.1.0",
|
|
66
66
|
"koa": "^2.16.1",
|
|
67
67
|
"koa-router": "^13.1.1",
|
|
68
|
-
"viem": "npm:@
|
|
68
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
69
69
|
},
|
|
70
70
|
"files": [
|
|
71
71
|
"dest",
|
|
72
|
+
"scripts",
|
|
72
73
|
"src",
|
|
73
74
|
"!*.test.*"
|
|
74
75
|
],
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"@jest/globals": "^30.0.0",
|
|
78
79
|
"@types/jest": "^30.0.0",
|
|
79
80
|
"@types/koa": "^2.15.0",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
80
82
|
"jest": "^30.0.0",
|
|
81
83
|
"ts-node": "^10.9.1",
|
|
82
84
|
"typescript": "^5.3.3"
|
package/scripts/aztec.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
script_dir="$(dirname "$(realpath "$0")")"
|
|
5
|
+
|
|
6
|
+
function aztec {
|
|
7
|
+
exec node --no-warnings $script_dir/../dest/bin/index.js "$@"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
cmd=${1:-}
|
|
11
|
+
[ -n "$cmd" ] && shift
|
|
12
|
+
|
|
13
|
+
export AZTEC_SHELL_WRAPPER=1
|
|
14
|
+
|
|
15
|
+
case $cmd in
|
|
16
|
+
test)
|
|
17
|
+
export LOG_LEVEL="${LOG_LEVEL:-info}"
|
|
18
|
+
aztec start --txe --port 8081 &
|
|
19
|
+
server_pid=$!
|
|
20
|
+
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
21
|
+
while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
|
|
22
|
+
export NARGO_FOREIGN_CALL_TIMEOUT=300000
|
|
23
|
+
nargo test --silence-warnings --pedantic-solving --oracle-resolver http://127.0.0.1:8081 "$@"
|
|
24
|
+
;;
|
|
25
|
+
start)
|
|
26
|
+
if [ "${1:-}" == "--local-network" ]; then
|
|
27
|
+
# TODO: Can these just be set in TS?
|
|
28
|
+
export ARCHIVER_POLLING_INTERVAL_MS=500
|
|
29
|
+
export P2P_BLOCK_CHECK_INTERVAL_MS=500
|
|
30
|
+
export SEQ_TX_POLLING_INTERVAL_MS=500
|
|
31
|
+
export WS_BLOCK_CHECK_INTERVAL_MS=500
|
|
32
|
+
export ARCHIVER_VIEM_POLLING_INTERVAL_MS=500
|
|
33
|
+
export TEST_ACCOUNTS=${TEST_ACCOUNTS:-true}
|
|
34
|
+
export LOG_LEVEL=${LOG_LEVEL:-info;silent:sequencer;verbose:debug_log}
|
|
35
|
+
export DEPLOY_AZTEC_CONTRACTS_SALT=${DEPLOY_AZTEC_CONTRACTS_SALT:-$RANDOM}
|
|
36
|
+
|
|
37
|
+
ANVIL_PORT=${ANVIL_PORT:-8545}
|
|
38
|
+
|
|
39
|
+
export L1_CHAIN_ID=${L1_CHAIN_ID:-31337}
|
|
40
|
+
export ETHEREUM_HOSTS=${ETHEREUM_HOSTS:-"http://127.0.0.1:${ANVIL_PORT}"}
|
|
41
|
+
|
|
42
|
+
anvil --version
|
|
43
|
+
anvil --silent &
|
|
44
|
+
anvil_pid=$!
|
|
45
|
+
trap 'kill $anvil_pid &>/dev/null' EXIT
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
aztec start "$@"
|
|
49
|
+
;;
|
|
50
|
+
compile|new|init|flamegraph)
|
|
51
|
+
$script_dir/${cmd}.sh "$@"
|
|
52
|
+
;;
|
|
53
|
+
*)
|
|
54
|
+
aztec $cmd "$@"
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
BB=${BB:-bb}
|
|
6
|
+
|
|
7
|
+
# If help is requested, show Aztec-specific info then run nargo compile help and then exit in order to not trigger
|
|
8
|
+
# transpilation
|
|
9
|
+
for arg in "$@"; do
|
|
10
|
+
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
|
11
|
+
cat << 'EOF'
|
|
12
|
+
Aztec Compile - Compile Aztec Noir contracts
|
|
13
|
+
|
|
14
|
+
This command compiles Aztec Noir contracts using nargo and then automatically
|
|
15
|
+
postprocesses them to generate Aztec specific artifacts including:
|
|
16
|
+
- Transpiled contract artifacts
|
|
17
|
+
- Verification keys
|
|
18
|
+
|
|
19
|
+
The compiled contracts will be placed in the target/ directory by default.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
Underlying nargo compile options:
|
|
23
|
+
|
|
24
|
+
EOF
|
|
25
|
+
nargo compile --help
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
# Run nargo compile.
|
|
31
|
+
$NARGO compile "$@"
|
|
32
|
+
|
|
33
|
+
echo "Postprocessing contract..."
|
|
34
|
+
$BB aztec_process
|
|
35
|
+
|
|
36
|
+
# Strip internal prefixes from all compiled contract JSONs in target directory
|
|
37
|
+
# TODO: This should be part of bb aztec_process!
|
|
38
|
+
for json in target/*.json; do
|
|
39
|
+
temp_file="${json}.tmp"
|
|
40
|
+
jq '.functions |= map(.name |= sub("^__aztec_nr_internals__"; ""))' "$json" > "$temp_file"
|
|
41
|
+
mv "$temp_file" "$json"
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
echo "Compilation complete!"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
// Simple script to extract a contract function as a separate Noir artifact.
|
|
6
|
+
// We need to use this since the transpiling that we do on public functions make the contract artifacts
|
|
7
|
+
// unreadable by noir tooling, since they are no longer following the noir artifact format.
|
|
8
|
+
async function main() {
|
|
9
|
+
let [contractArtifactPath, functionName] = process.argv.slice(2);
|
|
10
|
+
if (!contractArtifactPath || !functionName) {
|
|
11
|
+
console.log('Usage: node extractFunctionAsNoirArtifact.js <contractArtifactPath> <functionName>');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const contractArtifact = JSON.parse(await fs.readFile(contractArtifactPath, 'utf8'));
|
|
16
|
+
const func = contractArtifact.functions.find(f => f.name === functionName);
|
|
17
|
+
if (!func) {
|
|
18
|
+
console.error(`Function ${functionName} not found in ${contractArtifactPath}`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const artifact = {
|
|
23
|
+
noir_version: contractArtifact.noir_version,
|
|
24
|
+
hash: 0,
|
|
25
|
+
abi: func.abi,
|
|
26
|
+
bytecode: func.bytecode,
|
|
27
|
+
debug_symbols: func.debug_symbols,
|
|
28
|
+
file_map: contractArtifact.file_map,
|
|
29
|
+
expression_width: {
|
|
30
|
+
Bounded: {
|
|
31
|
+
width: 4,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const outputDir = path.dirname(contractArtifactPath);
|
|
37
|
+
const outputName = path.basename(contractArtifactPath, '.json') + `-${functionName}.json`;
|
|
38
|
+
|
|
39
|
+
const outPath = path.join(outputDir, outputName);
|
|
40
|
+
|
|
41
|
+
await fs.writeFile(outPath, JSON.stringify(artifact, null, 2));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main().catch(err => {
|
|
45
|
+
console.error(err);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# If first arg is -h or --help, print usage.
|
|
5
|
+
if [ $# -lt 2 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
|
6
|
+
cat << 'EOF'
|
|
7
|
+
Aztec Flamegraph - Generate a gate count flamegraph for an aztec contract function.
|
|
8
|
+
|
|
9
|
+
Usage: aztec flamegraph <contract_artifact> <function>
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
-h, --help Print help
|
|
13
|
+
|
|
14
|
+
Will output an svg at <artifact_path>/<contract>-<function>-flamegraph.svg.
|
|
15
|
+
You can open it in your browser to view it.
|
|
16
|
+
|
|
17
|
+
EOF
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
cleanup() {
|
|
22
|
+
set +e
|
|
23
|
+
if [ -f "$function_artifact" ]; then
|
|
24
|
+
rm -f "$function_artifact"
|
|
25
|
+
fi
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
trap cleanup EXIT
|
|
29
|
+
|
|
30
|
+
# Get the directory of the script
|
|
31
|
+
script_dir=$(realpath $(dirname $0))
|
|
32
|
+
|
|
33
|
+
PROFILER=${PROFILER_PATH:-noir-profiler}
|
|
34
|
+
BB=${BB:-bb}
|
|
35
|
+
|
|
36
|
+
# first console arg is contract name in camel case or path to contract artifact
|
|
37
|
+
contract=$1
|
|
38
|
+
|
|
39
|
+
# second console arg is the contract function
|
|
40
|
+
function=$2
|
|
41
|
+
|
|
42
|
+
if [ ! -f "$contract" ]; then
|
|
43
|
+
echo "Error: Contract artifact not found at: $contract"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
artifact_path=$contract
|
|
47
|
+
function_artifact="${artifact_path%%.json}-${function}.json"
|
|
48
|
+
output_dir=$(dirname "$artifact_path")
|
|
49
|
+
|
|
50
|
+
# Extract artifact for the specific function.
|
|
51
|
+
node $script_dir/extract_function.js "$artifact_path" $function
|
|
52
|
+
|
|
53
|
+
# Generate the flamegraph
|
|
54
|
+
$PROFILER gates --artifact-path "$function_artifact" --backend-path "$BB" --backend-gates-command "gates" --output "$output_dir" --scheme chonk --include_gates_per_opcode
|
|
55
|
+
|
|
56
|
+
# Save as $artifact_name-$function-flamegraph.svg
|
|
57
|
+
output_file="${function_artifact%%.json}-flamegraph.svg"
|
|
58
|
+
mv "$output_dir/__aztec_nr_internals__${function}_gates.svg" "$output_file"
|
|
59
|
+
echo "Flamegraph generated at: $output_file"
|
package/scripts/init.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
script_path=$(realpath $(dirname "$0"))
|
|
6
|
+
|
|
7
|
+
for arg in "$@"; do
|
|
8
|
+
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
|
9
|
+
cat << 'EOF'
|
|
10
|
+
Aztec Init - Create a new Aztec Noir project in the current directory
|
|
11
|
+
|
|
12
|
+
Usage: aztec init [OPTIONS]
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
--name <NAME> Name of the package [default: current directory name]
|
|
16
|
+
--lib Use a library template
|
|
17
|
+
-h, --help Print help
|
|
18
|
+
|
|
19
|
+
This command creates a new Aztec Noir project in the current directory using nargo
|
|
20
|
+
and automatically adds the Aztec.nr dependency to your Nargo.toml file.
|
|
21
|
+
|
|
22
|
+
EOF
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
if [ "$arg" == "--lib" ]; then
|
|
26
|
+
is_contract=0
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
echo "Initializing Noir project..."
|
|
31
|
+
$NARGO init "$@"
|
|
32
|
+
|
|
33
|
+
if [ "${is_contract:-1}" -eq 1 ]; then
|
|
34
|
+
$script_path/setup_project.sh
|
|
35
|
+
fi
|
package/scripts/new.sh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
script_path=$(realpath $(dirname "$0"))
|
|
6
|
+
|
|
7
|
+
type_arg="--contract"
|
|
8
|
+
|
|
9
|
+
while [[ $# -gt 0 ]]; do
|
|
10
|
+
case $1 in
|
|
11
|
+
--help|-h)
|
|
12
|
+
cat << 'EOF'
|
|
13
|
+
Aztec New - Create a new Aztec Noir project in a new directory
|
|
14
|
+
|
|
15
|
+
Usage: aztec new [OPTIONS] <PATH>
|
|
16
|
+
|
|
17
|
+
Arguments:
|
|
18
|
+
<PATH> The path to save the new project
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
--name <NAME> Name of the package [default: package directory name]
|
|
22
|
+
--lib Create a library template instead of a contract
|
|
23
|
+
-h, --help Print help
|
|
24
|
+
|
|
25
|
+
This command creates a new Aztec Noir project using nargo and automatically
|
|
26
|
+
adds the Aztec.nr dependency to your Nargo.toml file.
|
|
27
|
+
EOF
|
|
28
|
+
exit 0
|
|
29
|
+
;;
|
|
30
|
+
--lib)
|
|
31
|
+
type_arg="--lib"
|
|
32
|
+
shift
|
|
33
|
+
;;
|
|
34
|
+
--name)
|
|
35
|
+
name_arg="--name $2"
|
|
36
|
+
shift 2
|
|
37
|
+
;;
|
|
38
|
+
*)
|
|
39
|
+
project_path=$1
|
|
40
|
+
shift
|
|
41
|
+
break
|
|
42
|
+
;;
|
|
43
|
+
esac
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
if [ -z "$project_path" ]; then
|
|
47
|
+
echo "Error: PATH argument is required"
|
|
48
|
+
echo "Usage: aztec new [OPTIONS] <PATH>"
|
|
49
|
+
echo "Run 'aztec new --help' for more information"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
echo "Creating new Noir project at $project_path..."
|
|
54
|
+
$NARGO new $type_arg ${name_arg:-} $project_path
|
|
55
|
+
|
|
56
|
+
if [ "$type_arg" == "--contract" ]; then
|
|
57
|
+
cd $project_path
|
|
58
|
+
$script_path/setup_project.sh
|
|
59
|
+
fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Get the actual aztec version for the git tag.
|
|
5
|
+
AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
|
|
6
|
+
NARGO_TOML_PATH="Nargo.toml"
|
|
7
|
+
MAIN_NR_PATH="src/main.nr"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$NARGO_TOML_PATH" ]; then
|
|
10
|
+
>&2 echo "Warning: Could not find Nargo.toml at $NARGO_TOML_PATH to add aztec dependency"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if [ ! -f "$MAIN_NR_PATH" ]; then
|
|
15
|
+
>&2 echo "Warning: Could not find main.nr at $MAIN_NR_PATH"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Add aztec dependency to Nargo.toml
|
|
20
|
+
echo "" >> "$NARGO_TOML_PATH"
|
|
21
|
+
echo "aztec = { git=\"https://github.com/AztecProtocol/aztec-nr\", tag=\"v${AZTEC_VERSION}\", directory=\"aztec\" }" >> "$NARGO_TOML_PATH"
|
|
22
|
+
echo "Added aztec dependency (v${AZTEC_VERSION}) to Nargo.toml"
|
|
23
|
+
|
|
24
|
+
# Replace the contents of main.nr with the Aztec contract template
|
|
25
|
+
cat > "$MAIN_NR_PATH" << 'EOF'
|
|
26
|
+
use aztec::macros::aztec;
|
|
27
|
+
|
|
28
|
+
#[aztec]
|
|
29
|
+
contract Main {}
|
|
30
|
+
EOF
|
|
31
|
+
echo "Created main.nr with Aztec contract template"
|
package/src/bin/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
import { injectCommands as injectBuilderCommands } from '@aztec/builder';
|
|
4
4
|
import { injectCommands as injectAztecNodeCommands } from '@aztec/cli/aztec_node';
|
|
5
|
-
import {
|
|
5
|
+
import { enrichEnvironmentWithChainName, enrichEnvironmentWithNetworkConfig } from '@aztec/cli/config';
|
|
6
6
|
import { injectCommands as injectContractCommands } from '@aztec/cli/contracts';
|
|
7
7
|
import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infrastructure';
|
|
8
8
|
import { injectCommands as injectL1Commands } from '@aztec/cli/l1';
|
|
@@ -40,7 +40,7 @@ async function main() {
|
|
|
40
40
|
|
|
41
41
|
const networkName = getActiveNetworkName(networkValue);
|
|
42
42
|
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
43
|
-
|
|
43
|
+
enrichEnvironmentWithChainName(networkName);
|
|
44
44
|
|
|
45
45
|
const cliVersion = getCliVersion();
|
|
46
46
|
let program = new Command('aztec');
|