@aztec/aztec 0.0.0-test.1 → 0.0.1-commit.24de95ac
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 +20 -12
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +32 -33
- package/dest/cli/aztec_start_options.d.ts +4 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +137 -207
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +4 -0
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +18 -10
- package/dest/cli/cmds/start_blob_sink.d.ts.map +1 -1
- package/dest/cli/cmds/start_blob_sink.js +17 -1
- package/dest/cli/cmds/start_bot.d.ts +3 -6
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +24 -13
- 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 +66 -79
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +9 -4
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +31 -2
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +9 -3
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +43 -45
- package/dest/cli/preload_crs.d.ts +3 -0
- package/dest/cli/preload_crs.d.ts.map +1 -0
- package/dest/cli/preload_crs.js +6 -0
- package/dest/cli/release_version.d.ts +2 -0
- package/dest/cli/release_version.d.ts.map +1 -0
- package/dest/cli/release_version.js +14 -0
- package/dest/cli/util.d.ts +36 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +198 -28
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.js +31 -18
- package/dest/examples/util.d.ts +4 -5
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +5 -6
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/sandbox/banana_fpc.d.ts +4 -5
- package/dest/sandbox/banana_fpc.d.ts.map +1 -1
- package/dest/sandbox/banana_fpc.js +19 -21
- package/dest/sandbox/index.d.ts +2 -3
- package/dest/sandbox/index.d.ts.map +1 -1
- package/dest/sandbox/index.js +2 -3
- package/dest/sandbox/sandbox.d.ts +25 -27
- package/dest/sandbox/sandbox.d.ts.map +1 -1
- package/dest/sandbox/sandbox.js +51 -49
- package/dest/sandbox/sponsored_fpc.d.ts +3 -5
- package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
- package/dest/sandbox/sponsored_fpc.js +10 -18
- package/dest/testing/anvil_test_watcher.d.ts +34 -0
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
- package/dest/testing/anvil_test_watcher.js +142 -0
- package/dest/testing/cheat_codes.d.ts +43 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +62 -0
- package/dest/testing/index.d.ts +4 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +3 -0
- package/package.json +47 -41
- package/src/bin/index.ts +24 -12
- package/src/cli/aztec_start_action.ts +27 -30
- package/src/cli/aztec_start_options.ts +155 -207
- package/src/cli/cli.ts +8 -0
- package/src/cli/cmds/start_archiver.ts +19 -13
- package/src/cli/cmds/start_blob_sink.ts +27 -1
- package/src/cli/cmds/start_bot.ts +35 -12
- package/src/cli/cmds/start_node.ts +89 -84
- package/src/cli/cmds/start_p2p_bootstrap.ts +12 -4
- package/src/cli/cmds/start_prover_agent.ts +22 -2
- package/src/cli/cmds/start_prover_broker.ts +23 -3
- package/src/cli/cmds/start_prover_node.ts +53 -50
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/release_version.ts +21 -0
- package/src/cli/util.ts +208 -34
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +23 -19
- package/src/examples/util.ts +6 -8
- package/src/index.ts +3 -4
- package/src/sandbox/banana_fpc.ts +20 -25
- package/src/sandbox/index.ts +5 -3
- package/src/sandbox/sandbox.ts +70 -57
- package/src/sandbox/sponsored_fpc.ts +12 -25
- package/src/testing/anvil_test_watcher.ts +164 -0
- package/src/testing/cheat_codes.ts +78 -0
- package/src/testing/index.ts +3 -0
- package/dest/cli/chain_l2_config.d.ts +0 -19
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -56
- package/dest/cli/cmds/start_faucet.d.ts +0 -4
- package/dest/cli/cmds/start_faucet.d.ts.map +0 -1
- package/dest/cli/cmds/start_faucet.js +0 -20
- package/dest/cli/cmds/start_pxe.d.ts +0 -16
- package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
- package/dest/cli/cmds/start_pxe.js +0 -95
- package/dest/cli/get_l1_config.d.ts +0 -7
- package/dest/cli/get_l1_config.d.ts.map +0 -1
- package/dest/cli/get_l1_config.js +0 -13
- package/dest/sandbox/sponsored_fee_payment_method.d.ts +0 -23
- package/dest/sandbox/sponsored_fee_payment_method.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fee_payment_method.js +0 -36
- package/src/cli/chain_l2_config.ts +0 -74
- package/src/cli/cmds/start_faucet.ts +0 -34
- package/src/cli/cmds/start_pxe.ts +0 -129
- package/src/cli/get_l1_config.ts +0 -18
- package/src/sandbox/sponsored_fee_payment_method.ts +0 -46
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import { type CliPXEOptions, type PXEService, type PXEServiceConfig } from '@aztec/pxe/server';
|
|
4
|
-
import { type AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
export type { PXEServiceConfig, CliPXEOptions };
|
|
6
|
-
export declare function startPXE(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<{
|
|
7
|
-
pxe: PXEService;
|
|
8
|
-
config: PXEServiceConfig & CliPXEOptions;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function addPXE(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn, deps?: {
|
|
11
|
-
node?: AztecNode;
|
|
12
|
-
}): Promise<{
|
|
13
|
-
pxe: PXEService;
|
|
14
|
-
config: PXEServiceConfig & CliPXEOptions;
|
|
15
|
-
}>;
|
|
16
|
-
//# sourceMappingURL=start_pxe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start_pxe.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_pxe.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAoC,MAAM,iCAAiC,CAAC;AAOnG,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AAIhD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,CAAA;CAAE,CAAC,CAExE;AAcD,wBAAsB,MAAM,CAC1B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,EACd,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAO,GAC9B,OAAO,CAAC;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,CAAA;CAAE,CAAC,CAwExE"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, Fr, PublicKeys, getContractClassFromArtifact } from '@aztec/aztec.js';
|
|
2
|
-
import { getContractArtifact } from '@aztec/cli/cli-utils';
|
|
3
|
-
import { allPxeConfigMappings, createPXEService } from '@aztec/pxe/server';
|
|
4
|
-
import { PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import { L2BasicContractsMap, Network } from '@aztec/stdlib/network';
|
|
6
|
-
import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
7
|
-
import { extractRelevantOptions } from '../util.js';
|
|
8
|
-
import { getVersions } from '../versioning.js';
|
|
9
|
-
const contractAddressesUrl = 'http://static.aztec.network';
|
|
10
|
-
export async function startPXE(options, signalHandlers, services, userLog) {
|
|
11
|
-
return await addPXE(options, signalHandlers, services, userLog, {});
|
|
12
|
-
}
|
|
13
|
-
function isValidNetwork(value) {
|
|
14
|
-
return Object.values(Network).includes(value);
|
|
15
|
-
}
|
|
16
|
-
async function fetchBasicContractAddresses(url) {
|
|
17
|
-
const response = await fetch(url);
|
|
18
|
-
if (!response.ok) {
|
|
19
|
-
throw new Error(`Failed to fetch basic contract addresses from ${url}`);
|
|
20
|
-
}
|
|
21
|
-
return response.json();
|
|
22
|
-
}
|
|
23
|
-
export async function addPXE(options, signalHandlers, services, userLog, deps = {}) {
|
|
24
|
-
const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
|
|
25
|
-
let nodeUrl;
|
|
26
|
-
if (pxeConfig.network) {
|
|
27
|
-
if (isValidNetwork(pxeConfig.network)) {
|
|
28
|
-
if (!pxeConfig.apiKey && !pxeConfig.nodeUrl) {
|
|
29
|
-
userLog(`API Key or Aztec Node URL is required to connect to ${pxeConfig.network}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
} else if (pxeConfig.apiKey) {
|
|
32
|
-
nodeUrl = `https://api.aztec.network/${pxeConfig.network}/aztec-node-1/${pxeConfig.apiKey}`;
|
|
33
|
-
} else if (pxeConfig.nodeUrl) {
|
|
34
|
-
nodeUrl = pxeConfig.nodeUrl;
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
userLog(`Network ${pxeConfig.network} is not supported`);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
nodeUrl = pxeConfig.nodeUrl;
|
|
42
|
-
}
|
|
43
|
-
if (!nodeUrl && !deps.node && !pxeConfig.network) {
|
|
44
|
-
userLog('Aztec Node URL (nodeUrl | AZTEC_NODE_URL) option is required to start PXE without --node option');
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
const node = deps.node ?? createAztecNodeClient(nodeUrl, getVersions(pxeConfig), makeTracedFetch([
|
|
48
|
-
1,
|
|
49
|
-
2,
|
|
50
|
-
3
|
|
51
|
-
], true));
|
|
52
|
-
const pxe = await createPXEService(node, pxeConfig);
|
|
53
|
-
// register basic contracts
|
|
54
|
-
if (pxeConfig.network) {
|
|
55
|
-
userLog(`Registering basic contracts for ${pxeConfig.network}`);
|
|
56
|
-
const basicContractsInfo = await fetchBasicContractAddresses(`${contractAddressesUrl}/${pxeConfig.network}/basic_contracts.json`);
|
|
57
|
-
const l2Contracts = {};
|
|
58
|
-
for (const [key, artifactName] of Object.entries(L2BasicContractsMap[pxeConfig.network])){
|
|
59
|
-
l2Contracts[key] = {
|
|
60
|
-
name: key,
|
|
61
|
-
address: AztecAddress.fromString(basicContractsInfo[key].address),
|
|
62
|
-
initHash: Fr.fromHexString(basicContractsInfo[key].initHash),
|
|
63
|
-
salt: Fr.fromHexString(basicContractsInfo[key].salt),
|
|
64
|
-
artifact: await getContractArtifact(artifactName, userLog)
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
await Promise.all(Object.values(l2Contracts).map(async ({ name, address, artifact, initHash, salt })=>{
|
|
68
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
69
|
-
const instance = {
|
|
70
|
-
version: 1,
|
|
71
|
-
salt,
|
|
72
|
-
initializationHash: initHash,
|
|
73
|
-
address,
|
|
74
|
-
deployer: AztecAddress.ZERO,
|
|
75
|
-
currentContractClassId: contractClass.id,
|
|
76
|
-
originalContractClassId: contractClass.id,
|
|
77
|
-
publicKeys: PublicKeys.default()
|
|
78
|
-
};
|
|
79
|
-
userLog(`Registering ${name} at ${address.toString()}`);
|
|
80
|
-
await pxe.registerContract({
|
|
81
|
-
artifact,
|
|
82
|
-
instance
|
|
83
|
-
});
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
// Add PXE to services list
|
|
87
|
-
services.pxe = [
|
|
88
|
-
pxe,
|
|
89
|
-
PXESchema
|
|
90
|
-
];
|
|
91
|
-
return {
|
|
92
|
-
pxe,
|
|
93
|
-
config: pxeConfig
|
|
94
|
-
};
|
|
95
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type L1ContractAddresses, getL1ContractsConfig } from '@aztec/ethereum';
|
|
2
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
export declare function getL1Config(registryAddress: EthAddress, l1RpcUrls: string[], l1ChainId: number): Promise<{
|
|
4
|
-
addresses: L1ContractAddresses;
|
|
5
|
-
config: Awaited<ReturnType<typeof getL1ContractsConfig>>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=get_l1_config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_l1_config.d.ts","sourceRoot":"","sources":["../../src/cli/get_l1_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAoB,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC;AACpH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,wBAAsB,WAAW,CAC/B,eAAe,EAAE,UAAU,EAC3B,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,SAAS,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAA;CAAE,CAAC,CAUvG"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RegistryContract, getL1ContractsConfig, getPublicClient } from '@aztec/ethereum';
|
|
2
|
-
export async function getL1Config(registryAddress, l1RpcUrls, l1ChainId) {
|
|
3
|
-
const publicClient = getPublicClient({
|
|
4
|
-
l1RpcUrls,
|
|
5
|
-
l1ChainId
|
|
6
|
-
});
|
|
7
|
-
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
|
|
8
|
-
const config = await getL1ContractsConfig(publicClient, addresses);
|
|
9
|
-
return {
|
|
10
|
-
addresses,
|
|
11
|
-
config
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FeePaymentMethod } from '@aztec/aztec.js';
|
|
2
|
-
import { type FunctionCall } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
/**
|
|
6
|
-
* A payment method that uses the SponsoredFPCContract to pay the fee unconditionally.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
9
|
-
/**
|
|
10
|
-
* Contract which will pay the fee.
|
|
11
|
-
*/
|
|
12
|
-
private paymentContract;
|
|
13
|
-
constructor(
|
|
14
|
-
/**
|
|
15
|
-
* Contract which will pay the fee.
|
|
16
|
-
*/
|
|
17
|
-
paymentContract: AztecAddress);
|
|
18
|
-
static new(pxe: PXE): Promise<SponsoredFeePaymentMethod>;
|
|
19
|
-
getAsset(): Promise<AztecAddress>;
|
|
20
|
-
getFeePayer(): Promise<AztecAddress>;
|
|
21
|
-
getFunctionCalls(): Promise<FunctionCall[]>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=sponsored_fee_payment_method.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/sandbox/sponsored_fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAI3D;;GAEG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IAE9D;;OAEG;IACH,OAAO,CAAC,eAAe;;IAHvB;;OAEG;IACK,eAAe,EAAE,YAAY;WAG1B,GAAG,CAAC,GAAG,EAAE,GAAG;IAKzB,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAIjC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAI9B,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAalD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
|
-
import { getDeployedSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
4
|
-
/**
|
|
5
|
-
* A payment method that uses the SponsoredFPCContract to pay the fee unconditionally.
|
|
6
|
-
*/ export class SponsoredFeePaymentMethod {
|
|
7
|
-
paymentContract;
|
|
8
|
-
constructor(/**
|
|
9
|
-
* Contract which will pay the fee.
|
|
10
|
-
*/ paymentContract){
|
|
11
|
-
this.paymentContract = paymentContract;
|
|
12
|
-
}
|
|
13
|
-
static async new(pxe) {
|
|
14
|
-
const sponsoredFPC = await getDeployedSponsoredFPCAddress(pxe);
|
|
15
|
-
return new SponsoredFeePaymentMethod(sponsoredFPC);
|
|
16
|
-
}
|
|
17
|
-
getAsset() {
|
|
18
|
-
return Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
19
|
-
}
|
|
20
|
-
getFeePayer() {
|
|
21
|
-
return Promise.resolve(this.paymentContract);
|
|
22
|
-
}
|
|
23
|
-
async getFunctionCalls() {
|
|
24
|
-
return [
|
|
25
|
-
{
|
|
26
|
-
name: 'sponsor_unconditionally',
|
|
27
|
-
to: this.paymentContract,
|
|
28
|
-
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
29
|
-
type: FunctionType.PRIVATE,
|
|
30
|
-
isStatic: false,
|
|
31
|
-
args: [],
|
|
32
|
-
returnTypes: []
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export type NetworkNames = 'testnet-ignition';
|
|
2
|
-
|
|
3
|
-
export type L2ChainConfig = {
|
|
4
|
-
l1ChainId: number;
|
|
5
|
-
ethereumSlotDuration: number;
|
|
6
|
-
aztecSlotDuration: number;
|
|
7
|
-
aztecEpochDuration: number;
|
|
8
|
-
aztecProofSubmissionWindow: number;
|
|
9
|
-
testAccounts: boolean;
|
|
10
|
-
p2pEnabled: boolean;
|
|
11
|
-
p2pBootstrapNodes: string[];
|
|
12
|
-
registryAddress: string;
|
|
13
|
-
seqMinTxsPerBlock: number;
|
|
14
|
-
seqMaxTxsPerBlock: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
18
|
-
l1ChainId: 11155111,
|
|
19
|
-
ethereumSlotDuration: 12,
|
|
20
|
-
aztecSlotDuration: 36,
|
|
21
|
-
aztecEpochDuration: 32,
|
|
22
|
-
aztecProofSubmissionWindow: 64,
|
|
23
|
-
testAccounts: true,
|
|
24
|
-
p2pEnabled: true,
|
|
25
|
-
p2pBootstrapNodes: [],
|
|
26
|
-
registryAddress: '0x12b3ebc176a1646b911391eab3760764f2e05fe3',
|
|
27
|
-
seqMinTxsPerBlock: 0,
|
|
28
|
-
seqMaxTxsPerBlock: 0,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export async function getBootnodes(networkName: NetworkNames) {
|
|
32
|
-
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
33
|
-
const response = await fetch(url);
|
|
34
|
-
if (!response.ok) {
|
|
35
|
-
throw new Error(`Failed to fetch basic contract addresses from ${url}`);
|
|
36
|
-
}
|
|
37
|
-
const json = await response.json();
|
|
38
|
-
return json['bootnodes'];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function getL2ChainConfig(networkName: NetworkNames): Promise<L2ChainConfig | undefined> {
|
|
42
|
-
if (networkName === 'testnet-ignition') {
|
|
43
|
-
const config = { ...testnetIgnitionL2ChainConfig };
|
|
44
|
-
config.p2pBootstrapNodes = await getBootnodes(networkName);
|
|
45
|
-
return config;
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function enrichVar(envVar: string, value: string) {
|
|
51
|
-
// Don't override
|
|
52
|
-
if (process.env[envVar]) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
process.env[envVar] = value;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
59
|
-
const config = await getL2ChainConfig(networkName);
|
|
60
|
-
if (!config) {
|
|
61
|
-
throw new Error(`Unknown network name: ${networkName}`);
|
|
62
|
-
}
|
|
63
|
-
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
64
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
65
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
66
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_WINDOW', config.aztecProofSubmissionWindow.toString());
|
|
67
|
-
enrichVar('P2P_BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
|
|
68
|
-
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
69
|
-
enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
|
|
70
|
-
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
71
|
-
enrichVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
72
|
-
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
73
|
-
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
74
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Faucet,
|
|
3
|
-
FaucetSchema,
|
|
4
|
-
createFaucetHttpServer,
|
|
5
|
-
faucetConfigMapping,
|
|
6
|
-
getFaucetConfigFromEnv,
|
|
7
|
-
} from '@aztec/aztec-faucet';
|
|
8
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
9
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
10
|
-
|
|
11
|
-
import { extractNamespacedOptions, extractRelevantOptions } from '../util.js';
|
|
12
|
-
|
|
13
|
-
export async function startFaucet(
|
|
14
|
-
options: any,
|
|
15
|
-
signalHandlers: (() => Promise<void>)[],
|
|
16
|
-
services: NamespacedApiHandlers,
|
|
17
|
-
log: LogFn,
|
|
18
|
-
) {
|
|
19
|
-
const faucetOptions = extractNamespacedOptions(options, 'faucet');
|
|
20
|
-
const config = {
|
|
21
|
-
...getFaucetConfigFromEnv(),
|
|
22
|
-
...extractRelevantOptions(options, faucetConfigMapping, 'faucet'),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const faucet = await Faucet.create(config);
|
|
26
|
-
if (faucetOptions.apiServer) {
|
|
27
|
-
const httpServer = createFaucetHttpServer(faucet);
|
|
28
|
-
httpServer.listen(faucetOptions.apiServerPort);
|
|
29
|
-
signalHandlers.push(() => new Promise(res => httpServer.close(() => res())));
|
|
30
|
-
log(`Faucet now running on port: ${faucetOptions.apiServerPort}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
services.faucet = [faucet, FaucetSchema];
|
|
34
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AztecAddress,
|
|
3
|
-
type ContractArtifact,
|
|
4
|
-
type ContractInstanceWithAddress,
|
|
5
|
-
Fr,
|
|
6
|
-
PublicKeys,
|
|
7
|
-
getContractClassFromArtifact,
|
|
8
|
-
} from '@aztec/aztec.js';
|
|
9
|
-
import { getContractArtifact } from '@aztec/cli/cli-utils';
|
|
10
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
11
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
12
|
-
import {
|
|
13
|
-
type CliPXEOptions,
|
|
14
|
-
type PXEService,
|
|
15
|
-
type PXEServiceConfig,
|
|
16
|
-
allPxeConfigMappings,
|
|
17
|
-
createPXEService,
|
|
18
|
-
} from '@aztec/pxe/server';
|
|
19
|
-
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
20
|
-
import { L2BasicContractsMap, Network } from '@aztec/stdlib/network';
|
|
21
|
-
import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
22
|
-
|
|
23
|
-
import { extractRelevantOptions } from '../util.js';
|
|
24
|
-
import { getVersions } from '../versioning.js';
|
|
25
|
-
|
|
26
|
-
export type { PXEServiceConfig, CliPXEOptions };
|
|
27
|
-
|
|
28
|
-
const contractAddressesUrl = 'http://static.aztec.network';
|
|
29
|
-
|
|
30
|
-
export async function startPXE(
|
|
31
|
-
options: any,
|
|
32
|
-
signalHandlers: (() => Promise<void>)[],
|
|
33
|
-
services: NamespacedApiHandlers,
|
|
34
|
-
userLog: LogFn,
|
|
35
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
36
|
-
return await addPXE(options, signalHandlers, services, userLog, {});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function isValidNetwork(value: any): value is Network {
|
|
40
|
-
return Object.values(Network).includes(value);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function fetchBasicContractAddresses(url: string) {
|
|
44
|
-
const response = await fetch(url);
|
|
45
|
-
if (!response.ok) {
|
|
46
|
-
throw new Error(`Failed to fetch basic contract addresses from ${url}`);
|
|
47
|
-
}
|
|
48
|
-
return response.json();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export async function addPXE(
|
|
52
|
-
options: any,
|
|
53
|
-
signalHandlers: (() => Promise<void>)[],
|
|
54
|
-
services: NamespacedApiHandlers,
|
|
55
|
-
userLog: LogFn,
|
|
56
|
-
deps: { node?: AztecNode } = {},
|
|
57
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
58
|
-
const pxeConfig = extractRelevantOptions<PXEServiceConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
59
|
-
|
|
60
|
-
let nodeUrl;
|
|
61
|
-
if (pxeConfig.network) {
|
|
62
|
-
if (isValidNetwork(pxeConfig.network)) {
|
|
63
|
-
if (!pxeConfig.apiKey && !pxeConfig.nodeUrl) {
|
|
64
|
-
userLog(`API Key or Aztec Node URL is required to connect to ${pxeConfig.network}`);
|
|
65
|
-
process.exit(1);
|
|
66
|
-
} else if (pxeConfig.apiKey) {
|
|
67
|
-
nodeUrl = `https://api.aztec.network/${pxeConfig.network}/aztec-node-1/${pxeConfig.apiKey}`;
|
|
68
|
-
} else if (pxeConfig.nodeUrl) {
|
|
69
|
-
nodeUrl = pxeConfig.nodeUrl;
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
userLog(`Network ${pxeConfig.network} is not supported`);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
nodeUrl = pxeConfig.nodeUrl;
|
|
77
|
-
}
|
|
78
|
-
if (!nodeUrl && !deps.node && !pxeConfig.network) {
|
|
79
|
-
userLog('Aztec Node URL (nodeUrl | AZTEC_NODE_URL) option is required to start PXE without --node option');
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const node = deps.node ?? createAztecNodeClient(nodeUrl!, getVersions(pxeConfig), makeTracedFetch([1, 2, 3], true));
|
|
84
|
-
const pxe = await createPXEService(node, pxeConfig as PXEServiceConfig);
|
|
85
|
-
|
|
86
|
-
// register basic contracts
|
|
87
|
-
if (pxeConfig.network) {
|
|
88
|
-
userLog(`Registering basic contracts for ${pxeConfig.network}`);
|
|
89
|
-
const basicContractsInfo = await fetchBasicContractAddresses(
|
|
90
|
-
`${contractAddressesUrl}/${pxeConfig.network}/basic_contracts.json`,
|
|
91
|
-
);
|
|
92
|
-
const l2Contracts: Record<
|
|
93
|
-
string,
|
|
94
|
-
{ name: string; address: AztecAddress; initHash: Fr; salt: Fr; artifact: ContractArtifact }
|
|
95
|
-
> = {};
|
|
96
|
-
for (const [key, artifactName] of Object.entries(L2BasicContractsMap[pxeConfig.network as Network])) {
|
|
97
|
-
l2Contracts[key] = {
|
|
98
|
-
name: key,
|
|
99
|
-
address: AztecAddress.fromString(basicContractsInfo[key].address),
|
|
100
|
-
initHash: Fr.fromHexString(basicContractsInfo[key].initHash),
|
|
101
|
-
salt: Fr.fromHexString(basicContractsInfo[key].salt),
|
|
102
|
-
artifact: await getContractArtifact(artifactName, userLog),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
await Promise.all(
|
|
107
|
-
Object.values(l2Contracts).map(async ({ name, address, artifact, initHash, salt }) => {
|
|
108
|
-
const contractClass = await getContractClassFromArtifact(artifact!);
|
|
109
|
-
const instance: ContractInstanceWithAddress = {
|
|
110
|
-
version: 1,
|
|
111
|
-
salt,
|
|
112
|
-
initializationHash: initHash,
|
|
113
|
-
address,
|
|
114
|
-
deployer: AztecAddress.ZERO,
|
|
115
|
-
currentContractClassId: contractClass.id,
|
|
116
|
-
originalContractClassId: contractClass.id,
|
|
117
|
-
publicKeys: PublicKeys.default(),
|
|
118
|
-
};
|
|
119
|
-
userLog(`Registering ${name} at ${address.toString()}`);
|
|
120
|
-
await pxe.registerContract({ artifact, instance });
|
|
121
|
-
}),
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Add PXE to services list
|
|
126
|
-
services.pxe = [pxe, PXESchema];
|
|
127
|
-
|
|
128
|
-
return { pxe, config: pxeConfig };
|
|
129
|
-
}
|
package/src/cli/get_l1_config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type L1ContractAddresses, RegistryContract, getL1ContractsConfig, getPublicClient } from '@aztec/ethereum';
|
|
2
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
|
|
4
|
-
export async function getL1Config(
|
|
5
|
-
registryAddress: EthAddress,
|
|
6
|
-
l1RpcUrls: string[],
|
|
7
|
-
l1ChainId: number,
|
|
8
|
-
): Promise<{ addresses: L1ContractAddresses; config: Awaited<ReturnType<typeof getL1ContractsConfig>> }> {
|
|
9
|
-
const publicClient = getPublicClient({ l1RpcUrls, l1ChainId });
|
|
10
|
-
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
|
|
11
|
-
|
|
12
|
-
const config = await getL1ContractsConfig(publicClient, addresses);
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
addresses,
|
|
16
|
-
config,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { FeePaymentMethod } from '@aztec/aztec.js';
|
|
2
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
-
import { type FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
|
|
7
|
-
import { getDeployedSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A payment method that uses the SponsoredFPCContract to pay the fee unconditionally.
|
|
11
|
-
*/
|
|
12
|
-
export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
13
|
-
constructor(
|
|
14
|
-
/**
|
|
15
|
-
* Contract which will pay the fee.
|
|
16
|
-
*/
|
|
17
|
-
private paymentContract: AztecAddress,
|
|
18
|
-
) {}
|
|
19
|
-
|
|
20
|
-
static async new(pxe: PXE) {
|
|
21
|
-
const sponsoredFPC = await getDeployedSponsoredFPCAddress(pxe);
|
|
22
|
-
return new SponsoredFeePaymentMethod(sponsoredFPC);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getAsset(): Promise<AztecAddress> {
|
|
26
|
-
return Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getFeePayer(): Promise<AztecAddress> {
|
|
30
|
-
return Promise.resolve(this.paymentContract);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async getFunctionCalls(): Promise<FunctionCall[]> {
|
|
34
|
-
return [
|
|
35
|
-
{
|
|
36
|
-
name: 'sponsor_unconditionally',
|
|
37
|
-
to: this.paymentContract,
|
|
38
|
-
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
39
|
-
type: FunctionType.PRIVATE,
|
|
40
|
-
isStatic: false,
|
|
41
|
-
args: [],
|
|
42
|
-
returnTypes: [],
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
}
|