@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8
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/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +28 -13
- package/dest/bench/utils.d.ts +5 -4
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +9 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- 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 +7 -8
- package/dest/e2e_epochs/epochs_test.d.ts +7 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +29 -7
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +6 -6
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +6 -2
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +9 -16
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +3 -3
- package/dest/fixtures/e2e_prover_test.d.ts +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +8 -5
- package/dest/fixtures/setup.d.ts +5 -3
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +31 -20
- package/dest/fixtures/setup_p2p_test.d.ts +4 -5
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +24 -19
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/shared/cross_chain_test_harness.d.ts +3 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +11 -11
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +12 -12
- package/dest/simulators/lending_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +61 -34
- package/dest/spartan/tx_metrics.d.ts +38 -2
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +178 -4
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -260
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -942
- package/package.json +39 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +11 -24
- package/src/bench/utils.ts +9 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -12
- package/src/e2e_epochs/epochs_test.ts +58 -32
- package/src/e2e_fees/bridging_race.notest.ts +1 -4
- package/src/e2e_fees/fees_test.ts +10 -14
- package/src/e2e_l1_publisher/write_json.ts +3 -8
- package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
- package/src/e2e_p2p/p2p_network.ts +15 -9
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +20 -22
- package/src/e2e_token_contract/token_contract_test.ts +3 -5
- package/src/fixtures/e2e_prover_test.ts +4 -9
- package/src/fixtures/setup.ts +33 -26
- package/src/fixtures/setup_p2p_test.ts +15 -20
- package/src/fixtures/token_utils.ts +6 -5
- package/src/shared/cross_chain_test_harness.ts +13 -27
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +12 -19
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +72 -24
- package/src/spartan/tx_metrics.ts +152 -7
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -1246
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
4
|
+
import { Tx } from '@aztec/aztec.js/tx';
|
|
5
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
8
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
9
|
+
|
|
10
|
+
import { jest } from '@jest/globals';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import os from 'os';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
|
|
15
|
+
import { shouldCollectMetrics } from '../../fixtures/fixtures.js';
|
|
16
|
+
import { createNodes } from '../../fixtures/setup_p2p_test.js';
|
|
17
|
+
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES, WAIT_FOR_TX_TIMEOUT } from '../p2p_network.js';
|
|
18
|
+
import { prepareTransactions } from '../shared.js';
|
|
19
|
+
|
|
20
|
+
// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
|
|
21
|
+
export const NUM_VALIDATORS = 6;
|
|
22
|
+
export const NUM_TXS_PER_NODE = 2;
|
|
23
|
+
export const BOOT_NODE_UDP_PORT = 4500;
|
|
24
|
+
|
|
25
|
+
export const createReqrespDataDir = () => fs.mkdtempSync(path.join(os.tmpdir(), 'reqresp-'));
|
|
26
|
+
|
|
27
|
+
type ReqrespOptions = {
|
|
28
|
+
disableStatusHandshake?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export async function createReqrespTest(options: ReqrespOptions = {}): Promise<P2PNetworkTest> {
|
|
32
|
+
const { disableStatusHandshake = false } = options;
|
|
33
|
+
const t = await P2PNetworkTest.create({
|
|
34
|
+
testName: 'e2e_p2p_reqresp_tx',
|
|
35
|
+
numberOfNodes: 0,
|
|
36
|
+
numberOfValidators: NUM_VALIDATORS,
|
|
37
|
+
basePort: BOOT_NODE_UDP_PORT,
|
|
38
|
+
// To collect metrics - run in aztec-packages `docker compose --profile metrics up`
|
|
39
|
+
metricsPort: shouldCollectMetrics(),
|
|
40
|
+
initialConfig: {
|
|
41
|
+
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
|
|
42
|
+
aztecSlotDuration: 24,
|
|
43
|
+
...(disableStatusHandshake ? { p2pDisableStatusHandshake: true } : {}),
|
|
44
|
+
listenAddress: '127.0.0.1',
|
|
45
|
+
aztecEpochDuration: 64, // stable committee
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
await t.setup();
|
|
49
|
+
await t.applyBaseSetup();
|
|
50
|
+
return t;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function cleanupReqrespTest(params: { t: P2PNetworkTest; nodes?: AztecNodeService[]; dataDir: string }) {
|
|
54
|
+
const { t, nodes, dataDir } = params;
|
|
55
|
+
if (nodes) {
|
|
56
|
+
await t.stopNodes(nodes);
|
|
57
|
+
}
|
|
58
|
+
await t.teardown();
|
|
59
|
+
for (let i = 0; i < NUM_VALIDATORS; i++) {
|
|
60
|
+
fs.rmSync(`${dataDir}-${i}`, { recursive: true, force: true, maxRetries: 3 });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const getNodePort = (nodeIndex: number) => BOOT_NODE_UDP_PORT + 1 + nodeIndex;
|
|
65
|
+
|
|
66
|
+
export async function runReqrespTxTest(params: {
|
|
67
|
+
t: P2PNetworkTest;
|
|
68
|
+
dataDir: string;
|
|
69
|
+
disableStatusHandshake?: boolean;
|
|
70
|
+
}): Promise<AztecNodeService[]> {
|
|
71
|
+
const { t, dataDir, disableStatusHandshake = false } = params;
|
|
72
|
+
|
|
73
|
+
if (!t.bootstrapNodeEnr) {
|
|
74
|
+
throw new Error('Bootstrap node ENR is not available');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
t.logger.info('Creating nodes');
|
|
78
|
+
const aztecNodeConfig = disableStatusHandshake
|
|
79
|
+
? { ...t.ctx.aztecNodeConfig, p2pDisableStatusHandshake: true }
|
|
80
|
+
: t.ctx.aztecNodeConfig;
|
|
81
|
+
|
|
82
|
+
const nodes = await createNodes(
|
|
83
|
+
aztecNodeConfig,
|
|
84
|
+
t.ctx.dateProvider!,
|
|
85
|
+
t.bootstrapNodeEnr,
|
|
86
|
+
NUM_VALIDATORS,
|
|
87
|
+
BOOT_NODE_UDP_PORT,
|
|
88
|
+
t.prefilledPublicData,
|
|
89
|
+
dataDir,
|
|
90
|
+
shouldCollectMetrics(),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
t.logger.info('Waiting for nodes to connect');
|
|
94
|
+
await t.waitForP2PMeshConnectivity(nodes, NUM_VALIDATORS);
|
|
95
|
+
|
|
96
|
+
await t.setupAccount();
|
|
97
|
+
|
|
98
|
+
const targetBlockNumber = await t.ctx.aztecNodeService!.getBlockNumber();
|
|
99
|
+
await retryUntil(
|
|
100
|
+
async () => {
|
|
101
|
+
const blockNumbers = await Promise.all(nodes.map(node => node.getBlockNumber()));
|
|
102
|
+
return blockNumbers.every(blockNumber => blockNumber >= targetBlockNumber) ? true : undefined;
|
|
103
|
+
},
|
|
104
|
+
`validators to sync to L2 block ${targetBlockNumber}`,
|
|
105
|
+
60,
|
|
106
|
+
0.5,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
t.logger.info('Preparing transactions to send');
|
|
110
|
+
const txBatches = await timesAsync(2, () =>
|
|
111
|
+
prepareTransactions(t.logger, t.ctx.aztecNodeService!, NUM_TXS_PER_NODE, t.fundedAccount),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
t.logger.info('Removing initial node');
|
|
115
|
+
await t.removeInitialNode();
|
|
116
|
+
|
|
117
|
+
t.logger.info('Starting fresh slot');
|
|
118
|
+
const [timestamp] = await t.ctx.cheatCodes.rollup.advanceToNextSlot();
|
|
119
|
+
t.ctx.dateProvider!.setTime(Number(timestamp) * 1000);
|
|
120
|
+
const startSlotTimestamp = BigInt(timestamp);
|
|
121
|
+
|
|
122
|
+
const { proposerIndexes, nodesToTurnOffTxGossip } = await getProposerIndexes(t, startSlotTimestamp);
|
|
123
|
+
t.logger.info(`Turning off tx gossip for nodes: ${nodesToTurnOffTxGossip.map(getNodePort)}`);
|
|
124
|
+
t.logger.info(`Sending txs to proposer nodes: ${proposerIndexes.map(getNodePort)}`);
|
|
125
|
+
|
|
126
|
+
// Replace the p2p node implementation of some of the nodes with a spy such that it does not store transactions that are gossiped to it
|
|
127
|
+
// Original implementation of `handleGossipedTx` will store received transactions in the tx pool.
|
|
128
|
+
// We chose the first 2 nodes that will be the proposers for the next few slots
|
|
129
|
+
for (const nodeIndex of nodesToTurnOffTxGossip) {
|
|
130
|
+
const logger = createLogger(`p2p:${getNodePort(nodeIndex)}`);
|
|
131
|
+
jest.spyOn((nodes[nodeIndex] as any).p2pClient.p2pService, 'handleGossipedTx').mockImplementation(((
|
|
132
|
+
payloadData: Buffer,
|
|
133
|
+
) => {
|
|
134
|
+
const txHash = Tx.fromBuffer(payloadData).getTxHash();
|
|
135
|
+
logger.info(`Skipping storage of gossiped transaction ${txHash.toString()}`);
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
}) as any);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// We send the tx to the proposer nodes directly, ignoring the pxe and node in each context
|
|
141
|
+
// We cannot just call tx.send since they were created using a pxe wired to the first node which is now stopped
|
|
142
|
+
t.logger.info('Sending transactions through proposer nodes');
|
|
143
|
+
const submittedTxs = await Promise.all(
|
|
144
|
+
txBatches.map(async (batch, batchIndex) => {
|
|
145
|
+
const proposerNode = nodes[proposerIndexes[batchIndex]];
|
|
146
|
+
await Promise.all(
|
|
147
|
+
batch.map(async tx => {
|
|
148
|
+
try {
|
|
149
|
+
await proposerNode.sendTx(tx);
|
|
150
|
+
} catch (err) {
|
|
151
|
+
t.logger.error(`Error sending tx: ${err}`);
|
|
152
|
+
throw err;
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
156
|
+
return batch.map(tx => ({ node: proposerNode, txHash: tx.getTxHash() }));
|
|
157
|
+
}),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
t.logger.info('Waiting for all transactions to be mined');
|
|
161
|
+
await Promise.all(
|
|
162
|
+
submittedTxs.flatMap((batch, batchIndex) =>
|
|
163
|
+
batch.map(async (submittedTx, txIndex) => {
|
|
164
|
+
t.logger.info(`Waiting for tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} to be mined`);
|
|
165
|
+
await waitForTx(submittedTx.node, submittedTx.txHash, { timeout: WAIT_FOR_TX_TIMEOUT * 1.5 });
|
|
166
|
+
t.logger.info(`Tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} has been mined`);
|
|
167
|
+
}),
|
|
168
|
+
),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
t.logger.info('All transactions mined');
|
|
172
|
+
|
|
173
|
+
return nodes;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint) {
|
|
177
|
+
// Get the nodes for the next set of slots
|
|
178
|
+
const rollupContract = new RollupContract(
|
|
179
|
+
t.ctx.deployL1ContractsValues.l1Client,
|
|
180
|
+
t.ctx.deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const attesters = await rollupContract.getAttesters();
|
|
184
|
+
const startSlot = await rollupContract.getSlotAt(startSlotTimestamp);
|
|
185
|
+
|
|
186
|
+
const proposers = await Promise.all(
|
|
187
|
+
Array.from({ length: 3 }, async (_, i) => {
|
|
188
|
+
const slot = SlotNumber(startSlot + i);
|
|
189
|
+
const slotTimestamp = await rollupContract.getTimestampForSlot(slot);
|
|
190
|
+
return await rollupContract.getProposerAt(slotTimestamp);
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
// Get the indexes of the nodes that are responsible for the next two slots
|
|
194
|
+
const proposerIndexes = proposers.map(proposer => attesters.findIndex(a => a.equals(proposer)));
|
|
195
|
+
|
|
196
|
+
if (proposerIndexes.some(i => i === -1)) {
|
|
197
|
+
throw new Error(
|
|
198
|
+
`Proposer index not found for proposer ` +
|
|
199
|
+
`(proposers=${proposers.map(p => p.toString()).join(',')}, indices=${proposerIndexes.join(',')})`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const nodesToTurnOffTxGossip = Array.from({ length: NUM_VALIDATORS }, (_, i) => i).filter(
|
|
204
|
+
i => !proposerIndexes.includes(i),
|
|
205
|
+
);
|
|
206
|
+
return { proposerIndexes, nodesToTurnOffTxGossip };
|
|
207
|
+
}
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import {
|
|
4
|
+
import { NO_WAIT, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
6
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
|
-
import {
|
|
7
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
8
8
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
9
|
import type {
|
|
10
10
|
EmpireSlashingProposerContract,
|
|
@@ -22,7 +22,7 @@ import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
|
22
22
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
23
23
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
24
24
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
25
|
-
import { TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
25
|
+
import { type ProvenTx, TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
26
26
|
|
|
27
27
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
28
28
|
|
|
@@ -34,24 +34,15 @@ export const submitComplexTxsTo = async (
|
|
|
34
34
|
numTxs: number,
|
|
35
35
|
opts: { callPublic?: boolean } = {},
|
|
36
36
|
) => {
|
|
37
|
-
const txs:
|
|
37
|
+
const txs: TxHash[] = [];
|
|
38
38
|
|
|
39
39
|
const seed = 1234n;
|
|
40
40
|
const spamCount = 15;
|
|
41
41
|
for (let i = 0; i < numTxs; i++) {
|
|
42
|
-
const
|
|
43
|
-
const txHash = await
|
|
44
|
-
|
|
42
|
+
const method = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic);
|
|
43
|
+
const txHash = await method.send({ from, wait: NO_WAIT });
|
|
45
44
|
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
46
|
-
|
|
47
|
-
expect(receipt).toEqual(
|
|
48
|
-
expect.objectContaining({
|
|
49
|
-
status: TxStatus.PENDING,
|
|
50
|
-
error: '',
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
logger.info(`Receipt received for ${txHash.toString()}`);
|
|
54
|
-
txs.push(tx);
|
|
45
|
+
txs.push(txHash);
|
|
55
46
|
}
|
|
56
47
|
return txs;
|
|
57
48
|
};
|
|
@@ -62,10 +53,14 @@ export const submitTransactions = async (
|
|
|
62
53
|
node: AztecNodeService,
|
|
63
54
|
numTxs: number,
|
|
64
55
|
fundedAccount: InitialAccountData,
|
|
65
|
-
): Promise<
|
|
56
|
+
): Promise<TxHash[]> => {
|
|
66
57
|
const rpcConfig = getRpcConfig();
|
|
67
58
|
rpcConfig.proverEnabled = false;
|
|
68
|
-
const wallet = await TestWallet.create(
|
|
59
|
+
const wallet = await TestWallet.create(
|
|
60
|
+
node,
|
|
61
|
+
{ ...getPXEConfig(), proverEnabled: false },
|
|
62
|
+
{ loggerActorLabel: 'pxe-tx' },
|
|
63
|
+
);
|
|
69
64
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
70
65
|
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
71
66
|
};
|
|
@@ -75,11 +70,15 @@ export async function prepareTransactions(
|
|
|
75
70
|
node: AztecNodeService,
|
|
76
71
|
numTxs: number,
|
|
77
72
|
fundedAccount: InitialAccountData,
|
|
78
|
-
): Promise<
|
|
73
|
+
): Promise<ProvenTx[]> {
|
|
79
74
|
const rpcConfig = getRpcConfig();
|
|
80
75
|
rpcConfig.proverEnabled = false;
|
|
81
76
|
|
|
82
|
-
const wallet = await TestWallet.create(
|
|
77
|
+
const wallet = await TestWallet.create(
|
|
78
|
+
node,
|
|
79
|
+
{ ...getPXEConfig(), proverEnabled: false },
|
|
80
|
+
{ loggerActorLabel: 'pxe-tx' },
|
|
81
|
+
);
|
|
83
82
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
84
83
|
|
|
85
84
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
@@ -92,8 +91,7 @@ export async function prepareTransactions(
|
|
|
92
91
|
const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
|
|
93
92
|
from: fundedAccountManager.address,
|
|
94
93
|
});
|
|
95
|
-
|
|
96
|
-
logger.info(`Tx prepared with hash ${txHash}`);
|
|
94
|
+
logger.info(`Tx prepared with hash ${tx.getTxHash()}`);
|
|
97
95
|
return tx;
|
|
98
96
|
});
|
|
99
97
|
}
|
|
@@ -85,13 +85,11 @@ export class TokenContractTest {
|
|
|
85
85
|
TokenContractTest.TOKEN_NAME,
|
|
86
86
|
TokenContractTest.TOKEN_SYMBOL,
|
|
87
87
|
TokenContractTest.TOKEN_DECIMALS,
|
|
88
|
-
)
|
|
89
|
-
.send({ from: this.adminAddress })
|
|
90
|
-
.deployed();
|
|
88
|
+
).send({ from: this.adminAddress });
|
|
91
89
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
92
90
|
|
|
93
91
|
this.logger.verbose(`Deploying bad account...`);
|
|
94
|
-
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress })
|
|
92
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress });
|
|
95
93
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
96
94
|
|
|
97
95
|
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
@@ -130,7 +128,7 @@ export class TokenContractTest {
|
|
|
130
128
|
const amount = 10000n;
|
|
131
129
|
|
|
132
130
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
133
|
-
await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress })
|
|
131
|
+
await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress });
|
|
134
132
|
tokenSim.mintPublic(adminAddress, amount);
|
|
135
133
|
|
|
136
134
|
const publicBalance = await asset.methods.balance_of_public(adminAddress).simulate({ from: adminAddress });
|
|
@@ -114,9 +114,7 @@ export class FullProverTest {
|
|
|
114
114
|
FullProverTest.TOKEN_NAME,
|
|
115
115
|
FullProverTest.TOKEN_SYMBOL,
|
|
116
116
|
FullProverTest.TOKEN_DECIMALS,
|
|
117
|
-
)
|
|
118
|
-
.send({ from: this.accounts[0] })
|
|
119
|
-
.wait();
|
|
117
|
+
).send({ from: this.accounts[0], wait: { returnReceipt: true } });
|
|
120
118
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
121
119
|
|
|
122
120
|
this.fakeProofsAsset = asset;
|
|
@@ -200,7 +198,7 @@ export class FullProverTest {
|
|
|
200
198
|
this.aztecNode,
|
|
201
199
|
{ proverEnabled: this.realProofs },
|
|
202
200
|
undefined,
|
|
203
|
-
|
|
201
|
+
'pxe-proven',
|
|
204
202
|
);
|
|
205
203
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
206
204
|
await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
|
|
@@ -308,13 +306,10 @@ export class FullProverTest {
|
|
|
308
306
|
const publicAmount = 10000n;
|
|
309
307
|
|
|
310
308
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
311
|
-
await asset.methods
|
|
312
|
-
.mint_to_public(accounts[0], privateAmount + publicAmount)
|
|
313
|
-
.send({ from: accounts[0] })
|
|
314
|
-
.wait();
|
|
309
|
+
await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({ from: accounts[0] });
|
|
315
310
|
|
|
316
311
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
317
|
-
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] })
|
|
312
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] });
|
|
318
313
|
|
|
319
314
|
this.logger.info(`Minting complete`);
|
|
320
315
|
|
package/src/fixtures/setup.ts
CHANGED
|
@@ -41,7 +41,7 @@ import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
|
41
41
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
42
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
43
43
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
44
|
-
import {
|
|
44
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
45
45
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
46
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
47
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
@@ -125,14 +125,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
125
125
|
* @param aztecNode - An instance of Aztec Node.
|
|
126
126
|
* @param opts - Partial configuration for the PXE.
|
|
127
127
|
* @param logger - The logger to be used.
|
|
128
|
-
* @param
|
|
128
|
+
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
129
129
|
* @returns A test wallet, logger and teardown function.
|
|
130
130
|
*/
|
|
131
131
|
export async function setupPXEAndGetWallet(
|
|
132
132
|
aztecNode: AztecNode,
|
|
133
133
|
opts: Partial<PXEConfig> = {},
|
|
134
134
|
logger = getLogger(),
|
|
135
|
-
|
|
135
|
+
actor?: string,
|
|
136
136
|
): Promise<{
|
|
137
137
|
wallet: TestWallet;
|
|
138
138
|
logger: Logger;
|
|
@@ -150,9 +150,7 @@ export async function setupPXEAndGetWallet(
|
|
|
150
150
|
|
|
151
151
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
|
|
152
152
|
|
|
153
|
-
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
154
|
-
useLogSuffix,
|
|
155
|
-
});
|
|
153
|
+
const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
|
|
156
154
|
|
|
157
155
|
return {
|
|
158
156
|
wallet,
|
|
@@ -209,6 +207,8 @@ export type SetupOptions = {
|
|
|
209
207
|
skipAccountDeployment?: boolean;
|
|
210
208
|
/** L1 contracts deployment arguments. */
|
|
211
209
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
210
|
+
/** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
|
|
211
|
+
walletMinFeePadding?: number;
|
|
212
212
|
} & Partial<AztecNodeConfig>;
|
|
213
213
|
|
|
214
214
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -268,7 +268,7 @@ export type EndToEndContext = {
|
|
|
268
268
|
*/
|
|
269
269
|
async function setupWithRemoteEnvironment(
|
|
270
270
|
account: HDAccount | PrivateKeyAccount,
|
|
271
|
-
config: AztecNodeConfig,
|
|
271
|
+
config: AztecNodeConfig & SetupOptions,
|
|
272
272
|
logger: Logger,
|
|
273
273
|
numberOfAccounts: number,
|
|
274
274
|
): Promise<EndToEndContext> {
|
|
@@ -289,6 +289,11 @@ async function setupWithRemoteEnvironment(
|
|
|
289
289
|
};
|
|
290
290
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
291
291
|
const wallet = await TestWallet.create(aztecNode);
|
|
292
|
+
|
|
293
|
+
if (config.walletMinFeePadding !== undefined) {
|
|
294
|
+
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
295
|
+
}
|
|
296
|
+
|
|
292
297
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
293
298
|
const teardown = () => Promise.resolve();
|
|
294
299
|
|
|
@@ -385,7 +390,7 @@ export async function setup(
|
|
|
385
390
|
const res = await startAnvil({
|
|
386
391
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
387
392
|
accounts: opts.anvilAccounts,
|
|
388
|
-
port: opts.anvilPort,
|
|
393
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
389
394
|
});
|
|
390
395
|
anvil = res.anvil;
|
|
391
396
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -567,10 +572,12 @@ export async function setup(
|
|
|
567
572
|
}
|
|
568
573
|
}
|
|
569
574
|
|
|
570
|
-
const aztecNodeService = await
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
575
|
+
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
576
|
+
AztecNodeService.createAndSync(
|
|
577
|
+
config,
|
|
578
|
+
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
579
|
+
{ prefilledPublicData },
|
|
580
|
+
),
|
|
574
581
|
);
|
|
575
582
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
576
583
|
|
|
@@ -604,7 +611,11 @@ export async function setup(
|
|
|
604
611
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
605
612
|
// For tests we only want proving enabled if specifically requested
|
|
606
613
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
607
|
-
const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
|
|
614
|
+
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
|
|
615
|
+
|
|
616
|
+
if (opts.walletMinFeePadding !== undefined) {
|
|
617
|
+
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
618
|
+
}
|
|
608
619
|
|
|
609
620
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
610
621
|
|
|
@@ -629,7 +640,7 @@ export async function setup(
|
|
|
629
640
|
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
|
|
630
641
|
);
|
|
631
642
|
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
632
|
-
const accountManagers = await deployFundedSchnorrAccounts(wallet,
|
|
643
|
+
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
633
644
|
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
634
645
|
} else if (needsEmptyBlock) {
|
|
635
646
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
@@ -786,7 +797,7 @@ export function createAndSyncProverNode(
|
|
|
786
797
|
prefilledPublicData: PublicDataTreeLeaf[] = [],
|
|
787
798
|
proverNodeDeps: ProverNodeDeps = {},
|
|
788
799
|
) {
|
|
789
|
-
return
|
|
800
|
+
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
790
801
|
const aztecNodeTxProvider = aztecNode && {
|
|
791
802
|
getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
|
|
792
803
|
getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
|
|
@@ -921,13 +932,11 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
921
932
|
).map(contractMetadata => contractMetadata.instance);
|
|
922
933
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
923
934
|
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
924
|
-
await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
|
|
925
|
-
.send({ from: accountsToDeploy[0] })
|
|
926
|
-
.wait();
|
|
935
|
+
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
|
|
927
936
|
}
|
|
928
937
|
const requests = instances.map(instance => publishInstance(wallet, instance!));
|
|
929
938
|
const batch = new BatchCall(wallet, requests);
|
|
930
|
-
await batch.send({ from: accountsToDeploy[0] })
|
|
939
|
+
await batch.send({ from: accountsToDeploy[0] });
|
|
931
940
|
}
|
|
932
941
|
|
|
933
942
|
/**
|
|
@@ -951,12 +960,10 @@ export const deployAccounts =
|
|
|
951
960
|
deployedAccounts[i].signingKey,
|
|
952
961
|
);
|
|
953
962
|
const deployMethod = await accountManager.getDeployMethod();
|
|
954
|
-
await deployMethod
|
|
955
|
-
.
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
})
|
|
959
|
-
.wait();
|
|
963
|
+
await deployMethod.send({
|
|
964
|
+
from: AztecAddress.ZERO,
|
|
965
|
+
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
966
|
+
});
|
|
960
967
|
}
|
|
961
968
|
|
|
962
969
|
return { deployedAccounts };
|
|
@@ -986,7 +993,7 @@ export async function publicDeployAccounts(
|
|
|
986
993
|
|
|
987
994
|
const batch = new BatchCall(wallet, calls);
|
|
988
995
|
|
|
989
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] })
|
|
996
|
+
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
990
997
|
if (waitUntilProven) {
|
|
991
998
|
if (!node) {
|
|
992
999
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
5
|
import { range } from '@aztec/foundation/array';
|
|
6
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
7
|
-
import {
|
|
7
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
8
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
10
|
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
11
11
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
12
12
|
|
|
13
13
|
import getPort from 'get-port';
|
|
14
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
15
14
|
|
|
16
15
|
import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
17
16
|
import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
|
|
@@ -22,6 +21,11 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
22
21
|
// to avoid running validators with the same key
|
|
23
22
|
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
24
23
|
|
|
24
|
+
// Global counters for actor naming (start at 1)
|
|
25
|
+
let validatorCounter = 1;
|
|
26
|
+
let nodeCounter = 1;
|
|
27
|
+
let proverCounter = 1;
|
|
28
|
+
|
|
25
29
|
export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
|
|
26
30
|
const privateKeys: `0x${string}`[] = [];
|
|
27
31
|
// Do not start from 0 as it is used during setup
|
|
@@ -44,10 +48,6 @@ export async function createNodes(
|
|
|
44
48
|
validatorsPerNode = 1,
|
|
45
49
|
): Promise<AztecNodeService[]> {
|
|
46
50
|
const nodePromises: Promise<AztecNodeService>[] = [];
|
|
47
|
-
const loggerIdStorage = new AsyncLocalStorage<string>();
|
|
48
|
-
const logNameHandler = (module: string) =>
|
|
49
|
-
loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
|
|
50
|
-
addLogNameHandler(logNameHandler);
|
|
51
51
|
|
|
52
52
|
for (let i = 0; i < numNodes; i++) {
|
|
53
53
|
const index = indexOffset + i;
|
|
@@ -69,7 +69,6 @@ export async function createNodes(
|
|
|
69
69
|
prefilledPublicData,
|
|
70
70
|
dataDir,
|
|
71
71
|
metricsPort,
|
|
72
|
-
loggerIdStorage,
|
|
73
72
|
);
|
|
74
73
|
nodePromises.push(nodePromise);
|
|
75
74
|
}
|
|
@@ -81,7 +80,6 @@ export async function createNodes(
|
|
|
81
80
|
throw new Error('Sequencer not found');
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
removeLogNameHandler(logNameHandler);
|
|
85
83
|
return nodes;
|
|
86
84
|
}
|
|
87
85
|
|
|
@@ -95,9 +93,9 @@ export async function createNode(
|
|
|
95
93
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
96
94
|
dataDirectory?: string,
|
|
97
95
|
metricsPort?: number,
|
|
98
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
99
96
|
) {
|
|
100
|
-
const
|
|
97
|
+
const actorIndex = validatorCounter++;
|
|
98
|
+
return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
|
|
101
99
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
102
100
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
103
101
|
return await AztecNodeService.createAndSync(
|
|
@@ -105,8 +103,7 @@ export async function createNode(
|
|
|
105
103
|
{ telemetry, dateProvider },
|
|
106
104
|
{ prefilledPublicData, dontStartSequencer: config.dontStartSequencer },
|
|
107
105
|
);
|
|
108
|
-
};
|
|
109
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
106
|
+
});
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
@@ -118,9 +115,9 @@ export async function createNonValidatorNode(
|
|
|
118
115
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
119
116
|
dataDirectory?: string,
|
|
120
117
|
metricsPort?: number,
|
|
121
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
122
118
|
) {
|
|
123
|
-
const
|
|
119
|
+
const actorIndex = nodeCounter++;
|
|
120
|
+
return await withLoggerBindings({ actor: `node-${actorIndex}` }, async () => {
|
|
124
121
|
const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
|
|
125
122
|
const config: AztecNodeConfig = {
|
|
126
123
|
...p2pConfig,
|
|
@@ -130,8 +127,7 @@ export async function createNonValidatorNode(
|
|
|
130
127
|
};
|
|
131
128
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
132
129
|
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
|
|
133
|
-
};
|
|
134
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
130
|
+
});
|
|
135
131
|
}
|
|
136
132
|
|
|
137
133
|
export async function createProverNode(
|
|
@@ -143,9 +139,9 @@ export async function createProverNode(
|
|
|
143
139
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
144
140
|
dataDirectory?: string,
|
|
145
141
|
metricsPort?: number,
|
|
146
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
147
142
|
) {
|
|
148
|
-
const
|
|
143
|
+
const actorIndex = proverCounter++;
|
|
144
|
+
return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
|
|
149
145
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
150
146
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
151
147
|
|
|
@@ -165,8 +161,7 @@ export async function createProverNode(
|
|
|
165
161
|
prefilledPublicData,
|
|
166
162
|
{ ...proverNodeDeps, telemetry },
|
|
167
163
|
);
|
|
168
|
-
};
|
|
169
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
|
|
164
|
+
});
|
|
170
165
|
}
|
|
171
166
|
|
|
172
167
|
export async function createP2PConfig(
|
|
@@ -6,9 +6,10 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
6
6
|
|
|
7
7
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
|
-
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
|
+
from: admin,
|
|
11
|
+
wait: { returnReceipt: true },
|
|
12
|
+
});
|
|
12
13
|
|
|
13
14
|
if (initialAdminBalance > 0n) {
|
|
14
15
|
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
@@ -25,7 +26,7 @@ export async function mintTokensToPrivate(
|
|
|
25
26
|
recipient: AztecAddress,
|
|
26
27
|
amount: bigint,
|
|
27
28
|
) {
|
|
28
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter })
|
|
29
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter });
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export async function expectTokenBalance(
|
|
@@ -55,7 +56,7 @@ export async function mintNotes(
|
|
|
55
56
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
56
57
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
57
58
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
|
58
|
-
await new BatchCall(wallet, actions).send({ from: minter })
|
|
59
|
+
await new BatchCall(wallet, actions).send({ from: minter });
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
|