@aztec/cli 3.0.0-nightly.20250910 → 3.0.0-nightly.20250911
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/devnet/bootstrap_network.d.ts.map +1 -1
- package/dest/cmds/devnet/bootstrap_network.js +11 -10
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +10 -14
- package/dest/cmds/l1/deploy_l1_contracts.js +2 -2
- package/dest/cmds/l1/deploy_new_rollup.js +2 -2
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +33 -68
- package/dest/utils/setup_contracts.d.ts +3 -3
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +9 -19
- package/package.json +24 -23
- package/src/cmds/devnet/bootstrap_network.ts +15 -10
- package/src/cmds/infrastructure/index.ts +1 -9
- package/src/cmds/infrastructure/setup_l2_contract.ts +10 -17
- package/src/cmds/l1/deploy_l1_contracts.ts +2 -2
- package/src/cmds/l1/deploy_new_rollup.ts +2 -2
- package/src/config/chain_l2_config.ts +42 -80
- package/src/utils/setup_contracts.ts +6 -36
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAsB3D,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,iBAsFjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { BatchCall, Fr, L1FeeJuicePortalManager, createCompatibleClient, retryUntil, waitForProven } from '@aztec/aztec.js';
|
|
3
3
|
import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
4
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
import { getContract } from 'viem';
|
|
5
6
|
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
6
7
|
const waitOpts = {
|
|
@@ -13,12 +14,12 @@ const provenWaitOpts = {
|
|
|
13
14
|
};
|
|
14
15
|
export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey, l1Mnemonic, addressIndex, json, log, debugLog) {
|
|
15
16
|
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
17
|
+
const wallet = new TestWallet(pxe);
|
|
16
18
|
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
17
19
|
// so all we need to do is register them to our pxe.
|
|
18
|
-
const [
|
|
19
|
-
await
|
|
20
|
-
const
|
|
21
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
20
|
+
const [accountData] = await getInitialTestAccountsData();
|
|
21
|
+
const accountManager = await wallet.createSchnorrAccount(accountData.secret, accountData.salt, accountData.signingKey);
|
|
22
|
+
const defaultAccountAddress = accountManager.getAddress();
|
|
22
23
|
const l1Client = createExtendedL1Client(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
|
|
23
24
|
mnemonicToAccount(l1Mnemonic, {
|
|
24
25
|
addressIndex
|
|
@@ -26,7 +27,7 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
26
27
|
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
27
28
|
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
28
29
|
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
29
|
-
const fpcAdmin =
|
|
30
|
+
const fpcAdmin = defaultAccountAddress;
|
|
30
31
|
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
31
32
|
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
32
33
|
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
@@ -190,19 +191,19 @@ async function fundFPC(pxe, counterAddress, wallet, defaultAccountAddress, l1Cli
|
|
|
190
191
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
191
192
|
// @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
193
|
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
193
|
-
const { protocolContractAddresses: { feeJuice } } = await
|
|
194
|
+
const { protocolContractAddresses: { feeJuice } } = await pxe.getNodeInfo();
|
|
194
195
|
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
195
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(
|
|
196
|
+
const feeJuicePortal = await L1FeeJuicePortalManager.new(pxe, l1Client, debugLog);
|
|
196
197
|
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, undefined, true);
|
|
197
198
|
await retryUntil(async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
198
199
|
const counter = await CounterContract.at(counterAddress, wallet);
|
|
199
200
|
debugLog.info('Incrementing Counter');
|
|
200
201
|
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
201
202
|
// advance the chain
|
|
202
|
-
await counter.methods.increment(
|
|
203
|
+
await counter.methods.increment(defaultAccountAddress).send({
|
|
203
204
|
from: defaultAccountAddress
|
|
204
205
|
}).wait(waitOpts);
|
|
205
|
-
await counter.methods.increment(
|
|
206
|
+
await counter.methods.increment(defaultAccountAddress).send({
|
|
206
207
|
from: defaultAccountAddress
|
|
207
208
|
}).wait(waitOpts);
|
|
208
209
|
debugLog.info('Claiming FPC');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/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,WAgD/E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ETHEREUM_HOSTS, l1ChainIdOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js';
|
|
2
2
|
export function injectCommands(program, log, debugLogger) {
|
|
3
|
-
program.command('setup-protocol-contracts').description('Bootstrap the blockchain by initializing all the protocol contracts').addOption(pxeOption).option('--testAccounts', 'Deploy funded test accounts.').option('--sponsoredFPC', 'Deploy a sponsored FPC.').option('--json', 'Output the contract addresses in JSON format').
|
|
3
|
+
program.command('setup-protocol-contracts').description('Bootstrap the blockchain by initializing all the protocol contracts').addOption(pxeOption).option('--testAccounts', 'Deploy funded test accounts.').option('--sponsoredFPC', 'Deploy a sponsored FPC.').option('--json', 'Output the contract addresses in JSON format').action(async (options)=>{
|
|
4
4
|
const { setupL2Contracts } = await import('./setup_l2_contract.js');
|
|
5
|
-
await setupL2Contracts(options.rpcUrl, options.testAccounts, options.sponsoredFPC, options.json,
|
|
5
|
+
await setupL2Contracts(options.rpcUrl, options.testAccounts, options.sponsoredFPC, options.json, log);
|
|
6
6
|
});
|
|
7
7
|
program.command('sequencers').argument('<command>', 'Command to run: list, add, remove, who-next').argument('[who]', 'Who to add/remove').description('Manages or queries registered sequencers on the L1 rollup contract.').requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
|
|
8
8
|
ETHEREUM_HOSTS
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
-
export declare function setupL2Contracts(rpcUrl: string, testAccounts: boolean, sponsoredFPC: boolean, json: boolean,
|
|
2
|
+
export declare function setupL2Contracts(rpcUrl: string, testAccounts: boolean, sponsoredFPC: boolean, json: boolean, log: LogFn): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=setup_l2_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,iBA8BX"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
|
|
5
6
|
import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
|
|
6
|
-
export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json,
|
|
7
|
+
export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json, log) {
|
|
7
8
|
const waitOpts = {
|
|
8
9
|
timeout: 180,
|
|
9
10
|
interval: 1
|
|
10
11
|
};
|
|
11
|
-
const waitForProvenOptions = !skipProofWait ? {
|
|
12
|
-
provenTimeout: 600
|
|
13
|
-
} : undefined;
|
|
14
12
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
15
|
-
if (waitForProvenOptions) {
|
|
16
|
-
log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
|
|
17
|
-
}
|
|
18
13
|
log('setupL2Contracts: Creating PXE client...');
|
|
19
14
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([
|
|
20
15
|
1,
|
|
@@ -23,22 +18,23 @@ export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json,
|
|
|
23
18
|
1,
|
|
24
19
|
1
|
|
25
20
|
], false));
|
|
26
|
-
|
|
21
|
+
const wallet = new TestWallet(pxe);
|
|
22
|
+
let deployedAccountManagers = [];
|
|
27
23
|
if (testAccounts) {
|
|
28
24
|
log('setupL2Contracts: Deploying test accounts...');
|
|
29
|
-
|
|
30
|
-
await deployFundedSchnorrAccounts(
|
|
25
|
+
const initialAccountsData = await getInitialTestAccountsData();
|
|
26
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
31
27
|
}
|
|
32
28
|
if (sponsoredFPC) {
|
|
33
29
|
log('setupL2Contracts: Setting up sponsored FPC...');
|
|
34
|
-
await setupSponsoredFPC(pxe, log
|
|
30
|
+
await setupSponsoredFPC(pxe, log);
|
|
35
31
|
}
|
|
36
32
|
if (json) {
|
|
37
33
|
const toPrint = {
|
|
38
34
|
...ProtocolContractAddress
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
toPrint[`testAccount${i}`] = a.
|
|
36
|
+
deployedAccountManagers.forEach((a, i)=>{
|
|
37
|
+
toPrint[`testAccount${i}`] = a.getAddress();
|
|
42
38
|
});
|
|
43
39
|
log(JSON.stringify(toPrint, null, 2));
|
|
44
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { Fr } from '@aztec/aztec.js';
|
|
3
3
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
4
|
import { SecretValue } from '@aztec/foundation/config';
|
|
@@ -7,7 +7,7 @@ import { deployAztecContracts } from '../../utils/aztec.js';
|
|
|
7
7
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
8
8
|
export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, log, debugLogger) {
|
|
9
9
|
const config = getL1ContractsConfigEnvVars();
|
|
10
|
-
const initialAccounts = testAccounts ? await
|
|
10
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
11
11
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
12
12
|
const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
|
|
13
13
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
4
4
|
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
5
5
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
6
6
|
export async function deployNewRollup(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, json, initialValidators, realVerifier, log, debugLogger) {
|
|
7
7
|
const config = getL1ContractsConfigEnvVars();
|
|
8
|
-
const initialAccounts = testAccounts ? await
|
|
8
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
9
9
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
10
10
|
const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
|
|
11
11
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -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,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,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,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,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;IAGpC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;
|
|
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,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,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,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,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;IAGpC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAoCJ,eAAO,MAAM,4BAA4B,EAAE,aAqC1C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAiDxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAiDlC,CAAC;AAIF,wBAAsB,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,MAAM,gBAgC9E;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAkBpC;AAuBD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA0F/E"}
|
|
@@ -5,6 +5,32 @@ import path, { dirname, join } from 'path';
|
|
|
5
5
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
|
|
6
6
|
type: 'json'
|
|
7
7
|
};
|
|
8
|
+
const DefaultSlashConfig = {
|
|
9
|
+
/** Tally-style slashing */ slasherFlavor: 'tally',
|
|
10
|
+
/** Allow one round for vetoing */ slashingExecutionDelayInRounds: 1,
|
|
11
|
+
/** How long for a slash payload to be executed */ slashingLifetimeInRounds: 5,
|
|
12
|
+
/** Allow 2 rounds to discover faults */ slashingOffsetInRounds: 2,
|
|
13
|
+
/** No slash vetoer */ slashingVetoer: EthAddress.ZERO,
|
|
14
|
+
/** Use default slash amounts */ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
15
|
+
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
16
|
+
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
17
|
+
// Slashing stuff
|
|
18
|
+
slashMinPenaltyPercentage: 0.5,
|
|
19
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
20
|
+
slashInactivityTargetPercentage: 0.7,
|
|
21
|
+
slashInactivityConsecutiveEpochThreshold: 1,
|
|
22
|
+
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
23
|
+
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
24
|
+
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
25
|
+
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
26
|
+
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
27
|
+
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
28
|
+
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
29
|
+
slashMaxPayloadSize: 50,
|
|
30
|
+
slashGracePeriodL2Slots: 32 * 2,
|
|
31
|
+
slashOffenseExpirationRounds: 8,
|
|
32
|
+
sentinelEnabled: true
|
|
33
|
+
};
|
|
8
34
|
export const stagingIgnitionL2ChainConfig = {
|
|
9
35
|
l1ChainId: 11155111,
|
|
10
36
|
testAccounts: true,
|
|
@@ -27,32 +53,14 @@ export const stagingIgnitionL2ChainConfig = {
|
|
|
27
53
|
'sequencer'
|
|
28
54
|
],
|
|
29
55
|
...DefaultL1ContractsConfig,
|
|
56
|
+
...DefaultSlashConfig,
|
|
30
57
|
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
31
58
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
32
59
|
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
33
60
|
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
34
61
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
35
62
|
/** The mana target for the rollup */ manaTarget: 0n,
|
|
36
|
-
/** The proving cost per mana */ provingCostPerMana: 0n
|
|
37
|
-
slasherFlavor: 'none',
|
|
38
|
-
slashAmountSmall: 0n,
|
|
39
|
-
slashAmountMedium: 0n,
|
|
40
|
-
slashAmountLarge: 0n,
|
|
41
|
-
slashMinPenaltyPercentage: 0.5,
|
|
42
|
-
slashMaxPenaltyPercentage: 200,
|
|
43
|
-
slashInactivityTargetPercentage: 0,
|
|
44
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
45
|
-
slashInactivityPenalty: 0n,
|
|
46
|
-
slashPrunePenalty: 0n,
|
|
47
|
-
slashDataWithholdingPenalty: 0n,
|
|
48
|
-
slashProposeInvalidAttestationsPenalty: 0n,
|
|
49
|
-
slashAttestDescendantOfInvalidPenalty: 0n,
|
|
50
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
51
|
-
slashMaxPayloadSize: 50,
|
|
52
|
-
slashGracePeriodL2Slots: 0,
|
|
53
|
-
slashUnknownPenalty: 0n,
|
|
54
|
-
slashOffenseExpirationRounds: 10,
|
|
55
|
-
sentinelEnabled: false
|
|
63
|
+
/** The proving cost per mana */ provingCostPerMana: 0n
|
|
56
64
|
};
|
|
57
65
|
export const stagingPublicL2ChainConfig = {
|
|
58
66
|
l1ChainId: 11155111,
|
|
@@ -80,6 +88,7 @@ export const stagingPublicL2ChainConfig = {
|
|
|
80
88
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
81
89
|
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
82
90
|
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
91
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
83
92
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
84
93
|
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
85
94
|
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
@@ -88,30 +97,7 @@ export const stagingPublicL2ChainConfig = {
|
|
|
88
97
|
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
89
98
|
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
90
99
|
/** Exit delay for stakers */ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
91
|
-
|
|
92
|
-
/** Allow one round for vetoing */ slashingExecutionDelayInRounds: 1,
|
|
93
|
-
/** How long for a slash payload to be executed */ slashingLifetimeInRounds: 5,
|
|
94
|
-
/** Allow 2 rounds to discover faults */ slashingOffsetInRounds: 2,
|
|
95
|
-
/** No slash vetoer */ slashingVetoer: EthAddress.ZERO,
|
|
96
|
-
/** Use default slash amounts */ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
97
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
98
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
99
|
-
// Slashing stuff
|
|
100
|
-
slashMinPenaltyPercentage: 0.5,
|
|
101
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
102
|
-
slashInactivityTargetPercentage: 0.7,
|
|
103
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
104
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
105
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
106
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
107
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
108
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
109
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
110
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
111
|
-
slashMaxPayloadSize: 50,
|
|
112
|
-
slashGracePeriodL2Slots: 32 * 2,
|
|
113
|
-
slashOffenseExpirationRounds: 8,
|
|
114
|
-
sentinelEnabled: true
|
|
100
|
+
...DefaultSlashConfig
|
|
115
101
|
};
|
|
116
102
|
export const testnetL2ChainConfig = {
|
|
117
103
|
l1ChainId: 11155111,
|
|
@@ -142,35 +128,13 @@ export const testnetL2ChainConfig = {
|
|
|
142
128
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
143
129
|
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
144
130
|
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
131
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
145
132
|
/** The slashing round size */ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
146
133
|
/** Governance proposing round size */ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
|
|
147
134
|
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
148
135
|
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
149
136
|
/** Exit delay for stakers */ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
150
|
-
|
|
151
|
-
/** Allow one round for vetoing */ slashingExecutionDelayInRounds: 1,
|
|
152
|
-
/** How long for a slash payload to be executed */ slashingLifetimeInRounds: 5,
|
|
153
|
-
/** Allow 2 rounds to discover faults */ slashingOffsetInRounds: 2,
|
|
154
|
-
/** No slash vetoer */ slashingVetoer: EthAddress.ZERO,
|
|
155
|
-
/** Use default slash amounts */ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
156
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
157
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
158
|
-
// Slashing stuff
|
|
159
|
-
slashMinPenaltyPercentage: 0.5,
|
|
160
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
161
|
-
slashInactivityTargetPercentage: 0.7,
|
|
162
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
163
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
164
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
165
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
166
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
167
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
168
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
169
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
170
|
-
slashMaxPayloadSize: 50,
|
|
171
|
-
slashGracePeriodL2Slots: 32 * 2,
|
|
172
|
-
slashOffenseExpirationRounds: 8,
|
|
173
|
-
sentinelEnabled: true
|
|
137
|
+
...DefaultSlashConfig
|
|
174
138
|
};
|
|
175
139
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
176
140
|
export async function getBootnodes(networkName, cacheDir) {
|
|
@@ -293,6 +257,7 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
293
257
|
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
294
258
|
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
295
259
|
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
260
|
+
enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
|
|
296
261
|
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
297
262
|
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
298
263
|
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
|
|
4
|
-
export declare function setupSponsoredFPC(pxe: PXE, log: LogFn
|
|
3
|
+
export declare function getSponsoredFPCAddress(): Promise<import("@aztec/aztec.js").AztecAddress>;
|
|
4
|
+
export declare function setupSponsoredFPC(pxe: PXE, log: LogFn): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=setup_contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,GAAG,EAA8C,MAAM,iBAAiB,CAAC;AAE3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,wBAAsB,sBAAsB,oDAM3C;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,iBAQ3D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fr, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
|
|
2
2
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
|
-
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
4
3
|
async function getSponsoredFPCContract() {
|
|
5
4
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
5
|
// @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
|
|
@@ -14,23 +13,14 @@ export async function getSponsoredFPCAddress() {
|
|
|
14
13
|
});
|
|
15
14
|
return sponsoredFPCInstance.address;
|
|
16
15
|
}
|
|
17
|
-
export async function setupSponsoredFPC(pxe, log
|
|
16
|
+
export async function setupSponsoredFPC(pxe, log) {
|
|
18
17
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
26
|
-
universalDeploy: true,
|
|
27
|
-
fee: {
|
|
28
|
-
paymentMethod
|
|
29
|
-
}
|
|
18
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
19
|
+
salt: new Fr(SPONSORED_FPC_SALT)
|
|
20
|
+
});
|
|
21
|
+
await pxe.registerContract({
|
|
22
|
+
instance: sponsoredFPCInstance,
|
|
23
|
+
artifact: SponsoredFPCContract.artifact
|
|
30
24
|
});
|
|
31
|
-
|
|
32
|
-
if (waitForProvenOptions !== undefined) {
|
|
33
|
-
await waitForProven(pxe, await deployTx.getReceipt(), waitForProvenOptions);
|
|
34
|
-
}
|
|
35
|
-
log(`SponsoredFPC: ${deployed.address}`);
|
|
25
|
+
log(`SponsoredFPC: ${sponsoredFPCInstance.address}`);
|
|
36
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250911",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -70,17 +70,20 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
81
|
-
"@aztec/
|
|
82
|
-
"@aztec/
|
|
83
|
-
"@aztec/
|
|
73
|
+
"@aztec/accounts": "3.0.0-nightly.20250911",
|
|
74
|
+
"@aztec/archiver": "3.0.0-nightly.20250911",
|
|
75
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250911",
|
|
76
|
+
"@aztec/constants": "3.0.0-nightly.20250911",
|
|
77
|
+
"@aztec/entrypoints": "3.0.0-nightly.20250911",
|
|
78
|
+
"@aztec/ethereum": "3.0.0-nightly.20250911",
|
|
79
|
+
"@aztec/foundation": "3.0.0-nightly.20250911",
|
|
80
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250911",
|
|
81
|
+
"@aztec/node-lib": "3.0.0-nightly.20250911",
|
|
82
|
+
"@aztec/p2p": "3.0.0-nightly.20250911",
|
|
83
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250911",
|
|
84
|
+
"@aztec/stdlib": "3.0.0-nightly.20250911",
|
|
85
|
+
"@aztec/test-wallet": "3.0.0-nightly.20250911",
|
|
86
|
+
"@aztec/world-state": "3.0.0-nightly.20250911",
|
|
84
87
|
"@iarna/toml": "^2.2.5",
|
|
85
88
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
86
89
|
"commander": "^12.1.0",
|
|
@@ -92,8 +95,6 @@
|
|
|
92
95
|
"viem": "2.23.7"
|
|
93
96
|
},
|
|
94
97
|
"devDependencies": {
|
|
95
|
-
"@aztec/accounts": "3.0.0-nightly.20250910",
|
|
96
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.20250910",
|
|
97
98
|
"@jest/globals": "^30.0.0",
|
|
98
99
|
"@types/jest": "^30.0.0",
|
|
99
100
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -109,15 +110,15 @@
|
|
|
109
110
|
"typescript": "^5.3.3"
|
|
110
111
|
},
|
|
111
112
|
"peerDependencies": {
|
|
112
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
113
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
114
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
115
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
116
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
117
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
118
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
119
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
120
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
113
|
+
"@aztec/accounts": "3.0.0-nightly.20250911",
|
|
114
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250911",
|
|
115
|
+
"@aztec/ethereum": "3.0.0-nightly.20250911",
|
|
116
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250911",
|
|
117
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250911",
|
|
118
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250911",
|
|
119
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20250911",
|
|
120
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250911",
|
|
121
|
+
"@aztec/stdlib": "3.0.0-nightly.20250911"
|
|
121
122
|
},
|
|
122
123
|
"files": [
|
|
123
124
|
"dest",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import {
|
|
3
3
|
AztecAddress,
|
|
4
4
|
BatchCall,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
deployL1Contract,
|
|
22
22
|
} from '@aztec/ethereum';
|
|
23
23
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
24
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
24
25
|
|
|
25
26
|
import { getContract } from 'viem';
|
|
26
27
|
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
@@ -53,14 +54,18 @@ export async function bootstrapNetwork(
|
|
|
53
54
|
debugLog: Logger,
|
|
54
55
|
) {
|
|
55
56
|
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
57
|
+
const wallet = new TestWallet(pxe);
|
|
56
58
|
|
|
57
59
|
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
58
60
|
// so all we need to do is register them to our pxe.
|
|
59
|
-
const [
|
|
60
|
-
await
|
|
61
|
+
const [accountData] = await getInitialTestAccountsData();
|
|
62
|
+
const accountManager = await wallet.createSchnorrAccount(
|
|
63
|
+
accountData.secret,
|
|
64
|
+
accountData.salt,
|
|
65
|
+
accountData.signingKey,
|
|
66
|
+
);
|
|
61
67
|
|
|
62
|
-
const
|
|
63
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
68
|
+
const defaultAccountAddress = accountManager.getAddress();
|
|
64
69
|
|
|
65
70
|
const l1Client = createExtendedL1Client(
|
|
66
71
|
l1Urls,
|
|
@@ -78,7 +83,7 @@ export async function bootstrapNetwork(
|
|
|
78
83
|
|
|
79
84
|
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
80
85
|
|
|
81
|
-
const fpcAdmin =
|
|
86
|
+
const fpcAdmin = defaultAccountAddress;
|
|
82
87
|
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
83
88
|
|
|
84
89
|
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
@@ -285,11 +290,11 @@ async function fundFPC(
|
|
|
285
290
|
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
286
291
|
const {
|
|
287
292
|
protocolContractAddresses: { feeJuice },
|
|
288
|
-
} = await
|
|
293
|
+
} = await pxe.getNodeInfo();
|
|
289
294
|
|
|
290
295
|
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
291
296
|
|
|
292
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(
|
|
297
|
+
const feeJuicePortal = await L1FeeJuicePortalManager.new(pxe, l1Client, debugLog);
|
|
293
298
|
|
|
294
299
|
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(
|
|
295
300
|
fpcAddress,
|
|
@@ -305,8 +310,8 @@ async function fundFPC(
|
|
|
305
310
|
|
|
306
311
|
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
307
312
|
// advance the chain
|
|
308
|
-
await counter.methods.increment(
|
|
309
|
-
await counter.methods.increment(
|
|
313
|
+
await counter.methods.increment(defaultAccountAddress).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
314
|
+
await counter.methods.increment(defaultAccountAddress).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
310
315
|
|
|
311
316
|
debugLog.info('Claiming FPC');
|
|
312
317
|
|
|
@@ -12,17 +12,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
12
12
|
.option('--testAccounts', 'Deploy funded test accounts.')
|
|
13
13
|
.option('--sponsoredFPC', 'Deploy a sponsored FPC.')
|
|
14
14
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
15
|
-
.option('--skipProofWait', "Don't wait for proofs to land.")
|
|
16
15
|
.action(async options => {
|
|
17
16
|
const { setupL2Contracts } = await import('./setup_l2_contract.js');
|
|
18
|
-
await setupL2Contracts(
|
|
19
|
-
options.rpcUrl,
|
|
20
|
-
options.testAccounts,
|
|
21
|
-
options.sponsoredFPC,
|
|
22
|
-
options.json,
|
|
23
|
-
options.skipProofWait,
|
|
24
|
-
log,
|
|
25
|
-
);
|
|
17
|
+
await setupL2Contracts(options.rpcUrl, options.testAccounts, options.sponsoredFPC, options.json, log);
|
|
26
18
|
});
|
|
27
19
|
|
|
28
20
|
program
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { AccountManager, type AztecAddress, type WaitOpts, createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
5
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
6
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
|
|
6
7
|
|
|
7
8
|
import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
|
|
8
9
|
|
|
@@ -11,41 +12,33 @@ export async function setupL2Contracts(
|
|
|
11
12
|
testAccounts: boolean,
|
|
12
13
|
sponsoredFPC: boolean,
|
|
13
14
|
json: boolean,
|
|
14
|
-
skipProofWait: boolean,
|
|
15
15
|
log: LogFn,
|
|
16
16
|
) {
|
|
17
17
|
const waitOpts: WaitOpts = {
|
|
18
18
|
timeout: 180,
|
|
19
19
|
interval: 1,
|
|
20
20
|
};
|
|
21
|
-
const waitForProvenOptions: WaitForProvenOpts | undefined = !skipProofWait
|
|
22
|
-
? {
|
|
23
|
-
provenTimeout: 600,
|
|
24
|
-
}
|
|
25
|
-
: undefined;
|
|
26
21
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
27
|
-
if (waitForProvenOptions) {
|
|
28
|
-
log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
|
|
29
|
-
}
|
|
30
22
|
log('setupL2Contracts: Creating PXE client...');
|
|
31
23
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
|
|
24
|
+
const wallet = new TestWallet(pxe);
|
|
32
25
|
|
|
33
|
-
let
|
|
26
|
+
let deployedAccountManagers: AccountManager[] = [];
|
|
34
27
|
if (testAccounts) {
|
|
35
28
|
log('setupL2Contracts: Deploying test accounts...');
|
|
36
|
-
|
|
37
|
-
await deployFundedSchnorrAccounts(
|
|
29
|
+
const initialAccountsData = await getInitialTestAccountsData();
|
|
30
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
if (sponsoredFPC) {
|
|
41
34
|
log('setupL2Contracts: Setting up sponsored FPC...');
|
|
42
|
-
await setupSponsoredFPC(pxe, log
|
|
35
|
+
await setupSponsoredFPC(pxe, log);
|
|
43
36
|
}
|
|
44
37
|
|
|
45
38
|
if (json) {
|
|
46
39
|
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
47
|
-
|
|
48
|
-
toPrint[`testAccount${i}`] = a.
|
|
40
|
+
deployedAccountManagers.forEach((a, i) => {
|
|
41
|
+
toPrint[`testAccount${i}`] = a.getAddress();
|
|
49
42
|
});
|
|
50
43
|
log(JSON.stringify(toPrint, null, 2));
|
|
51
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { type EthAddress, Fr } from '@aztec/aztec.js';
|
|
3
3
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
4
|
import { SecretValue } from '@aztec/foundation/config';
|
|
@@ -27,7 +27,7 @@ export async function deployL1Contracts(
|
|
|
27
27
|
) {
|
|
28
28
|
const config = getL1ContractsConfigEnvVars();
|
|
29
29
|
|
|
30
|
-
const initialAccounts = testAccounts ? await
|
|
30
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
31
31
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
32
32
|
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
33
33
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { type Operator, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
@@ -25,7 +25,7 @@ export async function deployNewRollup(
|
|
|
25
25
|
) {
|
|
26
26
|
const config = getL1ContractsConfigEnvVars();
|
|
27
27
|
|
|
28
|
-
const initialAccounts = testAccounts ? await
|
|
28
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
29
29
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
30
30
|
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
31
31
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -34,6 +34,40 @@ export type L2ChainConfig = L1ContractsConfig &
|
|
|
34
34
|
sentinelEnabled: boolean;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const DefaultSlashConfig = {
|
|
38
|
+
/** Tally-style slashing */
|
|
39
|
+
slasherFlavor: 'tally',
|
|
40
|
+
/** Allow one round for vetoing */
|
|
41
|
+
slashingExecutionDelayInRounds: 1,
|
|
42
|
+
/** How long for a slash payload to be executed */
|
|
43
|
+
slashingLifetimeInRounds: 5,
|
|
44
|
+
/** Allow 2 rounds to discover faults */
|
|
45
|
+
slashingOffsetInRounds: 2,
|
|
46
|
+
/** No slash vetoer */
|
|
47
|
+
slashingVetoer: EthAddress.ZERO,
|
|
48
|
+
/** Use default slash amounts */
|
|
49
|
+
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
50
|
+
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
51
|
+
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
52
|
+
|
|
53
|
+
// Slashing stuff
|
|
54
|
+
slashMinPenaltyPercentage: 0.5,
|
|
55
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
56
|
+
slashInactivityTargetPercentage: 0.7,
|
|
57
|
+
slashInactivityConsecutiveEpochThreshold: 1,
|
|
58
|
+
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
59
|
+
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
60
|
+
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
61
|
+
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
62
|
+
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
63
|
+
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
64
|
+
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
65
|
+
slashMaxPayloadSize: 50,
|
|
66
|
+
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
67
|
+
slashOffenseExpirationRounds: 8,
|
|
68
|
+
sentinelEnabled: true,
|
|
69
|
+
} satisfies Partial<L2ChainConfig>;
|
|
70
|
+
|
|
37
71
|
export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
38
72
|
l1ChainId: 11155111,
|
|
39
73
|
testAccounts: true,
|
|
@@ -55,6 +89,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
55
89
|
publicMetricsCollectFrom: ['sequencer'],
|
|
56
90
|
|
|
57
91
|
...DefaultL1ContractsConfig,
|
|
92
|
+
...DefaultSlashConfig,
|
|
58
93
|
|
|
59
94
|
/** How many seconds an L1 slot lasts. */
|
|
60
95
|
ethereumSlotDuration: 12,
|
|
@@ -70,26 +105,6 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
70
105
|
manaTarget: 0n,
|
|
71
106
|
/** The proving cost per mana */
|
|
72
107
|
provingCostPerMana: 0n,
|
|
73
|
-
|
|
74
|
-
slasherFlavor: 'none',
|
|
75
|
-
slashAmountSmall: 0n,
|
|
76
|
-
slashAmountMedium: 0n,
|
|
77
|
-
slashAmountLarge: 0n,
|
|
78
|
-
slashMinPenaltyPercentage: 0.5,
|
|
79
|
-
slashMaxPenaltyPercentage: 200,
|
|
80
|
-
slashInactivityTargetPercentage: 0,
|
|
81
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
82
|
-
slashInactivityPenalty: 0n,
|
|
83
|
-
slashPrunePenalty: 0n,
|
|
84
|
-
slashDataWithholdingPenalty: 0n,
|
|
85
|
-
slashProposeInvalidAttestationsPenalty: 0n,
|
|
86
|
-
slashAttestDescendantOfInvalidPenalty: 0n,
|
|
87
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
88
|
-
slashMaxPayloadSize: 50,
|
|
89
|
-
slashGracePeriodL2Slots: 0,
|
|
90
|
-
slashUnknownPenalty: 0n,
|
|
91
|
-
slashOffenseExpirationRounds: 10,
|
|
92
|
-
sentinelEnabled: false,
|
|
93
108
|
};
|
|
94
109
|
|
|
95
110
|
export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
@@ -121,6 +136,8 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
121
136
|
aztecEpochDuration: 32,
|
|
122
137
|
/** The target validator committee size. */
|
|
123
138
|
aztecTargetCommitteeSize: 48,
|
|
139
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
140
|
+
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
124
141
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
125
142
|
aztecProofSubmissionEpochs: 1,
|
|
126
143
|
/** The deposit amount for a validator */
|
|
@@ -137,37 +154,8 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
137
154
|
provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
138
155
|
/** Exit delay for stakers */
|
|
139
156
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
140
|
-
/** Tally-style slashing */
|
|
141
|
-
slasherFlavor: 'tally',
|
|
142
|
-
/** Allow one round for vetoing */
|
|
143
|
-
slashingExecutionDelayInRounds: 1,
|
|
144
|
-
/** How long for a slash payload to be executed */
|
|
145
|
-
slashingLifetimeInRounds: 5,
|
|
146
|
-
/** Allow 2 rounds to discover faults */
|
|
147
|
-
slashingOffsetInRounds: 2,
|
|
148
|
-
/** No slash vetoer */
|
|
149
|
-
slashingVetoer: EthAddress.ZERO,
|
|
150
|
-
/** Use default slash amounts */
|
|
151
|
-
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
152
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
153
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
154
157
|
|
|
155
|
-
|
|
156
|
-
slashMinPenaltyPercentage: 0.5,
|
|
157
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
158
|
-
slashInactivityTargetPercentage: 0.7,
|
|
159
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
160
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
161
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
162
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
163
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
164
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
165
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
166
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
167
|
-
slashMaxPayloadSize: 50,
|
|
168
|
-
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
169
|
-
slashOffenseExpirationRounds: 8,
|
|
170
|
-
sentinelEnabled: true,
|
|
158
|
+
...DefaultSlashConfig,
|
|
171
159
|
};
|
|
172
160
|
|
|
173
161
|
export const testnetL2ChainConfig: L2ChainConfig = {
|
|
@@ -205,6 +193,8 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
205
193
|
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
206
194
|
/** The minimum stake for a validator. */
|
|
207
195
|
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
196
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
197
|
+
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
208
198
|
/** The slashing round size */
|
|
209
199
|
slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
210
200
|
/** Governance proposing round size */
|
|
@@ -215,37 +205,8 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
215
205
|
provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
216
206
|
/** Exit delay for stakers */
|
|
217
207
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
218
|
-
/** Tally-style slashing */
|
|
219
|
-
slasherFlavor: 'tally',
|
|
220
|
-
/** Allow one round for vetoing */
|
|
221
|
-
slashingExecutionDelayInRounds: 1,
|
|
222
|
-
/** How long for a slash payload to be executed */
|
|
223
|
-
slashingLifetimeInRounds: 5,
|
|
224
|
-
/** Allow 2 rounds to discover faults */
|
|
225
|
-
slashingOffsetInRounds: 2,
|
|
226
|
-
/** No slash vetoer */
|
|
227
|
-
slashingVetoer: EthAddress.ZERO,
|
|
228
|
-
/** Use default slash amounts */
|
|
229
|
-
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
230
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
231
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
232
208
|
|
|
233
|
-
|
|
234
|
-
slashMinPenaltyPercentage: 0.5,
|
|
235
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
236
|
-
slashInactivityTargetPercentage: 0.7,
|
|
237
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
238
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
239
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
240
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
241
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
242
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
243
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
244
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
245
|
-
slashMaxPayloadSize: 50,
|
|
246
|
-
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
247
|
-
slashOffenseExpirationRounds: 8,
|
|
248
|
-
sentinelEnabled: true,
|
|
209
|
+
...DefaultSlashConfig,
|
|
249
210
|
};
|
|
250
211
|
|
|
251
212
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
@@ -385,6 +346,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
385
346
|
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
386
347
|
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
387
348
|
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
349
|
+
enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
|
|
388
350
|
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
389
351
|
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
390
352
|
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AztecAddress,
|
|
3
|
-
DefaultWaitOpts,
|
|
4
|
-
Fr,
|
|
5
|
-
type PXE,
|
|
6
|
-
SignerlessWallet,
|
|
7
|
-
SponsoredFeePaymentMethod,
|
|
8
|
-
type WaitForProvenOpts,
|
|
9
|
-
getContractInstanceFromInstantiationParams,
|
|
10
|
-
waitForProven,
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import { Fr, type PXE, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
|
|
12
2
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
13
|
-
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
14
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
15
4
|
|
|
16
5
|
async function getSponsoredFPCContract() {
|
|
@@ -28,31 +17,12 @@ export async function getSponsoredFPCAddress() {
|
|
|
28
17
|
return sponsoredFPCInstance.address;
|
|
29
18
|
}
|
|
30
19
|
|
|
31
|
-
export async function setupSponsoredFPC(
|
|
32
|
-
pxe: PXE,
|
|
33
|
-
log: LogFn,
|
|
34
|
-
waitOpts = DefaultWaitOpts,
|
|
35
|
-
waitForProvenOptions?: WaitForProvenOpts,
|
|
36
|
-
) {
|
|
20
|
+
export async function setupSponsoredFPC(pxe: PXE, log: LogFn) {
|
|
37
21
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
41
|
-
|
|
42
|
-
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
43
|
-
|
|
44
|
-
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
45
|
-
from: AztecAddress.ZERO,
|
|
46
|
-
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
47
|
-
universalDeploy: true,
|
|
48
|
-
fee: { paymentMethod },
|
|
22
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
23
|
+
salt: new Fr(SPONSORED_FPC_SALT),
|
|
49
24
|
});
|
|
25
|
+
await pxe.registerContract({ instance: sponsoredFPCInstance, artifact: SponsoredFPCContract.artifact });
|
|
50
26
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (waitForProvenOptions !== undefined) {
|
|
54
|
-
await waitForProven(pxe, await deployTx.getReceipt(), waitForProvenOptions);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
log(`SponsoredFPC: ${deployed.address}`);
|
|
27
|
+
log(`SponsoredFPC: ${sponsoredFPCInstance.address}`);
|
|
58
28
|
}
|