@aztec/end-to-end 1.2.0 → 2.0.0-nightly.20250813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +2 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +4 -2
- 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 +33 -15
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +7 -4
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +11 -3
- 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 +59 -24
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +3 -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 +13 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +7 -6
- package/dest/e2e_epochs/epochs_test.d.ts +16 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +65 -7
- package/dest/e2e_fees/bridging_race.notest.js +3 -1
- package/dest/e2e_fees/fees_test.d.ts +5 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +44 -59
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +17 -12
- package/dest/e2e_p2p/p2p_network.d.ts +7 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +43 -22
- package/dest/e2e_p2p/shared.d.ts +3 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +16 -12
- package/dest/e2e_token_contract/token_contract_test.d.ts +8 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +48 -23
- 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 +27 -10
- package/dest/fixtures/setup_p2p_test.d.ts +4 -1
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +39 -8
- package/dest/fixtures/snapshot_manager.d.ts +3 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +20 -17
- package/dest/fixtures/token_utils.d.ts +3 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +14 -10
- package/dest/fixtures/utils.d.ts +23 -8
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +88 -56
- package/dest/integration_l1_publisher/write_json.d.ts +8 -0
- package/dest/integration_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/integration_l1_publisher/write_json.js +57 -0
- package/dest/sample-dapp/connect.d.mts +2 -0
- package/dest/sample-dapp/connect.d.mts.map +1 -0
- package/dest/sample-dapp/connect.js +1 -1
- package/dest/sample-dapp/contracts.d.mts +3 -0
- package/dest/sample-dapp/contracts.d.mts.map +1 -0
- package/dest/sample-dapp/contracts.js +1 -1
- package/dest/sample-dapp/deploy.d.mts +3 -0
- package/dest/sample-dapp/deploy.d.mts.map +1 -0
- package/dest/sample-dapp/deploy.js +4 -1
- package/dest/sample-dapp/index.d.mts +2 -0
- package/dest/sample-dapp/index.d.mts.map +1 -0
- package/dest/sample-dapp/index.js +18 -8
- package/dest/shared/cross_chain_test_harness.d.ts +6 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +50 -20
- package/dest/shared/gas_portal_test_harness.d.ts +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +21 -6
- 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 +45 -22
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -2
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +12 -4
- package/dest/spartan/setup_test_wallets.d.ts +7 -0
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +96 -11
- package/dest/spartan/utils.d.ts +23 -3
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +9 -6
- package/package.json +36 -36
- package/src/bench/client_flows/benchmark.ts +8 -3
- package/src/bench/client_flows/client_flows_benchmark.ts +23 -14
- package/src/bench/utils.ts +5 -4
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +47 -26
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -9
- package/src/e2e_deploy_contract/deploy_test.ts +7 -7
- package/src/e2e_epochs/epochs_test.ts +97 -25
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +55 -82
- package/src/e2e_nested_contract/nested_contract_test.ts +16 -11
- package/src/e2e_p2p/p2p_network.ts +51 -26
- package/src/e2e_p2p/shared.ts +14 -12
- package/src/e2e_token_contract/token_contract_test.ts +38 -36
- package/src/fixtures/e2e_prover_test.ts +17 -10
- package/src/fixtures/setup_p2p_test.ts +51 -9
- package/src/fixtures/snapshot_manager.ts +24 -17
- package/src/fixtures/token_utils.ts +14 -9
- package/src/fixtures/utils.ts +116 -57
- package/src/guides/up_quick_start.sh +1 -1
- package/src/integration_l1_publisher/write_json.ts +74 -0
- package/src/sample-dapp/connect.mjs +1 -1
- package/src/sample-dapp/contracts.mjs +1 -1
- package/src/sample-dapp/deploy.mjs +3 -3
- package/src/sample-dapp/index.mjs +11 -8
- package/src/shared/cross_chain_test_harness.ts +31 -18
- package/src/shared/gas_portal_test_harness.ts +17 -7
- package/src/shared/uniswap_l1_l2.ts +28 -24
- package/src/simulators/lending_simulator.ts +3 -3
- package/src/simulators/token_simulator.ts +12 -3
- package/src/spartan/setup_test_wallets.ts +130 -19
- package/src/spartan/utils.ts +10 -3
|
@@ -5,15 +5,24 @@ import { RollupContract } from '@aztec/ethereum/contracts';
|
|
|
5
5
|
import { ChainMonitor, type Delayer } from '@aztec/ethereum/test';
|
|
6
6
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
7
7
|
import { ProverNode } from '@aztec/prover-node';
|
|
8
|
-
import type
|
|
8
|
+
import { type SequencerClient, type SequencerEvents } from '@aztec/sequencer-client';
|
|
9
|
+
import type { EthAddress, L2BlockNumber } from '@aztec/stdlib/block';
|
|
9
10
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
10
11
|
import { type EndToEndContext, type SetupOptions } from '../fixtures/utils.js';
|
|
11
12
|
export declare const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
12
13
|
export declare const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
13
14
|
export declare const ARCHIVER_POLL_INTERVAL = 50;
|
|
14
|
-
export
|
|
15
|
+
export declare const DEFAULT_L1_BLOCK_TIME: number;
|
|
16
|
+
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
15
17
|
numberOfAccounts?: number;
|
|
16
18
|
};
|
|
19
|
+
export type TrackedSequencerEvent = {
|
|
20
|
+
[K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
|
|
21
|
+
type: K;
|
|
22
|
+
sequencerIndex: number;
|
|
23
|
+
validator: EthAddress;
|
|
24
|
+
};
|
|
25
|
+
}[keyof SequencerEvents];
|
|
17
26
|
/**
|
|
18
27
|
* Tests building of epochs using fast block times and short epochs.
|
|
19
28
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -45,6 +54,7 @@ export declare class EpochsTestContext {
|
|
|
45
54
|
createProverNode(): Promise<ProverNode>;
|
|
46
55
|
createNonValidatorNode(opts?: Partial<AztecNodeConfig>): Promise<AztecNodeService>;
|
|
47
56
|
createValidatorNode(privateKeys: `0x${string}`[], opts?: Partial<AztecNodeConfig> & {
|
|
57
|
+
txDelayerMaxInclusionTimeIntoSlot?: number;
|
|
48
58
|
dontStartSequencer?: boolean;
|
|
49
59
|
}): Promise<AztecNodeService>;
|
|
50
60
|
private createNode;
|
|
@@ -68,5 +78,9 @@ export declare class EpochsTestContext {
|
|
|
68
78
|
}>;
|
|
69
79
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
70
80
|
verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean): Promise<void>;
|
|
81
|
+
watchSequencerEvents(sequencers: SequencerClient[], getMetadata?: (i: number) => Record<string, any>): {
|
|
82
|
+
failEvents: TrackedSequencerEvent[];
|
|
83
|
+
stateChanges: TrackedSequencerEvent[];
|
|
84
|
+
};
|
|
71
85
|
}
|
|
72
86
|
//# sourceMappingURL=epochs_test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,EAAE,EACF,KAAK,MAAM,EAEX,KAAK,MAAM,EAKZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,E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,CAAC,EAAE,OAAO,CAAA;KAAO;YAMtG,UAAU;IAgDxB,OAAO,CAAC,iBAAiB;IAKzB,0FAA0F;IAC7E,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAO/C,sDAAsD;IACzC,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK;IAShE,iEAAiE;IACpD,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,SAAK;IAUjE,kFAAkF;IACrE,wCAAwC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAUlF,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU;IAoB7F,sDAAsD;IACzC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAU;IAYhE,0GAA0G;IAC7F,cAAc;;;;IAc3B,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;IAW9E,oBAAoB,CACzB,UAAU,EAAE,eAAe,EAAE,EAC7B,WAAW,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAc;;;;CAiD/D"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { Fr, MerkleTreeId,
|
|
2
|
+
import { Fr, MerkleTreeId, getContractInstanceFromInstantiationParams, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { DefaultL1ContractsConfig, createExtendedL1Client } from '@aztec/ethereum';
|
|
4
4
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
-
import { ChainMonitor, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
5
|
+
import { ChainMonitor, DelayedTxUtils, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
6
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
7
7
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
8
8
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
9
9
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
10
10
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
11
|
+
import { SequencerState } from '@aztec/sequencer-client';
|
|
11
12
|
import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
12
13
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
13
14
|
import { join } from 'path';
|
|
@@ -16,6 +17,7 @@ import { createAndSyncProverNode, getPrivateKeyFromIndex, setup } from '../fixtu
|
|
|
16
17
|
export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
17
18
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
18
19
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
20
|
+
export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
19
21
|
/**
|
|
20
22
|
* Tests building of epochs using fast block times and short epochs.
|
|
21
23
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -40,7 +42,7 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
40
42
|
return test;
|
|
41
43
|
}
|
|
42
44
|
static getSlotDurations(opts = {}) {
|
|
43
|
-
const envEthereumSlotDuration = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) :
|
|
45
|
+
const envEthereumSlotDuration = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : DEFAULT_L1_BLOCK_TIME;
|
|
44
46
|
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
|
|
45
47
|
const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
|
|
46
48
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 4;
|
|
@@ -95,7 +97,7 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
95
97
|
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
96
98
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
97
99
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
98
|
-
this.monitor = new ChainMonitor(this.rollup, this.logger).start();
|
|
100
|
+
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
99
101
|
// This is hideous.
|
|
100
102
|
// We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
|
|
101
103
|
this.proverDelayer = context.proverNode ? context.proverNode.publisher.l1TxUtils.delayer : undefined;
|
|
@@ -130,7 +132,9 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
130
132
|
proverId: Fr.fromString(suffix)
|
|
131
133
|
}, {
|
|
132
134
|
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex'))
|
|
133
|
-
}, this.context.aztecNode
|
|
135
|
+
}, this.context.aztecNode, undefined, {
|
|
136
|
+
dateProvider: this.context.dateProvider
|
|
137
|
+
}));
|
|
134
138
|
this.proverNodes.push(proverNode);
|
|
135
139
|
return proverNode;
|
|
136
140
|
}
|
|
@@ -173,6 +177,17 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
173
177
|
prefilledPublicData: this.context.prefilledPublicData,
|
|
174
178
|
...opts
|
|
175
179
|
}));
|
|
180
|
+
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
181
|
+
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
182
|
+
// which directly exposes the delayer and sets any test config.
|
|
183
|
+
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
184
|
+
this.logger.info(`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`);
|
|
185
|
+
const sequencer = node.getSequencer();
|
|
186
|
+
const publisher = sequencer.sequencer.publisher;
|
|
187
|
+
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S);
|
|
188
|
+
delayed.delayer.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
189
|
+
publisher.l1TxUtils = delayed;
|
|
190
|
+
}
|
|
176
191
|
this.nodes.push(node);
|
|
177
192
|
return node;
|
|
178
193
|
}
|
|
@@ -227,7 +242,7 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
227
242
|
}
|
|
228
243
|
}
|
|
229
244
|
/** Registers the SpamContract on the given wallet. */ async registerSpamContract(wallet, salt = Fr.ZERO) {
|
|
230
|
-
const instance = await
|
|
245
|
+
const instance = await getContractInstanceFromInstantiationParams(SpamContract.artifact, {
|
|
231
246
|
constructorArgs: [],
|
|
232
247
|
constructorArtifact: undefined,
|
|
233
248
|
salt,
|
|
@@ -243,7 +258,7 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
243
258
|
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */ async createL1Client() {
|
|
244
259
|
const { client, delayer } = withDelayer(createExtendedL1Client([
|
|
245
260
|
...this.l1Client.chain.rpcUrls.default.http
|
|
246
|
-
], privateKeyToAccount(this.getNextPrivateKey()), this.l1Client.chain), {
|
|
261
|
+
], privateKeyToAccount(this.getNextPrivateKey()), this.l1Client.chain), this.context.dateProvider, {
|
|
247
262
|
ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S
|
|
248
263
|
});
|
|
249
264
|
expect(await client.getBalance({
|
|
@@ -263,4 +278,47 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
263
278
|
]).then((_)=>true).catch((_)=>false);
|
|
264
279
|
expect(result).toBe(expectedSuccess);
|
|
265
280
|
}
|
|
281
|
+
watchSequencerEvents(sequencers, getMetadata = ()=>({})) {
|
|
282
|
+
const stateChanges = [];
|
|
283
|
+
const failEvents = [];
|
|
284
|
+
// Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
|
|
285
|
+
// due to lack of txs available.
|
|
286
|
+
const failEventsKeys = [
|
|
287
|
+
'block-build-failed',
|
|
288
|
+
'block-publish-failed',
|
|
289
|
+
'proposer-rollup-check-failed'
|
|
290
|
+
];
|
|
291
|
+
const makeEvent = (i, eventName, args)=>({
|
|
292
|
+
...args,
|
|
293
|
+
type: eventName,
|
|
294
|
+
sequencerIndex: i + 2,
|
|
295
|
+
...getMetadata(i)
|
|
296
|
+
});
|
|
297
|
+
sequencers.forEach((sequencer, i)=>{
|
|
298
|
+
const sequencerIndex = i + 2;
|
|
299
|
+
sequencer.getSequencer().on('state-changed', (args)=>{
|
|
300
|
+
const noisyStates = [
|
|
301
|
+
SequencerState.IDLE,
|
|
302
|
+
SequencerState.PROPOSER_CHECK,
|
|
303
|
+
SequencerState.SYNCHRONIZING
|
|
304
|
+
];
|
|
305
|
+
if (!noisyStates.includes(args.newState)) {
|
|
306
|
+
const evt = makeEvent(i, 'state-changed', args);
|
|
307
|
+
stateChanges.push(evt);
|
|
308
|
+
this.logger.verbose(`Sequencer ${sequencerIndex} transitioned from state ${args.oldState} to state ${args.newState}`, evt);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
failEventsKeys.forEach((eventName)=>{
|
|
312
|
+
sequencer.getSequencer().on(eventName, (args)=>{
|
|
313
|
+
const evt = makeEvent(i, eventName, args);
|
|
314
|
+
failEvents.push(evt);
|
|
315
|
+
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, evt);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
return {
|
|
320
|
+
failEvents,
|
|
321
|
+
stateChanges
|
|
322
|
+
};
|
|
323
|
+
}
|
|
266
324
|
}
|
|
@@ -53,7 +53,9 @@ describe('e2e_fees bridging_race', ()=>{
|
|
|
53
53
|
const amount = FEE_FUNDING_FOR_TESTER_ACCOUNT;
|
|
54
54
|
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, bobsAddress);
|
|
55
55
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
56
|
-
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send(
|
|
56
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send({
|
|
57
|
+
from: bobsAddress
|
|
58
|
+
}).wait();
|
|
57
59
|
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
58
60
|
expect(balance).toEqual(amount);
|
|
59
61
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AccountWallet, type AztecAddress, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
|
|
2
|
-
import { CheatCodes } from '@aztec/aztec
|
|
3
|
-
import { type DeployL1ContractsArgs } from '@aztec/ethereum';
|
|
2
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
|
+
import { type DeployL1ContractsArgs, RollupContract } from '@aztec/ethereum';
|
|
4
4
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
6
|
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
@@ -27,6 +27,7 @@ export declare class FeesTest {
|
|
|
27
27
|
private numberOfAccounts;
|
|
28
28
|
private snapshotManager;
|
|
29
29
|
private wallets;
|
|
30
|
+
private accounts;
|
|
30
31
|
logger: Logger;
|
|
31
32
|
pxe: PXE;
|
|
32
33
|
aztecNode: AztecNode;
|
|
@@ -39,6 +40,7 @@ export declare class FeesTest {
|
|
|
39
40
|
coinbase: EthAddress;
|
|
40
41
|
fpcAdmin: AztecAddress;
|
|
41
42
|
gasSettings: GasSettings;
|
|
43
|
+
rollupContract: RollupContract;
|
|
42
44
|
feeJuiceContract: FeeJuiceContract;
|
|
43
45
|
bananaCoin: BananaCoin;
|
|
44
46
|
bananaFPC: FPCContract;
|
|
@@ -66,7 +68,7 @@ export declare class FeesTest {
|
|
|
66
68
|
sequencerBlockRewards: bigint;
|
|
67
69
|
proverBlockRewards: bigint;
|
|
68
70
|
}>;
|
|
69
|
-
mintAndBridgeFeeJuice(
|
|
71
|
+
mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress, amount: bigint): Promise<void>;
|
|
70
72
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
71
73
|
mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
|
|
72
74
|
applyBaseSnapshots(): Promise<void>;
|
|
@@ -78,6 +80,5 @@ export declare class FeesTest {
|
|
|
78
80
|
applySponsoredFPCSetupSnapshot(): Promise<void>;
|
|
79
81
|
applyFundAliceWithBananas(): Promise<void>;
|
|
80
82
|
applyFundAliceWithPrivateBananas(): Promise<void>;
|
|
81
|
-
applySetupSubscription(): Promise<void>;
|
|
82
83
|
}
|
|
83
84
|
//# sourceMappingURL=fees_test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MA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aztec.js';
|
|
3
|
-
import { CheatCodes } from '@aztec/aztec
|
|
3
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
4
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
5
|
-
import { RollupContract, createExtendedL1Client
|
|
5
|
+
import { RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
6
6
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
7
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
8
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
9
|
-
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
10
9
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
11
10
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
12
11
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
13
12
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
14
|
-
import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
15
13
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
16
14
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
17
15
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -19,7 +17,7 @@ import { getContract } from 'viem';
|
|
|
19
17
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
20
18
|
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
21
19
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
22
|
-
import {
|
|
20
|
+
import { ensureAccountContractsPublished, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
23
21
|
import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
|
|
24
22
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
25
23
|
/**
|
|
@@ -35,6 +33,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
35
33
|
numberOfAccounts;
|
|
36
34
|
snapshotManager;
|
|
37
35
|
wallets;
|
|
36
|
+
accounts;
|
|
38
37
|
logger;
|
|
39
38
|
pxe;
|
|
40
39
|
aztecNode;
|
|
@@ -47,6 +46,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
47
46
|
coinbase;
|
|
48
47
|
fpcAdmin;
|
|
49
48
|
gasSettings;
|
|
49
|
+
rollupContract;
|
|
50
50
|
feeJuiceContract;
|
|
51
51
|
bananaCoin;
|
|
52
52
|
bananaFPC;
|
|
@@ -68,6 +68,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
68
68
|
constructor(testName, numberOfAccounts = 3, setupOptions = {}){
|
|
69
69
|
this.numberOfAccounts = numberOfAccounts;
|
|
70
70
|
this.wallets = [];
|
|
71
|
+
this.accounts = [];
|
|
71
72
|
this.ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
72
73
|
this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
73
74
|
this.APP_SPONSORED_TX_GAS_LIMIT = BigInt(10e9);
|
|
@@ -88,8 +89,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
88
89
|
feeRecipient: this.sequencerAddress,
|
|
89
90
|
coinbase: this.coinbase
|
|
90
91
|
});
|
|
91
|
-
|
|
92
|
-
this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
|
|
92
|
+
this.rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
|
|
93
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider, this.logger, 200).start();
|
|
93
94
|
return this;
|
|
94
95
|
}
|
|
95
96
|
async teardown() {
|
|
@@ -106,13 +107,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
async getBlockRewards() {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
112
|
-
client: this.context.deployL1ContractsValues.l1Client
|
|
113
|
-
});
|
|
114
|
-
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
115
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(EthAddress.fromString(rewardDistributor.address));
|
|
110
|
+
const blockReward = await this.rollupContract.getBlockReward();
|
|
111
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress);
|
|
116
112
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
117
113
|
const sequencerBlockRewards = toDistribute / 2n;
|
|
118
114
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
@@ -121,15 +117,21 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
121
117
|
proverBlockRewards
|
|
122
118
|
};
|
|
123
119
|
}
|
|
124
|
-
async mintAndBridgeFeeJuice(
|
|
125
|
-
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount,
|
|
120
|
+
async mintAndBridgeFeeJuice(minter, recipient, amount) {
|
|
121
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, recipient);
|
|
126
122
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
127
|
-
await this.feeJuiceContract.methods.claim(
|
|
123
|
+
await this.feeJuiceContract.methods.claim(recipient, amount, secret, index).send({
|
|
124
|
+
from: minter
|
|
125
|
+
}).wait();
|
|
128
126
|
}
|
|
129
127
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
|
|
130
|
-
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate(
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
129
|
+
from: this.aliceAddress
|
|
130
|
+
});
|
|
131
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, this.aliceWallet, address, amount);
|
|
132
|
+
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
133
|
+
from: this.aliceAddress
|
|
134
|
+
});
|
|
133
135
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
134
136
|
}
|
|
135
137
|
async applyBaseSnapshots() {
|
|
@@ -148,8 +150,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
148
150
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
149
151
|
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
150
152
|
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
153
|
+
this.accounts = this.wallets.map((w)=>w.getAddress());
|
|
151
154
|
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
152
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.
|
|
155
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
|
|
153
156
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
154
157
|
this.fpcAdmin = this.aliceAddress;
|
|
155
158
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
@@ -158,13 +161,13 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
158
161
|
});
|
|
159
162
|
}
|
|
160
163
|
async applyPublicDeployAccountsSnapshot() {
|
|
161
|
-
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>
|
|
164
|
+
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.aliceWallet, this.wallets));
|
|
162
165
|
}
|
|
163
166
|
async applySetupFeeJuiceSnapshot() {
|
|
164
167
|
await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
|
|
165
168
|
this.context = context;
|
|
166
169
|
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.aliceWallet);
|
|
167
|
-
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
170
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
168
171
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
169
172
|
aztecNode: context.aztecNode,
|
|
170
173
|
aztecNodeAdmin: context.aztecNode,
|
|
@@ -177,7 +180,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
177
180
|
}
|
|
178
181
|
async applyDeployBananaTokenSnapshot() {
|
|
179
182
|
await this.snapshotManager.snapshot('deploy_banana_token', async ()=>{
|
|
180
|
-
const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n).send(
|
|
183
|
+
const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
184
|
+
from: this.aliceAddress
|
|
185
|
+
}).deployed();
|
|
181
186
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
182
187
|
return {
|
|
183
188
|
bananaCoinAddress: bananaCoin.address
|
|
@@ -185,18 +190,20 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
185
190
|
}, async ({ bananaCoinAddress })=>{
|
|
186
191
|
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.aliceWallet);
|
|
187
192
|
const logger = this.logger;
|
|
188
|
-
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, logger);
|
|
189
|
-
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, logger);
|
|
193
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, logger);
|
|
194
|
+
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, logger);
|
|
190
195
|
});
|
|
191
196
|
}
|
|
192
197
|
async applyFPCSetupSnapshot() {
|
|
193
198
|
await this.snapshotManager.snapshot('fpc_setup', async (context)=>{
|
|
194
199
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
195
|
-
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).
|
|
200
|
+
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
196
201
|
const bananaCoin = this.bananaCoin;
|
|
197
|
-
const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin).send(
|
|
202
|
+
const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin).send({
|
|
203
|
+
from: this.aliceAddress
|
|
204
|
+
}).deployed();
|
|
198
205
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
199
|
-
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(FEE_FUNDING_FOR_TESTER_ACCOUNT, bananaFPC.address);
|
|
206
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(FEE_FUNDING_FOR_TESTER_ACCOUNT, bananaFPC.address, this.aliceAddress);
|
|
200
207
|
return {
|
|
201
208
|
bananaFPCAddress: bananaFPC.address,
|
|
202
209
|
feeJuiceAddress: feeJuiceContract.address,
|
|
@@ -218,25 +225,18 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
218
225
|
]);
|
|
219
226
|
};
|
|
220
227
|
this.getCoinbaseSequencerRewards = async ()=>{
|
|
221
|
-
|
|
222
|
-
const rollup = new RollupContract(l1Client, data.rollupAddress);
|
|
223
|
-
return await rollup.getSequencerRewards(this.coinbase);
|
|
228
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
224
229
|
};
|
|
225
230
|
this.getProverFee = async (blockNumber)=>{
|
|
226
231
|
const block = await this.pxe.getBlock(blockNumber);
|
|
227
|
-
const publicClient = getPublicClient({
|
|
228
|
-
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
229
|
-
l1ChainId: context.aztecNodeConfig.l1ChainId
|
|
230
|
-
});
|
|
231
|
-
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
232
232
|
// @todo @lherskind As we deal with #13601
|
|
233
233
|
// Right now the value is from `FeeLib.sol`
|
|
234
234
|
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
235
235
|
// We round up
|
|
236
236
|
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
237
|
-
const { baseFee } = await
|
|
238
|
-
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await
|
|
239
|
-
const price = await
|
|
237
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
238
|
+
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await this.rollupContract.getEpochDuration()), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
|
|
239
|
+
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
240
240
|
const mana = block.header.totalManaUsed.toBigInt();
|
|
241
241
|
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
242
242
|
};
|
|
@@ -245,7 +245,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
245
245
|
async applySponsoredFPCSetupSnapshot() {
|
|
246
246
|
await this.snapshotManager.snapshot('sponsored_fpc_setup', async (context)=>{
|
|
247
247
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
248
|
-
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).
|
|
248
|
+
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
249
249
|
const sponsoredFPC = await setupSponsoredFPC(context.pxe);
|
|
250
250
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
251
251
|
return {
|
|
@@ -258,7 +258,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
258
258
|
async applyFundAliceWithBananas() {
|
|
259
259
|
await this.snapshotManager.snapshot('fund_alice', async ()=>{
|
|
260
260
|
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
261
|
-
await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send(
|
|
261
|
+
await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send({
|
|
262
|
+
from: this.aliceAddress
|
|
263
|
+
}).wait();
|
|
262
264
|
}, ()=>Promise.resolve());
|
|
263
265
|
}
|
|
264
266
|
async applyFundAliceWithPrivateBananas() {
|
|
@@ -266,21 +268,4 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
266
268
|
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
267
269
|
}, ()=>Promise.resolve());
|
|
268
270
|
}
|
|
269
|
-
async applySetupSubscription() {
|
|
270
|
-
await this.snapshotManager.snapshot('setup_subscription', async ()=>{
|
|
271
|
-
const counterContract = await CounterContract.deploy(this.bobWallet, 0, this.bobAddress).send().deployed();
|
|
272
|
-
// Deploy subscription contract, that allows subscriptions for SUBSCRIPTION_AMOUNT of bananas
|
|
273
|
-
const subscriptionContract = await AppSubscriptionContract.deploy(this.bobWallet, counterContract.address, this.bobAddress, this.bananaCoin.address, this.SUBSCRIPTION_AMOUNT, this.APP_SPONSORED_TX_GAS_LIMIT).send().deployed();
|
|
274
|
-
// Mint some Fee Juice to the subscription contract
|
|
275
|
-
// Could also use bridgeFromL1ToL2 from the harness, but this is more direct
|
|
276
|
-
await this.mintAndBridgeFeeJuice(subscriptionContract.address, FEE_FUNDING_FOR_TESTER_ACCOUNT);
|
|
277
|
-
return {
|
|
278
|
-
counterContractAddress: counterContract.address,
|
|
279
|
-
subscriptionContractAddress: subscriptionContract.address
|
|
280
|
-
};
|
|
281
|
-
}, async ({ counterContractAddress, subscriptionContractAddress })=>{
|
|
282
|
-
this.counterContract = await CounterContract.at(counterContractAddress, this.bobWallet);
|
|
283
|
-
this.subscriptionContract = await AppSubscriptionContract.at(subscriptionContractAddress, this.bobWallet);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
271
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccountWallet,
|
|
1
|
+
import { type AccountWallet, AztecAddress, type Logger, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
4
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
@@ -6,8 +6,8 @@ export declare class NestedContractTest {
|
|
|
6
6
|
private numberOfAccounts;
|
|
7
7
|
private snapshotManager;
|
|
8
8
|
logger: Logger;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
wallet: AccountWallet;
|
|
10
|
+
defaultAccountAddress: AztecAddress;
|
|
11
11
|
pxe: PXE;
|
|
12
12
|
parentContract: ParentContract;
|
|
13
13
|
childContract: ChildContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAgB,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAIzC,qBAAa,kBAAkB;IAY3B,OAAO,CAAC,gBAAgB;IAX1B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,aAAa,CAAC;IACvB,qBAAqB,EAAG,YAAY,CAAC;IACrC,GAAG,EAAG,GAAG,CAAC;IAEV,cAAc,EAAG,cAAc,CAAC;IAChC,aAAa,EAAG,aAAa,CAAC;gBAG5B,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI;IAM9B;;;;OAIG;IACG,kBAAkB;IAuBlB,KAAK;IAIL,QAAQ;IAId,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,oBAAoB;CAkB3B"}
|
|
@@ -8,15 +8,13 @@ export class NestedContractTest {
|
|
|
8
8
|
numberOfAccounts;
|
|
9
9
|
snapshotManager;
|
|
10
10
|
logger;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
wallet;
|
|
12
|
+
defaultAccountAddress;
|
|
13
13
|
pxe;
|
|
14
14
|
parentContract;
|
|
15
15
|
childContract;
|
|
16
16
|
constructor(testName, numberOfAccounts = 1){
|
|
17
17
|
this.numberOfAccounts = numberOfAccounts;
|
|
18
|
-
this.wallets = [];
|
|
19
|
-
this.accounts = [];
|
|
20
18
|
this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
21
19
|
this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`);
|
|
22
20
|
this.snapshotManager = createSnapshotManager(`e2e_nested_contract/${testName}-${numberOfAccounts}`, dataPath);
|
|
@@ -27,14 +25,17 @@ export class NestedContractTest {
|
|
|
27
25
|
* 2. Publicly deploy accounts
|
|
28
26
|
*/ async applyBaseSnapshots() {
|
|
29
27
|
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
28
|
+
const wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
29
|
+
wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
30
|
+
[this.wallet] = wallets;
|
|
31
|
+
this.defaultAccountAddress = this.wallet.getAddress();
|
|
33
32
|
this.pxe = pxe;
|
|
34
33
|
});
|
|
35
34
|
await this.snapshotManager.snapshot('public_deploy', async ()=>{}, async ()=>{
|
|
36
35
|
this.logger.verbose(`Public deploy accounts...`);
|
|
37
|
-
await publicDeployAccounts(this.
|
|
36
|
+
await publicDeployAccounts(this.wallet, [
|
|
37
|
+
this.defaultAccountAddress
|
|
38
|
+
]);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
async setup() {
|
|
@@ -46,15 +47,19 @@ export class NestedContractTest {
|
|
|
46
47
|
snapshot;
|
|
47
48
|
async applyManualSnapshots() {
|
|
48
49
|
await this.snapshotManager.snapshot('manual', async ()=>{
|
|
49
|
-
const parentContract = await ParentContract.deploy(this.
|
|
50
|
-
|
|
50
|
+
const parentContract = await ParentContract.deploy(this.wallet).send({
|
|
51
|
+
from: this.defaultAccountAddress
|
|
52
|
+
}).deployed();
|
|
53
|
+
const childContract = await ChildContract.deploy(this.wallet).send({
|
|
54
|
+
from: this.defaultAccountAddress
|
|
55
|
+
}).deployed();
|
|
51
56
|
return {
|
|
52
57
|
parentContractAddress: parentContract.address,
|
|
53
58
|
childContractAddress: childContract.address
|
|
54
59
|
};
|
|
55
60
|
}, async ({ parentContractAddress, childContractAddress })=>{
|
|
56
|
-
this.parentContract = await ParentContract.at(parentContractAddress, this.
|
|
57
|
-
this.childContract = await ChildContract.at(childContractAddress, this.
|
|
61
|
+
this.parentContract = await ParentContract.at(parentContractAddress, this.wallet);
|
|
62
|
+
this.childContract = await ChildContract.at(childContractAddress, this.wallet);
|
|
58
63
|
});
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { type AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
3
|
+
import { type AccountWalletWithSecretKey, AztecAddress } from '@aztec/aztec.js';
|
|
4
4
|
import { type Operator, RollupContract, type ViemClient } from '@aztec/ethereum';
|
|
5
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
6
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
@@ -19,7 +19,8 @@ export declare const SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES: {
|
|
|
19
19
|
export declare class P2PNetworkTest {
|
|
20
20
|
bootstrapNodeEnr: string;
|
|
21
21
|
bootNodePort: number;
|
|
22
|
-
|
|
22
|
+
numberOfValidators: number;
|
|
23
|
+
numberOfNodes: number;
|
|
23
24
|
private metricsPort?;
|
|
24
25
|
private snapshotManager;
|
|
25
26
|
baseAccountPrivateKey: `0x${string}`;
|
|
@@ -51,12 +52,14 @@ export declare class P2PNetworkTest {
|
|
|
51
52
|
deployedAccounts: InitialAccountData[];
|
|
52
53
|
prefilledPublicData: PublicDataTreeLeaf[];
|
|
53
54
|
wallet?: AccountWalletWithSecretKey;
|
|
55
|
+
defaultAccountAddress?: AztecAddress;
|
|
54
56
|
spamContract?: SpamContract;
|
|
55
57
|
bootstrapNode?: BootstrapNode;
|
|
56
|
-
constructor(testName: string, bootstrapNodeEnr: string, bootNodePort: number,
|
|
57
|
-
static create({ testName, numberOfNodes, basePort, metricsPort, initialConfig, startProverNode, mockZkPassportVerifier, }: {
|
|
58
|
+
constructor(testName: string, bootstrapNodeEnr: string, bootNodePort: number, numberOfValidators: number, initialValidatorConfig: AztecNodeConfig, numberOfNodes?: number, metricsPort?: number | undefined, startProverNode?: boolean, mockZkPassportVerifier?: boolean);
|
|
59
|
+
static create({ testName, numberOfNodes, numberOfValidators, basePort, metricsPort, initialConfig, startProverNode, mockZkPassportVerifier, }: {
|
|
58
60
|
testName: string;
|
|
59
61
|
numberOfNodes: number;
|
|
62
|
+
numberOfValidators: number;
|
|
60
63
|
basePort?: number;
|
|
61
64
|
metricsPort?: number;
|
|
62
65
|
initialConfig?: Partial<AztecNodeConfig>;
|