@aztec/cli 2.1.0-rc.2 → 2.1.0-rc.20
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/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +0 -18
- package/dest/config/chain_l2_config.d.ts +2 -3
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +4 -23
- package/package.json +24 -24
- package/src/cmds/l1/index.ts +0 -32
- package/src/config/chain_l2_config.ts +5 -30
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -216
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/src/cmds/devnet/bootstrap_network.ts +0 -321
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAkf/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -194,23 +194,5 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
194
194
|
const { advanceEpoch } = await import('./advance_epoch.js');
|
|
195
195
|
await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
|
|
196
196
|
});
|
|
197
|
-
program.command('prover-stats', {
|
|
198
|
-
hidden: true
|
|
199
|
-
}).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n).option('--end-block <number>', 'The last L1 block number to query', parseBigint).option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n).option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint).option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)').option('--node-url <string>', 'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)').option('--raw-logs', 'Output raw logs instead of aggregated stats').action(async (options)=>{
|
|
200
|
-
const { proverStats } = await import('./prover_stats.js');
|
|
201
|
-
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } = options;
|
|
202
|
-
await proverStats({
|
|
203
|
-
l1RpcUrls,
|
|
204
|
-
chainId,
|
|
205
|
-
l1RollupAddress,
|
|
206
|
-
startBlock,
|
|
207
|
-
endBlock,
|
|
208
|
-
batchSize,
|
|
209
|
-
nodeUrl,
|
|
210
|
-
provingTimeout,
|
|
211
|
-
rawLogs,
|
|
212
|
-
log
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
197
|
return program;
|
|
216
198
|
}
|
|
@@ -30,7 +30,6 @@ export declare const stagingIgnitionL2ChainConfig: L2ChainConfig;
|
|
|
30
30
|
export declare const stagingPublicL2ChainConfig: L2ChainConfig;
|
|
31
31
|
export declare const testnetL2ChainConfig: L2ChainConfig;
|
|
32
32
|
export declare const ignitionL2ChainConfig: L2ChainConfig;
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
|
|
33
|
+
export declare function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined;
|
|
34
|
+
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): void;
|
|
36
35
|
//# sourceMappingURL=chain_l2_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAYrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,GAC5C,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,uBAAuB,CAAC,GAAG;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAIpC,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAGhC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA+CJ,eAAO,MAAM,4BAA4B,EAAE,aA+E1C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAmDxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAsDlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aA+EnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,SAAS,CAYrF;AAMD,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,YAAY,QA2FzE"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import path
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
|
|
5
5
|
type: 'json'
|
|
6
6
|
};
|
|
7
|
-
import { cachedFetch } from './cached_fetch.js';
|
|
8
7
|
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
9
8
|
const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
|
|
10
9
|
const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
|
|
@@ -257,16 +256,7 @@ export const ignitionL2ChainConfig = {
|
|
|
257
256
|
slashExecuteRoundsLookBack: 4,
|
|
258
257
|
...DefaultNetworkDBMapSizeConfig
|
|
259
258
|
};
|
|
260
|
-
|
|
261
|
-
export async function getBootnodes(networkName, cacheDir) {
|
|
262
|
-
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
263
|
-
const data = await cachedFetch(url, {
|
|
264
|
-
cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
|
|
265
|
-
cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined
|
|
266
|
-
});
|
|
267
|
-
return data?.bootnodes;
|
|
268
|
-
}
|
|
269
|
-
export async function getL2ChainConfig(networkName, cacheDir) {
|
|
259
|
+
export function getL2ChainConfig(networkName) {
|
|
270
260
|
let config;
|
|
271
261
|
if (networkName === 'staging-public') {
|
|
272
262
|
config = {
|
|
@@ -285,26 +275,17 @@ export async function getL2ChainConfig(networkName, cacheDir) {
|
|
|
285
275
|
...ignitionL2ChainConfig
|
|
286
276
|
};
|
|
287
277
|
}
|
|
288
|
-
if (!config) {
|
|
289
|
-
return undefined;
|
|
290
|
-
}
|
|
291
|
-
// If the bootnodes are not set, get them from the network
|
|
292
|
-
const bootnodeKey = 'BOOTSTRAP_NODES';
|
|
293
|
-
if (!process.env[bootnodeKey]) {
|
|
294
|
-
config.p2pBootstrapNodes = await getBootnodes(networkName, cacheDir);
|
|
295
|
-
}
|
|
296
278
|
return config;
|
|
297
279
|
}
|
|
298
280
|
function getDefaultDataDir(networkName) {
|
|
299
281
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
300
282
|
}
|
|
301
|
-
export
|
|
283
|
+
export function enrichEnvironmentWithChainConfig(networkName) {
|
|
302
284
|
if (networkName === 'local') {
|
|
303
285
|
return;
|
|
304
286
|
}
|
|
305
287
|
enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
|
|
306
|
-
const
|
|
307
|
-
const config = await getL2ChainConfig(networkName, cacheDir);
|
|
288
|
+
const config = getL2ChainConfig(networkName);
|
|
308
289
|
if (!config) {
|
|
309
290
|
throw new Error(`Unknown network name: ${networkName}`);
|
|
310
291
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/archiver": "2.1.0-rc.
|
|
74
|
-
"@aztec/aztec.js": "2.1.0-rc.
|
|
75
|
-
"@aztec/constants": "2.1.0-rc.
|
|
76
|
-
"@aztec/entrypoints": "2.1.0-rc.
|
|
77
|
-
"@aztec/ethereum": "2.1.0-rc.
|
|
78
|
-
"@aztec/foundation": "2.1.0-rc.
|
|
79
|
-
"@aztec/l1-artifacts": "2.1.0-rc.
|
|
80
|
-
"@aztec/node-lib": "2.1.0-rc.
|
|
81
|
-
"@aztec/p2p": "2.1.0-rc.
|
|
82
|
-
"@aztec/stdlib": "2.1.0-rc.
|
|
83
|
-
"@aztec/world-state": "2.1.0-rc.
|
|
73
|
+
"@aztec/archiver": "2.1.0-rc.20",
|
|
74
|
+
"@aztec/aztec.js": "2.1.0-rc.20",
|
|
75
|
+
"@aztec/constants": "2.1.0-rc.20",
|
|
76
|
+
"@aztec/entrypoints": "2.1.0-rc.20",
|
|
77
|
+
"@aztec/ethereum": "2.1.0-rc.20",
|
|
78
|
+
"@aztec/foundation": "2.1.0-rc.20",
|
|
79
|
+
"@aztec/l1-artifacts": "2.1.0-rc.20",
|
|
80
|
+
"@aztec/node-lib": "2.1.0-rc.20",
|
|
81
|
+
"@aztec/p2p": "2.1.0-rc.20",
|
|
82
|
+
"@aztec/stdlib": "2.1.0-rc.20",
|
|
83
|
+
"@aztec/world-state": "2.1.0-rc.20",
|
|
84
84
|
"@iarna/toml": "^2.2.5",
|
|
85
85
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
86
86
|
"commander": "^12.1.0",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"semver": "^7.5.4",
|
|
90
90
|
"source-map-support": "^0.5.21",
|
|
91
91
|
"tslib": "^2.4.0",
|
|
92
|
-
"viem": "2.
|
|
92
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@aztec/accounts": "2.1.0-rc.
|
|
96
|
-
"@aztec/protocol-contracts": "2.1.0-rc.
|
|
95
|
+
"@aztec/accounts": "2.1.0-rc.20",
|
|
96
|
+
"@aztec/protocol-contracts": "2.1.0-rc.20",
|
|
97
97
|
"@jest/globals": "^30.0.0",
|
|
98
98
|
"@types/jest": "^30.0.0",
|
|
99
99
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -109,15 +109,15 @@
|
|
|
109
109
|
"typescript": "^5.3.3"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
|
-
"@aztec/accounts": "2.1.0-rc.
|
|
113
|
-
"@aztec/bb-prover": "2.1.0-rc.
|
|
114
|
-
"@aztec/ethereum": "2.1.0-rc.
|
|
115
|
-
"@aztec/l1-artifacts": "2.1.0-rc.
|
|
116
|
-
"@aztec/noir-contracts.js": "2.1.0-rc.
|
|
117
|
-
"@aztec/noir-protocol-circuits-types": "2.1.0-rc.
|
|
118
|
-
"@aztec/noir-test-contracts.js": "2.1.0-rc.
|
|
119
|
-
"@aztec/protocol-contracts": "2.1.0-rc.
|
|
120
|
-
"@aztec/stdlib": "2.1.0-rc.
|
|
112
|
+
"@aztec/accounts": "2.1.0-rc.20",
|
|
113
|
+
"@aztec/bb-prover": "2.1.0-rc.20",
|
|
114
|
+
"@aztec/ethereum": "2.1.0-rc.20",
|
|
115
|
+
"@aztec/l1-artifacts": "2.1.0-rc.20",
|
|
116
|
+
"@aztec/noir-contracts.js": "2.1.0-rc.20",
|
|
117
|
+
"@aztec/noir-protocol-circuits-types": "2.1.0-rc.20",
|
|
118
|
+
"@aztec/noir-test-contracts.js": "2.1.0-rc.20",
|
|
119
|
+
"@aztec/protocol-contracts": "2.1.0-rc.20",
|
|
120
|
+
"@aztec/stdlib": "2.1.0-rc.20"
|
|
121
121
|
},
|
|
122
122
|
"files": [
|
|
123
123
|
"dest",
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -525,37 +525,5 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
525
525
|
await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
|
|
526
526
|
});
|
|
527
527
|
|
|
528
|
-
program
|
|
529
|
-
.command('prover-stats', { hidden: true })
|
|
530
|
-
.addOption(l1RpcUrlsOption)
|
|
531
|
-
.addOption(l1ChainIdOption)
|
|
532
|
-
.option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n)
|
|
533
|
-
.option('--end-block <number>', 'The last L1 block number to query', parseBigint)
|
|
534
|
-
.option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n)
|
|
535
|
-
.option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint)
|
|
536
|
-
.option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)')
|
|
537
|
-
.option(
|
|
538
|
-
'--node-url <string>',
|
|
539
|
-
'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)',
|
|
540
|
-
)
|
|
541
|
-
.option('--raw-logs', 'Output raw logs instead of aggregated stats')
|
|
542
|
-
.action(async options => {
|
|
543
|
-
const { proverStats } = await import('./prover_stats.js');
|
|
544
|
-
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } =
|
|
545
|
-
options;
|
|
546
|
-
await proverStats({
|
|
547
|
-
l1RpcUrls,
|
|
548
|
-
chainId,
|
|
549
|
-
l1RollupAddress,
|
|
550
|
-
startBlock,
|
|
551
|
-
endBlock,
|
|
552
|
-
batchSize,
|
|
553
|
-
nodeUrl,
|
|
554
|
-
provingTimeout,
|
|
555
|
-
rawLogs,
|
|
556
|
-
log,
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
|
|
560
528
|
return program;
|
|
561
529
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NetworkNames } from '@aztec/foundation/config';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
5
5
|
import type { P2PConfig } from '@aztec/p2p/config';
|
|
6
6
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
|
|
8
|
-
import path
|
|
8
|
+
import path from 'path';
|
|
9
9
|
|
|
10
10
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
|
|
11
|
-
import { cachedFetch } from './cached_fetch.js';
|
|
12
11
|
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
13
12
|
|
|
14
13
|
const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
|
|
@@ -363,22 +362,7 @@ export const ignitionL2ChainConfig: L2ChainConfig = {
|
|
|
363
362
|
...DefaultNetworkDBMapSizeConfig,
|
|
364
363
|
};
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
|
|
369
|
-
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
370
|
-
const data = await cachedFetch(url, {
|
|
371
|
-
cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
|
|
372
|
-
cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined,
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
return data?.bootnodes;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
export async function getL2ChainConfig(
|
|
379
|
-
networkName: NetworkNames,
|
|
380
|
-
cacheDir?: string,
|
|
381
|
-
): Promise<L2ChainConfig | undefined> {
|
|
365
|
+
export function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined {
|
|
382
366
|
let config: L2ChainConfig | undefined;
|
|
383
367
|
if (networkName === 'staging-public') {
|
|
384
368
|
config = { ...stagingPublicL2ChainConfig };
|
|
@@ -389,14 +373,6 @@ export async function getL2ChainConfig(
|
|
|
389
373
|
} else if (networkName === 'ignition') {
|
|
390
374
|
config = { ...ignitionL2ChainConfig };
|
|
391
375
|
}
|
|
392
|
-
if (!config) {
|
|
393
|
-
return undefined;
|
|
394
|
-
}
|
|
395
|
-
// If the bootnodes are not set, get them from the network
|
|
396
|
-
const bootnodeKey: EnvVar = 'BOOTSTRAP_NODES';
|
|
397
|
-
if (!process.env[bootnodeKey]) {
|
|
398
|
-
config.p2pBootstrapNodes = await getBootnodes(networkName, cacheDir);
|
|
399
|
-
}
|
|
400
376
|
return config;
|
|
401
377
|
}
|
|
402
378
|
|
|
@@ -404,14 +380,13 @@ function getDefaultDataDir(networkName: NetworkNames): string {
|
|
|
404
380
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
405
381
|
}
|
|
406
382
|
|
|
407
|
-
export
|
|
383
|
+
export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
408
384
|
if (networkName === 'local') {
|
|
409
385
|
return;
|
|
410
386
|
}
|
|
411
387
|
|
|
412
388
|
enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
|
|
413
|
-
const
|
|
414
|
-
const config = await getL2ChainConfig(networkName, cacheDir);
|
|
389
|
+
const config = getL2ChainConfig(networkName);
|
|
415
390
|
|
|
416
391
|
if (!config) {
|
|
417
392
|
throw new Error(`Unknown network name: ${networkName}`);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
-
export declare function bootstrapNetwork(pxeUrl: string, l1Urls: string[], l1ChainId: string, l1PrivateKey: `0x${string}` | undefined, l1Mnemonic: string, addressIndex: number, json: boolean, log: LogFn, debugLog: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=bootstrap_network.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_network.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/bootstrap_network.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAqB3D,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,KAAK,MAAM,EAAE,GAAG,SAAS,EACvC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,MAAM,iBAkFjB"}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { getInitialTestAccountsManagers } from '@aztec/accounts/testing';
|
|
2
|
-
import { BatchCall, Fr, L1FeeJuicePortalManager, createCompatibleClient, retryUntil, waitForProven } from '@aztec/aztec.js';
|
|
3
|
-
import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
4
|
-
import { getContract } from 'viem';
|
|
5
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
6
|
-
const waitOpts = {
|
|
7
|
-
timeout: 120,
|
|
8
|
-
interval: 1
|
|
9
|
-
};
|
|
10
|
-
const provenWaitOpts = {
|
|
11
|
-
provenTimeout: 4800,
|
|
12
|
-
interval: 1
|
|
13
|
-
};
|
|
14
|
-
export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey, l1Mnemonic, addressIndex, json, log, debugLog) {
|
|
15
|
-
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
16
|
-
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
17
|
-
// so all we need to do is register them to our pxe.
|
|
18
|
-
const [accountManager] = await getInitialTestAccountsManagers(pxe);
|
|
19
|
-
await accountManager.register();
|
|
20
|
-
const wallet = await accountManager.getWallet();
|
|
21
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
22
|
-
const l1Client = createExtendedL1Client(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
|
|
23
|
-
mnemonicToAccount(l1Mnemonic, {
|
|
24
|
-
addressIndex
|
|
25
|
-
}), createEthereumChain(l1Urls, +l1ChainId).chainInfo);
|
|
26
|
-
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
27
|
-
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
28
|
-
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
29
|
-
const fpcAdmin = wallet.getAddress();
|
|
30
|
-
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
31
|
-
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
32
|
-
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
33
|
-
if (json) {
|
|
34
|
-
log(JSON.stringify({
|
|
35
|
-
devCoinL1: erc20Address.toString(),
|
|
36
|
-
devCoinPortalL1: portalAddress.toString(),
|
|
37
|
-
devCoin: {
|
|
38
|
-
address: token.address.toString(),
|
|
39
|
-
initHash: token.initHash.toString(),
|
|
40
|
-
salt: token.salt.toString()
|
|
41
|
-
},
|
|
42
|
-
devCoinBridge: {
|
|
43
|
-
address: bridge.address.toString(),
|
|
44
|
-
initHash: bridge.initHash.toString(),
|
|
45
|
-
salt: bridge.salt.toString()
|
|
46
|
-
},
|
|
47
|
-
devCoinFpc: {
|
|
48
|
-
address: fpc.address.toString(),
|
|
49
|
-
initHash: fpc.initHash.toString(),
|
|
50
|
-
salt: fpc.salt.toString()
|
|
51
|
-
},
|
|
52
|
-
counter: {
|
|
53
|
-
address: counter.address.toString(),
|
|
54
|
-
initHash: counter.initHash.toString(),
|
|
55
|
-
salt: counter.salt.toString()
|
|
56
|
-
}
|
|
57
|
-
}, null, 2));
|
|
58
|
-
} else {
|
|
59
|
-
log(`DevCoin L1: ${erc20Address}`);
|
|
60
|
-
log(`DevCoin L1 Portal: ${portalAddress}`);
|
|
61
|
-
log(`DevCoin L2: ${token.address}`);
|
|
62
|
-
log(`DevCoin L2 init hash: ${token.initHash}`);
|
|
63
|
-
log(`DevCoin L2 salt: ${token.salt}`);
|
|
64
|
-
log(`DevCoin L2 Bridge: ${bridge.address}`);
|
|
65
|
-
log(`DevCoin L2 Bridge init hash: ${bridge.initHash}`);
|
|
66
|
-
log(`DevCoin L2 Bridge salt: ${bridge.salt}`);
|
|
67
|
-
log(`DevCoin FPC: ${fpc.address}`);
|
|
68
|
-
log(`DevCoin FPC init hash: ${fpc.initHash}`);
|
|
69
|
-
log(`DevCoin FPC salt: ${fpc.salt}`);
|
|
70
|
-
log(`Counter: ${counter.address}`);
|
|
71
|
-
log(`Counter init hash: ${counter.initHash}`);
|
|
72
|
-
log(`Counter salt: ${counter.salt}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Step 1. Deploy the L1 contracts, but don't initialize
|
|
77
|
-
*/ async function deployERC20(l1Client) {
|
|
78
|
-
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
79
|
-
const erc20 = {
|
|
80
|
-
name: 'TestERC20',
|
|
81
|
-
contractAbi: TestERC20Abi,
|
|
82
|
-
contractBytecode: TestERC20Bytecode
|
|
83
|
-
};
|
|
84
|
-
const portal = {
|
|
85
|
-
name: 'TokenPortal',
|
|
86
|
-
contractAbi: TokenPortalAbi,
|
|
87
|
-
contractBytecode: TokenPortalBytecode
|
|
88
|
-
};
|
|
89
|
-
const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
|
|
90
|
-
'DevCoin',
|
|
91
|
-
'DEV',
|
|
92
|
-
l1Client.account.address
|
|
93
|
-
]);
|
|
94
|
-
const { address: portalAddress } = await deployL1Contract(l1Client, portal.contractAbi, portal.contractBytecode);
|
|
95
|
-
return {
|
|
96
|
-
erc20Address,
|
|
97
|
-
portalAddress
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Step 2. Deploy the L2 contracts
|
|
102
|
-
*/ async function deployToken(wallet, defaultAccountAddress, l1Portal) {
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
104
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
105
|
-
const { TokenContract } = await import('@aztec/noir-contracts.js/Token');
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
107
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
108
|
-
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
109
|
-
const devCoin = await TokenContract.deploy(wallet, defaultAccountAddress, 'DevCoin', 'DEV', 18).send({
|
|
110
|
-
from: defaultAccountAddress,
|
|
111
|
-
universalDeploy: true
|
|
112
|
-
}).deployed(waitOpts);
|
|
113
|
-
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal).send({
|
|
114
|
-
from: defaultAccountAddress,
|
|
115
|
-
universalDeploy: true
|
|
116
|
-
}).deployed(waitOpts);
|
|
117
|
-
await new BatchCall(wallet, [
|
|
118
|
-
devCoin.methods.set_minter(bridge.address, true),
|
|
119
|
-
devCoin.methods.set_admin(bridge.address)
|
|
120
|
-
]).send({
|
|
121
|
-
from: defaultAccountAddress
|
|
122
|
-
}).wait(waitOpts);
|
|
123
|
-
return {
|
|
124
|
-
token: {
|
|
125
|
-
address: devCoin.address,
|
|
126
|
-
initHash: devCoin.instance.initializationHash,
|
|
127
|
-
salt: devCoin.instance.salt
|
|
128
|
-
},
|
|
129
|
-
bridge: {
|
|
130
|
-
address: bridge.address,
|
|
131
|
-
initHash: bridge.instance.initializationHash,
|
|
132
|
-
salt: bridge.instance.salt
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Step 3. Initialize DevCoin's L1 portal
|
|
138
|
-
*/ async function initPortal(pxe, l1Client, erc20, portal, bridge) {
|
|
139
|
-
const { TokenPortalAbi } = await import('@aztec/l1-artifacts');
|
|
140
|
-
const { l1ContractAddresses: { registryAddress } } = await pxe.getNodeInfo();
|
|
141
|
-
const contract = getContract({
|
|
142
|
-
abi: TokenPortalAbi,
|
|
143
|
-
address: portal.toString(),
|
|
144
|
-
client: l1Client
|
|
145
|
-
});
|
|
146
|
-
const hash = await contract.write.initialize([
|
|
147
|
-
registryAddress.toString(),
|
|
148
|
-
erc20.toString(),
|
|
149
|
-
bridge.toString()
|
|
150
|
-
]);
|
|
151
|
-
await l1Client.waitForTransactionReceipt({
|
|
152
|
-
hash
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
async function deployFPC(wallet, defaultAccountAddress, tokenAddress, admin) {
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
157
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
158
|
-
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
159
|
-
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin).send({
|
|
160
|
-
from: defaultAccountAddress,
|
|
161
|
-
universalDeploy: true
|
|
162
|
-
}).deployed(waitOpts);
|
|
163
|
-
const info = {
|
|
164
|
-
address: fpc.address,
|
|
165
|
-
initHash: fpc.instance.initializationHash,
|
|
166
|
-
salt: fpc.instance.salt
|
|
167
|
-
};
|
|
168
|
-
return info;
|
|
169
|
-
}
|
|
170
|
-
async function deployCounter(wallet, defaultAccountAddress) {
|
|
171
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
172
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
173
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
174
|
-
const counter = await CounterContract.deploy(wallet, 1, defaultAccountAddress).send({
|
|
175
|
-
from: defaultAccountAddress,
|
|
176
|
-
universalDeploy: true
|
|
177
|
-
}).deployed(waitOpts);
|
|
178
|
-
const info = {
|
|
179
|
-
address: counter.address,
|
|
180
|
-
initHash: counter.instance.initializationHash,
|
|
181
|
-
salt: counter.instance.salt
|
|
182
|
-
};
|
|
183
|
-
return info;
|
|
184
|
-
}
|
|
185
|
-
// NOTE: Disabling for now in order to get devnet running
|
|
186
|
-
async function fundFPC(pxe, counterAddress, wallet, defaultAccountAddress, l1Client, fpcAddress, debugLog) {
|
|
187
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
188
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
189
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
191
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
192
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
193
|
-
const { protocolContractAddresses: { feeJuice } } = await wallet.getPXEInfo();
|
|
194
|
-
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
195
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Client, debugLog);
|
|
196
|
-
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, undefined, true);
|
|
197
|
-
await retryUntil(async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
198
|
-
const counter = await CounterContract.at(counterAddress, wallet);
|
|
199
|
-
debugLog.info('Incrementing Counter');
|
|
200
|
-
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
201
|
-
// advance the chain
|
|
202
|
-
await counter.methods.increment(wallet.getAddress()).send({
|
|
203
|
-
from: defaultAccountAddress
|
|
204
|
-
}).wait(waitOpts);
|
|
205
|
-
await counter.methods.increment(wallet.getAddress()).send({
|
|
206
|
-
from: defaultAccountAddress
|
|
207
|
-
}).wait(waitOpts);
|
|
208
|
-
debugLog.info('Claiming FPC');
|
|
209
|
-
const receipt = await feeJuiceContract.methods.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex).send({
|
|
210
|
-
from: defaultAccountAddress
|
|
211
|
-
}).wait({
|
|
212
|
-
...waitOpts
|
|
213
|
-
});
|
|
214
|
-
await waitForProven(pxe, receipt, provenWaitOpts);
|
|
215
|
-
debugLog.info('Finished claiming FPC');
|
|
216
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function dripFaucet(faucetUrl: string, asset: string, account: EthAddress, json: boolean, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=faucet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/faucet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
2
|
-
export async function dripFaucet(faucetUrl, asset, account, json, log) {
|
|
3
|
-
const url = new URL(`/drip/${account.toString()}`, faucetUrl);
|
|
4
|
-
url.searchParams.set('asset', asset);
|
|
5
|
-
const res = await fetch(url);
|
|
6
|
-
if (res.status === 200) {
|
|
7
|
-
if (json) {
|
|
8
|
-
log(prettyPrintJSON({
|
|
9
|
-
ok: true
|
|
10
|
-
}));
|
|
11
|
-
} else {
|
|
12
|
-
log(`Dripped ${asset} for ${account.toString()}`);
|
|
13
|
-
}
|
|
14
|
-
} else {
|
|
15
|
-
if (json) {
|
|
16
|
-
log(prettyPrintJSON({
|
|
17
|
-
ok: false
|
|
18
|
-
}));
|
|
19
|
-
} else if (res.status === 429) {
|
|
20
|
-
log(`Rate limited when dripping ${asset} for ${account.toString()}`);
|
|
21
|
-
} else {
|
|
22
|
-
log(`Failed to drip ${asset} for ${account.toString()}`);
|
|
23
|
-
}
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAqD/E"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
2
|
-
export function injectCommands(program, log, debugLogger) {
|
|
3
|
-
program.command('bootstrap-network').description('Bootstrap a new network').addOption(pxeOption).addOption(l1ChainIdOption).requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
|
|
4
|
-
ETHEREUM_HOSTS
|
|
5
|
-
]).option('--l1-private-key <string>', 'The private key to use for deployment', process.env.PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-ai, --address-index <number>', 'The address index to use when calculating an address', (arg)=>BigInt(arg), 0n).option('--json', 'Output the result as JSON').action(async (options)=>{
|
|
6
|
-
const { bootstrapNetwork } = await import('./bootstrap_network.js');
|
|
7
|
-
await bootstrapNetwork(options[pxeOption.attributeName()], options.l1RpcUrls, options[l1ChainIdOption.attributeName()], options.l1PrivateKey, options.mnemonic, options.addressIndex, options.json, log, debugLogger);
|
|
8
|
-
});
|
|
9
|
-
program.command('drip-faucet').description('Drip the faucet').requiredOption('-u, --faucet-url <string>', 'Url of the faucet', 'http://localhost:8082').requiredOption('-t, --token <string>', 'The asset to drip', 'eth').requiredOption('-a, --address <string>', 'The Ethereum address to drip to', parseEthereumAddress).option('--json', 'Output the result as JSON').action(async (options)=>{
|
|
10
|
-
const { dripFaucet } = await import('./faucet.js');
|
|
11
|
-
await dripFaucet(options.faucetUrl, options.token, options.address, options.json, log);
|
|
12
|
-
});
|
|
13
|
-
return program;
|
|
14
|
-
}
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { getInitialTestAccountsManagers } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
3
|
-
AztecAddress,
|
|
4
|
-
BatchCall,
|
|
5
|
-
EthAddress,
|
|
6
|
-
Fr,
|
|
7
|
-
L1FeeJuicePortalManager,
|
|
8
|
-
type PXE,
|
|
9
|
-
type WaitForProvenOpts,
|
|
10
|
-
type WaitOpts,
|
|
11
|
-
type Wallet,
|
|
12
|
-
createCompatibleClient,
|
|
13
|
-
retryUntil,
|
|
14
|
-
waitForProven,
|
|
15
|
-
} from '@aztec/aztec.js';
|
|
16
|
-
import {
|
|
17
|
-
type ContractArtifacts,
|
|
18
|
-
type ExtendedViemWalletClient,
|
|
19
|
-
createEthereumChain,
|
|
20
|
-
createExtendedL1Client,
|
|
21
|
-
deployL1Contract,
|
|
22
|
-
} from '@aztec/ethereum';
|
|
23
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
24
|
-
|
|
25
|
-
import { getContract } from 'viem';
|
|
26
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
27
|
-
|
|
28
|
-
type ContractDeploymentInfo = {
|
|
29
|
-
address: AztecAddress;
|
|
30
|
-
initHash: Fr;
|
|
31
|
-
salt: Fr;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const waitOpts: WaitOpts = {
|
|
35
|
-
timeout: 120,
|
|
36
|
-
interval: 1,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const provenWaitOpts: WaitForProvenOpts = {
|
|
40
|
-
provenTimeout: 4800,
|
|
41
|
-
interval: 1,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export async function bootstrapNetwork(
|
|
45
|
-
pxeUrl: string,
|
|
46
|
-
l1Urls: string[],
|
|
47
|
-
l1ChainId: string,
|
|
48
|
-
l1PrivateKey: `0x${string}` | undefined,
|
|
49
|
-
l1Mnemonic: string,
|
|
50
|
-
addressIndex: number,
|
|
51
|
-
json: boolean,
|
|
52
|
-
log: LogFn,
|
|
53
|
-
debugLog: Logger,
|
|
54
|
-
) {
|
|
55
|
-
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
56
|
-
|
|
57
|
-
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
58
|
-
// so all we need to do is register them to our pxe.
|
|
59
|
-
const [accountManager] = await getInitialTestAccountsManagers(pxe);
|
|
60
|
-
await accountManager.register();
|
|
61
|
-
|
|
62
|
-
const wallet = await accountManager.getWallet();
|
|
63
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
64
|
-
|
|
65
|
-
const l1Client = createExtendedL1Client(
|
|
66
|
-
l1Urls,
|
|
67
|
-
l1PrivateKey
|
|
68
|
-
? privateKeyToAccount(l1PrivateKey)
|
|
69
|
-
: // We need to use a different account that the main "deployer" account because the "deployer" account creates transactions that send blobs.
|
|
70
|
-
// Note that this account needs to be funded on L1 !
|
|
71
|
-
mnemonicToAccount(l1Mnemonic, { addressIndex }),
|
|
72
|
-
createEthereumChain(l1Urls, +l1ChainId).chainInfo,
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
76
|
-
|
|
77
|
-
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
78
|
-
|
|
79
|
-
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
80
|
-
|
|
81
|
-
const fpcAdmin = wallet.getAddress();
|
|
82
|
-
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
83
|
-
|
|
84
|
-
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
85
|
-
|
|
86
|
-
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
87
|
-
|
|
88
|
-
if (json) {
|
|
89
|
-
log(
|
|
90
|
-
JSON.stringify(
|
|
91
|
-
{
|
|
92
|
-
devCoinL1: erc20Address.toString(),
|
|
93
|
-
devCoinPortalL1: portalAddress.toString(),
|
|
94
|
-
devCoin: {
|
|
95
|
-
address: token.address.toString(),
|
|
96
|
-
initHash: token.initHash.toString(),
|
|
97
|
-
salt: token.salt.toString(),
|
|
98
|
-
},
|
|
99
|
-
devCoinBridge: {
|
|
100
|
-
address: bridge.address.toString(),
|
|
101
|
-
initHash: bridge.initHash.toString(),
|
|
102
|
-
salt: bridge.salt.toString(),
|
|
103
|
-
},
|
|
104
|
-
devCoinFpc: {
|
|
105
|
-
address: fpc.address.toString(),
|
|
106
|
-
initHash: fpc.initHash.toString(),
|
|
107
|
-
salt: fpc.salt.toString(),
|
|
108
|
-
},
|
|
109
|
-
counter: {
|
|
110
|
-
address: counter.address.toString(),
|
|
111
|
-
initHash: counter.initHash.toString(),
|
|
112
|
-
salt: counter.salt.toString(),
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
null,
|
|
116
|
-
2,
|
|
117
|
-
),
|
|
118
|
-
);
|
|
119
|
-
} else {
|
|
120
|
-
log(`DevCoin L1: ${erc20Address}`);
|
|
121
|
-
log(`DevCoin L1 Portal: ${portalAddress}`);
|
|
122
|
-
log(`DevCoin L2: ${token.address}`);
|
|
123
|
-
log(`DevCoin L2 init hash: ${token.initHash}`);
|
|
124
|
-
log(`DevCoin L2 salt: ${token.salt}`);
|
|
125
|
-
log(`DevCoin L2 Bridge: ${bridge.address}`);
|
|
126
|
-
log(`DevCoin L2 Bridge init hash: ${bridge.initHash}`);
|
|
127
|
-
log(`DevCoin L2 Bridge salt: ${bridge.salt}`);
|
|
128
|
-
log(`DevCoin FPC: ${fpc.address}`);
|
|
129
|
-
log(`DevCoin FPC init hash: ${fpc.initHash}`);
|
|
130
|
-
log(`DevCoin FPC salt: ${fpc.salt}`);
|
|
131
|
-
log(`Counter: ${counter.address}`);
|
|
132
|
-
log(`Counter init hash: ${counter.initHash}`);
|
|
133
|
-
log(`Counter salt: ${counter.salt}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Step 1. Deploy the L1 contracts, but don't initialize
|
|
139
|
-
*/
|
|
140
|
-
async function deployERC20(l1Client: ExtendedViemWalletClient) {
|
|
141
|
-
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
142
|
-
|
|
143
|
-
const erc20: ContractArtifacts = {
|
|
144
|
-
name: 'TestERC20',
|
|
145
|
-
contractAbi: TestERC20Abi,
|
|
146
|
-
contractBytecode: TestERC20Bytecode,
|
|
147
|
-
};
|
|
148
|
-
const portal: ContractArtifacts = {
|
|
149
|
-
name: 'TokenPortal',
|
|
150
|
-
contractAbi: TokenPortalAbi,
|
|
151
|
-
contractBytecode: TokenPortalBytecode,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
|
|
155
|
-
'DevCoin',
|
|
156
|
-
'DEV',
|
|
157
|
-
l1Client.account.address,
|
|
158
|
-
]);
|
|
159
|
-
const { address: portalAddress } = await deployL1Contract(l1Client, portal.contractAbi, portal.contractBytecode);
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
erc20Address,
|
|
163
|
-
portalAddress,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Step 2. Deploy the L2 contracts
|
|
169
|
-
*/
|
|
170
|
-
async function deployToken(
|
|
171
|
-
wallet: Wallet,
|
|
172
|
-
defaultAccountAddress: AztecAddress,
|
|
173
|
-
l1Portal: EthAddress,
|
|
174
|
-
): Promise<{ token: ContractDeploymentInfo; bridge: ContractDeploymentInfo }> {
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
176
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
177
|
-
const { TokenContract } = await import('@aztec/noir-contracts.js/Token');
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
179
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
180
|
-
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
181
|
-
const devCoin = await TokenContract.deploy(wallet, defaultAccountAddress, 'DevCoin', 'DEV', 18)
|
|
182
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
183
|
-
.deployed(waitOpts);
|
|
184
|
-
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal)
|
|
185
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
186
|
-
.deployed(waitOpts);
|
|
187
|
-
|
|
188
|
-
await new BatchCall(wallet, [
|
|
189
|
-
devCoin.methods.set_minter(bridge.address, true),
|
|
190
|
-
devCoin.methods.set_admin(bridge.address),
|
|
191
|
-
])
|
|
192
|
-
.send({ from: defaultAccountAddress })
|
|
193
|
-
.wait(waitOpts);
|
|
194
|
-
|
|
195
|
-
return {
|
|
196
|
-
token: {
|
|
197
|
-
address: devCoin.address,
|
|
198
|
-
initHash: devCoin.instance.initializationHash,
|
|
199
|
-
salt: devCoin.instance.salt,
|
|
200
|
-
},
|
|
201
|
-
bridge: {
|
|
202
|
-
address: bridge.address,
|
|
203
|
-
initHash: bridge.instance.initializationHash,
|
|
204
|
-
salt: bridge.instance.salt,
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Step 3. Initialize DevCoin's L1 portal
|
|
211
|
-
*/
|
|
212
|
-
async function initPortal(
|
|
213
|
-
pxe: PXE,
|
|
214
|
-
l1Client: ExtendedViemWalletClient,
|
|
215
|
-
erc20: EthAddress,
|
|
216
|
-
portal: EthAddress,
|
|
217
|
-
bridge: AztecAddress,
|
|
218
|
-
) {
|
|
219
|
-
const { TokenPortalAbi } = await import('@aztec/l1-artifacts');
|
|
220
|
-
const {
|
|
221
|
-
l1ContractAddresses: { registryAddress },
|
|
222
|
-
} = await pxe.getNodeInfo();
|
|
223
|
-
|
|
224
|
-
const contract = getContract({
|
|
225
|
-
abi: TokenPortalAbi,
|
|
226
|
-
address: portal.toString(),
|
|
227
|
-
client: l1Client,
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
const hash = await contract.write.initialize([registryAddress.toString(), erc20.toString(), bridge.toString()]);
|
|
231
|
-
|
|
232
|
-
await l1Client.waitForTransactionReceipt({ hash });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
async function deployFPC(
|
|
236
|
-
wallet: Wallet,
|
|
237
|
-
defaultAccountAddress: AztecAddress,
|
|
238
|
-
tokenAddress: AztecAddress,
|
|
239
|
-
admin: AztecAddress,
|
|
240
|
-
): Promise<ContractDeploymentInfo> {
|
|
241
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
242
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
243
|
-
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
244
|
-
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin)
|
|
245
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
246
|
-
.deployed(waitOpts);
|
|
247
|
-
const info: ContractDeploymentInfo = {
|
|
248
|
-
address: fpc.address,
|
|
249
|
-
initHash: fpc.instance.initializationHash,
|
|
250
|
-
salt: fpc.instance.salt,
|
|
251
|
-
};
|
|
252
|
-
return info;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async function deployCounter(wallet: Wallet, defaultAccountAddress: AztecAddress): Promise<ContractDeploymentInfo> {
|
|
256
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
257
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
258
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
259
|
-
const counter = await CounterContract.deploy(wallet, 1, defaultAccountAddress)
|
|
260
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
261
|
-
.deployed(waitOpts);
|
|
262
|
-
const info: ContractDeploymentInfo = {
|
|
263
|
-
address: counter.address,
|
|
264
|
-
initHash: counter.instance.initializationHash,
|
|
265
|
-
salt: counter.instance.salt,
|
|
266
|
-
};
|
|
267
|
-
return info;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// NOTE: Disabling for now in order to get devnet running
|
|
271
|
-
async function fundFPC(
|
|
272
|
-
pxe: PXE,
|
|
273
|
-
counterAddress: AztecAddress,
|
|
274
|
-
wallet: Wallet,
|
|
275
|
-
defaultAccountAddress: AztecAddress,
|
|
276
|
-
l1Client: ExtendedViemWalletClient,
|
|
277
|
-
fpcAddress: AztecAddress,
|
|
278
|
-
debugLog: Logger,
|
|
279
|
-
) {
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
281
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
282
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
283
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
284
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
285
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
286
|
-
const {
|
|
287
|
-
protocolContractAddresses: { feeJuice },
|
|
288
|
-
} = await wallet.getPXEInfo();
|
|
289
|
-
|
|
290
|
-
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
291
|
-
|
|
292
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Client, debugLog);
|
|
293
|
-
|
|
294
|
-
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(
|
|
295
|
-
fpcAddress,
|
|
296
|
-
undefined,
|
|
297
|
-
true,
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
await retryUntil(async () => await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
301
|
-
|
|
302
|
-
const counter = await CounterContract.at(counterAddress, wallet);
|
|
303
|
-
|
|
304
|
-
debugLog.info('Incrementing Counter');
|
|
305
|
-
|
|
306
|
-
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
307
|
-
// advance the chain
|
|
308
|
-
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
309
|
-
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
310
|
-
|
|
311
|
-
debugLog.info('Claiming FPC');
|
|
312
|
-
|
|
313
|
-
const receipt = await feeJuiceContract.methods
|
|
314
|
-
.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex)
|
|
315
|
-
.send({ from: defaultAccountAddress })
|
|
316
|
-
.wait({ ...waitOpts });
|
|
317
|
-
|
|
318
|
-
await waitForProven(pxe, receipt, provenWaitOpts);
|
|
319
|
-
|
|
320
|
-
debugLog.info('Finished claiming FPC');
|
|
321
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
5
|
-
|
|
6
|
-
export async function dripFaucet(
|
|
7
|
-
faucetUrl: string,
|
|
8
|
-
asset: string,
|
|
9
|
-
account: EthAddress,
|
|
10
|
-
json: boolean,
|
|
11
|
-
log: LogFn,
|
|
12
|
-
): Promise<void> {
|
|
13
|
-
const url = new URL(`/drip/${account.toString()}`, faucetUrl);
|
|
14
|
-
url.searchParams.set('asset', asset);
|
|
15
|
-
const res = await fetch(url);
|
|
16
|
-
if (res.status === 200) {
|
|
17
|
-
if (json) {
|
|
18
|
-
log(prettyPrintJSON({ ok: true }));
|
|
19
|
-
} else {
|
|
20
|
-
log(`Dripped ${asset} for ${account.toString()}`);
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
if (json) {
|
|
24
|
-
log(prettyPrintJSON({ ok: false }));
|
|
25
|
-
} else if (res.status === 429) {
|
|
26
|
-
log(`Rate limited when dripping ${asset} for ${account.toString()}`);
|
|
27
|
-
} else {
|
|
28
|
-
log(`Failed to drip ${asset} for ${account.toString()}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/cmds/devnet/index.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
-
|
|
3
|
-
import type { Command } from 'commander';
|
|
4
|
-
|
|
5
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
6
|
-
|
|
7
|
-
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
8
|
-
program
|
|
9
|
-
.command('bootstrap-network')
|
|
10
|
-
.description('Bootstrap a new network')
|
|
11
|
-
.addOption(pxeOption)
|
|
12
|
-
.addOption(l1ChainIdOption)
|
|
13
|
-
.requiredOption<string[]>(
|
|
14
|
-
'--l1-rpc-urls <string>',
|
|
15
|
-
'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)',
|
|
16
|
-
(arg: string) => arg.split(','),
|
|
17
|
-
[ETHEREUM_HOSTS],
|
|
18
|
-
)
|
|
19
|
-
.option('--l1-private-key <string>', 'The private key to use for deployment', process.env.PRIVATE_KEY)
|
|
20
|
-
.option(
|
|
21
|
-
'-m, --mnemonic <string>',
|
|
22
|
-
'The mnemonic to use in deployment',
|
|
23
|
-
'test test test test test test test test test test test junk',
|
|
24
|
-
)
|
|
25
|
-
.option(
|
|
26
|
-
'-ai, --address-index <number>',
|
|
27
|
-
'The address index to use when calculating an address',
|
|
28
|
-
arg => BigInt(arg),
|
|
29
|
-
0n,
|
|
30
|
-
)
|
|
31
|
-
.option('--json', 'Output the result as JSON')
|
|
32
|
-
.action(async options => {
|
|
33
|
-
const { bootstrapNetwork } = await import('./bootstrap_network.js');
|
|
34
|
-
await bootstrapNetwork(
|
|
35
|
-
options[pxeOption.attributeName()],
|
|
36
|
-
options.l1RpcUrls,
|
|
37
|
-
options[l1ChainIdOption.attributeName()],
|
|
38
|
-
options.l1PrivateKey,
|
|
39
|
-
options.mnemonic,
|
|
40
|
-
options.addressIndex,
|
|
41
|
-
options.json,
|
|
42
|
-
log,
|
|
43
|
-
debugLogger,
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
program
|
|
48
|
-
.command('drip-faucet')
|
|
49
|
-
.description('Drip the faucet')
|
|
50
|
-
.requiredOption('-u, --faucet-url <string>', 'Url of the faucet', 'http://localhost:8082')
|
|
51
|
-
.requiredOption('-t, --token <string>', 'The asset to drip', 'eth')
|
|
52
|
-
.requiredOption('-a, --address <string>', 'The Ethereum address to drip to', parseEthereumAddress)
|
|
53
|
-
.option('--json', 'Output the result as JSON')
|
|
54
|
-
.action(async options => {
|
|
55
|
-
const { dripFaucet } = await import('./faucet.js');
|
|
56
|
-
await dripFaucet(options.faucetUrl, options.token, options.address, options.json, log);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return program;
|
|
60
|
-
}
|