@aztec/end-to-end 3.0.0-nightly.20250917 → 3.0.0-nightly.20250919
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.js +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -4
- package/dest/e2e_l1_publisher/write_json.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +3 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +18 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts +3 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +3 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +7 -7
- package/dest/fixtures/utils.js +4 -4
- package/dest/shared/uniswap_l1_l2.d.ts +3 -2
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +6 -17
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +3 -3
- package/package.json +37 -37
- package/src/bench/client_flows/client_flows_benchmark.ts +1 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_fees/fees_test.ts +5 -4
- package/src/e2e_l1_publisher/write_json.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +4 -2
- package/src/e2e_p2p/inactivity_slash_test.ts +27 -8
- package/src/e2e_token_contract/token_contract_test.ts +3 -2
- package/src/fixtures/snapshot_manager.ts +7 -8
- package/src/fixtures/utils.ts +4 -4
- package/src/shared/uniswap_l1_l2.ts +16 -14
- package/src/spartan/setup_test_wallets.ts +5 -2
|
@@ -154,7 +154,7 @@ export class ClientFlowsBenchmark {
|
|
|
154
154
|
this.pxe = pxe;
|
|
155
155
|
this.adminWallet = wallet;
|
|
156
156
|
this.aztecNode = aztecNode;
|
|
157
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
157
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
158
158
|
this.adminAddress = adminAddress;
|
|
159
159
|
this.sequencerAddress = sequencerAddress;
|
|
160
160
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
@@ -120,7 +120,7 @@ export class BlacklistTokenContractTest {
|
|
|
120
120
|
await this.snapshotManager.teardown();
|
|
121
121
|
}
|
|
122
122
|
async addPendingShieldNoteToPXE(contract, recipient, amount, secretHash, txHash) {
|
|
123
|
-
const txEffects = await this.
|
|
123
|
+
const txEffects = await this.aztecNode.getTxEffect(txHash);
|
|
124
124
|
await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash, txEffects.data.noteHashes, txEffects.data.nullifiers[0], recipient).simulate({
|
|
125
125
|
from: recipient
|
|
126
126
|
});
|
|
@@ -45,7 +45,7 @@ export class CrossChainMessagingTest {
|
|
|
45
45
|
this.aztecNode = this.ctx.aztecNode;
|
|
46
46
|
this.pxe = this.ctx.pxe;
|
|
47
47
|
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
48
|
-
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
48
|
+
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe, this.aztecNode);
|
|
49
49
|
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
50
50
|
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAuB,MAAM,iBAAiB,CAAC;AAChH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAuC,KAAK,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAIxH;;;;;;;;;GASG;AACH,qBAAa,QAAQ;IA6CjB,OAAO,CAA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B,CAAC,CAAC,EAAE,OAAO;IAIzB,kBAAkB;IAOlB,eAAe;;;;IAef,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY;IASzE,sFAAsF;IAChF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAajD,kBAAkB;IAOzB,4BAA4B;IAkC5B,iCAAiC;IAMjC,0BAA0B;IA4B1B,8BAA8B;IA6BvB,qBAAqB;IAoErB,8BAA8B;IAoB9B,yBAAyB;IAczB,gCAAgC;CAS9C"}
|
|
@@ -102,9 +102,10 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
102
102
|
}
|
|
103
103
|
async getBlockRewards() {
|
|
104
104
|
const blockReward = await this.rollupContract.getBlockReward();
|
|
105
|
-
const
|
|
105
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
106
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(EthAddress.fromString(rewardConfig.rewardDistributor));
|
|
106
107
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
107
|
-
const sequencerBlockRewards = toDistribute /
|
|
108
|
+
const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
|
|
108
109
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
109
110
|
return {
|
|
110
111
|
sequencerBlockRewards,
|
|
@@ -142,7 +143,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
142
143
|
this.gasSettings = GasSettings.default({
|
|
143
144
|
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
144
145
|
});
|
|
145
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
146
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
146
147
|
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
147
148
|
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
148
149
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -229,7 +230,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
229
230
|
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
230
231
|
};
|
|
231
232
|
this.getProverFee = async (blockNumber)=>{
|
|
232
|
-
const block = await this.
|
|
233
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
233
234
|
// @todo @lherskind As we deal with #13601
|
|
234
235
|
// Right now the value is from `FeeLib.sol`
|
|
235
236
|
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
@@ -48,7 +48,7 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
48
48
|
},
|
|
49
49
|
totalManaUsed: block.header.totalManaUsed.toNumber()
|
|
50
50
|
},
|
|
51
|
-
headerHash: asHex(block.
|
|
51
|
+
headerHash: asHex(block.getCheckpointHeader().hash()),
|
|
52
52
|
numTxs: block.body.txEffects.length
|
|
53
53
|
}
|
|
54
54
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE, type Wallet } 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';
|
|
@@ -9,6 +9,7 @@ export declare class NestedContractTest {
|
|
|
9
9
|
wallet: Wallet;
|
|
10
10
|
defaultAccountAddress: AztecAddress;
|
|
11
11
|
pxe: PXE;
|
|
12
|
+
aztecNode: AztecNode;
|
|
12
13
|
parentContract: ParentContract;
|
|
13
14
|
childContract: ChildContract;
|
|
14
15
|
constructor(testName: string, numberOfAccounts?: number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AACjH,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;IAa3B,OAAO,CAAC,gBAAgB;IAZ1B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAChB,qBAAqB,EAAG,YAAY,CAAC;IACrC,GAAG,EAAG,GAAG,CAAC;IACV,SAAS,EAAG,SAAS,CAAC;IAEtB,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"}
|
|
@@ -10,6 +10,7 @@ export class NestedContractTest {
|
|
|
10
10
|
wallet;
|
|
11
11
|
defaultAccountAddress;
|
|
12
12
|
pxe;
|
|
13
|
+
aztecNode;
|
|
13
14
|
parentContract;
|
|
14
15
|
childContract;
|
|
15
16
|
constructor(testName, numberOfAccounts = 1){
|
|
@@ -23,10 +24,11 @@ export class NestedContractTest {
|
|
|
23
24
|
* 1. Add 3 accounts.
|
|
24
25
|
* 2. Publicly deploy accounts
|
|
25
26
|
*/ async applyBaseSnapshots() {
|
|
26
|
-
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), ({ deployedAccounts }, { pxe, wallet })=>{
|
|
27
|
+
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), ({ deployedAccounts }, { pxe, wallet, aztecNode })=>{
|
|
27
28
|
this.wallet = wallet;
|
|
28
29
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
29
30
|
this.pxe = pxe;
|
|
31
|
+
this.aztecNode = aztecNode;
|
|
30
32
|
return Promise.resolve();
|
|
31
33
|
});
|
|
32
34
|
await this.snapshotManager.snapshot('public_deploy', async ()=>{}, async ()=>{
|
|
@@ -12,12 +12,15 @@ export declare class P2PInactivityTest {
|
|
|
12
12
|
offlineValidators: EthAddress[];
|
|
13
13
|
private dataDir;
|
|
14
14
|
private inactiveNodeCount;
|
|
15
|
+
private keepInitialNode;
|
|
15
16
|
constructor(test: P2PNetworkTest, opts: {
|
|
16
17
|
inactiveNodeCount: number;
|
|
18
|
+
keepInitialNode?: boolean;
|
|
17
19
|
});
|
|
18
20
|
static create(testName: string, opts: {
|
|
19
21
|
slashInactivityConsecutiveEpochThreshold: number;
|
|
20
22
|
inactiveNodeCount: number;
|
|
23
|
+
keepInitialNode?: boolean;
|
|
21
24
|
}): Promise<P2PInactivityTest>;
|
|
22
25
|
setup(): Promise<this>;
|
|
23
26
|
teardown(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,eAAe,CAAC;AAKvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,eAAe,CAAC;AAKvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBlD,qBAAa,iBAAiB;aAaV,IAAI,EAAE,cAAc;IAZ/B,KAAK,EAAG,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAG,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,EAAG,cAAc,CAAC;IACxB,iBAAiB,EAAG,UAAU,EAAE,CAAC;IAExC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAU;gBAGf,IAAI,EAAE,cAAc,EACpC,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;WAOnD,MAAM,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QAAE,wCAAwC,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;IAgCrG,KAAK;IAwEL,QAAQ;IAQrB,IAAW,GAAG,gEAEb;IAED,IAAW,MAAM,qCAEhB;IAED,IAAW,cAAc,WAExB;CACF"}
|
|
@@ -15,6 +15,8 @@ const ETHEREUM_SLOT_DURATION = 4;
|
|
|
15
15
|
const AZTEC_SLOT_DURATION = 8;
|
|
16
16
|
const SLASHING_UNIT = BigInt(1e18);
|
|
17
17
|
const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
|
|
18
|
+
// How many epochs it may take to set everything up, so we dont slash during this period
|
|
19
|
+
const SETUP_EPOCH_DURATION = 5;
|
|
18
20
|
export class P2PInactivityTest {
|
|
19
21
|
test;
|
|
20
22
|
nodes;
|
|
@@ -24,10 +26,12 @@ export class P2PInactivityTest {
|
|
|
24
26
|
offlineValidators;
|
|
25
27
|
dataDir;
|
|
26
28
|
inactiveNodeCount;
|
|
29
|
+
keepInitialNode;
|
|
27
30
|
constructor(test, opts){
|
|
28
31
|
this.test = test;
|
|
29
32
|
this.dataDir = fs.mkdtempSync(path.join(os.tmpdir(), test.testName));
|
|
30
33
|
this.inactiveNodeCount = opts.inactiveNodeCount;
|
|
34
|
+
this.keepInitialNode = opts.keepInitialNode ?? false;
|
|
31
35
|
}
|
|
32
36
|
static async create(testName, opts) {
|
|
33
37
|
const test = await P2PNetworkTest.create({
|
|
@@ -51,8 +55,8 @@ export class P2PInactivityTest {
|
|
|
51
55
|
sentinelEnabled: true,
|
|
52
56
|
slashingQuorum: SLASHING_QUORUM,
|
|
53
57
|
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE_IN_EPOCHS,
|
|
54
|
-
slashInactivityTargetPercentage: 0.
|
|
55
|
-
slashGracePeriodL2Slots: EPOCH_DURATION,
|
|
58
|
+
slashInactivityTargetPercentage: 0.8,
|
|
59
|
+
slashGracePeriodL2Slots: SETUP_EPOCH_DURATION * EPOCH_DURATION,
|
|
56
60
|
slashAmountSmall: SLASHING_UNIT,
|
|
57
61
|
slashAmountMedium: SLASHING_UNIT * 2n,
|
|
58
62
|
slashAmountLarge: SLASHING_UNIT * 3n,
|
|
@@ -75,10 +79,11 @@ export class P2PInactivityTest {
|
|
|
75
79
|
expect(activationThreshold - SLASHING_AMOUNT).toBeLessThan(biggestEjection);
|
|
76
80
|
this.test.ctx.aztecNodeConfig.slashInactivityPenalty = SLASHING_AMOUNT;
|
|
77
81
|
this.rollup = rollup;
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
if (!this.keepInitialNode) {
|
|
83
|
+
await this.test.ctx.aztecNode.stop();
|
|
84
|
+
}
|
|
80
85
|
// Create all active nodes
|
|
81
|
-
this.activeNodes = await createNodes(this.test.ctx.aztecNodeConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, NUM_NODES - this.inactiveNodeCount, BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir);
|
|
86
|
+
this.activeNodes = await createNodes(this.test.ctx.aztecNodeConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode), BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, Number(this.keepInitialNode));
|
|
82
87
|
// And the ones with an initially disabled sequencer
|
|
83
88
|
const inactiveConfig = {
|
|
84
89
|
...this.test.ctx.aztecNodeConfig,
|
|
@@ -86,14 +91,22 @@ export class P2PInactivityTest {
|
|
|
86
91
|
};
|
|
87
92
|
this.inactiveNodes = await createNodes(inactiveConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, this.inactiveNodeCount, BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, NUM_NODES - this.inactiveNodeCount);
|
|
88
93
|
this.nodes = [
|
|
94
|
+
...this.keepInitialNode ? [
|
|
95
|
+
this.test.ctx.aztecNode
|
|
96
|
+
] : [],
|
|
89
97
|
...this.activeNodes,
|
|
90
98
|
...this.inactiveNodes
|
|
91
99
|
];
|
|
100
|
+
if (this.nodes.length !== NUM_NODES) {
|
|
101
|
+
throw new Error(`Expected ${NUM_NODES} nodes but got ${this.nodes.length}`);
|
|
102
|
+
}
|
|
92
103
|
this.offlineValidators = this.test.validators.slice(this.test.validators.length - this.inactiveNodeCount).map((a)=>a.attester);
|
|
93
104
|
this.test.logger.warn(`Setup complete. Offline validators are ${this.offlineValidators.join(', ')}.`, {
|
|
94
105
|
validators: this.test.validators,
|
|
95
106
|
offlineValidators: this.offlineValidators
|
|
96
107
|
});
|
|
108
|
+
this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
|
|
109
|
+
await this.test.ctx.cheatCodes.rollup.advanceToEpoch(SETUP_EPOCH_DURATION + 1);
|
|
97
110
|
return this;
|
|
98
111
|
}
|
|
99
112
|
async teardown() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
5
6
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
6
7
|
export declare class TokenContractTest {
|
|
@@ -13,7 +14,7 @@ export declare class TokenContractTest {
|
|
|
13
14
|
tokenSim: TokenSimulator;
|
|
14
15
|
node: AztecNode;
|
|
15
16
|
badAccount: InvalidAccountContract;
|
|
16
|
-
wallet:
|
|
17
|
+
wallet: TestWallet;
|
|
17
18
|
adminAddress: AztecAddress;
|
|
18
19
|
account1Address: AztecAddress;
|
|
19
20
|
account2Address: AztecAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIlE,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAG,aAAa,CAAC;IACtB,QAAQ,EAAG,cAAc,CAAC;IAC1B,IAAI,EAAG,SAAS,CAAC;IAEjB,UAAU,EAAG,sBAAsB,CAAC;IACpC,MAAM,EAAG,UAAU,CAAC;IACpB,YAAY,EAAG,YAAY,CAAC;IAC5B,eAAe,EAAG,YAAY,CAAC;IAC/B,eAAe,EAAG,YAAY,CAAC;gBAEnB,QAAQ,EAAE,MAAM;IAO5B;;;;OAIG;IACG,kBAAkB;IAkElB,KAAK;IAIX,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,QAAQ;IAIR,iBAAiB;CAqCxB"}
|
|
@@ -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 AztecAddress, type AztecNode, type Logger, type
|
|
3
|
+
import { type AztecAddress, type AztecNode, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
4
4
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
5
5
|
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
6
6
|
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
@@ -87,8 +87,8 @@ export declare const deployAccounts: (numberOfAccounts: number, logger: Logger)
|
|
|
87
87
|
* @param sender - Wallet to send the deployment tx.
|
|
88
88
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
89
89
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
90
|
-
* @param
|
|
90
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
91
91
|
*/
|
|
92
|
-
export declare function publicDeployAccounts(wallet: Wallet, accountsToDeploy: AztecAddress[], waitUntilProven?: boolean,
|
|
92
|
+
export declare function publicDeployAccounts(wallet: Wallet, accountsToDeploy: AztecAddress[], waitUntilProven?: boolean, node?: AztecNode): Promise<void>;
|
|
93
93
|
export {};
|
|
94
94
|
//# sourceMappingURL=snapshot_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA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BAAoB,CACxC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,YAAY,EAAE,EAChC,eAAe,UAAQ,EACvB,IAAI,CAAC,EAAE,SAAS,iBAwBjB"}
|
|
@@ -332,7 +332,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
332
332
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
333
333
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
334
334
|
const wallet = new TestWallet(pxe);
|
|
335
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
335
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
336
336
|
if (statePath) {
|
|
337
337
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
338
338
|
writeFileSync(`${statePath}/accounts.json`, JSON.stringify(initialFundedAccounts, resolver));
|
|
@@ -431,7 +431,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
431
431
|
pxeConfig.dataDirectory = statePath;
|
|
432
432
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
433
433
|
const wallet = new TestWallet(pxe);
|
|
434
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
434
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
435
435
|
return {
|
|
436
436
|
aztecNodeConfig,
|
|
437
437
|
anvil,
|
|
@@ -481,8 +481,8 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
481
481
|
* @param sender - Wallet to send the deployment tx.
|
|
482
482
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
483
483
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
484
|
-
* @param
|
|
485
|
-
*/ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false,
|
|
484
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
485
|
+
*/ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false, node) {
|
|
486
486
|
const instances = (await Promise.all(accountsToDeploy.map((account)=>wallet.getContractMetadata(account)))).map((metadata)=>metadata.contractInstance);
|
|
487
487
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
488
488
|
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
@@ -497,10 +497,10 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
497
497
|
from: accountsToDeploy[0]
|
|
498
498
|
}).wait();
|
|
499
499
|
if (waitUntilProven) {
|
|
500
|
-
if (!
|
|
501
|
-
throw new Error('Need to provide
|
|
500
|
+
if (!node) {
|
|
501
|
+
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
502
502
|
} else {
|
|
503
|
-
await waitForProven(
|
|
503
|
+
await waitForProven(node, txReceipt);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -145,7 +145,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
145
145
|
rollupVersion
|
|
146
146
|
};
|
|
147
147
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
148
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
148
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient, aztecNode);
|
|
149
149
|
const teardown = ()=>Promise.resolve();
|
|
150
150
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
151
151
|
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
@@ -332,7 +332,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
332
332
|
}, telemetry);
|
|
333
333
|
await blobSink.start();
|
|
334
334
|
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
335
|
-
logger.verbose('Creating and synching an aztec node
|
|
335
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
336
336
|
const acvmConfig = await getACVMConfig(logger);
|
|
337
337
|
if (acvmConfig) {
|
|
338
338
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
@@ -410,7 +410,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
410
410
|
}
|
|
411
411
|
logger.verbose('Creating a pxe...');
|
|
412
412
|
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
413
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
413
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe, aztecNode);
|
|
414
414
|
if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
|
|
415
415
|
// We need to advance such that the committee is set up.
|
|
416
416
|
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1), {
|
|
@@ -424,7 +424,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
424
424
|
// Below we continue with what we described in the long comment on line 571.
|
|
425
425
|
if (numberOfAccounts === 0) {
|
|
426
426
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
427
|
-
while(await
|
|
427
|
+
while(await aztecNode.getBlockNumber() === 0){
|
|
428
428
|
await sleep(2000);
|
|
429
429
|
}
|
|
430
430
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger, type PXE
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
3
|
import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
/** Objects to be returned by the uniswap setup function */
|
|
5
6
|
export type UniswapSetupContext = {
|
|
6
7
|
/** Aztec Node instance */
|
|
@@ -12,7 +13,7 @@ export type UniswapSetupContext = {
|
|
|
12
13
|
/** The L1 wallet client, extended with public actions. */
|
|
13
14
|
l1Client: ExtendedViemWalletClient;
|
|
14
15
|
/** The wallet. */
|
|
15
|
-
wallet:
|
|
16
|
+
wallet: TestWallet;
|
|
16
17
|
/** The owner address. */
|
|
17
18
|
ownerAddress: AztecAddress;
|
|
18
19
|
/** The sponsor wallet. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkBrD,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,+CAA+C;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,0BAA0B;IAC1B,cAAc,EAAE,YAAY,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,OAAO,CAAC,mBAAmB,CAAC,EACzC,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,gCAAkC,SAo+BnC,CAAC"}
|
|
@@ -439,11 +439,8 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
439
439
|
const nonceForWETHTransferToPublicApproval = new Fr(2n);
|
|
440
440
|
const expectedMessageHash = await computeAuthWitMessageHash({
|
|
441
441
|
caller: uniswapL2Contract.address,
|
|
442
|
-
|
|
443
|
-
},
|
|
444
|
-
chainId: new Fr(await aztecNode.getChainId()),
|
|
445
|
-
version: new Fr(await aztecNode.getVersion())
|
|
446
|
-
});
|
|
442
|
+
call: await wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval).getFunctionCall()
|
|
443
|
+
}, await wallet.getChainInfo());
|
|
447
444
|
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
|
|
448
445
|
from: ownerAddress
|
|
449
446
|
})).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
|
|
@@ -478,9 +475,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
478
475
|
caller: uniswapL2Contract.address,
|
|
479
476
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
480
477
|
}, true);
|
|
481
|
-
await validateActionInteraction.send(
|
|
482
|
-
from: ownerAddress
|
|
483
|
-
}).wait();
|
|
478
|
+
await validateActionInteraction.send().wait();
|
|
484
479
|
// No approval to call `swap` but should work even without it:
|
|
485
480
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
486
481
|
await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -500,9 +495,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
500
495
|
caller: approvedUser,
|
|
501
496
|
action
|
|
502
497
|
}, true);
|
|
503
|
-
await validateActionInteraction.send(
|
|
504
|
-
from: ownerAddress
|
|
505
|
-
}).wait();
|
|
498
|
+
await validateActionInteraction.send().wait();
|
|
506
499
|
await expect(action.simulate({
|
|
507
500
|
from: sponsorAddress
|
|
508
501
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -514,9 +507,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
514
507
|
caller: uniswapL2Contract.address,
|
|
515
508
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
516
509
|
}, true);
|
|
517
|
-
await validateActionInteraction.send(
|
|
518
|
-
from: ownerAddress
|
|
519
|
-
}).wait();
|
|
510
|
+
await validateActionInteraction.send().wait();
|
|
520
511
|
await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate({
|
|
521
512
|
from: ownerAddress
|
|
522
513
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -622,9 +613,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
622
613
|
caller: uniswapL2Contract.address,
|
|
623
614
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
624
615
|
}, true);
|
|
625
|
-
await validateActionInteraction.send(
|
|
626
|
-
from: ownerAddress
|
|
627
|
-
}).wait();
|
|
616
|
+
await validateActionInteraction.send().wait();
|
|
628
617
|
// Call swap_public on L2
|
|
629
618
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
630
619
|
const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAGrB,KAAK,GAAG,EAMT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,aAA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ClB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAMD,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CA6BvB;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,YAAY,CAAC,CAqCvB;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,YAAY,CAAC,CAiDvB;AA+ED,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,EAAE;IACD,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,iBAiBA;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAmBrD"}
|
|
@@ -67,7 +67,7 @@ export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, m
|
|
|
67
67
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
68
68
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
69
69
|
const fundedAccounts = await Promise.all(funded.map((a)=>wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
70
|
-
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)));
|
|
70
|
+
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, node, a.getAddress(), undefined, logger)));
|
|
71
71
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
72
72
|
await advanceL2Block(node);
|
|
73
73
|
await advanceL2Block(node);
|
|
@@ -95,7 +95,7 @@ export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, m
|
|
|
95
95
|
recipientAddress: recipientAccount.getAddress()
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
98
|
+
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, node, recipient, amount, log) {
|
|
99
99
|
const { l1ChainId } = await pxe.getNodeInfo();
|
|
100
100
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
101
101
|
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
@@ -103,7 +103,7 @@ async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient,
|
|
|
103
103
|
const portal = await L1FeeJuicePortalManager.new(pxe, l1Client, log);
|
|
104
104
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true);
|
|
105
105
|
// docs:end:bridge_fee_juice
|
|
106
|
-
const isSynced = async ()=>await
|
|
106
|
+
const isSynced = async ()=>await node.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash)) !== undefined;
|
|
107
107
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
108
108
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
109
109
|
return claim;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250919",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,42 +25,42 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "3.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "3.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "3.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "3.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
46
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
47
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
48
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
50
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
52
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
53
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
54
|
-
"@aztec/prover-node": "3.0.0-nightly.
|
|
55
|
-
"@aztec/pxe": "3.0.0-nightly.
|
|
56
|
-
"@aztec/sequencer-client": "3.0.0-nightly.
|
|
57
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
58
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
59
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
60
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
61
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
62
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
63
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "3.0.0-nightly.20250919",
|
|
29
|
+
"@aztec/archiver": "3.0.0-nightly.20250919",
|
|
30
|
+
"@aztec/aztec": "3.0.0-nightly.20250919",
|
|
31
|
+
"@aztec/aztec-node": "3.0.0-nightly.20250919",
|
|
32
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250919",
|
|
33
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250919",
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250919",
|
|
35
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250919",
|
|
36
|
+
"@aztec/bot": "3.0.0-nightly.20250919",
|
|
37
|
+
"@aztec/cli": "3.0.0-nightly.20250919",
|
|
38
|
+
"@aztec/constants": "3.0.0-nightly.20250919",
|
|
39
|
+
"@aztec/entrypoints": "3.0.0-nightly.20250919",
|
|
40
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250919",
|
|
41
|
+
"@aztec/ethereum": "3.0.0-nightly.20250919",
|
|
42
|
+
"@aztec/foundation": "3.0.0-nightly.20250919",
|
|
43
|
+
"@aztec/kv-store": "3.0.0-nightly.20250919",
|
|
44
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250919",
|
|
45
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20250919",
|
|
46
|
+
"@aztec/node-keystore": "3.0.0-nightly.20250919",
|
|
47
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250919",
|
|
48
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20250919",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250919",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20250919",
|
|
51
|
+
"@aztec/p2p": "3.0.0-nightly.20250919",
|
|
52
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250919",
|
|
53
|
+
"@aztec/prover-client": "3.0.0-nightly.20250919",
|
|
54
|
+
"@aztec/prover-node": "3.0.0-nightly.20250919",
|
|
55
|
+
"@aztec/pxe": "3.0.0-nightly.20250919",
|
|
56
|
+
"@aztec/sequencer-client": "3.0.0-nightly.20250919",
|
|
57
|
+
"@aztec/simulator": "3.0.0-nightly.20250919",
|
|
58
|
+
"@aztec/slasher": "3.0.0-nightly.20250919",
|
|
59
|
+
"@aztec/stdlib": "3.0.0-nightly.20250919",
|
|
60
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250919",
|
|
61
|
+
"@aztec/test-wallet": "3.0.0-nightly.20250919",
|
|
62
|
+
"@aztec/validator-client": "3.0.0-nightly.20250919",
|
|
63
|
+
"@aztec/world-state": "3.0.0-nightly.20250919",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@jest/globals": "^30.0.0",
|
|
66
66
|
"@noble/curves": "=1.0.0",
|
|
@@ -207,7 +207,7 @@ export class ClientFlowsBenchmark {
|
|
|
207
207
|
this.pxe = pxe;
|
|
208
208
|
this.adminWallet = wallet;
|
|
209
209
|
this.aztecNode = aztecNode;
|
|
210
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
210
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
211
211
|
|
|
212
212
|
this.adminAddress = adminAddress;
|
|
213
213
|
this.sequencerAddress = sequencerAddress;
|
|
@@ -178,7 +178,7 @@ export class BlacklistTokenContractTest {
|
|
|
178
178
|
secretHash: Fr,
|
|
179
179
|
txHash: TxHash,
|
|
180
180
|
) {
|
|
181
|
-
const txEffects = await this.
|
|
181
|
+
const txEffects = await this.aztecNode.getTxEffect(txHash);
|
|
182
182
|
await contract.methods
|
|
183
183
|
.deliver_transparent_note(
|
|
184
184
|
contract.address,
|
|
@@ -72,7 +72,7 @@ export class CrossChainMessagingTest {
|
|
|
72
72
|
this.aztecNode = this.ctx.aztecNode;
|
|
73
73
|
this.pxe = this.ctx.pxe;
|
|
74
74
|
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
75
|
-
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
75
|
+
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe, this.aztecNode);
|
|
76
76
|
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
77
77
|
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
78
78
|
}
|
|
@@ -136,13 +136,14 @@ export class FeesTest {
|
|
|
136
136
|
|
|
137
137
|
async getBlockRewards() {
|
|
138
138
|
const blockReward = await this.rollupContract.getBlockReward();
|
|
139
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
139
140
|
|
|
140
141
|
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
141
|
-
|
|
142
|
+
EthAddress.fromString(rewardConfig.rewardDistributor),
|
|
142
143
|
);
|
|
143
144
|
|
|
144
145
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
145
|
-
const sequencerBlockRewards = toDistribute /
|
|
146
|
+
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
146
147
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
147
148
|
|
|
148
149
|
return { sequencerBlockRewards, proverBlockRewards };
|
|
@@ -187,7 +188,7 @@ export class FeesTest {
|
|
|
187
188
|
this.wallet = wallet;
|
|
188
189
|
this.aztecNode = aztecNode;
|
|
189
190
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
190
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
191
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
191
192
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
192
193
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
193
194
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -317,7 +318,7 @@ export class FeesTest {
|
|
|
317
318
|
};
|
|
318
319
|
|
|
319
320
|
this.getProverFee = async (blockNumber: number) => {
|
|
320
|
-
const block = await this.
|
|
321
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
321
322
|
|
|
322
323
|
// @todo @lherskind As we deal with #13601
|
|
323
324
|
// Right now the value is from `FeeLib.sol`
|
|
@@ -64,7 +64,7 @@ export async function writeJson(
|
|
|
64
64
|
},
|
|
65
65
|
totalManaUsed: block.header.totalManaUsed.toNumber(),
|
|
66
66
|
},
|
|
67
|
-
headerHash: asHex(block.
|
|
67
|
+
headerHash: asHex(block.getCheckpointHeader().hash()),
|
|
68
68
|
numTxs: block.body.txEffects.length,
|
|
69
69
|
},
|
|
70
70
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, type Logger, type PXE, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE, type Wallet, createLogger } 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
|
|
|
@@ -18,6 +18,7 @@ export class NestedContractTest {
|
|
|
18
18
|
wallet!: Wallet;
|
|
19
19
|
defaultAccountAddress!: AztecAddress;
|
|
20
20
|
pxe!: PXE;
|
|
21
|
+
aztecNode!: AztecNode;
|
|
21
22
|
|
|
22
23
|
parentContract!: ParentContract;
|
|
23
24
|
childContract!: ChildContract;
|
|
@@ -39,10 +40,11 @@ export class NestedContractTest {
|
|
|
39
40
|
await this.snapshotManager.snapshot(
|
|
40
41
|
'accounts',
|
|
41
42
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
42
|
-
({ deployedAccounts }, { pxe, wallet }) => {
|
|
43
|
+
({ deployedAccounts }, { pxe, wallet, aztecNode }) => {
|
|
43
44
|
this.wallet = wallet;
|
|
44
45
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
45
46
|
this.pxe = pxe;
|
|
47
|
+
this.aztecNode = aztecNode;
|
|
46
48
|
return Promise.resolve();
|
|
47
49
|
},
|
|
48
50
|
);
|
|
@@ -22,6 +22,9 @@ const AZTEC_SLOT_DURATION = 8;
|
|
|
22
22
|
const SLASHING_UNIT = BigInt(1e18);
|
|
23
23
|
const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
|
|
24
24
|
|
|
25
|
+
// How many epochs it may take to set everything up, so we dont slash during this period
|
|
26
|
+
const SETUP_EPOCH_DURATION = 5;
|
|
27
|
+
|
|
25
28
|
export class P2PInactivityTest {
|
|
26
29
|
public nodes!: AztecNodeService[];
|
|
27
30
|
public activeNodes!: AztecNodeService[];
|
|
@@ -32,18 +35,20 @@ export class P2PInactivityTest {
|
|
|
32
35
|
|
|
33
36
|
private dataDir: string;
|
|
34
37
|
private inactiveNodeCount: number;
|
|
38
|
+
private keepInitialNode: boolean;
|
|
35
39
|
|
|
36
40
|
constructor(
|
|
37
41
|
public readonly test: P2PNetworkTest,
|
|
38
|
-
opts: { inactiveNodeCount: number },
|
|
42
|
+
opts: { inactiveNodeCount: number; keepInitialNode?: boolean },
|
|
39
43
|
) {
|
|
40
44
|
this.dataDir = fs.mkdtempSync(path.join(os.tmpdir(), test.testName));
|
|
41
45
|
this.inactiveNodeCount = opts.inactiveNodeCount;
|
|
46
|
+
this.keepInitialNode = opts.keepInitialNode ?? false;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
static async create(
|
|
45
50
|
testName: string,
|
|
46
|
-
opts: { slashInactivityConsecutiveEpochThreshold: number; inactiveNodeCount: number },
|
|
51
|
+
opts: { slashInactivityConsecutiveEpochThreshold: number; inactiveNodeCount: number; keepInitialNode?: boolean },
|
|
47
52
|
) {
|
|
48
53
|
const test = await P2PNetworkTest.create({
|
|
49
54
|
testName,
|
|
@@ -64,8 +69,8 @@ export class P2PInactivityTest {
|
|
|
64
69
|
sentinelEnabled: true,
|
|
65
70
|
slashingQuorum: SLASHING_QUORUM,
|
|
66
71
|
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE_IN_EPOCHS,
|
|
67
|
-
slashInactivityTargetPercentage: 0.
|
|
68
|
-
slashGracePeriodL2Slots: EPOCH_DURATION, // do not slash during
|
|
72
|
+
slashInactivityTargetPercentage: 0.8,
|
|
73
|
+
slashGracePeriodL2Slots: SETUP_EPOCH_DURATION * EPOCH_DURATION, // do not slash during setup
|
|
69
74
|
slashAmountSmall: SLASHING_UNIT,
|
|
70
75
|
slashAmountMedium: SLASHING_UNIT * 2n,
|
|
71
76
|
slashAmountLarge: SLASHING_UNIT * 3n,
|
|
@@ -91,18 +96,21 @@ export class P2PInactivityTest {
|
|
|
91
96
|
this.test.ctx.aztecNodeConfig.slashInactivityPenalty = SLASHING_AMOUNT;
|
|
92
97
|
this.rollup = rollup;
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
if (!this.keepInitialNode) {
|
|
100
|
+
await this.test.ctx.aztecNode.stop();
|
|
101
|
+
}
|
|
96
102
|
|
|
97
103
|
// Create all active nodes
|
|
98
104
|
this.activeNodes = await createNodes(
|
|
99
105
|
this.test.ctx.aztecNodeConfig,
|
|
100
106
|
this.test.ctx.dateProvider,
|
|
101
107
|
this.test.bootstrapNodeEnr,
|
|
102
|
-
NUM_NODES - this.inactiveNodeCount,
|
|
108
|
+
NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode),
|
|
103
109
|
BOOT_NODE_UDP_PORT,
|
|
104
110
|
this.test.prefilledPublicData,
|
|
105
111
|
this.dataDir,
|
|
112
|
+
undefined,
|
|
113
|
+
Number(this.keepInitialNode),
|
|
106
114
|
);
|
|
107
115
|
|
|
108
116
|
// And the ones with an initially disabled sequencer
|
|
@@ -119,7 +127,15 @@ export class P2PInactivityTest {
|
|
|
119
127
|
NUM_NODES - this.inactiveNodeCount,
|
|
120
128
|
);
|
|
121
129
|
|
|
122
|
-
this.nodes = [
|
|
130
|
+
this.nodes = [
|
|
131
|
+
...(this.keepInitialNode ? [this.test.ctx.aztecNode] : []),
|
|
132
|
+
...this.activeNodes,
|
|
133
|
+
...this.inactiveNodes,
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
if (this.nodes.length !== NUM_NODES) {
|
|
137
|
+
throw new Error(`Expected ${NUM_NODES} nodes but got ${this.nodes.length}`);
|
|
138
|
+
}
|
|
123
139
|
|
|
124
140
|
this.offlineValidators = this.test.validators
|
|
125
141
|
.slice(this.test.validators.length - this.inactiveNodeCount)
|
|
@@ -130,6 +146,9 @@ export class P2PInactivityTest {
|
|
|
130
146
|
offlineValidators: this.offlineValidators,
|
|
131
147
|
});
|
|
132
148
|
|
|
149
|
+
this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
|
|
150
|
+
await this.test.ctx.cheatCodes.rollup.advanceToEpoch(SETUP_EPOCH_DURATION + 1);
|
|
151
|
+
|
|
133
152
|
return this;
|
|
134
153
|
}
|
|
135
154
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger,
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
|
|
5
6
|
import { jest } from '@jest/globals';
|
|
6
7
|
|
|
@@ -27,7 +28,7 @@ export class TokenContractTest {
|
|
|
27
28
|
node!: AztecNode;
|
|
28
29
|
|
|
29
30
|
badAccount!: InvalidAccountContract;
|
|
30
|
-
wallet!:
|
|
31
|
+
wallet!: TestWallet;
|
|
31
32
|
adminAddress!: AztecAddress;
|
|
32
33
|
account1Address!: AztecAddress;
|
|
33
34
|
account2Address!: AztecAddress;
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
type ContractFunctionInteraction,
|
|
9
9
|
EthAddress,
|
|
10
10
|
type Logger,
|
|
11
|
-
type PXE,
|
|
12
11
|
type Wallet,
|
|
13
12
|
getContractClassFromArtifact,
|
|
14
13
|
waitForProven,
|
|
@@ -450,7 +449,7 @@ async function setupFromFresh(
|
|
|
450
449
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
451
450
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
452
451
|
const wallet = new TestWallet(pxe);
|
|
453
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
452
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
454
453
|
|
|
455
454
|
if (statePath) {
|
|
456
455
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -579,7 +578,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
579
578
|
pxeConfig.dataDirectory = statePath;
|
|
580
579
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
581
580
|
const wallet = new TestWallet(pxe);
|
|
582
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
581
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
583
582
|
|
|
584
583
|
return {
|
|
585
584
|
aztecNodeConfig,
|
|
@@ -641,13 +640,13 @@ export const deployAccounts =
|
|
|
641
640
|
* @param sender - Wallet to send the deployment tx.
|
|
642
641
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
643
642
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
644
|
-
* @param
|
|
643
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
645
644
|
*/
|
|
646
645
|
export async function publicDeployAccounts(
|
|
647
646
|
wallet: Wallet,
|
|
648
647
|
accountsToDeploy: AztecAddress[],
|
|
649
648
|
waitUntilProven = false,
|
|
650
|
-
|
|
649
|
+
node?: AztecNode,
|
|
651
650
|
) {
|
|
652
651
|
const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
|
|
653
652
|
metadata => metadata.contractInstance,
|
|
@@ -665,10 +664,10 @@ export async function publicDeployAccounts(
|
|
|
665
664
|
|
|
666
665
|
const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
667
666
|
if (waitUntilProven) {
|
|
668
|
-
if (!
|
|
669
|
-
throw new Error('Need to provide
|
|
667
|
+
if (!node) {
|
|
668
|
+
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
670
669
|
} else {
|
|
671
|
-
await waitForProven(
|
|
670
|
+
await waitForProven(node, txReceipt);
|
|
672
671
|
}
|
|
673
672
|
}
|
|
674
673
|
}
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -236,7 +236,7 @@ async function setupWithRemoteEnvironment(
|
|
|
236
236
|
rollupVersion,
|
|
237
237
|
};
|
|
238
238
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
239
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient
|
|
239
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!, aztecNode);
|
|
240
240
|
const teardown = () => Promise.resolve();
|
|
241
241
|
|
|
242
242
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
@@ -573,7 +573,7 @@ export async function setup(
|
|
|
573
573
|
await blobSink.start();
|
|
574
574
|
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
575
575
|
|
|
576
|
-
logger.verbose('Creating and synching an aztec node
|
|
576
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
577
577
|
|
|
578
578
|
const acvmConfig = await getACVMConfig(logger);
|
|
579
579
|
if (acvmConfig) {
|
|
@@ -657,7 +657,7 @@ export async function setup(
|
|
|
657
657
|
logger.verbose('Creating a pxe...');
|
|
658
658
|
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode!, pxeOpts, logger);
|
|
659
659
|
|
|
660
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe
|
|
660
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe!, aztecNode);
|
|
661
661
|
|
|
662
662
|
if (
|
|
663
663
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -675,7 +675,7 @@ export async function setup(
|
|
|
675
675
|
// Below we continue with what we described in the long comment on line 571.
|
|
676
676
|
if (numberOfAccounts === 0) {
|
|
677
677
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
678
|
-
while ((await
|
|
678
|
+
while ((await aztecNode.getBlockNumber()) === 0) {
|
|
679
679
|
await sleep(2000);
|
|
680
680
|
}
|
|
681
681
|
} else {
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
Fr,
|
|
6
6
|
type Logger,
|
|
7
7
|
type PXE,
|
|
8
|
-
type Wallet,
|
|
9
8
|
computeAuthWitMessageHash,
|
|
10
9
|
generateClaimSecret,
|
|
11
10
|
} from '@aztec/aztec.js';
|
|
@@ -22,6 +21,7 @@ import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-art
|
|
|
22
21
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
23
22
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
24
23
|
import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
24
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
25
25
|
|
|
26
26
|
import { jest } from '@jest/globals';
|
|
27
27
|
import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
|
|
@@ -50,7 +50,7 @@ export type UniswapSetupContext = {
|
|
|
50
50
|
/** The L1 wallet client, extended with public actions. */
|
|
51
51
|
l1Client: ExtendedViemWalletClient;
|
|
52
52
|
/** The wallet. */
|
|
53
|
-
wallet:
|
|
53
|
+
wallet: TestWallet;
|
|
54
54
|
/** The owner address. */
|
|
55
55
|
ownerAddress: AztecAddress;
|
|
56
56
|
/** The sponsor wallet. */
|
|
@@ -80,7 +80,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
80
80
|
|
|
81
81
|
let l1Client: ExtendedViemWalletClient;
|
|
82
82
|
|
|
83
|
-
let wallet:
|
|
83
|
+
let wallet: TestWallet;
|
|
84
84
|
let ownerAddress: AztecAddress;
|
|
85
85
|
let ownerEthAddress: EthAddress;
|
|
86
86
|
// does transactions on behalf of owner on Aztec:
|
|
@@ -614,14 +614,16 @@ export const uniswapL1L2TestSuite = (
|
|
|
614
614
|
const expectedMessageHash = await computeAuthWitMessageHash(
|
|
615
615
|
{
|
|
616
616
|
caller: uniswapL2Contract.address,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
617
|
+
call: await wethCrossChainHarness.l2Token.methods
|
|
618
|
+
.transfer_to_public(
|
|
619
|
+
ownerAddress,
|
|
620
|
+
uniswapL2Contract.address,
|
|
621
|
+
wethAmountToBridge,
|
|
622
|
+
nonceForWETHTransferToPublicApproval,
|
|
623
|
+
)
|
|
624
|
+
.getFunctionCall(),
|
|
623
625
|
},
|
|
624
|
-
|
|
626
|
+
await wallet.getChainInfo(),
|
|
625
627
|
);
|
|
626
628
|
|
|
627
629
|
await expect(
|
|
@@ -699,7 +701,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
699
701
|
},
|
|
700
702
|
true,
|
|
701
703
|
);
|
|
702
|
-
await validateActionInteraction.send(
|
|
704
|
+
await validateActionInteraction.send().wait();
|
|
703
705
|
|
|
704
706
|
// No approval to call `swap` but should work even without it:
|
|
705
707
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
@@ -749,7 +751,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
749
751
|
{ caller: approvedUser, action },
|
|
750
752
|
true,
|
|
751
753
|
);
|
|
752
|
-
await validateActionInteraction.send(
|
|
754
|
+
await validateActionInteraction.send().wait();
|
|
753
755
|
|
|
754
756
|
await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
|
|
755
757
|
});
|
|
@@ -771,7 +773,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
771
773
|
},
|
|
772
774
|
true,
|
|
773
775
|
);
|
|
774
|
-
await validateActionInteraction.send(
|
|
776
|
+
await validateActionInteraction.send().wait();
|
|
775
777
|
|
|
776
778
|
await expect(
|
|
777
779
|
uniswapL2Contract.methods
|
|
@@ -942,7 +944,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
942
944
|
},
|
|
943
945
|
true,
|
|
944
946
|
);
|
|
945
|
-
await validateActionInteraction.send(
|
|
947
|
+
await validateActionInteraction.send().wait();
|
|
946
948
|
|
|
947
949
|
// Call swap_public on L2
|
|
948
950
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
@@ -136,7 +136,9 @@ export async function deployTestAccountsWithTokens(
|
|
|
136
136
|
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
137
137
|
|
|
138
138
|
const claims = await Promise.all(
|
|
139
|
-
fundedAccounts.map(a =>
|
|
139
|
+
fundedAccounts.map(a =>
|
|
140
|
+
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, node, a.getAddress(), undefined, logger),
|
|
141
|
+
),
|
|
140
142
|
);
|
|
141
143
|
|
|
142
144
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
@@ -179,6 +181,7 @@ async function bridgeL1FeeJuice(
|
|
|
179
181
|
l1RpcUrls: string[],
|
|
180
182
|
mnemonicOrPrivateKey: string,
|
|
181
183
|
pxe: PXE,
|
|
184
|
+
node: AztecNode,
|
|
182
185
|
recipient: AztecAddress,
|
|
183
186
|
amount: bigint | undefined,
|
|
184
187
|
log: Logger,
|
|
@@ -192,7 +195,7 @@ async function bridgeL1FeeJuice(
|
|
|
192
195
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
193
196
|
// docs:end:bridge_fee_juice
|
|
194
197
|
|
|
195
|
-
const isSynced = async () => await
|
|
198
|
+
const isSynced = async () => (await node.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
196
199
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
197
200
|
|
|
198
201
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|