@aztec/cli 1.2.0 → 2.0.0-nightly.20250813
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 +29 -14
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -0
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +12 -5
- package/dest/cmds/l1/advance_epoch.js +2 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +2 -3
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +5 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +20 -6
- package/dest/cmds/pxe/get_contract_data.js +1 -1
- package/dest/cmds/pxe/get_node_info.js +4 -4
- package/dest/cmds/pxe/get_pxe_info.js +2 -2
- package/dest/utils/aztec.d.ts +1 -1
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +7 -2
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +12 -19
- package/dest/utils/setup_contracts.d.ts +2 -2
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +3 -2
- package/package.json +22 -22
- package/src/cmds/devnet/bootstrap_network.ts +23 -15
- package/src/cmds/infrastructure/sequencers.ts +19 -6
- package/src/cmds/l1/advance_epoch.ts +2 -2
- package/src/cmds/l1/assume_proven_through.ts +2 -3
- package/src/cmds/l1/deploy_l1_contracts.ts +6 -4
- package/src/cmds/l1/index.ts +6 -0
- package/src/cmds/l1/update_l1_validators.ts +32 -6
- package/src/cmds/pxe/get_contract_data.ts +1 -1
- package/src/cmds/pxe/get_node_info.ts +4 -4
- package/src/cmds/pxe/get_pxe_info.ts +2 -2
- package/src/utils/aztec.ts +13 -3
- package/src/utils/inspect.ts +11 -16
- package/src/utils/setup_contracts.ts +4 -2
|
@@ -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;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,
|
|
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"}
|
|
@@ -18,17 +18,18 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
18
18
|
const [accountManager] = await getInitialTestAccountsManagers(pxe);
|
|
19
19
|
await accountManager.register();
|
|
20
20
|
const wallet = await accountManager.getWallet();
|
|
21
|
+
const defaultAccountAddress = wallet.getAddress();
|
|
21
22
|
const l1Client = createExtendedL1Client(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
|
|
22
23
|
mnemonicToAccount(l1Mnemonic, {
|
|
23
24
|
addressIndex
|
|
24
25
|
}), createEthereumChain(l1Urls, +l1ChainId).chainInfo);
|
|
25
26
|
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
26
|
-
const { token, bridge } = await deployToken(wallet, portalAddress);
|
|
27
|
+
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
27
28
|
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
28
29
|
const fpcAdmin = wallet.getAddress();
|
|
29
|
-
const fpc = await deployFPC(wallet, token.address, fpcAdmin);
|
|
30
|
-
const counter = await deployCounter(wallet);
|
|
31
|
-
await fundFPC(pxe, counter.address, wallet, l1Client, fpc.address, debugLog);
|
|
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);
|
|
32
33
|
if (json) {
|
|
33
34
|
log(JSON.stringify({
|
|
34
35
|
devCoinL1: erc20Address.toString(),
|
|
@@ -76,10 +77,12 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
76
77
|
*/ async function deployERC20(l1Client) {
|
|
77
78
|
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
78
79
|
const erc20 = {
|
|
80
|
+
name: 'TestERC20',
|
|
79
81
|
contractAbi: TestERC20Abi,
|
|
80
82
|
contractBytecode: TestERC20Bytecode
|
|
81
83
|
};
|
|
82
84
|
const portal = {
|
|
85
|
+
name: 'TokenPortal',
|
|
83
86
|
contractAbi: TokenPortalAbi,
|
|
84
87
|
contractBytecode: TokenPortalBytecode
|
|
85
88
|
};
|
|
@@ -96,23 +99,27 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
96
99
|
}
|
|
97
100
|
/**
|
|
98
101
|
* Step 2. Deploy the L2 contracts
|
|
99
|
-
*/ async function deployToken(wallet, l1Portal) {
|
|
102
|
+
*/ async function deployToken(wallet, defaultAccountAddress, l1Portal) {
|
|
100
103
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
101
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
|
|
102
105
|
const { TokenContract } = await import('@aztec/noir-contracts.js/Token');
|
|
103
106
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
104
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
|
|
105
108
|
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
106
|
-
const devCoin = await TokenContract.deploy(wallet,
|
|
109
|
+
const devCoin = await TokenContract.deploy(wallet, defaultAccountAddress, 'DevCoin', 'DEV', 18).send({
|
|
110
|
+
from: defaultAccountAddress,
|
|
107
111
|
universalDeploy: true
|
|
108
112
|
}).deployed(waitOpts);
|
|
109
113
|
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal).send({
|
|
114
|
+
from: defaultAccountAddress,
|
|
110
115
|
universalDeploy: true
|
|
111
116
|
}).deployed(waitOpts);
|
|
112
117
|
await new BatchCall(wallet, [
|
|
113
118
|
devCoin.methods.set_minter(bridge.address, true),
|
|
114
119
|
devCoin.methods.set_admin(bridge.address)
|
|
115
|
-
]).send(
|
|
120
|
+
]).send({
|
|
121
|
+
from: defaultAccountAddress
|
|
122
|
+
}).wait(waitOpts);
|
|
116
123
|
return {
|
|
117
124
|
token: {
|
|
118
125
|
address: devCoin.address,
|
|
@@ -145,11 +152,12 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
145
152
|
hash
|
|
146
153
|
});
|
|
147
154
|
}
|
|
148
|
-
async function deployFPC(wallet, tokenAddress, admin) {
|
|
155
|
+
async function deployFPC(wallet, defaultAccountAddress, tokenAddress, admin) {
|
|
149
156
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
150
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
|
|
151
158
|
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
152
159
|
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin).send({
|
|
160
|
+
from: defaultAccountAddress,
|
|
153
161
|
universalDeploy: true
|
|
154
162
|
}).deployed(waitOpts);
|
|
155
163
|
const info = {
|
|
@@ -159,11 +167,12 @@ async function deployFPC(wallet, tokenAddress, admin) {
|
|
|
159
167
|
};
|
|
160
168
|
return info;
|
|
161
169
|
}
|
|
162
|
-
async function deployCounter(wallet) {
|
|
170
|
+
async function deployCounter(wallet, defaultAccountAddress) {
|
|
163
171
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
164
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
|
|
165
173
|
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
166
|
-
const counter = await CounterContract.deploy(wallet, 1,
|
|
174
|
+
const counter = await CounterContract.deploy(wallet, 1, defaultAccountAddress).send({
|
|
175
|
+
from: defaultAccountAddress,
|
|
167
176
|
universalDeploy: true
|
|
168
177
|
}).deployed(waitOpts);
|
|
169
178
|
const info = {
|
|
@@ -174,7 +183,7 @@ async function deployCounter(wallet) {
|
|
|
174
183
|
return info;
|
|
175
184
|
}
|
|
176
185
|
// NOTE: Disabling for now in order to get devnet running
|
|
177
|
-
async function fundFPC(pxe, counterAddress, wallet, l1Client, fpcAddress, debugLog) {
|
|
186
|
+
async function fundFPC(pxe, counterAddress, wallet, defaultAccountAddress, l1Client, fpcAddress, debugLog) {
|
|
178
187
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
179
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
|
|
180
189
|
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
@@ -190,10 +199,16 @@ async function fundFPC(pxe, counterAddress, wallet, l1Client, fpcAddress, debugL
|
|
|
190
199
|
debugLog.info('Incrementing Counter');
|
|
191
200
|
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
192
201
|
// advance the chain
|
|
193
|
-
await counter.methods.increment(wallet.getAddress()
|
|
194
|
-
|
|
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);
|
|
195
208
|
debugLog.info('Claiming FPC');
|
|
196
|
-
const receipt = await feeJuiceContract.methods.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex).send(
|
|
209
|
+
const receipt = await feeJuiceContract.methods.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex).send({
|
|
210
|
+
from: defaultAccountAddress
|
|
211
|
+
}).wait({
|
|
197
212
|
...waitOpts
|
|
198
213
|
});
|
|
199
214
|
await waitForProven(pxe, receipt, provenWaitOpts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencers.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/sequencers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,
|
|
1
|
+
{"version":3,"file":"sequencers.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/sequencers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,iBAoGA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import { RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
1
|
+
import { Fr, createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
+
import { GSEContract, RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
4
4
|
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
5
5
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
6
6
|
export async function sequencers(opts) {
|
|
7
|
-
const { command, who: maybeWho, mnemonic, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
|
|
7
|
+
const { command, who: maybeWho, mnemonic, bn254SecretKey, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
|
|
8
8
|
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
9
9
|
const { l1ContractAddresses } = await client.getNodeInfo();
|
|
10
10
|
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
@@ -45,14 +45,18 @@ export async function sequencers(opts) {
|
|
|
45
45
|
client: walletClient
|
|
46
46
|
});
|
|
47
47
|
const config = getL1ContractsConfigEnvVars();
|
|
48
|
+
const bn254SecretKeyFieldElement = bn254SecretKey ? new Fr(bn254SecretKey) : Fr.random();
|
|
49
|
+
const gseAddress = await rollup.getGSE();
|
|
50
|
+
const gseContract = new GSEContract(publicClient, gseAddress);
|
|
51
|
+
const registrationTuple = await gseContract.makeRegistrationTuple(bn254SecretKeyFieldElement.toBigInt());
|
|
48
52
|
await Promise.all([
|
|
49
53
|
await stakingAsset.write.mint([
|
|
50
54
|
walletClient.account.address,
|
|
51
|
-
config.
|
|
55
|
+
config.activationThreshold
|
|
52
56
|
], {}),
|
|
53
57
|
await stakingAsset.write.approve([
|
|
54
58
|
rollup.address,
|
|
55
|
-
config.
|
|
59
|
+
config.activationThreshold
|
|
56
60
|
], {})
|
|
57
61
|
].map((txHash)=>publicClient.waitForTransactionReceipt({
|
|
58
62
|
hash: txHash
|
|
@@ -60,6 +64,9 @@ export async function sequencers(opts) {
|
|
|
60
64
|
const hash = await writeableRollup.write.deposit([
|
|
61
65
|
who,
|
|
62
66
|
who,
|
|
67
|
+
registrationTuple.publicKeyInG1,
|
|
68
|
+
registrationTuple.publicKeyInG2,
|
|
69
|
+
registrationTuple.proofOfPossession,
|
|
63
70
|
true
|
|
64
71
|
]);
|
|
65
72
|
await publicClient.waitForTransactionReceipt({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
export async function advanceEpoch(l1RpcUrls, rpcUrl, log) {
|
|
4
4
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
|
|
5
5
|
const rollupAddress = await pxe.getNodeInfo().then((i)=>i.l1ContractAddresses.rollupAddress);
|
|
6
|
-
const cheat =
|
|
6
|
+
const cheat = RollupCheatCodes.create(l1RpcUrls, {
|
|
7
7
|
rollupAddress
|
|
8
8
|
});
|
|
9
9
|
await cheat.advanceToNextEpoch();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assume_proven_through.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/assume_proven_through.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,mBAAmB,CACvC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"assume_proven_through.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/assume_proven_through.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,mBAAmB,CACvC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,iBAUX"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
export async function assumeProvenThrough(blockNumberOrLatest, l1RpcUrls, rpcUrl, log) {
|
|
4
4
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
|
|
5
5
|
const rollupAddress = await pxe.getNodeInfo().then((i)=>i.l1ContractAddresses.rollupAddress);
|
|
6
6
|
const blockNumber = blockNumberOrLatest ?? await pxe.getBlockNumber();
|
|
7
|
-
const
|
|
8
|
-
const rollupCheatCodes = new RollupCheatCodes(ethCheatCode, {
|
|
7
|
+
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, {
|
|
9
8
|
rollupAddress
|
|
10
9
|
});
|
|
11
10
|
await rollupCheatCodes.markAsProven(blockNumber);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EthAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
3
|
export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, initialValidators: EthAddress[], realVerifier: boolean, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=deploy_l1_contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA2DpB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js';
|
|
2
3
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
3
5
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
4
6
|
import { deployAztecContracts } from '../../utils/aztec.js';
|
|
5
7
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
@@ -11,13 +13,14 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
|
|
|
11
13
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
12
14
|
const initialValidatorOperators = initialValidators.map((a)=>({
|
|
13
15
|
attester: a,
|
|
14
|
-
withdrawer: a
|
|
16
|
+
withdrawer: a,
|
|
17
|
+
bn254SecretKey: new SecretValue(Fr.random().toBigInt())
|
|
15
18
|
}));
|
|
16
19
|
const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidatorOperators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, realVerifier, debugLogger);
|
|
17
20
|
if (json) {
|
|
18
21
|
log(JSON.stringify(Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v])=>[
|
|
19
22
|
k,
|
|
20
|
-
v
|
|
23
|
+
v?.toString() ?? 'Not deployed'
|
|
21
24
|
])), null, 2));
|
|
22
25
|
} else {
|
|
23
26
|
log(`Rollup Address: ${l1ContractAddresses.rollupAddress.toString()}`);
|
|
@@ -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;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAajD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAW3D,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;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAajD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAW3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WA6iB/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -95,7 +95,7 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
95
95
|
const account = generateL1Account();
|
|
96
96
|
log(JSON.stringify(account, null, 2));
|
|
97
97
|
});
|
|
98
|
-
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress).option('--proof <buffer>', 'The proof to use for the attestation', (arg)=>Buffer.from(withoutHexPrefix(arg), 'hex')).option('--merkle-proof <string>', 'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)', (arg)=>arg.split(',')).action(async (options)=>{
|
|
98
|
+
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--bls-secret-key <string>', 'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.', parseBigint).option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress).option('--proof <buffer>', 'The proof to use for the attestation', (arg)=>Buffer.from(withoutHexPrefix(arg), 'hex')).option('--merkle-proof <string>', 'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)', (arg)=>arg.split(',')).action(async (options)=>{
|
|
99
99
|
const { addL1Validator } = await import('./update_l1_validators.js');
|
|
100
100
|
await addL1Validator({
|
|
101
101
|
rpcUrls: options.l1RpcUrls,
|
|
@@ -106,6 +106,7 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
106
106
|
stakingAssetHandlerAddress: options.stakingAssetHandler,
|
|
107
107
|
merkleProof: options.merkleProof,
|
|
108
108
|
proofParams: options.proof,
|
|
109
|
+
blsSecretKey: options.blsSecretKey,
|
|
109
110
|
log,
|
|
110
111
|
debugLogger
|
|
111
112
|
});
|
|
@@ -23,7 +23,8 @@ export declare function generateL1Account(): {
|
|
|
23
23
|
privateKey: `0x${string}`;
|
|
24
24
|
address: `0x${string}`;
|
|
25
25
|
};
|
|
26
|
-
export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
|
|
26
|
+
export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, blsSecretKey, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
|
|
27
|
+
blsSecretKey: bigint;
|
|
27
28
|
attesterAddress: EthAddress;
|
|
28
29
|
proofParams: Buffer;
|
|
29
30
|
merkleProof: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,YAAY,EACZ,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAC/B,UAAU,GAAG;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,iBA4DF;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAiBnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GSEContract, L1TxUtils, RollupContract, createEthereumChain, createExtendedL1Client, getL1ContractsConfigEnvVars, getPublicClient, isAnvilTestChain } from '@aztec/ethereum';
|
|
2
|
+
import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
2
3
|
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
3
4
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
4
5
|
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
@@ -13,7 +14,7 @@ export function generateL1Account() {
|
|
|
13
14
|
address: account.address
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger }) {
|
|
17
|
+
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, blsSecretKey, log, debugLogger }) {
|
|
17
18
|
const dualLog = makeDualLog(log, debugLogger);
|
|
18
19
|
const account = getAccount(privateKey, mnemonic);
|
|
19
20
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
@@ -23,8 +24,16 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
|
|
|
23
24
|
abi: StakingAssetHandlerAbi,
|
|
24
25
|
client: l1Client
|
|
25
26
|
});
|
|
26
|
-
const
|
|
27
|
-
dualLog(`Adding validator ${attesterAddress} to rollup ${
|
|
27
|
+
const rollupAddress = await stakingAssetHandler.read.getRollup();
|
|
28
|
+
dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()}`);
|
|
29
|
+
const rollup = getContract({
|
|
30
|
+
address: rollupAddress,
|
|
31
|
+
abi: RollupAbi,
|
|
32
|
+
client: l1Client
|
|
33
|
+
});
|
|
34
|
+
const gseAddress = await rollup.read.getGSE();
|
|
35
|
+
const gse = new GSEContract(l1Client, gseAddress);
|
|
36
|
+
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
28
37
|
const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
|
|
29
38
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
30
39
|
const merkleProofArray = merkleProof.map((proof)=>addLeadingHex(proof));
|
|
@@ -36,7 +45,10 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
|
|
|
36
45
|
args: [
|
|
37
46
|
attesterAddress.toString(),
|
|
38
47
|
merkleProofArray,
|
|
39
|
-
proofParamsObj.toViem()
|
|
48
|
+
proofParamsObj.toViem(),
|
|
49
|
+
registrationTuple.publicKeyInG1,
|
|
50
|
+
registrationTuple.publicKeyInG2,
|
|
51
|
+
registrationTuple.proofOfPossession
|
|
40
52
|
]
|
|
41
53
|
}),
|
|
42
54
|
abi: StakingAssetHandlerAbi
|
|
@@ -114,7 +126,9 @@ export async function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEp
|
|
|
114
126
|
]);
|
|
115
127
|
dualLog(`Fast forwarding ${numEpochs} epochs to ${timestamp}`);
|
|
116
128
|
try {
|
|
117
|
-
await cheatCodes.warp(Number(timestamp)
|
|
129
|
+
await cheatCodes.warp(Number(timestamp), {
|
|
130
|
+
resetBlockInterval: true
|
|
131
|
+
});
|
|
118
132
|
dualLog(`Fast forwarded ${numEpochs} epochs to ${timestamp}`);
|
|
119
133
|
} catch (error) {
|
|
120
134
|
if (error instanceof Error && error.message.includes("is lower than or equal to previous block's timestamp")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
2
|
export async function getContractData(rpcUrl, contractAddress, includeBytecode, debugLogger, log) {
|
|
3
3
|
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
4
|
-
const { contractInstance: instance, isContractInitialized: isInitialized,
|
|
4
|
+
const { contractInstance: instance, isContractInitialized: isInitialized, isContractPublished: isPubliclyDeployed } = await client.getContractMetadata(contractAddress);
|
|
5
5
|
const contractClass = includeBytecode && instance && (await client.getContractClassMetadata(instance?.currentContractClassId)).contractClass;
|
|
6
6
|
const isPrivatelyDeployed = !!instance;
|
|
7
7
|
const initStr = isInitialized ? 'initialized' : 'not initialized';
|
|
@@ -30,9 +30,9 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
30
30
|
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()
|
|
31
31
|
},
|
|
32
32
|
protocolContractAddresses: {
|
|
33
|
-
|
|
33
|
+
classRegistry: info.protocolContractAddresses.classRegistry.toString(),
|
|
34
34
|
feeJuice: info.protocolContractAddresses.feeJuice.toString(),
|
|
35
|
-
|
|
35
|
+
instanceRegistry: info.protocolContractAddresses.instanceRegistry.toString(),
|
|
36
36
|
multiCallEntrypoint: info.protocolContractAddresses.multiCallEntrypoint.toString()
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -57,9 +57,9 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
57
57
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
58
58
|
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
59
59
|
log(`L2 Contract Addresses:`);
|
|
60
|
-
log(` Class
|
|
60
|
+
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
61
61
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
62
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.
|
|
62
|
+
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
63
63
|
log(` MultiCall: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -4,8 +4,8 @@ export async function getPXEInfo(rpcUrl, debugLogger, log) {
|
|
|
4
4
|
const info = await client.getPXEInfo();
|
|
5
5
|
log(`PXE Version: ${info.pxeVersion}`);
|
|
6
6
|
log(`Protocol Contract Addresses:`);
|
|
7
|
-
log(` Class
|
|
7
|
+
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
8
8
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
9
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.
|
|
9
|
+
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
10
10
|
log(` Multi Call Entrypoint: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
11
11
|
}
|
package/dest/utils/aztec.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddress, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { type ContractArtifact, type FunctionAbi } from '@aztec/aztec.js/abi';
|
|
3
3
|
import { type DeployL1ContractsReturnType, type L1ContractsConfig, type Operator, RollupContract } from '@aztec/ethereum';
|
|
4
|
-
import
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
6
6
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,CA6BtC;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,mBAAmB,EAAE,UAAU,CAAA;CAAE,CAAC,CA6CtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAK7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js';
|
|
2
2
|
import { FunctionType, getAllFunctionAbis, loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
3
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
5
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
4
6
|
import TOML from '@iarna/toml';
|
|
5
7
|
import { readFile } from 'fs/promises';
|
|
@@ -54,11 +56,14 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
54
56
|
const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
|
|
55
57
|
if (!initialValidators || initialValidators.length === 0) {
|
|
56
58
|
// initialize the new rollup with Amin's validator address.
|
|
57
|
-
const
|
|
59
|
+
const aminAddressString = '0x3b218d0F26d15B36C715cB06c949210a0d630637';
|
|
60
|
+
const amin = EthAddress.fromString(aminAddressString);
|
|
58
61
|
initialValidators = [
|
|
59
62
|
{
|
|
60
63
|
attester: amin,
|
|
61
|
-
withdrawer: amin
|
|
64
|
+
withdrawer: amin,
|
|
65
|
+
// No secrets here. The actual keys are not currently used.
|
|
66
|
+
bn254SecretKey: new SecretValue(Fr.fromHexString(aminAddressString).toBigInt())
|
|
62
67
|
}
|
|
63
68
|
];
|
|
64
69
|
logger.info('Initializing new rollup with old attesters', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0B7G;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0B7G;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,iBA8FrE;AAuCD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AAC/D,KAAK,2BAA2B,GAAG,gBAAgB,GAAG;IAAE,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC"}
|
package/dest/utils/inspect.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
2
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
3
|
-
import { NoteStatus } from '@aztec/stdlib/note';
|
|
4
3
|
export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
|
|
5
4
|
const block = await pxe.getBlock(blockNumber);
|
|
6
5
|
if (!block) {
|
|
@@ -29,13 +28,9 @@ export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
32
|
-
const [receipt, effectsInBlock
|
|
31
|
+
const [receipt, effectsInBlock] = await Promise.all([
|
|
33
32
|
pxe.getTxReceipt(txHash),
|
|
34
|
-
pxe.getTxEffect(txHash)
|
|
35
|
-
pxe.getNotes({
|
|
36
|
-
txHash,
|
|
37
|
-
status: NoteStatus.ACTIVE_OR_NULLIFIED
|
|
38
|
-
})
|
|
33
|
+
pxe.getTxEffect(txHash)
|
|
39
34
|
]);
|
|
40
35
|
// Base tx data
|
|
41
36
|
log(`Tx ${txHash.toString()}`);
|
|
@@ -74,12 +69,9 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
74
69
|
const notes = effects.noteHashes;
|
|
75
70
|
if (notes.length > 0) {
|
|
76
71
|
log(' Created notes:');
|
|
77
|
-
log(` Total: ${notes.length}
|
|
78
|
-
|
|
79
|
-
log(
|
|
80
|
-
for (const note of getNotes){
|
|
81
|
-
inspectNote(note, artifactMap, log);
|
|
82
|
-
}
|
|
72
|
+
log(` Total: ${notes.length}`);
|
|
73
|
+
for (const note of notes){
|
|
74
|
+
log(` Note hash: ${note.toShortString()}`);
|
|
83
75
|
}
|
|
84
76
|
}
|
|
85
77
|
// Nullifiers
|
|
@@ -88,10 +80,11 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
88
80
|
if (nullifierCount > 0) {
|
|
89
81
|
log(' Nullifiers:');
|
|
90
82
|
for (const nullifier of effects.nullifiers){
|
|
91
|
-
const [note] = await pxe.getNotes({
|
|
92
|
-
siloedNullifier: nullifier
|
|
93
|
-
});
|
|
94
83
|
const deployed = deployNullifiers[nullifier.toString()];
|
|
84
|
+
const note = deployed ? (await pxe.getNotes({
|
|
85
|
+
siloedNullifier: nullifier,
|
|
86
|
+
contractAddress: deployed
|
|
87
|
+
}))[0] : undefined;
|
|
95
88
|
const initialized = initNullifiers[nullifier.toString()];
|
|
96
89
|
const registered = classNullifiers[nullifier.toString()];
|
|
97
90
|
if (nullifier.toBuffer().equals(txHash.toBuffer())) {
|
|
@@ -135,8 +128,8 @@ function toFriendlyAddress(address, artifactMap) {
|
|
|
135
128
|
}
|
|
136
129
|
async function getKnownNullifiers(pxe, artifactMap) {
|
|
137
130
|
const knownContracts = await pxe.getContracts();
|
|
138
|
-
const deployerAddress = ProtocolContractAddress.
|
|
139
|
-
const
|
|
131
|
+
const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
|
|
132
|
+
const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
|
|
140
133
|
const initNullifiers = {};
|
|
141
134
|
const deployNullifiers = {};
|
|
142
135
|
const classNullifiers = {};
|
|
@@ -145,7 +138,7 @@ async function getKnownNullifiers(pxe, artifactMap) {
|
|
|
145
138
|
deployNullifiers[(await siloNullifier(deployerAddress, contract.toField())).toString()] = contract;
|
|
146
139
|
}
|
|
147
140
|
for (const artifact of Object.values(artifactMap)){
|
|
148
|
-
classNullifiers[(await siloNullifier(
|
|
141
|
+
classNullifiers[(await siloNullifier(classRegistryAddress, artifact.classId)).toString()] = `${artifact.name}Class<${artifact.classId}>`;
|
|
149
142
|
}
|
|
150
143
|
return {
|
|
151
144
|
initNullifiers,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PXE, type WaitForProvenOpts } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type PXE, type WaitForProvenOpts } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function getSponsoredFPCAddress(): Promise<
|
|
3
|
+
export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
|
|
4
4
|
export declare function setupSponsoredFPC(pxe: PXE, log: LogFn, waitOpts?: import("@aztec/aztec.js").WaitOpts, waitForProvenOptions?: WaitForProvenOpts): 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,EACL,YAAY,EAGZ,KAAK,GAAG,EAGR,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,wBAAsB,sBAAsB,0BAM3C;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,KAAK,EACV,QAAQ,qCAAkB,EAC1B,oBAAoB,CAAC,EAAE,iBAAiB,iBAuBzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultWaitOpts, Fr, SignerlessWallet, SponsoredFeePaymentMethod,
|
|
1
|
+
import { AztecAddress, DefaultWaitOpts, Fr, SignerlessWallet, SponsoredFeePaymentMethod, getContractInstanceFromInstantiationParams, waitForProven } from '@aztec/aztec.js';
|
|
2
2
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
3
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
4
4
|
async function getSponsoredFPCContract() {
|
|
@@ -9,7 +9,7 @@ async function getSponsoredFPCContract() {
|
|
|
9
9
|
}
|
|
10
10
|
export async function getSponsoredFPCAddress() {
|
|
11
11
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
12
|
-
const sponsoredFPCInstance = await
|
|
12
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
13
13
|
salt: new Fr(SPONSORED_FPC_SALT)
|
|
14
14
|
});
|
|
15
15
|
return sponsoredFPCInstance.address;
|
|
@@ -21,6 +21,7 @@ export async function setupSponsoredFPC(pxe, log, waitOpts = DefaultWaitOpts, wa
|
|
|
21
21
|
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
22
22
|
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
23
23
|
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
24
|
+
from: AztecAddress.ZERO,
|
|
24
25
|
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
25
26
|
universalDeploy: true,
|
|
26
27
|
fee: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-nightly.20250813",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -69,15 +69,16 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/archiver": "
|
|
73
|
-
"@aztec/aztec.js": "
|
|
74
|
-
"@aztec/constants": "
|
|
75
|
-
"@aztec/entrypoints": "
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
72
|
+
"@aztec/archiver": "2.0.0-nightly.20250813",
|
|
73
|
+
"@aztec/aztec.js": "2.0.0-nightly.20250813",
|
|
74
|
+
"@aztec/constants": "2.0.0-nightly.20250813",
|
|
75
|
+
"@aztec/entrypoints": "2.0.0-nightly.20250813",
|
|
76
|
+
"@aztec/ethereum": "2.0.0-nightly.20250813",
|
|
77
|
+
"@aztec/foundation": "2.0.0-nightly.20250813",
|
|
78
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250813",
|
|
79
|
+
"@aztec/p2p": "2.0.0-nightly.20250813",
|
|
80
|
+
"@aztec/stdlib": "2.0.0-nightly.20250813",
|
|
81
|
+
"@aztec/world-state": "2.0.0-nightly.20250813",
|
|
81
82
|
"@iarna/toml": "^2.2.5",
|
|
82
83
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
83
84
|
"commander": "^12.1.0",
|
|
@@ -89,9 +90,8 @@
|
|
|
89
90
|
"viem": "2.23.7"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
|
-
"@aztec/accounts": "
|
|
93
|
-
"@aztec/
|
|
94
|
-
"@aztec/protocol-contracts": "1.2.0",
|
|
93
|
+
"@aztec/accounts": "2.0.0-nightly.20250813",
|
|
94
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250813",
|
|
95
95
|
"@jest/globals": "^30.0.0",
|
|
96
96
|
"@types/jest": "^30.0.0",
|
|
97
97
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -107,15 +107,15 @@
|
|
|
107
107
|
"typescript": "^5.3.3"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
|
-
"@aztec/accounts": "
|
|
111
|
-
"@aztec/bb-prover": "
|
|
112
|
-
"@aztec/ethereum": "
|
|
113
|
-
"@aztec/l1-artifacts": "
|
|
114
|
-
"@aztec/noir-contracts.js": "
|
|
115
|
-
"@aztec/noir-protocol-circuits-types": "
|
|
116
|
-
"@aztec/noir-test-contracts.js": "
|
|
117
|
-
"@aztec/protocol-contracts": "
|
|
118
|
-
"@aztec/stdlib": "
|
|
110
|
+
"@aztec/accounts": "2.0.0-nightly.20250813",
|
|
111
|
+
"@aztec/bb-prover": "2.0.0-nightly.20250813",
|
|
112
|
+
"@aztec/ethereum": "2.0.0-nightly.20250813",
|
|
113
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250813",
|
|
114
|
+
"@aztec/noir-contracts.js": "2.0.0-nightly.20250813",
|
|
115
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250813",
|
|
116
|
+
"@aztec/noir-test-contracts.js": "2.0.0-nightly.20250813",
|
|
117
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250813",
|
|
118
|
+
"@aztec/stdlib": "2.0.0-nightly.20250813"
|
|
119
119
|
},
|
|
120
120
|
"files": [
|
|
121
121
|
"dest",
|
|
@@ -60,6 +60,7 @@ export async function bootstrapNetwork(
|
|
|
60
60
|
await accountManager.register();
|
|
61
61
|
|
|
62
62
|
const wallet = await accountManager.getWallet();
|
|
63
|
+
const defaultAccountAddress = wallet.getAddress();
|
|
63
64
|
|
|
64
65
|
const l1Client = createExtendedL1Client(
|
|
65
66
|
l1Urls,
|
|
@@ -73,16 +74,16 @@ export async function bootstrapNetwork(
|
|
|
73
74
|
|
|
74
75
|
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
75
76
|
|
|
76
|
-
const { token, bridge } = await deployToken(wallet, portalAddress);
|
|
77
|
+
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
77
78
|
|
|
78
79
|
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
79
80
|
|
|
80
81
|
const fpcAdmin = wallet.getAddress();
|
|
81
|
-
const fpc = await deployFPC(wallet, token.address, fpcAdmin);
|
|
82
|
+
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
82
83
|
|
|
83
|
-
const counter = await deployCounter(wallet);
|
|
84
|
+
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
84
85
|
|
|
85
|
-
await fundFPC(pxe, counter.address, wallet, l1Client, fpc.address, debugLog);
|
|
86
|
+
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
86
87
|
|
|
87
88
|
if (json) {
|
|
88
89
|
log(
|
|
@@ -140,10 +141,12 @@ async function deployERC20(l1Client: ExtendedViemWalletClient) {
|
|
|
140
141
|
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
141
142
|
|
|
142
143
|
const erc20: ContractArtifacts = {
|
|
144
|
+
name: 'TestERC20',
|
|
143
145
|
contractAbi: TestERC20Abi,
|
|
144
146
|
contractBytecode: TestERC20Bytecode,
|
|
145
147
|
};
|
|
146
148
|
const portal: ContractArtifacts = {
|
|
149
|
+
name: 'TokenPortal',
|
|
147
150
|
contractAbi: TokenPortalAbi,
|
|
148
151
|
contractBytecode: TokenPortalBytecode,
|
|
149
152
|
};
|
|
@@ -166,6 +169,7 @@ async function deployERC20(l1Client: ExtendedViemWalletClient) {
|
|
|
166
169
|
*/
|
|
167
170
|
async function deployToken(
|
|
168
171
|
wallet: Wallet,
|
|
172
|
+
defaultAccountAddress: AztecAddress,
|
|
169
173
|
l1Portal: EthAddress,
|
|
170
174
|
): Promise<{ token: ContractDeploymentInfo; bridge: ContractDeploymentInfo }> {
|
|
171
175
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -174,18 +178,18 @@ async function deployToken(
|
|
|
174
178
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
175
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
|
|
176
180
|
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
177
|
-
const devCoin = await TokenContract.deploy(wallet,
|
|
178
|
-
.send({ universalDeploy: true })
|
|
181
|
+
const devCoin = await TokenContract.deploy(wallet, defaultAccountAddress, 'DevCoin', 'DEV', 18)
|
|
182
|
+
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
179
183
|
.deployed(waitOpts);
|
|
180
184
|
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal)
|
|
181
|
-
.send({ universalDeploy: true })
|
|
185
|
+
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
182
186
|
.deployed(waitOpts);
|
|
183
187
|
|
|
184
188
|
await new BatchCall(wallet, [
|
|
185
189
|
devCoin.methods.set_minter(bridge.address, true),
|
|
186
190
|
devCoin.methods.set_admin(bridge.address),
|
|
187
191
|
])
|
|
188
|
-
.send()
|
|
192
|
+
.send({ from: defaultAccountAddress })
|
|
189
193
|
.wait(waitOpts);
|
|
190
194
|
|
|
191
195
|
return {
|
|
@@ -230,13 +234,16 @@ async function initPortal(
|
|
|
230
234
|
|
|
231
235
|
async function deployFPC(
|
|
232
236
|
wallet: Wallet,
|
|
237
|
+
defaultAccountAddress: AztecAddress,
|
|
233
238
|
tokenAddress: AztecAddress,
|
|
234
239
|
admin: AztecAddress,
|
|
235
240
|
): Promise<ContractDeploymentInfo> {
|
|
236
241
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
237
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
|
|
238
243
|
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
239
|
-
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin)
|
|
244
|
+
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin)
|
|
245
|
+
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
246
|
+
.deployed(waitOpts);
|
|
240
247
|
const info: ContractDeploymentInfo = {
|
|
241
248
|
address: fpc.address,
|
|
242
249
|
initHash: fpc.instance.initializationHash,
|
|
@@ -245,12 +252,12 @@ async function deployFPC(
|
|
|
245
252
|
return info;
|
|
246
253
|
}
|
|
247
254
|
|
|
248
|
-
async function deployCounter(wallet: Wallet): Promise<ContractDeploymentInfo> {
|
|
255
|
+
async function deployCounter(wallet: Wallet, defaultAccountAddress: AztecAddress): Promise<ContractDeploymentInfo> {
|
|
249
256
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
250
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
|
|
251
258
|
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
252
|
-
const counter = await CounterContract.deploy(wallet, 1,
|
|
253
|
-
.send({ universalDeploy: true })
|
|
259
|
+
const counter = await CounterContract.deploy(wallet, 1, defaultAccountAddress)
|
|
260
|
+
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
254
261
|
.deployed(waitOpts);
|
|
255
262
|
const info: ContractDeploymentInfo = {
|
|
256
263
|
address: counter.address,
|
|
@@ -265,6 +272,7 @@ async function fundFPC(
|
|
|
265
272
|
pxe: PXE,
|
|
266
273
|
counterAddress: AztecAddress,
|
|
267
274
|
wallet: Wallet,
|
|
275
|
+
defaultAccountAddress: AztecAddress,
|
|
268
276
|
l1Client: ExtendedViemWalletClient,
|
|
269
277
|
fpcAddress: AztecAddress,
|
|
270
278
|
debugLog: Logger,
|
|
@@ -297,14 +305,14 @@ async function fundFPC(
|
|
|
297
305
|
|
|
298
306
|
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
299
307
|
// advance the chain
|
|
300
|
-
await counter.methods.increment(wallet.getAddress()
|
|
301
|
-
await counter.methods.increment(wallet.getAddress()
|
|
308
|
+
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
309
|
+
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
302
310
|
|
|
303
311
|
debugLog.info('Claiming FPC');
|
|
304
312
|
|
|
305
313
|
const receipt = await feeJuiceContract.methods
|
|
306
314
|
.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex)
|
|
307
|
-
.send()
|
|
315
|
+
.send({ from: defaultAccountAddress })
|
|
308
316
|
.wait({ ...waitOpts });
|
|
309
317
|
|
|
310
318
|
await waitForProven(pxe, receipt, provenWaitOpts);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import { RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
1
|
+
import { Fr, createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
+
import { GSEContract, RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
5
|
|
|
@@ -10,6 +10,7 @@ export async function sequencers(opts: {
|
|
|
10
10
|
command: 'list' | 'add' | 'remove' | 'who-next' | 'flush';
|
|
11
11
|
who?: string;
|
|
12
12
|
mnemonic?: string;
|
|
13
|
+
bn254SecretKey?: bigint;
|
|
13
14
|
rpcUrl: string;
|
|
14
15
|
l1RpcUrls: string[];
|
|
15
16
|
chainId: number;
|
|
@@ -17,7 +18,7 @@ export async function sequencers(opts: {
|
|
|
17
18
|
log: LogFn;
|
|
18
19
|
debugLogger: Logger;
|
|
19
20
|
}) {
|
|
20
|
-
const { command, who: maybeWho, mnemonic, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
|
|
21
|
+
const { command, who: maybeWho, mnemonic, bn254SecretKey, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
|
|
21
22
|
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
22
23
|
const { l1ContractAddresses } = await client.getNodeInfo();
|
|
23
24
|
|
|
@@ -72,14 +73,26 @@ export async function sequencers(opts: {
|
|
|
72
73
|
|
|
73
74
|
const config = getL1ContractsConfigEnvVars();
|
|
74
75
|
|
|
76
|
+
const bn254SecretKeyFieldElement = bn254SecretKey ? new Fr(bn254SecretKey) : Fr.random();
|
|
77
|
+
const gseAddress = await rollup.getGSE();
|
|
78
|
+
const gseContract = new GSEContract(publicClient, gseAddress);
|
|
79
|
+
const registrationTuple = await gseContract.makeRegistrationTuple(bn254SecretKeyFieldElement.toBigInt());
|
|
80
|
+
|
|
75
81
|
await Promise.all(
|
|
76
82
|
[
|
|
77
|
-
await stakingAsset.write.mint([walletClient.account.address, config.
|
|
78
|
-
await stakingAsset.write.approve([rollup.address, config.
|
|
83
|
+
await stakingAsset.write.mint([walletClient.account.address, config.activationThreshold], {} as any),
|
|
84
|
+
await stakingAsset.write.approve([rollup.address, config.activationThreshold], {} as any),
|
|
79
85
|
].map(txHash => publicClient.waitForTransactionReceipt({ hash: txHash })),
|
|
80
86
|
);
|
|
81
87
|
|
|
82
|
-
const hash = await writeableRollup.write.deposit([
|
|
88
|
+
const hash = await writeableRollup.write.deposit([
|
|
89
|
+
who,
|
|
90
|
+
who,
|
|
91
|
+
registrationTuple.publicKeyInG1,
|
|
92
|
+
registrationTuple.publicKeyInG2,
|
|
93
|
+
registrationTuple.proofOfPossession,
|
|
94
|
+
true,
|
|
95
|
+
]);
|
|
83
96
|
await publicClient.waitForTransactionReceipt({ hash });
|
|
84
97
|
log(`Added in tx ${hash}`);
|
|
85
98
|
} else if (command === 'flush') {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
export async function advanceEpoch(l1RpcUrls: string[], rpcUrl: string, log: LogFn) {
|
|
6
6
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
|
|
7
7
|
const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
8
8
|
|
|
9
|
-
const cheat =
|
|
9
|
+
const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
|
|
10
10
|
|
|
11
11
|
await cheat.advanceToNextEpoch();
|
|
12
12
|
log(`Warped time to advance to next epoch`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
export async function assumeProvenThrough(
|
|
@@ -12,8 +12,7 @@ export async function assumeProvenThrough(
|
|
|
12
12
|
const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
13
13
|
const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const rollupCheatCodes = new RollupCheatCodes(ethCheatCode, { rollupAddress });
|
|
15
|
+
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
|
|
17
16
|
|
|
18
17
|
await rollupCheatCodes.markAsProven(blockNumber);
|
|
19
18
|
log(`Assumed proven through block ${blockNumber}`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
2
|
+
import { type EthAddress, Fr } from '@aztec/aztec.js';
|
|
3
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
4
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
5
6
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
6
7
|
|
|
@@ -33,7 +34,8 @@ export async function deployL1Contracts(
|
|
|
33
34
|
const initialValidatorOperators = initialValidators.map(a => ({
|
|
34
35
|
attester: a,
|
|
35
36
|
withdrawer: a,
|
|
36
|
-
|
|
37
|
+
bn254SecretKey: new SecretValue(Fr.random().toBigInt()),
|
|
38
|
+
}));
|
|
37
39
|
|
|
38
40
|
const { l1ContractAddresses } = await deployAztecContracts(
|
|
39
41
|
rpcUrls,
|
|
@@ -54,7 +56,7 @@ export async function deployL1Contracts(
|
|
|
54
56
|
if (json) {
|
|
55
57
|
log(
|
|
56
58
|
JSON.stringify(
|
|
57
|
-
Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v]) => [k, v
|
|
59
|
+
Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v]) => [k, v?.toString() ?? 'Not deployed'])),
|
|
58
60
|
null,
|
|
59
61
|
2,
|
|
60
62
|
),
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -293,6 +293,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
293
293
|
)
|
|
294
294
|
.addOption(l1ChainIdOption)
|
|
295
295
|
.option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress)
|
|
296
|
+
.option(
|
|
297
|
+
'--bls-secret-key <string>',
|
|
298
|
+
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
|
|
299
|
+
parseBigint,
|
|
300
|
+
)
|
|
296
301
|
.option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress)
|
|
297
302
|
.option('--proof <buffer>', 'The proof to use for the attestation', arg =>
|
|
298
303
|
Buffer.from(withoutHexPrefix(arg), 'hex'),
|
|
@@ -313,6 +318,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
313
318
|
stakingAssetHandlerAddress: options.stakingAssetHandler,
|
|
314
319
|
merkleProof: options.merkleProof,
|
|
315
320
|
proofParams: options.proof,
|
|
321
|
+
blsSecretKey: options.blsSecretKey,
|
|
316
322
|
log,
|
|
317
323
|
debugLogger,
|
|
318
324
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
GSEContract,
|
|
3
3
|
L1TxUtils,
|
|
4
4
|
RollupContract,
|
|
5
5
|
createEthereumChain,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getPublicClient,
|
|
9
9
|
isAnvilTestChain,
|
|
10
10
|
} from '@aztec/ethereum';
|
|
11
|
+
import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
11
12
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
13
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
13
14
|
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
@@ -59,10 +60,16 @@ export async function addL1Validator({
|
|
|
59
60
|
stakingAssetHandlerAddress,
|
|
60
61
|
merkleProof,
|
|
61
62
|
proofParams,
|
|
63
|
+
blsSecretKey,
|
|
62
64
|
log,
|
|
63
65
|
debugLogger,
|
|
64
66
|
}: StakingAssetHandlerCommandArgs &
|
|
65
|
-
LoggerArgs & {
|
|
67
|
+
LoggerArgs & {
|
|
68
|
+
blsSecretKey: bigint; // scalar field element of BN254
|
|
69
|
+
attesterAddress: EthAddress;
|
|
70
|
+
proofParams: Buffer;
|
|
71
|
+
merkleProof: string[];
|
|
72
|
+
}) {
|
|
66
73
|
const dualLog = makeDualLog(log, debugLogger);
|
|
67
74
|
const account = getAccount(privateKey, mnemonic);
|
|
68
75
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
@@ -74,8 +81,20 @@ export async function addL1Validator({
|
|
|
74
81
|
client: l1Client,
|
|
75
82
|
});
|
|
76
83
|
|
|
77
|
-
const
|
|
78
|
-
dualLog(`Adding validator ${attesterAddress} to rollup ${
|
|
84
|
+
const rollupAddress = await stakingAssetHandler.read.getRollup();
|
|
85
|
+
dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()}`);
|
|
86
|
+
|
|
87
|
+
const rollup = getContract({
|
|
88
|
+
address: rollupAddress,
|
|
89
|
+
abi: RollupAbi,
|
|
90
|
+
client: l1Client,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const gseAddress = await rollup.read.getGSE();
|
|
94
|
+
|
|
95
|
+
const gse = new GSEContract(l1Client, gseAddress);
|
|
96
|
+
|
|
97
|
+
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
79
98
|
|
|
80
99
|
const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
|
|
81
100
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
@@ -86,7 +105,14 @@ export async function addL1Validator({
|
|
|
86
105
|
data: encodeFunctionData({
|
|
87
106
|
abi: StakingAssetHandlerAbi,
|
|
88
107
|
functionName: 'addValidator',
|
|
89
|
-
args: [
|
|
108
|
+
args: [
|
|
109
|
+
attesterAddress.toString(),
|
|
110
|
+
merkleProofArray,
|
|
111
|
+
proofParamsObj.toViem(),
|
|
112
|
+
registrationTuple.publicKeyInG1,
|
|
113
|
+
registrationTuple.publicKeyInG2,
|
|
114
|
+
registrationTuple.proofOfPossession,
|
|
115
|
+
],
|
|
90
116
|
}),
|
|
91
117
|
abi: StakingAssetHandlerAbi,
|
|
92
118
|
});
|
|
@@ -181,7 +207,7 @@ export async function fastForwardEpochs({
|
|
|
181
207
|
const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
|
|
182
208
|
dualLog(`Fast forwarding ${numEpochs} epochs to ${timestamp}`);
|
|
183
209
|
try {
|
|
184
|
-
await cheatCodes.warp(Number(timestamp));
|
|
210
|
+
await cheatCodes.warp(Number(timestamp), { resetBlockInterval: true });
|
|
185
211
|
dualLog(`Fast forwarded ${numEpochs} epochs to ${timestamp}`);
|
|
186
212
|
} catch (error) {
|
|
187
213
|
if (error instanceof Error && error.message.includes("is lower than or equal to previous block's timestamp")) {
|
|
@@ -13,7 +13,7 @@ export async function getContractData(
|
|
|
13
13
|
const {
|
|
14
14
|
contractInstance: instance,
|
|
15
15
|
isContractInitialized: isInitialized,
|
|
16
|
-
|
|
16
|
+
isContractPublished: isPubliclyDeployed,
|
|
17
17
|
} = await client.getContractMetadata(contractAddress);
|
|
18
18
|
const contractClass =
|
|
19
19
|
includeBytecode &&
|
|
@@ -39,9 +39,9 @@ export async function getNodeInfo(
|
|
|
39
39
|
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
40
40
|
},
|
|
41
41
|
protocolContractAddresses: {
|
|
42
|
-
|
|
42
|
+
classRegistry: info.protocolContractAddresses.classRegistry.toString(),
|
|
43
43
|
feeJuice: info.protocolContractAddresses.feeJuice.toString(),
|
|
44
|
-
|
|
44
|
+
instanceRegistry: info.protocolContractAddresses.instanceRegistry.toString(),
|
|
45
45
|
multiCallEntrypoint: info.protocolContractAddresses.multiCallEntrypoint.toString(),
|
|
46
46
|
},
|
|
47
47
|
});
|
|
@@ -66,9 +66,9 @@ export async function getNodeInfo(
|
|
|
66
66
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
67
67
|
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
68
68
|
log(`L2 Contract Addresses:`);
|
|
69
|
-
log(` Class
|
|
69
|
+
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
70
70
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
71
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.
|
|
71
|
+
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
72
72
|
log(` MultiCall: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -6,8 +6,8 @@ export async function getPXEInfo(rpcUrl: string, debugLogger: Logger, log: LogFn
|
|
|
6
6
|
const info = await client.getPXEInfo();
|
|
7
7
|
log(`PXE Version: ${info.pxeVersion}`);
|
|
8
8
|
log(`Protocol Contract Addresses:`);
|
|
9
|
-
log(` Class
|
|
9
|
+
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
10
10
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
11
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.
|
|
11
|
+
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
12
12
|
log(` Multi Call Entrypoint: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
13
13
|
}
|
package/src/utils/aztec.ts
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
type Operator,
|
|
13
13
|
RollupContract,
|
|
14
14
|
} from '@aztec/ethereum';
|
|
15
|
-
import
|
|
15
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
16
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
16
17
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
17
18
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
18
19
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
@@ -116,8 +117,17 @@ export async function deployNewRollupContracts(
|
|
|
116
117
|
|
|
117
118
|
if (!initialValidators || initialValidators.length === 0) {
|
|
118
119
|
// initialize the new rollup with Amin's validator address.
|
|
119
|
-
const
|
|
120
|
-
|
|
120
|
+
const aminAddressString = '0x3b218d0F26d15B36C715cB06c949210a0d630637';
|
|
121
|
+
const amin = EthAddress.fromString(aminAddressString);
|
|
122
|
+
|
|
123
|
+
initialValidators = [
|
|
124
|
+
{
|
|
125
|
+
attester: amin,
|
|
126
|
+
withdrawer: amin,
|
|
127
|
+
// No secrets here. The actual keys are not currently used.
|
|
128
|
+
bn254SecretKey: new SecretValue(Fr.fromHexString(aminAddressString).toBigInt()),
|
|
129
|
+
},
|
|
130
|
+
];
|
|
121
131
|
logger.info('Initializing new rollup with old attesters', { initialValidators });
|
|
122
132
|
}
|
|
123
133
|
|
package/src/utils/inspect.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
3
3
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
4
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
5
5
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
import {
|
|
6
|
+
import type { ExtendedNote } from '@aztec/stdlib/note';
|
|
7
7
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
9
|
export async function inspectBlock(pxe: PXE, blockNumber: number, log: LogFn, opts: { showTxs?: boolean } = {}) {
|
|
@@ -40,11 +40,7 @@ export async function inspectTx(
|
|
|
40
40
|
log: LogFn,
|
|
41
41
|
opts: { includeBlockInfo?: boolean; artifactMap?: ArtifactMap } = {},
|
|
42
42
|
) {
|
|
43
|
-
const [receipt, effectsInBlock
|
|
44
|
-
pxe.getTxReceipt(txHash),
|
|
45
|
-
pxe.getTxEffect(txHash),
|
|
46
|
-
pxe.getNotes({ txHash, status: NoteStatus.ACTIVE_OR_NULLIFIED }),
|
|
47
|
-
]);
|
|
43
|
+
const [receipt, effectsInBlock] = await Promise.all([pxe.getTxReceipt(txHash), pxe.getTxEffect(txHash)]);
|
|
48
44
|
// Base tx data
|
|
49
45
|
log(`Tx ${txHash.toString()}`);
|
|
50
46
|
log(` Status: ${receipt.status} ${effectsInBlock ? `(${effectsInBlock.data.revertCode.getDescription()})` : ''}`);
|
|
@@ -88,12 +84,9 @@ export async function inspectTx(
|
|
|
88
84
|
const notes = effects.noteHashes;
|
|
89
85
|
if (notes.length > 0) {
|
|
90
86
|
log(' Created notes:');
|
|
91
|
-
log(` Total: ${notes.length}
|
|
92
|
-
|
|
93
|
-
log(
|
|
94
|
-
for (const note of getNotes) {
|
|
95
|
-
inspectNote(note, artifactMap, log);
|
|
96
|
-
}
|
|
87
|
+
log(` Total: ${notes.length}`);
|
|
88
|
+
for (const note of notes) {
|
|
89
|
+
log(` Note hash: ${note.toShortString()}`);
|
|
97
90
|
}
|
|
98
91
|
}
|
|
99
92
|
|
|
@@ -103,8 +96,10 @@ export async function inspectTx(
|
|
|
103
96
|
if (nullifierCount > 0) {
|
|
104
97
|
log(' Nullifiers:');
|
|
105
98
|
for (const nullifier of effects.nullifiers) {
|
|
106
|
-
const [note] = await pxe.getNotes({ siloedNullifier: nullifier });
|
|
107
99
|
const deployed = deployNullifiers[nullifier.toString()];
|
|
100
|
+
const note = deployed
|
|
101
|
+
? (await pxe.getNotes({ siloedNullifier: nullifier, contractAddress: deployed }))[0]
|
|
102
|
+
: undefined;
|
|
108
103
|
const initialized = initNullifiers[nullifier.toString()];
|
|
109
104
|
const registered = classNullifiers[nullifier.toString()];
|
|
110
105
|
if (nullifier.toBuffer().equals(txHash.toBuffer())) {
|
|
@@ -160,8 +155,8 @@ function toFriendlyAddress(address: AztecAddress, artifactMap: ArtifactMap) {
|
|
|
160
155
|
|
|
161
156
|
async function getKnownNullifiers(pxe: PXE, artifactMap: ArtifactMap) {
|
|
162
157
|
const knownContracts = await pxe.getContracts();
|
|
163
|
-
const deployerAddress = ProtocolContractAddress.
|
|
164
|
-
const
|
|
158
|
+
const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
|
|
159
|
+
const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
|
|
165
160
|
const initNullifiers: Record<string, AztecAddress> = {};
|
|
166
161
|
const deployNullifiers: Record<string, AztecAddress> = {};
|
|
167
162
|
const classNullifiers: Record<string, string> = {};
|
|
@@ -170,7 +165,7 @@ async function getKnownNullifiers(pxe: PXE, artifactMap: ArtifactMap) {
|
|
|
170
165
|
deployNullifiers[(await siloNullifier(deployerAddress, contract.toField())).toString()] = contract;
|
|
171
166
|
}
|
|
172
167
|
for (const artifact of Object.values(artifactMap)) {
|
|
173
|
-
classNullifiers[(await siloNullifier(
|
|
168
|
+
classNullifiers[(await siloNullifier(classRegistryAddress, artifact.classId)).toString()] =
|
|
174
169
|
`${artifact.name}Class<${artifact.classId}>`;
|
|
175
170
|
}
|
|
176
171
|
return { initNullifiers, deployNullifiers, classNullifiers };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AztecAddress,
|
|
2
3
|
DefaultWaitOpts,
|
|
3
4
|
Fr,
|
|
4
5
|
type PXE,
|
|
5
6
|
SignerlessWallet,
|
|
6
7
|
SponsoredFeePaymentMethod,
|
|
7
8
|
type WaitForProvenOpts,
|
|
8
|
-
|
|
9
|
+
getContractInstanceFromInstantiationParams,
|
|
9
10
|
waitForProven,
|
|
10
11
|
} from '@aztec/aztec.js';
|
|
11
12
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
@@ -21,7 +22,7 @@ async function getSponsoredFPCContract() {
|
|
|
21
22
|
|
|
22
23
|
export async function getSponsoredFPCAddress() {
|
|
23
24
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
24
|
-
const sponsoredFPCInstance = await
|
|
25
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
25
26
|
salt: new Fr(SPONSORED_FPC_SALT),
|
|
26
27
|
});
|
|
27
28
|
return sponsoredFPCInstance.address;
|
|
@@ -41,6 +42,7 @@ export async function setupSponsoredFPC(
|
|
|
41
42
|
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
42
43
|
|
|
43
44
|
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
45
|
+
from: AztecAddress.ZERO,
|
|
44
46
|
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
45
47
|
universalDeploy: true,
|
|
46
48
|
fee: { paymentMethod },
|