@aztec/end-to-end 0.0.1-commit.c80b6263 → 0.0.1-commit.cd76b27
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 +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +3 -3
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- 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 +10 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- 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 +3 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +9 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +58 -33
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -5
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
- 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_p2p/p2p_network.d.ts +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +16 -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 +177 -0
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +5 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +10 -0
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +4 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +27 -34
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +39 -22
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +59 -149
- package/dest/fixtures/setup_p2p_test.d.ts +15 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -12
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- 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 +8 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -23
- package/dest/spartan/setup_test_wallets.d.ts +9 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +31 -1
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +4 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +2 -1
- package/dest/spartan/utils/index.d.ts +4 -4
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +2 -2
- package/dest/spartan/utils/k8s.d.ts +31 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +124 -0
- package/dest/spartan/utils/nodes.d.ts +11 -1
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +198 -27
- package/dest/spartan/utils/scripts.d.ts +18 -4
- package/dest/spartan/utils/scripts.d.ts.map +1 -1
- package/dest/spartan/utils/scripts.js +19 -4
- package/dest/test-wallet/test_wallet.d.ts +83 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +214 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +40 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +103 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +271 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +43 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +8 -12
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +1 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +11 -2
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +73 -63
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +11 -26
- package/src/e2e_l1_publisher/write_json.ts +1 -6
- package/src/e2e_nested_contract/nested_contract_test.ts +1 -1
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
- package/src/e2e_p2p/p2p_network.ts +29 -7
- package/src/e2e_p2p/reqresp/utils.ts +235 -0
- package/src/e2e_p2p/shared.ts +3 -1
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +11 -2
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +28 -38
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +89 -210
- package/src/fixtures/setup_p2p_test.ts +25 -24
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/index.ts +1 -0
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +2 -1
- package/src/shared/uniswap_l1_l2.ts +9 -11
- package/src/simulators/token_simulator.ts +1 -29
- package/src/spartan/setup_test_wallets.ts +43 -1
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +4 -1
- package/src/spartan/utils/k8s.ts +160 -0
- package/src/spartan/utils/nodes.ts +239 -24
- package/src/spartan/utils/scripts.ts +43 -7
- package/src/test-wallet/test_wallet.ts +306 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +43 -0
- package/src/test-wallet/worker_wallet.ts +165 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/dest/fixtures/setup.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { generateSchnorrAccounts
|
|
3
|
-
import { createArchiver } from '@aztec/archiver';
|
|
2
|
+
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
4
3
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
4
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
5
|
import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
|
|
7
6
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
8
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
9
8
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
10
|
-
import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
11
9
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
13
10
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
14
11
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
15
12
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -17,7 +14,7 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
|
17
14
|
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
18
15
|
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
19
16
|
import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
20
|
-
import {
|
|
17
|
+
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
21
18
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
22
19
|
import { SecretValue } from '@aztec/foundation/config';
|
|
23
20
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -25,32 +22,30 @@ import { tryRmDir } from '@aztec/foundation/fs';
|
|
|
25
22
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
26
23
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
27
24
|
import { sleep } from '@aztec/foundation/sleep';
|
|
28
|
-
import {
|
|
25
|
+
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
29
26
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
30
27
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
31
28
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
32
29
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
33
|
-
import { createProverNode } from '@aztec/prover-node';
|
|
34
30
|
import { getPXEConfig } from '@aztec/pxe/server';
|
|
35
31
|
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
36
32
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
37
33
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
38
34
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
39
|
-
import {
|
|
35
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
40
36
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
41
37
|
import fs from 'fs/promises';
|
|
42
38
|
import { tmpdir } from 'os';
|
|
43
39
|
import path from 'path';
|
|
44
40
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
45
41
|
import { foundry } from 'viem/chains';
|
|
42
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
46
43
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
47
44
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
48
45
|
import { getBBConfig } from './get_bb_config.js';
|
|
49
46
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
50
47
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
51
48
|
export { startAnvil };
|
|
52
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
53
|
-
const getAztecUrl = ()=>AZTEC_NODE_URL;
|
|
54
49
|
let telemetry = undefined;
|
|
55
50
|
async function getTelemetryClient(partialConfig = {}) {
|
|
56
51
|
if (!telemetry) {
|
|
@@ -110,65 +105,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
110
105
|
teardown
|
|
111
106
|
};
|
|
112
107
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
|
|
115
|
-
*/ async function setupWithRemoteEnvironment(account, config, logger, numberOfAccounts) {
|
|
116
|
-
const aztecNodeUrl = getAztecUrl();
|
|
117
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
118
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
119
|
-
await waitForNode(aztecNode, logger);
|
|
120
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
121
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
122
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
123
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
124
|
-
const deployL1ContractsValues = {
|
|
125
|
-
l1ContractAddresses,
|
|
126
|
-
l1Client,
|
|
127
|
-
rollupVersion
|
|
128
|
-
};
|
|
129
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
130
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
131
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
132
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
133
|
-
}
|
|
134
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
135
|
-
const teardown = ()=>Promise.resolve();
|
|
136
|
-
logger.verbose('Populating wallet from already registered accounts...');
|
|
137
|
-
const initialFundedAccounts = await getInitialTestAccountsData();
|
|
138
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
139
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
140
|
-
}
|
|
141
|
-
const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
|
|
142
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
143
|
-
return accountManager.address;
|
|
144
|
-
}));
|
|
145
|
-
return {
|
|
146
|
-
anvil: undefined,
|
|
147
|
-
aztecNode,
|
|
148
|
-
aztecNodeService: undefined,
|
|
149
|
-
aztecNodeAdmin: undefined,
|
|
150
|
-
sequencer: undefined,
|
|
151
|
-
proverNode: undefined,
|
|
152
|
-
deployL1ContractsValues,
|
|
153
|
-
config,
|
|
154
|
-
aztecNodeConfig: config,
|
|
155
|
-
initialFundedAccounts,
|
|
156
|
-
wallet,
|
|
157
|
-
accounts: testAccounts,
|
|
158
|
-
logger,
|
|
159
|
-
cheatCodes,
|
|
160
|
-
ethCheatCodes,
|
|
161
|
-
prefilledPublicData: undefined,
|
|
162
|
-
mockGossipSubNetwork: undefined,
|
|
163
|
-
watcher: undefined,
|
|
164
|
-
dateProvider: undefined,
|
|
165
|
-
telemetryClient: undefined,
|
|
166
|
-
acvmConfig: undefined,
|
|
167
|
-
bbConfig: undefined,
|
|
168
|
-
directoryToCleanup: undefined,
|
|
169
|
-
teardown
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
108
|
/**
|
|
173
109
|
* Sets up the environment for the end-to-end tests.
|
|
174
110
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
@@ -191,7 +127,10 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
191
127
|
config.realProofs = !!opts.realProofs;
|
|
192
128
|
// Only enforce the time table if requested
|
|
193
129
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
130
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
131
|
+
config.enableDelayer = true;
|
|
194
132
|
config.listenAddress = '127.0.0.1';
|
|
133
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
195
134
|
const logger = getLogger();
|
|
196
135
|
// Create a temp directory for any services that need it and cleanup later
|
|
197
136
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
@@ -205,9 +144,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
205
144
|
if (!isAnvilTestChain(chain.id)) {
|
|
206
145
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
207
146
|
}
|
|
208
|
-
if (AZTEC_NODE_URL) {
|
|
209
|
-
throw new Error(`AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`);
|
|
210
|
-
}
|
|
211
147
|
const res = await startAnvil({
|
|
212
148
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
213
149
|
accounts: opts.anvilAccounts,
|
|
@@ -239,8 +175,8 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
239
175
|
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
|
|
240
176
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
241
177
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
242
|
-
} else if (config.
|
|
243
|
-
publisherPrivKeyHex = config.
|
|
178
|
+
} else if (config.sequencerPublisherPrivateKeys && config.sequencerPublisherPrivateKeys.length > 0 && config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY) {
|
|
179
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
244
180
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
245
181
|
} else if (!MNEMONIC) {
|
|
246
182
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -251,17 +187,13 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
251
187
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
252
188
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
253
189
|
publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
|
|
254
|
-
config.
|
|
190
|
+
config.sequencerPublisherPrivateKeys = [
|
|
255
191
|
new SecretValue(publisherPrivKeyHex)
|
|
256
192
|
];
|
|
257
193
|
}
|
|
258
194
|
if (config.coinbase === undefined) {
|
|
259
195
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
260
196
|
}
|
|
261
|
-
if (AZTEC_NODE_URL) {
|
|
262
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
263
|
-
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
264
|
-
}
|
|
265
197
|
// Determine which addresses to fund in genesis
|
|
266
198
|
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
|
|
267
199
|
const addressesToFund = initialFundedAccounts.map((a)=>a.address);
|
|
@@ -300,8 +232,12 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
300
232
|
if (enableAutomine) {
|
|
301
233
|
await ethCheatCodes.setAutomine(false);
|
|
302
234
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
303
|
-
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
304
235
|
}
|
|
236
|
+
// Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
|
|
237
|
+
// In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
|
|
238
|
+
// warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
|
|
239
|
+
// slot from its dateProvider and cannot propose blocks.
|
|
240
|
+
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
305
241
|
if (opts.l2StartTime) {
|
|
306
242
|
await ethCheatCodes.warp(opts.l2StartTime, {
|
|
307
243
|
resetBlockInterval: true
|
|
@@ -365,23 +301,31 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
365
301
|
prefilledPublicData
|
|
366
302
|
}));
|
|
367
303
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
368
|
-
if (sequencerClient) {
|
|
369
|
-
const publisher = sequencerClient.sequencer.publisher;
|
|
370
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
371
|
-
}
|
|
372
304
|
let proverNode = undefined;
|
|
373
305
|
if (opts.startProverNode) {
|
|
374
306
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
375
307
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
376
308
|
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
377
309
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
310
|
+
const p2pClientDeps = {
|
|
311
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork),
|
|
312
|
+
rpcTxProviders: [
|
|
313
|
+
aztecNodeService
|
|
314
|
+
]
|
|
382
315
|
};
|
|
383
|
-
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config,
|
|
316
|
+
({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
|
|
317
|
+
...config.proverNodeConfig,
|
|
318
|
+
dataDirectory: proverNodeDataDirectory
|
|
319
|
+
}, {
|
|
320
|
+
dateProvider,
|
|
321
|
+
p2pClientDeps,
|
|
322
|
+
telemetry: telemetryClient
|
|
323
|
+
}, {
|
|
324
|
+
prefilledPublicData
|
|
325
|
+
}));
|
|
384
326
|
}
|
|
327
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
328
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
385
329
|
logger.verbose('Creating a pxe...');
|
|
386
330
|
const pxeConfig = {
|
|
387
331
|
...getPXEConfig(),
|
|
@@ -443,7 +387,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
443
387
|
logger.error(`Error during e2e test teardown`, err);
|
|
444
388
|
} finally{
|
|
445
389
|
try {
|
|
446
|
-
await telemetryClient
|
|
390
|
+
await telemetryClient.stop();
|
|
447
391
|
} catch (err) {
|
|
448
392
|
logger.error(`Error during telemetry client stop`, err);
|
|
449
393
|
}
|
|
@@ -465,6 +409,8 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
465
409
|
mockGossipSubNetwork,
|
|
466
410
|
prefilledPublicData,
|
|
467
411
|
proverNode,
|
|
412
|
+
sequencerDelayer,
|
|
413
|
+
proverDelayer,
|
|
468
414
|
sequencer: sequencerClient,
|
|
469
415
|
teardown,
|
|
470
416
|
telemetryClient,
|
|
@@ -525,76 +471,40 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
|
|
|
525
471
|
targetBlock ??= await node.getBlockNumber();
|
|
526
472
|
await retryUntil(async ()=>await node.getProvenBlockNumber() >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
|
|
527
473
|
}
|
|
528
|
-
|
|
474
|
+
/**
|
|
475
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
476
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
477
|
+
*/ export function createAndSyncProverNode(proverNodePrivateKey, baseConfig, configOverrides, deps, options) {
|
|
529
478
|
return withLoggerBindings({
|
|
530
479
|
actor: 'prover-0'
|
|
531
480
|
}, async ()=>{
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
...aztecNodeConfig,
|
|
540
|
-
dataDirectory: proverNodeConfig.dataDirectory
|
|
541
|
-
};
|
|
542
|
-
const archiver = await createArchiver(archiverConfig, {
|
|
543
|
-
blobClient,
|
|
544
|
-
dateProvider: proverNodeDeps.dateProvider
|
|
545
|
-
}, {
|
|
546
|
-
blockUntilSync: true
|
|
547
|
-
});
|
|
548
|
-
const proverConfig = {
|
|
549
|
-
...aztecNodeConfig,
|
|
550
|
-
txCollectionNodeRpcUrls: [],
|
|
551
|
-
realProofs: false,
|
|
552
|
-
proverAgentCount: 2,
|
|
553
|
-
publisherPrivateKeys: [
|
|
481
|
+
const proverNode = await AztecNodeService.createAndSync({
|
|
482
|
+
...baseConfig,
|
|
483
|
+
...configOverrides,
|
|
484
|
+
p2pPort: 0,
|
|
485
|
+
enableProverNode: true,
|
|
486
|
+
disableValidator: true,
|
|
487
|
+
proverPublisherPrivateKeys: [
|
|
554
488
|
new SecretValue(proverNodePrivateKey)
|
|
555
|
-
]
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
txGatheringIntervalMs: 1000,
|
|
560
|
-
txGatheringBatchSize: 10,
|
|
561
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
562
|
-
txGatheringTimeoutMs: 24_000,
|
|
563
|
-
proverNodeFailedEpochStore: undefined,
|
|
564
|
-
proverId: EthAddress.fromNumber(1),
|
|
565
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
566
|
-
...proverNodeConfig
|
|
567
|
-
};
|
|
568
|
-
const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node', proverNodeDeps.dateProvider);
|
|
569
|
-
const proverNode = await createProverNode(proverConfig, {
|
|
570
|
-
...proverNodeDeps,
|
|
571
|
-
aztecNodeTxProvider,
|
|
572
|
-
archiver: archiver,
|
|
573
|
-
l1TxUtils
|
|
574
|
-
}, {
|
|
575
|
-
prefilledPublicData
|
|
576
|
-
});
|
|
577
|
-
getLogger().info(`Created and synced prover node`, {
|
|
578
|
-
publisherAddress: l1TxUtils.client.account.address
|
|
489
|
+
]
|
|
490
|
+
}, deps, {
|
|
491
|
+
...options,
|
|
492
|
+
dontStartProverNode: options.dontStart
|
|
579
493
|
});
|
|
580
|
-
if (!
|
|
581
|
-
|
|
494
|
+
if (!proverNode.getProverNode()) {
|
|
495
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
582
496
|
}
|
|
583
|
-
|
|
497
|
+
getLogger().info(`Created and synced prover node`);
|
|
498
|
+
return {
|
|
499
|
+
proverNode
|
|
500
|
+
};
|
|
584
501
|
});
|
|
585
502
|
}
|
|
586
|
-
function
|
|
587
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
588
|
-
const log = createLogger(logName);
|
|
589
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
590
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
591
|
-
return l1TxUtils;
|
|
592
|
-
}
|
|
593
|
-
export function getBalancesFn(symbol, method, from, logger) {
|
|
503
|
+
export function getBalancesFn(symbol, method, logger) {
|
|
594
504
|
const balances = async (...addressLikes)=>{
|
|
595
505
|
const addresses = addressLikes.map((addressLike)=>'address' in addressLike ? addressLike.address : addressLike);
|
|
596
506
|
const b = await Promise.all(addresses.map((address)=>method(address).simulate({
|
|
597
|
-
from
|
|
507
|
+
from: address
|
|
598
508
|
})));
|
|
599
509
|
const debugString = `${symbol} balances: ${addresses.map((address, i)=>`${address}: ${b[i]}`).join(', ')}`;
|
|
600
510
|
logger.verbose(debugString);
|
|
@@ -3,20 +3,28 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
5
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
|
-
import type { ProverNodeDeps } from '@aztec/prover-node';
|
|
7
6
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
8
7
|
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
9
8
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
10
9
|
export declare function createNodes(config: AztecNodeConfig & {
|
|
11
10
|
dontStartSequencer?: boolean;
|
|
12
11
|
}, dateProvider: DateProvider, bootstrapNodeEnr: string, numNodes: number, bootNodePort: number, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, indexOffset?: number, validatorsPerNode?: number): Promise<AztecNodeService[]>;
|
|
13
|
-
/**
|
|
14
|
-
export
|
|
12
|
+
/** Extended config type for createNode with test-specific overrides. */
|
|
13
|
+
export type CreateNodeConfig = AztecNodeConfig & {
|
|
14
|
+
/** Whether to skip starting the sequencer. */
|
|
15
15
|
dontStartSequencer?: boolean;
|
|
16
|
-
|
|
16
|
+
/** Override the private key (instead of deriving from addressIndex). */
|
|
17
|
+
validatorPrivateKey?: `0x${string}`;
|
|
18
|
+
};
|
|
19
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */
|
|
20
|
+
export declare function createNode(config: CreateNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number | number[], prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number): Promise<AztecNodeService>;
|
|
17
21
|
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
18
22
|
export declare function createNonValidatorNode(baseConfig: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number): Promise<AztecNodeService>;
|
|
19
|
-
export declare function createProverNode(config: AztecNodeConfig, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number,
|
|
23
|
+
export declare function createProverNode(config: AztecNodeConfig, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number, deps: {
|
|
24
|
+
dateProvider: DateProvider;
|
|
25
|
+
}, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number): Promise<{
|
|
26
|
+
proverNode: AztecNodeService;
|
|
27
|
+
}>;
|
|
20
28
|
export declare function createP2PConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
21
|
-
export declare function createValidatorConfig(config:
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
export declare function createValidatorConfig(config: CreateNodeConfig, bootstrapNodeEnr?: string, port?: number, addressIndex?: number | number[], dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXBfcDJwX3Rlc3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RSxNQUFNLEVBQ3RCLFdBQVcsQ0FBQyxFQUFFLE1BQU0sR0FDbkIsT0FBTyxDQUFDO0lBQUUsVUFBVSxFQUFFLGdCQUFnQixDQUFBO0NBQUUsQ0FBQyxDQWdCM0M7QUFFRCx3QkFBc0IsZUFBZSxDQUNuQyxNQUFNLEVBQUUsZUFBZSxFQUN2QixnQkFBZ0IsQ0FBQyxFQUFFLE1BQU0sRUFDekIsSUFBSSxDQUFDLEVBQUUsTUFBTSxFQUNiLGFBQWEsQ0FBQyxFQUFFLE1BQU0sNEJBZ0J2QjtBQUVELHdCQUFzQixxQkFBcUIsQ0FDekMsTUFBTSxFQUFFLGdCQUFnQixFQUN4QixnQkFBZ0IsQ0FBQyxFQUFFLE1BQU0sRUFDekIsSUFBSSxDQUFDLEVBQUUsTUFBTSxFQUNiLFlBQVksR0FBRSxNQUFNLEdBQUcsTUFBTSxFQUFNLEVBQ25DLGFBQWEsQ0FBQyxFQUFFLE1BQU0sNEJBb0J2QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAW9D,eAAO,MAAM,iCAAiC,IAAI,CA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E,MAAM,6BAcrB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EACpC,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,EAC1C,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,UAAU,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAgB3C;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,4BAgBvB;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,MAAM,GAAG,MAAM,EAAM,EACnC,aAAa,CAAC,EAAE,MAAM,4BAoBvB"}
|
|
@@ -46,7 +46,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
46
46
|
}
|
|
47
47
|
return nodes;
|
|
48
48
|
}
|
|
49
|
-
/** Creates a P2P enabled instance of Aztec Node Service with a validator */ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex, prefilledPublicData, dataDirectory, metricsPort) {
|
|
49
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex, prefilledPublicData, dataDirectory, metricsPort) {
|
|
50
50
|
const actorIndex = validatorCounter++;
|
|
51
51
|
return await withLoggerBindings({
|
|
52
52
|
actor: `validator-${actorIndex}`
|
|
@@ -72,7 +72,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
72
72
|
...p2pConfig,
|
|
73
73
|
disableValidator: true,
|
|
74
74
|
validatorPrivateKeys: undefined,
|
|
75
|
-
|
|
75
|
+
sequencerPublisherPrivateKeys: []
|
|
76
76
|
};
|
|
77
77
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
78
78
|
return await AztecNodeService.createAndSync(config, {
|
|
@@ -83,21 +83,24 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
export async function createProverNode(config, tcpPort, bootstrapNode, addressIndex,
|
|
86
|
+
export async function createProverNode(config, tcpPort, bootstrapNode, addressIndex, deps, prefilledPublicData, dataDirectory, metricsPort) {
|
|
87
87
|
const actorIndex = proverCounter++;
|
|
88
88
|
return await withLoggerBindings({
|
|
89
89
|
actor: `prover-${actorIndex}`
|
|
90
90
|
}, async ()=>{
|
|
91
91
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex);
|
|
92
92
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...
|
|
93
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
94
|
+
return await createAndSyncProverNode(bufferToHex(proverNodePrivateKey), {
|
|
95
|
+
...config,
|
|
96
|
+
...p2pConfig
|
|
97
|
+
}, {
|
|
97
98
|
dataDirectory
|
|
98
|
-
},
|
|
99
|
-
...
|
|
99
|
+
}, {
|
|
100
|
+
...deps,
|
|
100
101
|
telemetry
|
|
102
|
+
}, {
|
|
103
|
+
prefilledPublicData: prefilledPublicData ?? []
|
|
101
104
|
});
|
|
102
105
|
});
|
|
103
106
|
}
|
|
@@ -121,16 +124,19 @@ export async function createValidatorConfig(config, bootstrapNodeEnr, port, addr
|
|
|
121
124
|
const addressIndices = Array.isArray(addressIndex) ? addressIndex : [
|
|
122
125
|
addressIndex
|
|
123
126
|
];
|
|
124
|
-
if (addressIndices.length === 0) {
|
|
127
|
+
if (addressIndices.length === 0 && !config.validatorPrivateKey) {
|
|
125
128
|
throw new Error('At least one address index must be provided to create a validator config');
|
|
126
129
|
}
|
|
127
|
-
|
|
130
|
+
// Use override private key if provided, otherwise derive from address indices
|
|
131
|
+
const attesterPrivateKeys = config.validatorPrivateKey ? [
|
|
132
|
+
config.validatorPrivateKey
|
|
133
|
+
] : addressIndices.map((index)=>bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)));
|
|
128
134
|
const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
|
|
129
135
|
const nodeConfig = {
|
|
130
136
|
...config,
|
|
131
137
|
...p2pConfig,
|
|
132
138
|
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
133
|
-
|
|
139
|
+
sequencerPublisherPrivateKeys: [
|
|
134
140
|
new SecretValue(attesterPrivateKeys[0])
|
|
135
141
|
]
|
|
136
142
|
};
|
package/dest/shared/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { uniswapL1L2TestSuite } from './uniswap_l1_l2.js';
|
|
2
|
-
|
|
2
|
+
export { MockStateView, diffInBps } from './mock_state_view.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaGFyZWQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDMUQsT0FBTyxFQUFFLGFBQWEsRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dest/shared/index.js
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { EthCheatCodes } from '@aztec/aztec/testing';
|
|
3
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
4
|
+
/**
|
|
5
|
+
* Mock StateView contract for testing the Uniswap price oracle.
|
|
6
|
+
*
|
|
7
|
+
* Wraps a compiled Solidity contract that mimics the Uniswap V4 StateView's getSlot0 function.
|
|
8
|
+
* The mock allows setting return values dynamically for testing different price scenarios.
|
|
9
|
+
*
|
|
10
|
+
* Solidity source:
|
|
11
|
+
* ```solidity
|
|
12
|
+
* // SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
* pragma solidity >=0.8.27;
|
|
14
|
+
*
|
|
15
|
+
* contract MockStateView {
|
|
16
|
+
* uint160 public sqrtPriceX96;
|
|
17
|
+
* int24 public tick;
|
|
18
|
+
* uint24 public protocolFee;
|
|
19
|
+
* uint24 public lpFee;
|
|
20
|
+
*
|
|
21
|
+
* function setReturnValues(
|
|
22
|
+
* uint160 _sqrtPriceX96,
|
|
23
|
+
* int24 _tick,
|
|
24
|
+
* uint24 _protocolFee,
|
|
25
|
+
* uint24 _lpFee
|
|
26
|
+
* ) external {
|
|
27
|
+
* sqrtPriceX96 = _sqrtPriceX96;
|
|
28
|
+
* tick = _tick;
|
|
29
|
+
* protocolFee = _protocolFee;
|
|
30
|
+
* lpFee = _lpFee;
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* function getSlot0(bytes32 poolId) external view returns (uint160, int24, uint24, uint24) {
|
|
34
|
+
* return (sqrtPriceX96, tick, protocolFee, lpFee);
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class MockStateView {
|
|
40
|
+
private readonly address;
|
|
41
|
+
private readonly walletClient;
|
|
42
|
+
private readonly log;
|
|
43
|
+
private static readonly BYTECODE;
|
|
44
|
+
private static readonly ABI;
|
|
45
|
+
private constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Deploys the mock StateView contract at the specified address using etch.
|
|
48
|
+
* @param ethCheatCodes - Cheat codes for etching bytecode
|
|
49
|
+
* @param walletClient - Wallet client for sending transactions
|
|
50
|
+
* @param address - Address to deploy the mock at (typically the real StateView address)
|
|
51
|
+
*/
|
|
52
|
+
static deploy(ethCheatCodes: EthCheatCodes, walletClient: ExtendedViemWalletClient, address: EthAddress): Promise<MockStateView>;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the price using the ethPerFeeAssetE12 format (same as rollup contract).
|
|
55
|
+
* Computes the corresponding sqrtPriceX96 internally.
|
|
56
|
+
*
|
|
57
|
+
* Math (from fee_asset_price_oracle.ts):
|
|
58
|
+
* ethPerFeeAssetE12 = 1e12 * 2^192 / sqrtPriceX96^2
|
|
59
|
+
*
|
|
60
|
+
* Inverted:
|
|
61
|
+
* sqrtPriceX96^2 = 1e12 * 2^192 / ethPerFeeAssetE12
|
|
62
|
+
* sqrtPriceX96 = sqrt(1e12 * 2^192 / ethPerFeeAssetE12)
|
|
63
|
+
*
|
|
64
|
+
* @param ethPerFeeAssetE12 - The price in ETH per fee asset, scaled by 1e12
|
|
65
|
+
*/
|
|
66
|
+
setEthPerFeeAsset(ethPerFeeAssetE12: bigint): Promise<import("viem").TransactionReceipt>;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the sqrtPriceX96 value directly (Uniswap's price encoding).
|
|
69
|
+
* @param sqrtPriceX96 - The sqrtPriceX96 value
|
|
70
|
+
* @param tick - The tick value (default 10)
|
|
71
|
+
* @param protocolFee - The protocol fee (default 0)
|
|
72
|
+
* @param lpFee - The LP fee (default 500)
|
|
73
|
+
*/
|
|
74
|
+
setSqrtPriceX96(sqrtPriceX96: bigint, tick?: number, protocolFee?: number, lpFee?: number): Promise<import("viem").TransactionReceipt>;
|
|
75
|
+
/**
|
|
76
|
+
* Converts ethPerFeeAssetE12 to sqrtPriceX96 (inverse of sqrtPriceX96ToEthPerFeeAssetE12).
|
|
77
|
+
*
|
|
78
|
+
* Math:
|
|
79
|
+
* sqrtPriceX96 = sqrt(1e12 * 2^192 / ethPerFeeAssetE12)
|
|
80
|
+
*/
|
|
81
|
+
ethPerFeeAssetE12ToSqrtPriceX96(ethPerFeeAssetE12: bigint): bigint;
|
|
82
|
+
/** Integer square root using Newton's method */
|
|
83
|
+
bigintSqrt(n: bigint): bigint;
|
|
84
|
+
}
|
|
85
|
+
export declare function diffInBps(a: bigint, b: bigint): bigint;
|
|
86
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19zdGF0ZV92aWV3LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2hhcmVkL21vY2tfc3RhdGVfdmlldy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFdkQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUl0RTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtDRztBQUNILHFCQUFhLGFBQWE7SUFxRHRCLE9BQU8sQ0FB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