@aztec/end-to-end 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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/bench/client_flows/benchmark.d.ts +4 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +25 -14
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +8 -30
- package/dest/bench/utils.d.ts +4 -13
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -34
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +12 -9
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +35 -35
- package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +19 -12
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +30 -22
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +14 -11
- package/dest/e2e_fees/fees_test.d.ts +10 -8
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +35 -38
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +9 -8
- package/dest/e2e_multi_validator/utils.d.ts +2 -2
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_multi_validator/utils.js +4 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +139 -0
- package/dest/e2e_p2p/p2p_network.d.ts +238 -17
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +46 -19
- package/dest/e2e_p2p/shared.d.ts +16 -17
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +56 -55
- package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +12 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +53 -58
- package/dest/fixtures/fixtures.d.ts +1 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +1 -1
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts +476 -5
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +12 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +50 -24
- package/dest/fixtures/snapshot_manager.d.ts +13 -10
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +66 -51
- package/dest/fixtures/token_utils.d.ts +10 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +17 -18
- package/dest/fixtures/utils.d.ts +479 -35
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +106 -125
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts +2 -2
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +20 -23
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +10 -17
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +11 -8
- package/dest/shared/index.d.ts +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +12 -8
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +44 -58
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +4 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +8 -5
- package/dest/simulators/token_simulator.d.ts +4 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +22 -14
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +144 -86
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +92 -17
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +386 -63
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +141 -114
- package/src/bench/client_flows/data_extractor.ts +9 -31
- package/src/bench/utils.ts +9 -37
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +38 -51
- package/src/e2e_deploy_contract/deploy_test.ts +18 -36
- package/src/e2e_epochs/epochs_test.ts +41 -35
- package/src/e2e_fees/bridging_race.notest.ts +16 -11
- package/src/e2e_fees/fees_test.ts +42 -47
- package/src/e2e_l1_publisher/write_json.ts +12 -9
- package/src/e2e_multi_validator/utils.ts +5 -11
- package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
- package/src/e2e_p2p/inactivity_slash_test.ts +184 -0
- package/src/e2e_p2p/p2p_network.ts +124 -82
- package/src/e2e_p2p/shared.ts +66 -58
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +60 -97
- package/src/fixtures/fixtures.ts +1 -2
- package/src/fixtures/get_acvm_config.ts +2 -2
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_l1_contracts.ts +5 -4
- package/src/fixtures/setup_p2p_test.ts +79 -32
- package/src/fixtures/snapshot_manager.ts +87 -82
- package/src/fixtures/token_utils.ts +16 -24
- package/src/fixtures/utils.ts +142 -172
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +3 -11
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +23 -31
- package/src/shared/gas_portal_test_harness.ts +14 -21
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +77 -86
- package/src/simulators/lending_simulator.ts +9 -6
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +15 -3
- package/src/spartan/setup_test_wallets.ts +171 -127
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +463 -64
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
4
|
+
import { RemoteSigner } from '@aztec/node-keystore';
|
|
5
|
+
|
|
6
|
+
import { mkdirSync } from 'node:fs';
|
|
7
|
+
import { writeFile } from 'node:fs/promises';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
export async function createWeb3SignerKeystore(dir: string, ...privateKeys: string[]) {
|
|
11
|
+
const yaml = privateKeys
|
|
12
|
+
.map(
|
|
13
|
+
pk => `\
|
|
14
|
+
type: file-raw
|
|
15
|
+
keyType: SECP256K1
|
|
16
|
+
privateKey: ${pk}`,
|
|
17
|
+
)
|
|
18
|
+
.join('\n---\n');
|
|
19
|
+
|
|
20
|
+
// NOTE: nodejs stdlib can only create temp directories, not temp files!
|
|
21
|
+
// this write uses wx (write-exclusive) so it'll throw if the file already exists
|
|
22
|
+
const path = join(dir, `keystore-${randomBytes(4).toString('hex')}.yaml`);
|
|
23
|
+
await writeFile(path, yaml, { flag: 'wx' });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function refreshWeb3Signer(url: string, ...expectedAddresses: string[]) {
|
|
27
|
+
await fetch(new URL('reload', url), { method: 'POST' });
|
|
28
|
+
|
|
29
|
+
if (expectedAddresses.length > 0) {
|
|
30
|
+
await retryUntil(
|
|
31
|
+
async () => {
|
|
32
|
+
try {
|
|
33
|
+
await RemoteSigner.validateAccess(url, expectedAddresses);
|
|
34
|
+
return true;
|
|
35
|
+
} catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
'web3signer refresh',
|
|
40
|
+
10,
|
|
41
|
+
0.5,
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
await sleep(1000);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getWeb3SignerTestKeystoreDir(): string {
|
|
49
|
+
if (process.env.WEB3_SIGNER_TEST_KEYSTORE_DIR) {
|
|
50
|
+
mkdirSync(process.env.WEB3_SIGNER_TEST_KEYSTORE_DIR, { recursive: true });
|
|
51
|
+
return process.env.WEB3_SIGNER_TEST_KEYSTORE_DIR;
|
|
52
|
+
} else {
|
|
53
|
+
throw new Error('Web3signer not running');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getWeb3SignerUrl(): string {
|
|
58
|
+
if (process.env.WEB3_SIGNER_URL) {
|
|
59
|
+
return process.env.WEB3_SIGNER_URL;
|
|
60
|
+
} else {
|
|
61
|
+
throw new Error('Web3signer not running');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from '@aztec/telemetry-client';
|
|
8
8
|
import { OTelPinoStream } from '@aztec/telemetry-client/otel-pino-stream';
|
|
9
9
|
|
|
10
|
-
export function getEndToEndTestTelemetryClient(metricsPort?: number): TelemetryClient {
|
|
10
|
+
export async function getEndToEndTestTelemetryClient(metricsPort?: number): Promise<TelemetryClient> {
|
|
11
11
|
if (metricsPort) {
|
|
12
12
|
const otelStream = new OTelPinoStream({ levels });
|
|
13
13
|
registerLoggingStream(otelStream);
|
|
14
14
|
}
|
|
15
|
-
return initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
|
|
15
|
+
return await initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Run locally from end-to-end folder while running anvil and
|
|
2
|
+
# Run locally from end-to-end folder while running anvil and local network with:
|
|
3
3
|
# PATH=$PATH:../node_modules/.bin ./src/guides/up_quick_start.sh
|
|
4
4
|
set -eux
|
|
5
5
|
|
|
@@ -19,36 +19,28 @@ aztec-wallet() {
|
|
|
19
19
|
aztec-wallet import-test-accounts
|
|
20
20
|
|
|
21
21
|
# docs:start:declare-accounts
|
|
22
|
-
aztec-wallet create-account -a alice
|
|
23
|
-
aztec-wallet create-account -a bob
|
|
22
|
+
aztec-wallet create-account -a alice -f test0
|
|
23
|
+
aztec-wallet create-account -a bob -f test0
|
|
24
24
|
# docs:end:declare-accounts
|
|
25
25
|
|
|
26
|
-
# docs:start:deploy
|
|
27
26
|
DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
|
|
28
27
|
TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
|
|
29
28
|
echo "Deployed contract at $TOKEN_ADDRESS"
|
|
30
|
-
# docs:end:deploy
|
|
31
29
|
|
|
32
|
-
# docs:start:mint-private
|
|
33
30
|
MINT_AMOUNT=69
|
|
34
31
|
aztec-wallet send mint_to_private -ca last --args accounts:alice $MINT_AMOUNT -f test0
|
|
35
|
-
# docs:end:mint-private
|
|
36
32
|
|
|
37
|
-
# docs:start:get-balance
|
|
38
33
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
39
34
|
if ! echo $ALICE_BALANCE | grep -q $MINT_AMOUNT; then
|
|
40
35
|
echo "Incorrect Alice balance after transaction (expected $MINT_AMOUNT but got $ALICE_BALANCE)"
|
|
41
36
|
exit 1
|
|
42
37
|
fi
|
|
43
|
-
# docs:end:get-balance
|
|
44
38
|
|
|
45
|
-
# docs:start:transfer
|
|
46
39
|
TRANSFER_AMOUNT=42
|
|
47
40
|
|
|
48
41
|
aztec-wallet create-authwit transfer_in_private accounts:test0 -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f alice
|
|
49
42
|
|
|
50
43
|
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
|
|
51
|
-
# docs:end:transfer
|
|
52
44
|
|
|
53
45
|
# Test end result
|
|
54
46
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
2
4
|
import {
|
|
3
|
-
type AccountWallet,
|
|
4
|
-
AuthWitness,
|
|
5
|
-
type AztecAddress,
|
|
6
|
-
type AztecNode,
|
|
7
|
-
EthAddress,
|
|
8
|
-
type FieldsOf,
|
|
9
|
-
Fr,
|
|
10
5
|
type L1TokenManager,
|
|
11
6
|
L1TokenPortalManager,
|
|
12
7
|
type L2AmountClaim,
|
|
13
8
|
type L2AmountClaimWithRecipient,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from '@aztec/aztec.js';
|
|
21
|
-
import {
|
|
9
|
+
} from '@aztec/aztec.js/ethereum';
|
|
10
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
11
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
12
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
13
|
+
import type { SiblingPath } from '@aztec/aztec.js/trees';
|
|
14
|
+
import type { TxReceipt } from '@aztec/aztec.js/tx';
|
|
15
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
16
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
|
|
17
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
18
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
19
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
20
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
21
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
22
22
|
import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
|
|
23
23
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
24
24
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
@@ -27,7 +27,6 @@ import { type Hex, getContract } from 'viem';
|
|
|
27
27
|
|
|
28
28
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
29
29
|
|
|
30
|
-
// docs:start:deployAndInitializeTokenAndBridgeContracts
|
|
31
30
|
/**
|
|
32
31
|
* Deploy L1 token and portal, initialize portal, deploy a non native l2 token contract, its L2 bridge contract and attach is to the portal.
|
|
33
32
|
* @param wallet - the wallet instance
|
|
@@ -112,7 +111,6 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
112
111
|
|
|
113
112
|
return { token, bridge, tokenPortalAddress, tokenPortal, underlyingERC20 };
|
|
114
113
|
}
|
|
115
|
-
// docs:end:deployAndInitializeTokenAndBridgeContracts
|
|
116
114
|
|
|
117
115
|
export type CrossChainContext = {
|
|
118
116
|
l2Token: AztecAddress;
|
|
@@ -132,15 +130,14 @@ export type CrossChainContext = {
|
|
|
132
130
|
export class CrossChainTestHarness {
|
|
133
131
|
static async new(
|
|
134
132
|
aztecNode: AztecNode,
|
|
135
|
-
pxeService: PXE,
|
|
136
133
|
l1Client: ExtendedViemWalletClient,
|
|
137
|
-
wallet:
|
|
134
|
+
wallet: Wallet,
|
|
138
135
|
ownerAddress: AztecAddress,
|
|
139
136
|
logger: Logger,
|
|
140
137
|
underlyingERC20Address: EthAddress,
|
|
141
138
|
): Promise<CrossChainTestHarness> {
|
|
142
139
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
143
|
-
const l1ContractAddresses = (await
|
|
140
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
144
141
|
|
|
145
142
|
// Deploy and initialize all required contracts
|
|
146
143
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
@@ -148,14 +145,13 @@ export class CrossChainTestHarness {
|
|
|
148
145
|
wallet,
|
|
149
146
|
l1Client,
|
|
150
147
|
l1ContractAddresses.registryAddress,
|
|
151
|
-
|
|
148
|
+
ownerAddress,
|
|
152
149
|
underlyingERC20Address,
|
|
153
150
|
);
|
|
154
151
|
logger.info('Deployed and initialized token, portal and its bridge.');
|
|
155
152
|
|
|
156
153
|
return new CrossChainTestHarness(
|
|
157
154
|
aztecNode,
|
|
158
|
-
pxeService,
|
|
159
155
|
logger,
|
|
160
156
|
token,
|
|
161
157
|
bridge,
|
|
@@ -175,8 +171,6 @@ export class CrossChainTestHarness {
|
|
|
175
171
|
constructor(
|
|
176
172
|
/** Aztec node instance. */
|
|
177
173
|
public aztecNode: AztecNode,
|
|
178
|
-
/** Private eXecution Environment (PXE). */
|
|
179
|
-
public pxeService: PXE,
|
|
180
174
|
/** Logger. */
|
|
181
175
|
public logger: Logger,
|
|
182
176
|
|
|
@@ -198,8 +192,8 @@ export class CrossChainTestHarness {
|
|
|
198
192
|
/** Deployment addresses for all L1 contracts */
|
|
199
193
|
public readonly l1ContractAddresses: L1ContractAddresses,
|
|
200
194
|
|
|
201
|
-
/** Wallet
|
|
202
|
-
public readonly
|
|
195
|
+
/** Wallet to simulate and send txs from. */
|
|
196
|
+
public readonly wallet: Wallet,
|
|
203
197
|
|
|
204
198
|
/** Owner of the l2 token and bridge */
|
|
205
199
|
public readonly ownerAddress: AztecAddress,
|
|
@@ -213,7 +207,6 @@ export class CrossChainTestHarness {
|
|
|
213
207
|
this.logger,
|
|
214
208
|
);
|
|
215
209
|
this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
|
|
216
|
-
this.ownerAddress = this.ownerWallet.getAddress();
|
|
217
210
|
}
|
|
218
211
|
|
|
219
212
|
async mintTokensOnL1(amount: bigint) {
|
|
@@ -246,7 +239,7 @@ export class CrossChainTestHarness {
|
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
async mintTokensPrivateOnL2(amount: bigint) {
|
|
249
|
-
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.
|
|
242
|
+
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerAddress, amount);
|
|
250
243
|
}
|
|
251
244
|
|
|
252
245
|
async sendL2PublicTransfer(transferAmount: bigint, receiverAddress: AztecAddress) {
|
|
@@ -331,7 +324,7 @@ export class CrossChainTestHarness {
|
|
|
331
324
|
|
|
332
325
|
withdrawFundsFromBridgeOnL1(
|
|
333
326
|
amount: bigint,
|
|
334
|
-
blockNumber:
|
|
327
|
+
blockNumber: BlockNumber,
|
|
335
328
|
messageIndex: bigint,
|
|
336
329
|
siblingPath: SiblingPath<number>,
|
|
337
330
|
) {
|
|
@@ -389,4 +382,3 @@ export class CrossChainTestHarness {
|
|
|
389
382
|
};
|
|
390
383
|
}
|
|
391
384
|
}
|
|
392
|
-
// docs:end:cross_chain_test_harness
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type Logger,
|
|
10
|
-
type PXE,
|
|
11
|
-
type Wallet,
|
|
12
|
-
retryUntil,
|
|
13
|
-
} from '@aztec/aztec.js';
|
|
14
|
-
import type { ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
1
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim } from '@aztec/aztec.js/ethereum';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
8
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
15
9
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
16
10
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
17
11
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -27,7 +21,6 @@ export interface IGasBridgingTestHarness {
|
|
|
27
21
|
export interface FeeJuicePortalTestingHarnessFactoryConfig {
|
|
28
22
|
aztecNode: AztecNode;
|
|
29
23
|
aztecNodeAdmin?: AztecNodeAdmin;
|
|
30
|
-
pxeService: PXE;
|
|
31
24
|
l1Client: ExtendedViemWalletClient;
|
|
32
25
|
wallet: Wallet;
|
|
33
26
|
logger: Logger;
|
|
@@ -38,10 +31,10 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
38
31
|
private constructor(private config: FeeJuicePortalTestingHarnessFactoryConfig) {}
|
|
39
32
|
|
|
40
33
|
private async createReal() {
|
|
41
|
-
const { aztecNode, aztecNodeAdmin,
|
|
34
|
+
const { aztecNode, aztecNodeAdmin, l1Client, wallet, logger } = this.config;
|
|
42
35
|
|
|
43
36
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
44
|
-
const l1ContractAddresses = (await
|
|
37
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
45
38
|
|
|
46
39
|
const feeJuiceAddress = l1ContractAddresses.feeJuiceAddress;
|
|
47
40
|
const feeJuicePortalAddress = l1ContractAddresses.feeJuicePortalAddress;
|
|
@@ -50,12 +43,12 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
50
43
|
throw new Error('Fee Juice portal not deployed on L1');
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
const gasL2 =
|
|
46
|
+
const gasL2 = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
54
47
|
|
|
55
48
|
return new GasBridgingTestHarness(
|
|
56
49
|
aztecNode,
|
|
57
50
|
aztecNodeAdmin,
|
|
58
|
-
|
|
51
|
+
wallet,
|
|
59
52
|
logger,
|
|
60
53
|
gasL2,
|
|
61
54
|
ethAccount,
|
|
@@ -85,8 +78,8 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
85
78
|
public aztecNode: AztecNode,
|
|
86
79
|
/** Aztec node admin interface */
|
|
87
80
|
public aztecNodeAdmin: AztecNodeAdmin | undefined,
|
|
88
|
-
/**
|
|
89
|
-
public
|
|
81
|
+
/** Wallet. */
|
|
82
|
+
public wallet: Wallet,
|
|
90
83
|
/** Logger. */
|
|
91
84
|
public logger: Logger,
|
|
92
85
|
|
package/src/shared/jest_setup.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { SentTx } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
4
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
5
|
+
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
3
6
|
import { times } from '@aztec/foundation/collection';
|
|
4
|
-
import type {
|
|
7
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
5
8
|
|
|
6
|
-
// submits a set of transactions to the provided
|
|
9
|
+
// submits a set of transactions to the provided Wallet
|
|
7
10
|
export const submitTxsTo = async (
|
|
8
|
-
|
|
11
|
+
wallet: TestWallet,
|
|
12
|
+
submitter: AztecAddress,
|
|
9
13
|
numTxs: number,
|
|
10
|
-
wallet: Wallet,
|
|
11
14
|
logger: Logger,
|
|
12
15
|
): Promise<SentTx[]> => {
|
|
13
16
|
const txs: SentTx[] = [];
|
|
14
17
|
await Promise.all(
|
|
15
18
|
times(numTxs, async () => {
|
|
16
|
-
const accountManager = await
|
|
17
|
-
const
|
|
19
|
+
const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
|
|
20
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
21
|
+
const tx = deployMethod.send({ from: submitter });
|
|
18
22
|
const txHash = await tx.getTxHash();
|
|
19
23
|
|
|
20
24
|
logger.info(`Tx sent with hash ${txHash}`);
|