@aztec/cli 0.0.0-test.1 → 0.0.1-commit.b655e406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -427
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +9 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_base_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +6 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +14 -15
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +9 -5
- package/dest/cmds/infrastructure/index.d.ts +2 -2
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +8 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +4 -4
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +29 -16
- 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 +11 -24
- package/dest/cmds/l1/advance_epoch.d.ts +1 -1
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +8 -6
- package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +9 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +5 -5
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +23 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +17 -8
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +17 -17
- package/dest/cmds/l1/index.d.ts +1 -0
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +33 -43
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
- package/dest/cmds/l1/trigger_seed_snapshot.js +19 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +159 -103
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +3 -3
- package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +7 -3
- package/dest/cmds/misc/update/github.d.ts +0 -1
- package/dest/cmds/misc/update/github.d.ts.map +1 -1
- package/dest/cmds/misc/update/github.js +0 -1
- package/dest/cmds/misc/update.d.ts.map +1 -1
- package/dest/cmds/misc/update.js +2 -3
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +70 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +26 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +20 -0
- package/dest/cmds/validator_keys/new.d.ts +26 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +60 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +271 -0
- package/dest/config/cached_fetch.d.ts +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +39 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +475 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/get_l1_config.d.ts +8 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +22 -0
- package/dest/config/index.d.ts +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +19 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +79 -0
- package/dest/utils/aztec.d.ts +12 -17
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +54 -49
- package/dest/utils/commands.d.ts +17 -9
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +40 -14
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +0 -1
- package/dest/utils/github.d.ts.map +1 -1
- package/dest/utils/github.js +0 -1
- package/dest/utils/index.d.ts +1 -0
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/inspect.d.ts +3 -10
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +19 -109
- package/dest/utils/setup_contracts.d.ts +3 -0
- package/dest/utils/setup_contracts.d.ts.map +1 -0
- package/dest/utils/setup_contracts.js +16 -0
- package/package.json +44 -33
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +10 -0
- package/src/cmds/aztec_node/get_current_base_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +8 -7
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +15 -23
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +16 -6
- package/src/cmds/infrastructure/index.ts +8 -10
- package/src/cmds/infrastructure/sequencers.ts +36 -19
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -25
- package/src/cmds/l1/advance_epoch.ts +7 -5
- package/src/cmds/l1/assume_proven_through.ts +8 -7
- package/src/cmds/l1/bridge_erc20.ts +7 -4
- package/src/cmds/l1/deploy_l1_contracts.ts +32 -7
- package/src/cmds/l1/deploy_new_rollup.ts +23 -9
- package/src/cmds/l1/get_l1_addresses.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +18 -17
- package/src/cmds/l1/index.ts +74 -101
- package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
- package/src/cmds/l1/update_l1_validators.ts +194 -94
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +3 -3
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
- package/src/cmds/misc/index.ts +13 -4
- package/src/cmds/misc/update/github.ts +0 -1
- package/src/cmds/misc/update.ts +1 -7
- package/src/cmds/validator_keys/add.ts +113 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +33 -0
- package/src/cmds/validator_keys/index.ts +96 -0
- package/src/cmds/validator_keys/new.ts +120 -0
- package/src/cmds/validator_keys/shared.ts +321 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +627 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +28 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +102 -0
- package/src/utils/aztec.ts +78 -65
- package/src/utils/commands.ts +54 -18
- package/src/utils/encoding.ts +1 -1
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +23 -123
- package/src/utils/setup_contracts.ts +19 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -196
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
- package/dest/cmds/misc/setup_contracts.d.ts +0 -7
- package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
- package/dest/cmds/misc/setup_contracts.js +0 -27
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/devnet/bootstrap_network.ts +0 -318
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
- package/src/cmds/misc/setup_contracts.ts +0 -40
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
- /package/dest/cmds/{devnet → aztec_node}/index.d.ts +0 -0
package/src/utils/inspect.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { AztecAddress, ContractArtifact, Fr } from '@aztec/aztec.js';
|
|
2
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
4
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
5
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
import { type ExtendedNote, NoteStatus } from '@aztec/stdlib/note';
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
7
3
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
8
4
|
|
|
9
|
-
export async function inspectBlock(
|
|
10
|
-
|
|
5
|
+
export async function inspectBlock(
|
|
6
|
+
aztecNode: AztecNode,
|
|
7
|
+
blockNumber: number,
|
|
8
|
+
log: LogFn,
|
|
9
|
+
opts: { showTxs?: boolean } = {},
|
|
10
|
+
) {
|
|
11
|
+
const block = await aztecNode.getBlock(blockNumber);
|
|
11
12
|
if (!block) {
|
|
12
13
|
log(`No block found for block number ${blockNumber}`);
|
|
13
14
|
return;
|
|
@@ -18,16 +19,15 @@ export async function inspectBlock(pxe: PXE, blockNumber: number, log: LogFn, op
|
|
|
18
19
|
log(` Total fees: ${block.header.totalFees.toBigInt()}`);
|
|
19
20
|
log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
|
|
20
21
|
log(
|
|
21
|
-
` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas
|
|
22
|
+
` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas} L2=${block.header.globalVariables.gasFees.feePerL2Gas}`,
|
|
22
23
|
);
|
|
23
24
|
log(` Coinbase: ${block.header.globalVariables.coinbase}`);
|
|
24
25
|
log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
|
|
25
|
-
log(` Timestamp: ${new Date(block.header.globalVariables.timestamp
|
|
26
|
+
log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
|
|
26
27
|
if (opts.showTxs) {
|
|
27
28
|
log(``);
|
|
28
|
-
const artifactMap = await getKnownArtifacts(pxe);
|
|
29
29
|
for (const txHash of block.body.txEffects.map(tx => tx.txHash)) {
|
|
30
|
-
await inspectTx(
|
|
30
|
+
await inspectTx(aztecNode, txHash, log, { includeBlockInfo: false });
|
|
31
31
|
}
|
|
32
32
|
} else {
|
|
33
33
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
@@ -35,16 +35,12 @@ export async function inspectBlock(pxe: PXE, blockNumber: number, log: LogFn, op
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export async function inspectTx(
|
|
38
|
-
|
|
38
|
+
aztecNode: AztecNode,
|
|
39
39
|
txHash: TxHash,
|
|
40
40
|
log: LogFn,
|
|
41
|
-
opts: { includeBlockInfo?: boolean
|
|
41
|
+
opts: { includeBlockInfo?: boolean } = {},
|
|
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([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
|
|
48
44
|
// Base tx data
|
|
49
45
|
log(`Tx ${txHash.toString()}`);
|
|
50
46
|
log(` Status: ${receipt.status} ${effectsInBlock ? `(${effectsInBlock.data.revertCode.getDescription()})` : ''}`);
|
|
@@ -57,7 +53,6 @@ export async function inspectTx(
|
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
const effects = effectsInBlock.data;
|
|
60
|
-
const artifactMap = opts?.artifactMap ?? (await getKnownArtifacts(pxe));
|
|
61
56
|
|
|
62
57
|
if (opts.includeBlockInfo) {
|
|
63
58
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|
|
@@ -88,45 +83,18 @@ export async function inspectTx(
|
|
|
88
83
|
const notes = effects.noteHashes;
|
|
89
84
|
if (notes.length > 0) {
|
|
90
85
|
log(' Created notes:');
|
|
91
|
-
log(` Total: ${notes.length}
|
|
92
|
-
|
|
93
|
-
log(
|
|
94
|
-
for (const note of getNotes) {
|
|
95
|
-
inspectNote(note, artifactMap, log);
|
|
96
|
-
}
|
|
86
|
+
log(` Total: ${notes.length}`);
|
|
87
|
+
for (const note of notes) {
|
|
88
|
+
log(` Note hash: ${note.toShortString()}`);
|
|
97
89
|
}
|
|
98
90
|
}
|
|
99
91
|
|
|
100
|
-
//
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const [note] = await pxe.getNotes({ siloedNullifier: nullifier });
|
|
107
|
-
const deployed = deployNullifiers[nullifier.toString()];
|
|
108
|
-
const initialized = initNullifiers[nullifier.toString()];
|
|
109
|
-
const registered = classNullifiers[nullifier.toString()];
|
|
110
|
-
if (nullifier.toBuffer().equals(txHash.toBuffer())) {
|
|
111
|
-
log(` Transaction hash nullifier ${nullifier.toShortString()}`);
|
|
112
|
-
} else if (note) {
|
|
113
|
-
inspectNote(note, artifactMap, log, `Nullifier ${nullifier.toShortString()} for note`);
|
|
114
|
-
} else if (deployed) {
|
|
115
|
-
log(
|
|
116
|
-
` Contract ${toFriendlyAddress(deployed, artifactMap)} deployed via nullifier ${nullifier.toShortString()}`,
|
|
117
|
-
);
|
|
118
|
-
} else if (initialized) {
|
|
119
|
-
log(
|
|
120
|
-
` Contract ${toFriendlyAddress(
|
|
121
|
-
initialized,
|
|
122
|
-
artifactMap,
|
|
123
|
-
)} initialized via nullifier ${nullifier.toShortString()}`,
|
|
124
|
-
);
|
|
125
|
-
} else if (registered) {
|
|
126
|
-
log(` Class ${registered} registered via nullifier ${nullifier.toShortString()}`);
|
|
127
|
-
} else {
|
|
128
|
-
log(` Unknown nullifier ${nullifier.toString()}`);
|
|
129
|
-
}
|
|
92
|
+
// Created nullifiers
|
|
93
|
+
const nullifiers = effects.nullifiers;
|
|
94
|
+
if (nullifiers.length > 0) {
|
|
95
|
+
log(' Created nullifiers:');
|
|
96
|
+
for (const nullifier of nullifiers) {
|
|
97
|
+
log(` Nullifier: ${nullifier.toShortString()}`);
|
|
130
98
|
}
|
|
131
99
|
}
|
|
132
100
|
|
|
@@ -138,71 +106,3 @@ export async function inspectTx(
|
|
|
138
106
|
}
|
|
139
107
|
}
|
|
140
108
|
}
|
|
141
|
-
|
|
142
|
-
function inspectNote(note: ExtendedNote, artifactMap: ArtifactMap, log: LogFn, text = 'Note') {
|
|
143
|
-
const artifact = artifactMap[note.contractAddress.toString()];
|
|
144
|
-
const contract = artifact?.name ?? note.contractAddress.toString();
|
|
145
|
-
const type = artifact?.notes[note.noteTypeId.toString()]?.typ ?? note.noteTypeId.toField().toShortString();
|
|
146
|
-
log(` ${text} type ${type} at ${contract}`);
|
|
147
|
-
log(` Owner: ${toFriendlyAddress(note.owner, artifactMap)}`);
|
|
148
|
-
for (const field of note.note.items) {
|
|
149
|
-
log(` ${field.toString()}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function toFriendlyAddress(address: AztecAddress, artifactMap: ArtifactMap) {
|
|
154
|
-
const artifact = artifactMap[address.toString()];
|
|
155
|
-
if (!artifact) {
|
|
156
|
-
return address.toString();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return `${artifact.name}<${address.toString()}>`;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async function getKnownNullifiers(pxe: PXE, artifactMap: ArtifactMap) {
|
|
163
|
-
const knownContracts = await pxe.getContracts();
|
|
164
|
-
const deployerAddress = ProtocolContractAddress.ContractInstanceDeployer;
|
|
165
|
-
const registererAddress = ProtocolContractAddress.ContractClassRegisterer;
|
|
166
|
-
const initNullifiers: Record<string, AztecAddress> = {};
|
|
167
|
-
const deployNullifiers: Record<string, AztecAddress> = {};
|
|
168
|
-
const classNullifiers: Record<string, string> = {};
|
|
169
|
-
for (const contract of knownContracts) {
|
|
170
|
-
initNullifiers[siloNullifier(contract, contract.toField()).toString()] = contract;
|
|
171
|
-
deployNullifiers[siloNullifier(deployerAddress, contract.toField()).toString()] = contract;
|
|
172
|
-
}
|
|
173
|
-
for (const artifact of Object.values(artifactMap)) {
|
|
174
|
-
classNullifiers[
|
|
175
|
-
siloNullifier(registererAddress, artifact.classId).toString()
|
|
176
|
-
] = `${artifact.name}Class<${artifact.classId}>`;
|
|
177
|
-
}
|
|
178
|
-
return { initNullifiers, deployNullifiers, classNullifiers };
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
type ArtifactMap = Record<string, ContractArtifactWithClassId>;
|
|
182
|
-
type ContractArtifactWithClassId = ContractArtifact & { classId: Fr };
|
|
183
|
-
async function getKnownArtifacts(pxe: PXE): Promise<ArtifactMap> {
|
|
184
|
-
const knownContractAddresses = await pxe.getContracts();
|
|
185
|
-
const knownContracts = (
|
|
186
|
-
await Promise.all(knownContractAddresses.map(contractAddress => pxe.getContractMetadata(contractAddress)))
|
|
187
|
-
).map(contractMetadata => contractMetadata.contractInstance);
|
|
188
|
-
const classIds = [...new Set(knownContracts.map(contract => contract?.currentContractClassId))];
|
|
189
|
-
const knownArtifacts = (
|
|
190
|
-
await Promise.all(classIds.map(classId => (classId ? pxe.getContractClassMetadata(classId) : undefined)))
|
|
191
|
-
).map(contractClassMetadata =>
|
|
192
|
-
contractClassMetadata
|
|
193
|
-
? { ...contractClassMetadata.artifact, classId: contractClassMetadata.contractClass?.id }
|
|
194
|
-
: undefined,
|
|
195
|
-
);
|
|
196
|
-
const map: Record<string, ContractArtifactWithClassId> = {};
|
|
197
|
-
for (const instance of knownContracts) {
|
|
198
|
-
if (instance) {
|
|
199
|
-
const artifact = knownArtifacts.find(a =>
|
|
200
|
-
a?.classId?.equals(instance.currentContractClassId),
|
|
201
|
-
) as ContractArtifactWithClassId;
|
|
202
|
-
if (artifact) {
|
|
203
|
-
map[instance.address.toString()] = artifact;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return map;
|
|
208
|
-
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
5
|
+
|
|
6
|
+
async function getSponsoredFPCContract() {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @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
|
|
9
|
+
const { SponsoredFPCContract } = await import('@aztec/noir-contracts.js/SponsoredFPC');
|
|
10
|
+
return SponsoredFPCContract;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function getSponsoredFPCAddress(): Promise<AztecAddress> {
|
|
14
|
+
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
15
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
16
|
+
salt: new Fr(SPONSORED_FPC_SALT),
|
|
17
|
+
});
|
|
18
|
+
return sponsoredFPCInstance.address;
|
|
19
|
+
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
-
export declare function bootstrapNetwork(pxeUrl: string, l1Urls: string[], l1ChainId: string, l1PrivateKey: `0x${string}` | undefined, l1Mnemonic: string, addressIndex: number, json: boolean, log: LogFn, debugLog: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=bootstrap_network.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_network.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/bootstrap_network.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAiB3D,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,iBA4EjB"}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
2
|
-
import { BatchCall, Fr, L1FeeJuicePortalManager, createCompatibleClient, retryUntil } from '@aztec/aztec.js';
|
|
3
|
-
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
4
|
-
import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
|
|
5
|
-
import { getContract } from 'viem';
|
|
6
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
7
|
-
const waitOpts = {
|
|
8
|
-
timeout: 120,
|
|
9
|
-
provenTimeout: 4800,
|
|
10
|
-
interval: 1
|
|
11
|
-
};
|
|
12
|
-
export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey, l1Mnemonic, addressIndex, json, log, debugLog) {
|
|
13
|
-
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
14
|
-
const [wallet] = await getDeployedTestAccountsWallets(pxe);
|
|
15
|
-
const l1Clients = createL1Clients(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
|
|
16
|
-
mnemonicToAccount(l1Mnemonic, {
|
|
17
|
-
addressIndex
|
|
18
|
-
}), createEthereumChain(l1Urls, +l1ChainId).chainInfo);
|
|
19
|
-
const { erc20Address, portalAddress } = await deployERC20(l1Clients);
|
|
20
|
-
const { token, bridge } = await deployToken(wallet, portalAddress);
|
|
21
|
-
await initPortal(pxe, l1Clients, erc20Address, portalAddress, bridge.address);
|
|
22
|
-
const fpcAdmin = wallet.getAddress();
|
|
23
|
-
const fpc = await deployFPC(wallet, token.address, fpcAdmin);
|
|
24
|
-
const counter = await deployCounter(wallet);
|
|
25
|
-
await fundFPC(counter.address, wallet, l1Clients, fpc.address, debugLog);
|
|
26
|
-
if (json) {
|
|
27
|
-
log(JSON.stringify({
|
|
28
|
-
devCoinL1: erc20Address.toString(),
|
|
29
|
-
devCoinPortalL1: portalAddress.toString(),
|
|
30
|
-
devCoin: {
|
|
31
|
-
address: token.address.toString(),
|
|
32
|
-
initHash: token.initHash.toString(),
|
|
33
|
-
salt: token.salt.toString()
|
|
34
|
-
},
|
|
35
|
-
devCoinBridge: {
|
|
36
|
-
address: bridge.address.toString(),
|
|
37
|
-
initHash: bridge.initHash.toString(),
|
|
38
|
-
salt: bridge.salt.toString()
|
|
39
|
-
},
|
|
40
|
-
devCoinFpc: {
|
|
41
|
-
address: fpc.address.toString(),
|
|
42
|
-
initHash: fpc.initHash.toString(),
|
|
43
|
-
salt: fpc.salt.toString()
|
|
44
|
-
},
|
|
45
|
-
counter: {
|
|
46
|
-
address: counter.address.toString(),
|
|
47
|
-
initHash: counter.initHash.toString(),
|
|
48
|
-
salt: counter.salt.toString()
|
|
49
|
-
}
|
|
50
|
-
}, null, 2));
|
|
51
|
-
} else {
|
|
52
|
-
log(`DevCoin L1: ${erc20Address}`);
|
|
53
|
-
log(`DevCoin L1 Portal: ${portalAddress}`);
|
|
54
|
-
log(`DevCoin L2: ${token.address}`);
|
|
55
|
-
log(`DevCoin L2 init hash: ${token.initHash}`);
|
|
56
|
-
log(`DevCoin L2 salt: ${token.salt}`);
|
|
57
|
-
log(`DevCoin L2 Bridge: ${bridge.address}`);
|
|
58
|
-
log(`DevCoin L2 Bridge init hash: ${bridge.initHash}`);
|
|
59
|
-
log(`DevCoin L2 Bridge salt: ${bridge.salt}`);
|
|
60
|
-
log(`DevCoin FPC: ${fpc.address}`);
|
|
61
|
-
log(`DevCoin FPC init hash: ${fpc.initHash}`);
|
|
62
|
-
log(`DevCoin FPC salt: ${fpc.salt}`);
|
|
63
|
-
log(`Counter: ${counter.address}`);
|
|
64
|
-
log(`Counter init hash: ${counter.initHash}`);
|
|
65
|
-
log(`Counter salt: ${counter.salt}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Step 1. Deploy the L1 contracts, but don't initialize
|
|
70
|
-
*/ async function deployERC20({ walletClient, publicClient }) {
|
|
71
|
-
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
72
|
-
const erc20 = {
|
|
73
|
-
contractAbi: TestERC20Abi,
|
|
74
|
-
contractBytecode: TestERC20Bytecode
|
|
75
|
-
};
|
|
76
|
-
const portal = {
|
|
77
|
-
contractAbi: TokenPortalAbi,
|
|
78
|
-
contractBytecode: TokenPortalBytecode
|
|
79
|
-
};
|
|
80
|
-
const { address: erc20Address } = await deployL1Contract(walletClient, publicClient, erc20.contractAbi, erc20.contractBytecode, [
|
|
81
|
-
'DevCoin',
|
|
82
|
-
'DEV',
|
|
83
|
-
walletClient.account.address
|
|
84
|
-
]);
|
|
85
|
-
const { address: portalAddress } = await deployL1Contract(walletClient, publicClient, portal.contractAbi, portal.contractBytecode);
|
|
86
|
-
return {
|
|
87
|
-
erc20Address,
|
|
88
|
-
portalAddress
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Step 2. Deploy the L2 contracts
|
|
93
|
-
*/ async function deployToken(wallet, l1Portal) {
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
95
|
-
// @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
|
|
96
|
-
const { TokenContract } = await import('@aztec/noir-contracts.js/Token');
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
|
-
// @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
|
|
99
|
-
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
100
|
-
const devCoin = await TokenContract.deploy(wallet, wallet.getAddress(), 'DevCoin', 'DEV', 18).send({
|
|
101
|
-
universalDeploy: true
|
|
102
|
-
}).deployed(waitOpts);
|
|
103
|
-
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal).send({
|
|
104
|
-
universalDeploy: true
|
|
105
|
-
}).deployed(waitOpts);
|
|
106
|
-
await new BatchCall(wallet, [
|
|
107
|
-
await devCoin.methods.set_minter(bridge.address, true).request(),
|
|
108
|
-
await devCoin.methods.set_admin(bridge.address).request()
|
|
109
|
-
]).send().wait(waitOpts);
|
|
110
|
-
return {
|
|
111
|
-
token: {
|
|
112
|
-
address: devCoin.address,
|
|
113
|
-
initHash: devCoin.instance.initializationHash,
|
|
114
|
-
salt: devCoin.instance.salt
|
|
115
|
-
},
|
|
116
|
-
bridge: {
|
|
117
|
-
address: bridge.address,
|
|
118
|
-
initHash: bridge.instance.initializationHash,
|
|
119
|
-
salt: bridge.instance.salt
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Step 3. Initialize DevCoin's L1 portal
|
|
125
|
-
*/ async function initPortal(pxe, { walletClient, publicClient }, erc20, portal, bridge) {
|
|
126
|
-
const { TokenPortalAbi } = await import('@aztec/l1-artifacts');
|
|
127
|
-
const { l1ContractAddresses: { registryAddress } } = await pxe.getNodeInfo();
|
|
128
|
-
const contract = getContract({
|
|
129
|
-
abi: TokenPortalAbi,
|
|
130
|
-
address: portal.toString(),
|
|
131
|
-
client: walletClient
|
|
132
|
-
});
|
|
133
|
-
const hash = await contract.write.initialize([
|
|
134
|
-
registryAddress.toString(),
|
|
135
|
-
erc20.toString(),
|
|
136
|
-
bridge.toString()
|
|
137
|
-
]);
|
|
138
|
-
await publicClient.waitForTransactionReceipt({
|
|
139
|
-
hash
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
async function deployFPC(wallet, tokenAddress, admin) {
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
144
|
-
// @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
|
|
145
|
-
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
146
|
-
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin).send({
|
|
147
|
-
universalDeploy: true
|
|
148
|
-
}).deployed(waitOpts);
|
|
149
|
-
const info = {
|
|
150
|
-
address: fpc.address,
|
|
151
|
-
initHash: fpc.instance.initializationHash,
|
|
152
|
-
salt: fpc.instance.salt
|
|
153
|
-
};
|
|
154
|
-
return info;
|
|
155
|
-
}
|
|
156
|
-
async function deployCounter(wallet) {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
|
-
// @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
|
|
159
|
-
const { CounterContract } = await import('@aztec/noir-contracts.js/Counter');
|
|
160
|
-
const counter = await CounterContract.deploy(wallet, 1, wallet.getAddress()).send({
|
|
161
|
-
universalDeploy: true
|
|
162
|
-
}).deployed(waitOpts);
|
|
163
|
-
const info = {
|
|
164
|
-
address: counter.address,
|
|
165
|
-
initHash: counter.instance.initializationHash,
|
|
166
|
-
salt: counter.instance.salt
|
|
167
|
-
};
|
|
168
|
-
return info;
|
|
169
|
-
}
|
|
170
|
-
// NOTE: Disabling for now in order to get devnet running
|
|
171
|
-
async function fundFPC(counterAddress, wallet, l1Clients, fpcAddress, debugLog) {
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
173
|
-
// @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
|
|
174
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
176
|
-
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
177
|
-
const { CounterContract } = await import('@aztec/noir-contracts.js/Counter');
|
|
178
|
-
const { protocolContractAddresses: { feeJuice } } = await wallet.getPXEInfo();
|
|
179
|
-
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
180
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Clients.publicClient, l1Clients.walletClient, debugLog);
|
|
181
|
-
const amount = FEE_FUNDING_FOR_TESTER_ACCOUNT;
|
|
182
|
-
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, amount, true);
|
|
183
|
-
await retryUntil(async ()=>await wallet.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
184
|
-
const counter = await CounterContract.at(counterAddress, wallet);
|
|
185
|
-
debugLog.info('Incrementing Counter');
|
|
186
|
-
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
187
|
-
// advance the chain
|
|
188
|
-
await counter.methods.increment(wallet.getAddress(), wallet.getAddress()).send().wait(waitOpts);
|
|
189
|
-
await counter.methods.increment(wallet.getAddress(), wallet.getAddress()).send().wait(waitOpts);
|
|
190
|
-
debugLog.info('Claiming FPC');
|
|
191
|
-
await feeJuiceContract.methods.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex).send().wait({
|
|
192
|
-
...waitOpts,
|
|
193
|
-
proven: true
|
|
194
|
-
});
|
|
195
|
-
debugLog.info('Finished claiming FPC');
|
|
196
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function dripFaucet(faucetUrl: string, asset: string, account: EthAddress, json: boolean, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=faucet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/faucet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
2
|
-
export async function dripFaucet(faucetUrl, asset, account, json, log) {
|
|
3
|
-
const url = new URL(`/drip/${account.toString()}`, faucetUrl);
|
|
4
|
-
url.searchParams.set('asset', asset);
|
|
5
|
-
const res = await fetch(url);
|
|
6
|
-
if (res.status === 200) {
|
|
7
|
-
if (json) {
|
|
8
|
-
log(prettyPrintJSON({
|
|
9
|
-
ok: true
|
|
10
|
-
}));
|
|
11
|
-
} else {
|
|
12
|
-
log(`Dripped ${asset} for ${account.toString()}`);
|
|
13
|
-
}
|
|
14
|
-
} else {
|
|
15
|
-
if (json) {
|
|
16
|
-
log(prettyPrintJSON({
|
|
17
|
-
ok: false
|
|
18
|
-
}));
|
|
19
|
-
} else if (res.status === 429) {
|
|
20
|
-
log(`Rate limited when dripping ${asset} for ${account.toString()}`);
|
|
21
|
-
} else {
|
|
22
|
-
log(`Failed to drip ${asset} for ${account.toString()}`);
|
|
23
|
-
}
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAqD/E"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
2
|
-
export function injectCommands(program, log, debugLogger) {
|
|
3
|
-
program.command('bootstrap-network').description('Bootstrap a new network').addOption(pxeOption).addOption(l1ChainIdOption).requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
|
|
4
|
-
ETHEREUM_HOSTS
|
|
5
|
-
]).option('--l1-private-key <string>', 'The private key to use for deployment', process.env.PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-ai, --address-index <number>', 'The address index to use when calculating an address', (arg)=>BigInt(arg), 0n).option('--json', 'Output the result as JSON').action(async (options)=>{
|
|
6
|
-
const { bootstrapNetwork } = await import('./bootstrap_network.js');
|
|
7
|
-
await bootstrapNetwork(options[pxeOption.attributeName()], options.l1RpcUrls, options[l1ChainIdOption.attributeName()], options.l1PrivateKey, options.mnemonic, options.addressIndex, options.json, log, debugLogger);
|
|
8
|
-
});
|
|
9
|
-
program.command('drip-faucet').description('Drip the faucet').requiredOption('-u, --faucet-url <string>', 'Url of the faucet', 'http://localhost:8082').requiredOption('-t, --token <string>', 'The asset to drip', 'eth').requiredOption('-a, --address <string>', 'The Ethereum address to drip to', parseEthereumAddress).option('--json', 'Output the result as JSON').action(async (options)=>{
|
|
10
|
-
const { dripFaucet } = await import('./faucet.js');
|
|
11
|
-
await dripFaucet(options.faucetUrl, options.token, options.address, options.json, log);
|
|
12
|
-
});
|
|
13
|
-
return program;
|
|
14
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
-
import { type Hex } from 'viem';
|
|
3
|
-
export declare function deployUltraHonkVerifier(rollupAddress: Hex | undefined, ethRpcUrls: string[], l1ChainId: string, privateKey: string | undefined, mnemonic: string, pxeRpcUrl: string, bbBinaryPath: string, bbWorkingDirectory: string, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
|
-
export declare function deployMockVerifier(rollupAddress: Hex | undefined, ethRpcUrls: string[], l1ChainId: string, privateKey: string | undefined, mnemonic: string, pxeRpcUrl: string, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
5
|
-
//# sourceMappingURL=deploy_l1_verifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_verifier.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAyCpB;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAmCpB"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
|
|
3
|
-
import { HonkVerifierAbi, HonkVerifierBytecode } from '@aztec/l1-artifacts';
|
|
4
|
-
import { InvalidOptionArgumentError } from 'commander';
|
|
5
|
-
import { getContract } from 'viem';
|
|
6
|
-
export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl, bbBinaryPath, bbWorkingDirectory, log, debugLogger) {
|
|
7
|
-
if (!bbBinaryPath || !bbWorkingDirectory) {
|
|
8
|
-
throw new InvalidOptionArgumentError('Missing path to bb binary and working directory');
|
|
9
|
-
}
|
|
10
|
-
const { publicClient, walletClient } = createL1Clients(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
|
|
11
|
-
if (!rollupAddress && pxeRpcUrl) {
|
|
12
|
-
const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger);
|
|
13
|
-
const { l1ContractAddresses } = await pxe.getNodeInfo();
|
|
14
|
-
rollupAddress = l1ContractAddresses.rollupAddress.toString();
|
|
15
|
-
}
|
|
16
|
-
if (!rollupAddress) {
|
|
17
|
-
throw new InvalidOptionArgumentError('Missing rollup address');
|
|
18
|
-
}
|
|
19
|
-
const { RollupAbi } = await import('@aztec/l1-artifacts');
|
|
20
|
-
const rollup = getContract({
|
|
21
|
-
abi: RollupAbi,
|
|
22
|
-
address: rollupAddress,
|
|
23
|
-
client: walletClient
|
|
24
|
-
});
|
|
25
|
-
const { address: verifierAddress } = await deployL1Contract(walletClient, publicClient, HonkVerifierAbi, HonkVerifierBytecode);
|
|
26
|
-
log(`Deployed honk verifier at ${verifierAddress}`);
|
|
27
|
-
await rollup.write.setEpochVerifier([
|
|
28
|
-
verifierAddress.toString()
|
|
29
|
-
]);
|
|
30
|
-
log(`Rollup accepts only real proofs now`);
|
|
31
|
-
}
|
|
32
|
-
export async function deployMockVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl, log, debugLogger) {
|
|
33
|
-
const { publicClient, walletClient } = createL1Clients(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
|
|
34
|
-
const { MockVerifierAbi, MockVerifierBytecode, RollupAbi } = await import('@aztec/l1-artifacts');
|
|
35
|
-
const { address: mockVerifierAddress } = await deployL1Contract(walletClient, publicClient, MockVerifierAbi, MockVerifierBytecode);
|
|
36
|
-
log(`Deployed MockVerifier at ${mockVerifierAddress.toString()}`);
|
|
37
|
-
if (!rollupAddress && pxeRpcUrl) {
|
|
38
|
-
const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger);
|
|
39
|
-
const { l1ContractAddresses } = await pxe.getNodeInfo();
|
|
40
|
-
rollupAddress = l1ContractAddresses.rollupAddress.toString();
|
|
41
|
-
}
|
|
42
|
-
if (!rollupAddress) {
|
|
43
|
-
throw new InvalidOptionArgumentError('Missing rollup address');
|
|
44
|
-
}
|
|
45
|
-
const rollup = getContract({
|
|
46
|
-
abi: RollupAbi,
|
|
47
|
-
address: rollupAddress,
|
|
48
|
-
client: walletClient
|
|
49
|
-
});
|
|
50
|
-
await rollup.write.setEpochVerifier([
|
|
51
|
-
mockVerifierAddress.toString()
|
|
52
|
-
]);
|
|
53
|
-
log(`Rollup accepts only fake proofs now`);
|
|
54
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type EthAddress, type Wallet } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
/**
|
|
4
|
-
* Deploys the contract to pay for gas on L2.
|
|
5
|
-
*/
|
|
6
|
-
export declare function setupCanonicalL2FeeJuice(deployer: Wallet, feeJuicePortalAddress: EthAddress, waitOpts: import("@aztec/aztec.js").WaitOpts | undefined, log: LogFn): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=setup_contracts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/misc/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAyB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,qBAAqB,EAAE,UAAU,EACjC,QAAQ,gDAAkB,EAC1B,GAAG,EAAE,KAAK,iBA0BX"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { DefaultWaitOpts, FeeJuicePaymentMethod } from '@aztec/aztec.js';
|
|
2
|
-
import { FEE_JUICE_INITIAL_MINT } from '@aztec/constants';
|
|
3
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
5
|
-
/**
|
|
6
|
-
* Deploys the contract to pay for gas on L2.
|
|
7
|
-
*/ export async function setupCanonicalL2FeeJuice(deployer, feeJuicePortalAddress, waitOpts = DefaultWaitOpts, log) {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
|
-
// @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
|
|
10
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
11
|
-
const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer);
|
|
12
|
-
const portalAddress = await deployer.getPublicStorageAt(feeJuiceContract.address, feeJuiceContract.artifact.storageLayout.portal_address.slot);
|
|
13
|
-
if (portalAddress.isZero()) {
|
|
14
|
-
log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...');
|
|
15
|
-
const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
|
|
16
|
-
await feeJuiceContract.methods.initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT).send({
|
|
17
|
-
fee: {
|
|
18
|
-
paymentMethod,
|
|
19
|
-
gasSettings: {
|
|
20
|
-
teardownGasLimits: Gas.empty()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}).wait(waitOpts);
|
|
24
|
-
} else {
|
|
25
|
-
log('setupCanonicalL2FeeJuice: Fee juice contract already initialized. Fee Juice Portal address: ' + portalAddress.toString());
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, type Fr } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
4
|
-
export declare function addContract(rpcUrl: string, contractArtifactPath: string, address: AztecAddress, initializationHash: Fr, salt: Fr, publicKeys: PublicKeys, deployer: AztecAddress | undefined, debugLogger: Logger, log: LogFn): Promise<void>;
|
|
5
|
-
//# sourceMappingURL=add_contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/add_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,KAAK,EAAE,EAAgC,MAAM,iBAAiB,CAAC;AAExH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,YAAY,EACrB,kBAAkB,EAAE,EAAE,EACtB,IAAI,EAAE,EAAE,EACR,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAuBX"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, getContractClassFromArtifact } from '@aztec/aztec.js';
|
|
2
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
3
|
-
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
4
|
-
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
-
import { getContractArtifact } from '../../utils/aztec.js';
|
|
6
|
-
export async function addContract(rpcUrl, contractArtifactPath, address, initializationHash, salt, publicKeys, deployer, debugLogger, log) {
|
|
7
|
-
const artifact = await getContractArtifact(contractArtifactPath, log);
|
|
8
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
9
|
-
const instance = {
|
|
10
|
-
version: 1,
|
|
11
|
-
salt,
|
|
12
|
-
initializationHash,
|
|
13
|
-
currentContractClassId: contractClass.id,
|
|
14
|
-
originalContractClassId: contractClass.id,
|
|
15
|
-
publicKeys: publicKeys ?? PublicKeys.default(),
|
|
16
|
-
address,
|
|
17
|
-
deployer: deployer ?? AztecAddress.ZERO
|
|
18
|
-
};
|
|
19
|
-
const computed = await computeContractAddressFromInstance(instance);
|
|
20
|
-
if (!computed.equals(address)) {
|
|
21
|
-
throw new Error(`Contract address ${address.toString()} does not match computed address ${computed.toString()}`);
|
|
22
|
-
}
|
|
23
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
24
|
-
await client.registerContract({
|
|
25
|
-
artifact,
|
|
26
|
-
instance
|
|
27
|
-
});
|
|
28
|
-
log(`\nContract added to PXE at ${address.toString()} with class ${instance.currentContractClassId.toString()}\n`);
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block_number.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/block_number.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAKhF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
export async function blockNumber(rpcUrl, debugLogger, log) {
|
|
3
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
4
|
-
const [latestNum, provenNum] = await Promise.all([
|
|
5
|
-
client.getBlockNumber(),
|
|
6
|
-
client.getProvenBlockNumber()
|
|
7
|
-
]);
|
|
8
|
-
log(`Latest block: ${latestNum}`);
|
|
9
|
-
log(`Proven block: ${provenNum}`);
|
|
10
|
-
}
|