@aztec/end-to-end 0.82.2 → 0.82.3-nightly.20250403
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 +66 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +281 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +85 -0
- package/dest/bench/client_flows/data_extractor.d.ts +23 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +198 -0
- package/dest/bench/utils.d.ts +0 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +2 -28
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -12
- 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 +1 -13
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +3 -14
- package/dest/e2e_p2p/p2p_network.d.ts +5 -0
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +13 -4
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +1 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -2
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +1 -2
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +7 -2
- package/dest/fixtures/token_utils.d.ts +2 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +14 -1
- package/dest/fixtures/utils.d.ts +0 -4
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +216 -238
- package/dest/sample-dapp/contracts.js +4 -4
- package/dest/shared/capture_private_execution_steps.d.ts +2 -2
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +24 -6
- package/dest/shared/cross_chain_test_harness.d.ts +12 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -3
- package/dest/shared/uniswap_l1_l2.js +8 -6
- package/package.json +32 -32
- package/src/bench/client_flows/client_flows_benchmark.ts +395 -0
- package/src/bench/client_flows/config.ts +53 -0
- package/src/bench/client_flows/data_extractor.ts +217 -0
- package/src/bench/utils.ts +2 -30
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -25
- package/src/e2e_fees/fees_test.ts +2 -15
- package/src/e2e_p2p/p2p_network.ts +10 -6
- package/src/e2e_p2p/shared.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +12 -3
- package/src/fixtures/setup_l1_contracts.ts +1 -2
- package/src/fixtures/snapshot_manager.ts +7 -2
- package/src/fixtures/token_utils.ts +22 -2
- package/src/fixtures/utils.ts +235 -261
- package/src/sample-dapp/contracts.mjs +4 -4
- package/src/shared/capture_private_execution_steps.ts +43 -6
- package/src/shared/cross_chain_test_harness.ts +26 -2
- package/src/shared/uniswap_l1_l2.ts +8 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { BatchCall } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
|
+
// docs:start:token_utils
|
|
3
4
|
export async function deployToken(adminWallet, initialAdminBalance, logger) {
|
|
4
5
|
logger.info(`Deploying Token contract...`);
|
|
5
6
|
const contract = await TokenContract.deploy(adminWallet, adminWallet.getAddress(), 'TokenName', 'TokenSymbol', 18).send().deployed();
|
|
@@ -25,3 +26,15 @@ export async function expectTokenBalance(wallet, token, owner, expectedBalance,
|
|
|
25
26
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
26
27
|
expect(balance).toBe(expectedBalance);
|
|
27
28
|
}
|
|
29
|
+
export async function mintNotes(sender, recipient, asset, noteAmounts) {
|
|
30
|
+
// We can only mint 4 notes at a time, since that's the maximum number of calls our entrypoints allow
|
|
31
|
+
// TODO(#13024): mint as many notes as possible in a single tx
|
|
32
|
+
const notesPerIteration = 4;
|
|
33
|
+
for(let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration){
|
|
34
|
+
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
35
|
+
const from = sender.getAddress(); // we are setting from to sender here because we need a sender to calculate the tag
|
|
36
|
+
const actions = toMint.map((amt)=>asset.methods.mint_to_private(from, recipient, amt));
|
|
37
|
+
await new BatchCall(sender, actions).send().wait();
|
|
38
|
+
}
|
|
39
|
+
return noteAmounts.reduce((prev, curr)=>prev + curr, 0n);
|
|
40
|
+
}
|
package/dest/fixtures/utils.d.ts
CHANGED
|
@@ -147,10 +147,6 @@ export declare function getBalancesFn(symbol: string, method: ContractMethod, lo
|
|
|
147
147
|
})[]) => Promise<bigint[]>;
|
|
148
148
|
export declare function expectMapping<K, V>(fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedOutputs: V[]): Promise<void>;
|
|
149
149
|
export declare function expectMappingDelta<K, V extends number | bigint>(initialValues: V[], fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedDiffs: V[]): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* Deploy the canonical Fee Juice contract to a running instance.
|
|
152
|
-
*/
|
|
153
|
-
export declare function setupCanonicalFeeJuice(pxe: PXE): Promise<void>;
|
|
154
150
|
/**
|
|
155
151
|
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
156
152
|
* but by conventions its address is computed with a salt of 0.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/utils.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/utils.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,GAAG,EAER,KAAK,MAAM,EAMZ,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,iBAAiB,EAOlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA0C,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAG7E,OAAO,EAAE,KAAK,UAAU,EAA2C,MAAM,oBAAoB,CAAC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,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAUnF;AAED,wBAAsB,aAAa,CAAC,CAAC,EAAE,CAAC,EACtC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,CAAC,EAAE,EACX,eAAe,EAAE,CAAC,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EACnE,aAAa,EAAE,CAAC,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,CAAC,EAAE,EACX,aAAa,EAAE,CAAC,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,0BAK3C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,iCAiB/C;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,SAAK,EAAE,WAAW,SAAI,iBAS/G;AAED,wBAAsB,uBAAuB,CAC3C,oBAAoB,EAAE,KAAK,MAAM,EAAE,EACnC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,MAAM,EACrB,mBAAmB,GAAE,kBAAkB,EAAO,uBA+C/C;AAWD,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,KAAK,MAAM,EAAE,EACzB,aAAa,EAAE,GAAG,8BAWnB"}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -2,13 +2,13 @@ import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
|
2
2
|
import { deployFundedSchnorrAccounts, generateSchnorrAccounts, getDeployedTestAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
|
-
import { BatchCall,
|
|
5
|
+
import { BatchCall, SignerlessWallet, createAztecNodeClient, createLogger, createPXEClient, makeFetch, waitForPXE } from '@aztec/aztec.js';
|
|
6
6
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
7
7
|
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee/testing';
|
|
8
8
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
9
9
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
10
10
|
import { createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
11
|
-
import {
|
|
11
|
+
import { GENESIS_ARCHIVE_ROOT, GENESIS_BLOCK_HASH, SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
12
12
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
13
13
|
import { ForwarderContract, NULL_KEY, createL1Clients, deployL1Contracts, getL1ContractsConfigEnvVars, isAnvilTestChain, l1Artifacts } from '@aztec/ethereum';
|
|
14
14
|
import { DelayedTxUtils, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
@@ -17,16 +17,14 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
17
17
|
import { Fr } from '@aztec/foundation/fields';
|
|
18
18
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
19
19
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
20
|
-
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
21
20
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
22
21
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
23
|
-
import {
|
|
22
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
24
23
|
import { createProverNode } from '@aztec/prover-node';
|
|
25
24
|
import { createPXEServiceWithSimulationProvider, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
26
25
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
27
26
|
import { SimulationProviderRecorderWrapper } from '@aztec/simulator/testing';
|
|
28
27
|
import { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
29
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
30
28
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
31
29
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
32
30
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -34,7 +32,6 @@ import fs from 'fs/promises';
|
|
|
34
32
|
import getPort from 'get-port';
|
|
35
33
|
import { tmpdir } from 'os';
|
|
36
34
|
import * as path from 'path';
|
|
37
|
-
import { inspect } from 'util';
|
|
38
35
|
import { getContract } from 'viem';
|
|
39
36
|
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
40
37
|
import { foundry } from 'viem/chains';
|
|
@@ -71,7 +68,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
71
68
|
};
|
|
72
69
|
export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, chain = foundry)=>{
|
|
73
70
|
const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
|
|
74
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
75
71
|
vkTreeRoot: getVKTreeRoot(),
|
|
76
72
|
protocolContractTreeRoot,
|
|
77
73
|
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
@@ -155,7 +151,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
155
151
|
};
|
|
156
152
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
157
153
|
const teardown = ()=>Promise.resolve();
|
|
158
|
-
await setupCanonicalFeeJuice(pxeClient);
|
|
159
154
|
logger.verbose('Constructing available wallets from already registered accounts...');
|
|
160
155
|
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
161
156
|
const wallets = await getDeployedTestAccountsWallets(pxeClient);
|
|
@@ -191,221 +186,226 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
191
186
|
*/ export async function setup(numberOfAccounts = 1, opts = {
|
|
192
187
|
customForwarderContractAddress: EthAddress.ZERO
|
|
193
188
|
}, pxeOpts = {}, chain = foundry) {
|
|
194
|
-
const config = {
|
|
195
|
-
...getConfigEnvVars(),
|
|
196
|
-
...opts
|
|
197
|
-
};
|
|
198
|
-
config.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
199
|
-
// For tests we only want proving enabled if specifically requested
|
|
200
|
-
config.realProofs = !!opts.realProofs;
|
|
201
|
-
const logger = getLogger();
|
|
202
|
-
// Create a temp directory for any services that need it and cleanup later
|
|
203
|
-
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
204
|
-
await fs.mkdir(directoryToCleanup, {
|
|
205
|
-
recursive: true
|
|
206
|
-
});
|
|
207
|
-
if (!config.dataDirectory) {
|
|
208
|
-
config.dataDirectory = directoryToCleanup;
|
|
209
|
-
}
|
|
210
189
|
let anvil;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
190
|
+
try {
|
|
191
|
+
const config = {
|
|
192
|
+
...getConfigEnvVars(),
|
|
193
|
+
...opts
|
|
194
|
+
};
|
|
195
|
+
config.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
196
|
+
// For tests we only want proving enabled if specifically requested
|
|
197
|
+
config.realProofs = !!opts.realProofs;
|
|
198
|
+
// Only enforce the time table if requested
|
|
199
|
+
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
200
|
+
const logger = getLogger();
|
|
201
|
+
// Create a temp directory for any services that need it and cleanup later
|
|
202
|
+
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
203
|
+
await fs.mkdir(directoryToCleanup, {
|
|
204
|
+
recursive: true
|
|
205
|
+
});
|
|
206
|
+
if (!config.dataDirectory) {
|
|
207
|
+
config.dataDirectory = directoryToCleanup;
|
|
214
208
|
}
|
|
209
|
+
if (!config.l1RpcUrls?.length) {
|
|
210
|
+
if (!isAnvilTestChain(chain.id)) {
|
|
211
|
+
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
212
|
+
}
|
|
213
|
+
if (PXE_URL) {
|
|
214
|
+
throw new Error(`PXE_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`);
|
|
215
|
+
}
|
|
216
|
+
const res = await startAnvil({
|
|
217
|
+
l1BlockTime: opts.ethereumSlotDuration
|
|
218
|
+
});
|
|
219
|
+
anvil = res.anvil;
|
|
220
|
+
config.l1RpcUrls = [
|
|
221
|
+
res.rpcUrl
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
// Enable logging metrics to a local file named after the test suite
|
|
225
|
+
if (isMetricsLoggingRequested()) {
|
|
226
|
+
const filename = path.join('log', getJobName() + '.jsonl');
|
|
227
|
+
logger.info(`Logging metrics to ${filename}`);
|
|
228
|
+
setupMetricsLogger(filename);
|
|
229
|
+
}
|
|
230
|
+
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
|
|
231
|
+
if (opts.stateLoad) {
|
|
232
|
+
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
233
|
+
}
|
|
234
|
+
if (opts.l1StartTime) {
|
|
235
|
+
await ethCheatCodes.warp(opts.l1StartTime);
|
|
236
|
+
}
|
|
237
|
+
let publisherPrivKey = undefined;
|
|
238
|
+
let publisherHdAccount = undefined;
|
|
239
|
+
if (config.publisherPrivateKey && config.publisherPrivateKey != NULL_KEY) {
|
|
240
|
+
publisherHdAccount = privateKeyToAccount(config.publisherPrivateKey);
|
|
241
|
+
} else if (!MNEMONIC) {
|
|
242
|
+
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
243
|
+
} else {
|
|
244
|
+
publisherHdAccount = mnemonicToAccount(MNEMONIC, {
|
|
245
|
+
addressIndex: 0
|
|
246
|
+
});
|
|
247
|
+
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
248
|
+
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
249
|
+
config.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
|
|
250
|
+
}
|
|
251
|
+
// Made as separate values such that keys can change, but for test they will be the same.
|
|
252
|
+
config.validatorPrivateKey = config.publisherPrivateKey;
|
|
215
253
|
if (PXE_URL) {
|
|
216
|
-
|
|
254
|
+
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
255
|
+
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
217
256
|
}
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
250
|
-
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
251
|
-
config.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
|
|
252
|
-
}
|
|
253
|
-
// Made as separate values such that keys can change, but for test they will be the same.
|
|
254
|
-
config.validatorPrivateKey = config.publisherPrivateKey;
|
|
255
|
-
if (PXE_URL) {
|
|
256
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
257
|
-
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
258
|
-
}
|
|
259
|
-
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts);
|
|
260
|
-
const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address), opts.initialAccountFeeJuice, opts.genesisPublicData);
|
|
261
|
-
const deployL1ContractsValues = opts.deployL1ContractsValues ?? await setupL1Contracts(config.l1RpcUrls, publisherHdAccount, logger, {
|
|
262
|
-
...opts,
|
|
263
|
-
genesisArchiveRoot,
|
|
264
|
-
genesisBlockHash
|
|
265
|
-
}, chain);
|
|
266
|
-
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
267
|
-
if (opts.fundRewardDistributor) {
|
|
268
|
-
// Mints block rewards for 10000 blocks to the rewardDistributor contract
|
|
269
|
-
const rewardDistributor = getContract({
|
|
270
|
-
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
271
|
-
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
272
|
-
client: deployL1ContractsValues.publicClient
|
|
273
|
-
});
|
|
274
|
-
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
275
|
-
const mintAmount = 10_000n * blockReward;
|
|
276
|
-
const feeJuice = getContract({
|
|
277
|
-
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
278
|
-
abi: l1Artifacts.feeAsset.contractAbi,
|
|
279
|
-
client: deployL1ContractsValues.walletClient
|
|
280
|
-
});
|
|
281
|
-
const rewardDistributorMintTxHash = await feeJuice.write.mint([
|
|
282
|
-
rewardDistributor.address,
|
|
283
|
-
mintAmount
|
|
284
|
-
], {});
|
|
285
|
-
await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
|
|
286
|
-
hash: rewardDistributorMintTxHash
|
|
287
|
-
});
|
|
288
|
-
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
289
|
-
}
|
|
290
|
-
if (opts.l2StartTime) {
|
|
291
|
-
// This should only be used in synching test or when you need to have a stable
|
|
292
|
-
// timestamp for the first l2 block.
|
|
293
|
-
await ethCheatCodes.warp(opts.l2StartTime);
|
|
294
|
-
}
|
|
295
|
-
const dateProvider = new TestDateProvider();
|
|
296
|
-
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.publicClient, dateProvider);
|
|
297
|
-
await watcher.start();
|
|
298
|
-
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
299
|
-
// Blob sink service - blobs get posted here and served from here
|
|
300
|
-
const blobSinkPort = await getPort();
|
|
301
|
-
const blobSink = await createBlobSinkServer({
|
|
302
|
-
l1ChainId: config.l1ChainId,
|
|
303
|
-
l1RpcUrls: config.l1RpcUrls,
|
|
304
|
-
rollupAddress: config.l1Contracts.rollupAddress,
|
|
305
|
-
port: blobSinkPort,
|
|
306
|
-
dataDirectory: config.dataDirectory,
|
|
307
|
-
dataStoreMapSizeKB: config.dataStoreMapSizeKB
|
|
308
|
-
}, telemetry);
|
|
309
|
-
await blobSink.start();
|
|
310
|
-
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
311
|
-
logger.verbose('Creating and synching an aztec node...');
|
|
312
|
-
const acvmConfig = await getACVMConfig(logger);
|
|
313
|
-
if (acvmConfig) {
|
|
314
|
-
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
315
|
-
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
316
|
-
}
|
|
317
|
-
const bbConfig = await getBBConfig(logger);
|
|
318
|
-
if (bbConfig) {
|
|
319
|
-
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
320
|
-
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
321
|
-
}
|
|
322
|
-
config.l1PublishRetryIntervalMS = 100;
|
|
323
|
-
const blobSinkClient = createBlobSinkClient(config);
|
|
324
|
-
const aztecNode = await AztecNodeService.createAndSync(config, {
|
|
325
|
-
dateProvider,
|
|
326
|
-
blobSinkClient,
|
|
327
|
-
telemetry
|
|
328
|
-
}, {
|
|
329
|
-
prefilledPublicData
|
|
330
|
-
});
|
|
331
|
-
const sequencer = aztecNode.getSequencer();
|
|
332
|
-
if (sequencer) {
|
|
333
|
-
const publisher = sequencer.sequencer.publisher;
|
|
334
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration);
|
|
335
|
-
}
|
|
336
|
-
let proverNode = undefined;
|
|
337
|
-
if (opts.startProverNode) {
|
|
338
|
-
logger.verbose('Creating and syncing a simulated prover node...');
|
|
339
|
-
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
340
|
-
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
341
|
-
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, aztecNode, path.join(directoryToCleanup, randomBytes(8).toString('hex')));
|
|
342
|
-
}
|
|
343
|
-
logger.verbose('Creating a pxe...');
|
|
344
|
-
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
345
|
-
if (!config.skipProtocolContracts) {
|
|
346
|
-
logger.verbose('Setting up Fee Juice...');
|
|
347
|
-
await setupCanonicalFeeJuice(pxe);
|
|
348
|
-
}
|
|
349
|
-
const accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
350
|
-
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
351
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
352
|
-
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
353
|
-
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
354
|
-
}
|
|
355
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
356
|
-
const teardown = async ()=>{
|
|
357
|
-
await pxeTeardown();
|
|
358
|
-
if (aztecNode instanceof AztecNodeService) {
|
|
359
|
-
await aztecNode?.stop();
|
|
257
|
+
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts);
|
|
258
|
+
const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address), opts.initialAccountFeeJuice, opts.genesisPublicData);
|
|
259
|
+
const deployL1ContractsValues = opts.deployL1ContractsValues ?? await setupL1Contracts(config.l1RpcUrls, publisherHdAccount, logger, {
|
|
260
|
+
...opts,
|
|
261
|
+
genesisArchiveRoot,
|
|
262
|
+
genesisBlockHash,
|
|
263
|
+
feeJuicePortalInitialBalance: fundingNeeded
|
|
264
|
+
}, chain);
|
|
265
|
+
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
266
|
+
if (opts.fundRewardDistributor) {
|
|
267
|
+
// Mints block rewards for 10000 blocks to the rewardDistributor contract
|
|
268
|
+
const rewardDistributor = getContract({
|
|
269
|
+
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
270
|
+
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
271
|
+
client: deployL1ContractsValues.publicClient
|
|
272
|
+
});
|
|
273
|
+
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
274
|
+
const mintAmount = 10_000n * blockReward;
|
|
275
|
+
const feeJuice = getContract({
|
|
276
|
+
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
277
|
+
abi: l1Artifacts.feeAsset.contractAbi,
|
|
278
|
+
client: deployL1ContractsValues.walletClient
|
|
279
|
+
});
|
|
280
|
+
const rewardDistributorMintTxHash = await feeJuice.write.mint([
|
|
281
|
+
rewardDistributor.address,
|
|
282
|
+
mintAmount
|
|
283
|
+
], {});
|
|
284
|
+
await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
|
|
285
|
+
hash: rewardDistributorMintTxHash
|
|
286
|
+
});
|
|
287
|
+
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
360
288
|
}
|
|
361
|
-
if (
|
|
362
|
-
|
|
289
|
+
if (opts.l2StartTime) {
|
|
290
|
+
// This should only be used in synching test or when you need to have a stable
|
|
291
|
+
// timestamp for the first l2 block.
|
|
292
|
+
await ethCheatCodes.warp(opts.l2StartTime);
|
|
363
293
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
294
|
+
const dateProvider = new TestDateProvider();
|
|
295
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.publicClient, dateProvider);
|
|
296
|
+
await watcher.start();
|
|
297
|
+
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
298
|
+
// Blob sink service - blobs get posted here and served from here
|
|
299
|
+
const blobSinkPort = await getPort();
|
|
300
|
+
const blobSink = await createBlobSinkServer({
|
|
301
|
+
l1ChainId: config.l1ChainId,
|
|
302
|
+
l1RpcUrls: config.l1RpcUrls,
|
|
303
|
+
rollupAddress: config.l1Contracts.rollupAddress,
|
|
304
|
+
port: blobSinkPort,
|
|
305
|
+
dataDirectory: config.dataDirectory,
|
|
306
|
+
dataStoreMapSizeKB: config.dataStoreMapSizeKB
|
|
307
|
+
}, telemetry);
|
|
308
|
+
await blobSink.start();
|
|
309
|
+
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
310
|
+
logger.verbose('Creating and synching an aztec node...');
|
|
311
|
+
const acvmConfig = await getACVMConfig(logger);
|
|
312
|
+
if (acvmConfig) {
|
|
313
|
+
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
314
|
+
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
368
315
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
316
|
+
const bbConfig = await getBBConfig(logger);
|
|
317
|
+
if (bbConfig) {
|
|
318
|
+
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
319
|
+
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
373
320
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
await
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
321
|
+
config.l1PublishRetryIntervalMS = 100;
|
|
322
|
+
const blobSinkClient = createBlobSinkClient(config);
|
|
323
|
+
const aztecNode = await AztecNodeService.createAndSync(config, {
|
|
324
|
+
dateProvider,
|
|
325
|
+
blobSinkClient,
|
|
326
|
+
telemetry
|
|
327
|
+
}, {
|
|
328
|
+
prefilledPublicData
|
|
329
|
+
});
|
|
330
|
+
const sequencer = aztecNode.getSequencer();
|
|
331
|
+
if (sequencer) {
|
|
332
|
+
const publisher = sequencer.sequencer.publisher;
|
|
333
|
+
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration);
|
|
388
334
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
initialFundedAccounts,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
335
|
+
let proverNode = undefined;
|
|
336
|
+
if (opts.startProverNode) {
|
|
337
|
+
logger.verbose('Creating and syncing a simulated prover node...');
|
|
338
|
+
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
339
|
+
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
340
|
+
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, aztecNode, path.join(directoryToCleanup, randomBytes(8).toString('hex')));
|
|
341
|
+
}
|
|
342
|
+
logger.verbose('Creating a pxe...');
|
|
343
|
+
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
344
|
+
const accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
345
|
+
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
346
|
+
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
347
|
+
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
348
|
+
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
349
|
+
}
|
|
350
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
351
|
+
const teardown = async ()=>{
|
|
352
|
+
await pxeTeardown();
|
|
353
|
+
if (aztecNode instanceof AztecNodeService) {
|
|
354
|
+
await aztecNode?.stop();
|
|
355
|
+
}
|
|
356
|
+
if (proverNode) {
|
|
357
|
+
await proverNode.stop();
|
|
358
|
+
}
|
|
359
|
+
if (acvmConfig?.cleanup) {
|
|
360
|
+
// remove the temp directory created for the acvm
|
|
361
|
+
logger.verbose(`Cleaning up ACVM state`);
|
|
362
|
+
await acvmConfig.cleanup();
|
|
363
|
+
}
|
|
364
|
+
if (bbConfig?.cleanup) {
|
|
365
|
+
// remove the temp directory created for the acvm
|
|
366
|
+
logger.verbose(`Cleaning up BB state`);
|
|
367
|
+
await bbConfig.cleanup();
|
|
368
|
+
}
|
|
369
|
+
await anvil?.stop().catch((err)=>getLogger().error(err));
|
|
370
|
+
await watcher.stop();
|
|
371
|
+
await blobSink?.stop();
|
|
372
|
+
if (directoryToCleanup) {
|
|
373
|
+
try {
|
|
374
|
+
logger.verbose(`Cleaning up data directory at ${directoryToCleanup}`);
|
|
375
|
+
await fs.rm(directoryToCleanup, {
|
|
376
|
+
recursive: true,
|
|
377
|
+
force: true,
|
|
378
|
+
maxRetries: 3
|
|
379
|
+
});
|
|
380
|
+
} catch (err) {
|
|
381
|
+
logger.warn(`Failed to delete data directory at ${directoryToCleanup}: ${err}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
return {
|
|
386
|
+
aztecNode,
|
|
387
|
+
aztecNodeAdmin: aztecNode,
|
|
388
|
+
blobSink,
|
|
389
|
+
cheatCodes,
|
|
390
|
+
config,
|
|
391
|
+
dateProvider,
|
|
392
|
+
deployL1ContractsValues,
|
|
393
|
+
initialFundedAccounts,
|
|
394
|
+
logger,
|
|
395
|
+
proverNode,
|
|
396
|
+
pxe,
|
|
397
|
+
sequencer,
|
|
398
|
+
teardown,
|
|
399
|
+
telemetryClient: telemetry,
|
|
400
|
+
wallet: wallets[0],
|
|
401
|
+
wallets,
|
|
402
|
+
watcher
|
|
403
|
+
};
|
|
404
|
+
} catch (err) {
|
|
405
|
+
// TODO: Just hoisted anvil for now to ensure cleanup. Prob need to hoist the rest.
|
|
406
|
+
await anvil?.stop();
|
|
407
|
+
throw err;
|
|
408
|
+
}
|
|
409
409
|
}
|
|
410
410
|
/**
|
|
411
411
|
* Registers the contract class used for test accounts and publicly deploys the instances requested.
|
|
@@ -482,28 +482,6 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
482
482
|
const diffs = outputs.map((output, i)=>output - initialValues[i]);
|
|
483
483
|
expect(diffs).toEqual(expectedDiffs);
|
|
484
484
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Deploy the canonical Fee Juice contract to a running instance.
|
|
487
|
-
*/ export async function setupCanonicalFeeJuice(pxe) {
|
|
488
|
-
// "deploy" the Fee Juice as it contains public functions
|
|
489
|
-
const feeJuicePortalAddress = (await pxe.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
|
|
490
|
-
const wallet = new SignerlessWallet(pxe);
|
|
491
|
-
const feeJuice = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
492
|
-
try {
|
|
493
|
-
const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
|
|
494
|
-
await feeJuice.methods.initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT).send({
|
|
495
|
-
fee: {
|
|
496
|
-
paymentMethod,
|
|
497
|
-
gasSettings: {
|
|
498
|
-
teardownGasLimits: Gas.empty()
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}).wait();
|
|
502
|
-
getLogger().info(`Fee Juice successfully setup. Portal address: ${feeJuicePortalAddress}`);
|
|
503
|
-
} catch (error) {
|
|
504
|
-
getLogger().warn(`Fee Juice might have already been setup. Got error: ${inspect(error)}.`);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
485
|
/**
|
|
508
486
|
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
509
487
|
* but by conventions its address is computed with a salt of 0.
|
|
@@ -517,8 +495,8 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
517
495
|
/**
|
|
518
496
|
* Deploy a sponsored FPC contract to a running instance.
|
|
519
497
|
*/ export async function setupSponsoredFPC(pxe) {
|
|
520
|
-
const { l1ChainId: chainId,
|
|
521
|
-
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId,
|
|
498
|
+
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
499
|
+
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
522
500
|
// Make the contract pay for the deployment fee itself
|
|
523
501
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
524
502
|
const deployed = await SponsoredFPCContract.deploy(deployer).send({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, Contract } from '@aztec/aztec.js';
|
|
3
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
3
|
import { readFileSync } from 'fs';
|
|
5
|
-
//
|
|
4
|
+
// This syntax is helpful for the referencing tutorial
|
|
5
|
+
const TokenContractArtifact = TokenContract.artifact;
|
|
6
6
|
// docs:start:get-tokens
|
|
7
7
|
export async function getToken(wallet) {
|
|
8
8
|
const addresses = JSON.parse(readFileSync('addresses.json'));
|
|
9
|
-
return
|
|
9
|
+
return Contract.at(AztecAddress.fromString(addresses.token), TokenContractArtifact, wallet);
|
|
10
10
|
} // docs:end:get-tokens
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This module exposes the ability to capture the private exection steps that go into our "Client IVC" prover.
|
|
3
3
|
* These are used for debugging and benchmarking barretenberg (the prover component).
|
|
4
4
|
*/
|
|
5
|
-
import type { ContractFunctionInteraction } from '@aztec/aztec.js/contracts';
|
|
6
|
-
export declare function capturePrivateExecutionStepsIfEnvSet(label: string, interaction: ContractFunctionInteraction): Promise<void>;
|
|
5
|
+
import type { ContractFunctionInteraction, DeployMethod, DeployOptions, ProfileMethodOptions } from '@aztec/aztec.js/contracts';
|
|
6
|
+
export declare function capturePrivateExecutionStepsIfEnvSet(label: string, interaction: ContractFunctionInteraction | DeployMethod, opts?: Omit<ProfileMethodOptions & DeployOptions, 'profileMode'>, expectedSteps?: number): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=capture_private_execution_steps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture_private_execution_steps.d.ts","sourceRoot":"","sources":["../../src/shared/capture_private_execution_steps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"capture_private_execution_steps.d.ts","sourceRoot":"","sources":["../../src/shared/capture_private_execution_steps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,2BAA2B,EAC3B,YAAY,EACZ,aAAa,EACb,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAoCnC,wBAAsB,oCAAoC,CACxD,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,2BAA2B,GAAG,YAAY,EACvD,IAAI,CAAC,EAAE,IAAI,CAAC,oBAAoB,GAAG,aAAa,EAAE,aAAa,CAAC,EAChE,aAAa,CAAC,EAAE,MAAM,iBA8BvB"}
|