@aztec/end-to-end 0.86.0-nightly.20250429 → 0.86.0-nightly.20250501
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/e2e_epochs/epochs_test.d.ts +6 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +13 -2
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +10 -3
- package/package.json +34 -34
- package/src/e2e_epochs/epochs_test.ts +21 -4
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +19 -3
|
@@ -5,14 +5,15 @@ import { RollupContract } from '@aztec/ethereum/contracts';
|
|
|
5
5
|
import { ChainMonitor, type Delayer } from '@aztec/ethereum/test';
|
|
6
6
|
import { ProverNode } from '@aztec/prover-node';
|
|
7
7
|
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
8
|
-
import type
|
|
8
|
+
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
9
9
|
import { type EndToEndContext, type SetupOptions } from '../fixtures/utils.js';
|
|
10
10
|
export declare const L1_BLOCK_TIME_IN_S: number;
|
|
11
11
|
export declare const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
12
|
+
export declare const L2_SLOT_DURATION_IN_S: number;
|
|
12
13
|
export declare const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
13
14
|
export declare const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
14
15
|
export declare const ARCHIVER_POLL_INTERVAL = 50;
|
|
15
|
-
export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs' | 'proverNodeConfig'>>;
|
|
16
|
+
export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs' | 'l1PublishRetryIntervalMS' | 'txPropagationMaxQueryAttempts' | 'proverNodeConfig'>>;
|
|
16
17
|
/**
|
|
17
18
|
* Tests building of epochs using fast block times and short epochs.
|
|
18
19
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -41,7 +42,9 @@ export declare class EpochsTestContext {
|
|
|
41
42
|
/** Waits until the given L2 block number is mined. */
|
|
42
43
|
waitUntilL2BlockNumber(target: number, timeout?: number): Promise<void>;
|
|
43
44
|
/** Waits until the given L2 block number is marked as proven. */
|
|
44
|
-
waitUntilProvenL2BlockNumber(t: number, timeout?: number): Promise<
|
|
45
|
+
waitUntilProvenL2BlockNumber(t: number, timeout?: number): Promise<number>;
|
|
46
|
+
/** Waits until the end of the proof submission window for a given epoch. */
|
|
47
|
+
waitUntilEndOfProofSubmissionWindow(epochNumber: number | bigint): Promise<void>;
|
|
45
48
|
/** Waits for the aztec node to sync to the target block number. */
|
|
46
49
|
waitForNodeToSync(blockNumber: number, type: 'finalised' | 'historic'): Promise<void>;
|
|
47
50
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAM,KAAK,MAAM,EAA8D,MAAM,iBAAiB,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,KAAK,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAGxG,OAAO,EAAE,UAAU,EAAuB,MAAM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U,CAAC;IACtB,MAAM,EAAG,cAAc,CAAC;IACxB,SAAS,EAAG,iBAAiB,CAAC;IAC9B,MAAM,EAAG,MAAM,CAAC;IAChB,OAAO,EAAG,YAAY,CAAC;IACvB,aAAa,EAAG,OAAO,CAAC;IACxB,gBAAgB,EAAG,OAAO,CAAC;IAE3B,WAAW,EAAE,UAAU,EAAE,CAAM;IAC/B,KAAK,EAAE,gBAAgB,EAAE,CAAM;IAE/B,aAAa,EAAG,MAAM,CAAC;WAEV,KAAK,CAAC,IAAI,GAAE,cAAmB;IAMtC,KAAK,CAAC,IAAI,GAAE,cAAmB;IAoE/B,QAAQ;IAOR,gBAAgB;IAgBhB,sBAAsB;IAcnC,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,4EAA4E;IAC/D,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAO7E,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU;IAclF,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;CAUtF"}
|
|
@@ -4,11 +4,13 @@ import { RollupContract } from '@aztec/ethereum/contracts';
|
|
|
4
4
|
import { ChainMonitor, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
5
5
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
6
6
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
7
|
+
import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
7
8
|
import { join } from 'path';
|
|
8
9
|
import { createAndSyncProverNode, getPrivateKeyFromIndex, setup } from '../fixtures/utils.js';
|
|
9
10
|
// This can be lowered to as much as 2s in non-CI
|
|
10
11
|
export const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8;
|
|
11
12
|
export const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
13
|
+
export const L2_SLOT_DURATION_IN_S = L2_SLOT_DURATION_IN_L1_SLOTS * L1_BLOCK_TIME_IN_S;
|
|
12
14
|
export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
13
15
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
14
16
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
@@ -133,10 +135,19 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
133
135
|
return start;
|
|
134
136
|
}
|
|
135
137
|
/** Waits until the given L2 block number is mined. */ async waitUntilL2BlockNumber(target, timeout = 60) {
|
|
136
|
-
await retryUntil(()=>Promise.resolve(target
|
|
138
|
+
await retryUntil(()=>Promise.resolve(target <= this.monitor.l2BlockNumber), `Wait until L2 block ${target}`, timeout, 0.1);
|
|
137
139
|
}
|
|
138
140
|
/** Waits until the given L2 block number is marked as proven. */ async waitUntilProvenL2BlockNumber(t, timeout = 60) {
|
|
139
|
-
await retryUntil(()=>Promise.resolve(t
|
|
141
|
+
await retryUntil(()=>Promise.resolve(t <= this.monitor.l2ProvenBlockNumber), `Wait proven L2 block ${t}`, timeout, 0.1);
|
|
142
|
+
return this.monitor.l2ProvenBlockNumber;
|
|
143
|
+
}
|
|
144
|
+
/** Waits until the end of the proof submission window for a given epoch. */ async waitUntilEndOfProofSubmissionWindow(epochNumber) {
|
|
145
|
+
const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
|
|
146
|
+
const date = new Date(Number(deadline) * 1000);
|
|
147
|
+
this.logger.info(`Waiting until end of submission window for epoch ${epochNumber} at ${date}`, {
|
|
148
|
+
deadline
|
|
149
|
+
});
|
|
150
|
+
await waitUntilL1Timestamp(this.l1Client, deadline);
|
|
140
151
|
}
|
|
141
152
|
/** Waits for the aztec node to sync to the target block number. */ async waitForNodeToSync(blockNumber, type) {
|
|
142
153
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridging_race.notest.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/bridging_race.notest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, sleep } from '@aztec/aztec.js';
|
|
3
|
+
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
4
|
+
import { Fq } from '@aztec/foundation/fields';
|
|
5
|
+
import { jest } from '@jest/globals';
|
|
6
|
+
import { FeesTest } from './fees_test.js';
|
|
7
|
+
jest.setTimeout(300_000);
|
|
8
|
+
// Regression for https://github.com/AztecProtocol/aztec-packages/issues/12366
|
|
9
|
+
// Similar to e2e_fees/account_init but with no automine
|
|
10
|
+
describe('e2e_fees bridging_race', ()=>{
|
|
11
|
+
const ETHEREUM_SLOT_DURATION = 4;
|
|
12
|
+
const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
|
|
13
|
+
const t = new FeesTest('bridging_race', 1, {
|
|
14
|
+
ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
|
|
15
|
+
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
16
|
+
minTxsPerBlock: 0
|
|
17
|
+
});
|
|
18
|
+
beforeAll(async ()=>{
|
|
19
|
+
await t.applyInitialAccountsSnapshot();
|
|
20
|
+
await t.applyPublicDeployAccountsSnapshot();
|
|
21
|
+
await t.applySetupFeeJuiceSnapshot();
|
|
22
|
+
({ pxe, logger } = await t.setup());
|
|
23
|
+
});
|
|
24
|
+
afterAll(async ()=>{
|
|
25
|
+
await t.teardown();
|
|
26
|
+
});
|
|
27
|
+
let logger;
|
|
28
|
+
let pxe;
|
|
29
|
+
let bobsAddress;
|
|
30
|
+
beforeEach(async ()=>{
|
|
31
|
+
const bobsSecretKey = Fr.random();
|
|
32
|
+
const bobsPrivateSigningKey = Fq.random();
|
|
33
|
+
const bobsAccountManager = await getSchnorrAccount(pxe, bobsSecretKey, bobsPrivateSigningKey, Fr.random());
|
|
34
|
+
const bobsCompleteAddress = await bobsAccountManager.getCompleteAddress();
|
|
35
|
+
bobsAddress = bobsCompleteAddress.address;
|
|
36
|
+
await bobsAccountManager.getWallet();
|
|
37
|
+
await bobsAccountManager.register();
|
|
38
|
+
});
|
|
39
|
+
it('Alice bridges funds to Bob', async ()=>{
|
|
40
|
+
// Tweak the token manager so the bridging happens immediately before the end of the current L2 slot
|
|
41
|
+
// This caused the message to be "not in state" when tried to be used
|
|
42
|
+
const l1TokenManager = t.feeJuiceBridgeTestHarness.l1TokenManager;
|
|
43
|
+
const origApprove = l1TokenManager.approve.bind(l1TokenManager);
|
|
44
|
+
l1TokenManager.approve = async (amount, address, addressName = '')=>{
|
|
45
|
+
await origApprove(amount, address, addressName);
|
|
46
|
+
const sleepTime = (Number(t.chainMonitor.l2BlockTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
|
|
47
|
+
logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
|
|
48
|
+
await sleep(sleepTime);
|
|
49
|
+
};
|
|
50
|
+
// Waiting for the archiver to sync the message _before_ waiting for the mandatory 2 L2 blocks to pass fixed it
|
|
51
|
+
// This was added everywhere we wait for two blocks, which is spread across three different places in the codebase
|
|
52
|
+
// Yes, we need to REFACTOR it at some point
|
|
53
|
+
const amount = FEE_FUNDING_FOR_TESTER_ACCOUNT;
|
|
54
|
+
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, bobsAddress);
|
|
55
|
+
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
56
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send().wait();
|
|
57
|
+
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
58
|
+
expect(balance).toEqual(amount);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -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,yBAAyB,CAAC;AAErD,OAAO,EACL,KAAK,qBAAqB,EAK3B,MAAM,iBAAiB,CAAC;AACzB,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;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,Q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qB,SAAgB;IACrD,SAAgB,mBAAmB,SAAgB;IACnD,SAAgB,0BAA0B,SAAgB;gBAGxD,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI,EAC5B,YAAY,GAAE,OAAO,CAAC,YAAY,GAAG,qBAAqB,CAAM;IAc5D,KAAK;IAUL,QAAQ;IAKd,oBAAoB,CAAC,CAAC,EAAE,OAAO;IAIzB,kBAAkB;IAOlB,eAAe;;;;IAoBf,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAMjE,sFAAsF;IAChF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IASjD,kBAAkB;IAOzB,4BAA4B;IAyB5B,iCAAiC;IAMjC,0BAA0B;IAuB1B,8BAA8B;IAuBvB,qBAAqB;IA4ErB,8BAA8B;IAqB9B,yBAAyB;IAWzB,gCAAgC;IAUhC,sBAAsB;CAgCpC"}
|
|
@@ -223,15 +223,22 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
223
223
|
return await rollup.getSequencerRewards(this.coinbase);
|
|
224
224
|
};
|
|
225
225
|
this.getProverFee = async (blockNumber)=>{
|
|
226
|
+
const block = await this.pxe.getBlock(blockNumber);
|
|
226
227
|
const publicClient = getPublicClient({
|
|
227
228
|
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
228
229
|
l1ChainId: context.aztecNodeConfig.l1ChainId
|
|
229
230
|
});
|
|
230
231
|
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
// @todo @lherskind As we deal with #13601
|
|
233
|
+
// Right now the value is from `FeeLib.sol`
|
|
234
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
235
|
+
// We round up
|
|
236
|
+
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
237
|
+
const { baseFee } = await rollup.getL1FeesAt(block.header.globalVariables.timestamp.toBigInt());
|
|
238
|
+
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await rollup.getEpochDuration()), 1n, await rollup.getManaTarget()) + await rollup.getProvingCostPerMana();
|
|
239
|
+
const price = await rollup.getFeeAssetPerEth();
|
|
233
240
|
const mana = block.header.totalManaUsed.toBigInt();
|
|
234
|
-
return mana *
|
|
241
|
+
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
235
242
|
};
|
|
236
243
|
});
|
|
237
244
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.86.0-nightly.
|
|
3
|
+
"version": "0.86.0-nightly.20250501",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,39 +25,39 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "0.86.0-nightly.
|
|
29
|
-
"@aztec/archiver": "0.86.0-nightly.
|
|
30
|
-
"@aztec/aztec": "0.86.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "0.86.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "0.86.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "0.86.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "0.86.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "0.86.0-nightly.
|
|
36
|
-
"@aztec/bot": "0.86.0-nightly.
|
|
37
|
-
"@aztec/cli": "0.86.0-nightly.
|
|
38
|
-
"@aztec/constants": "0.86.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "0.86.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "0.86.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "0.86.0-nightly.
|
|
42
|
-
"@aztec/foundation": "0.86.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "0.86.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "0.86.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "0.86.0-nightly.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.86.0-nightly.
|
|
47
|
-
"@aztec/noir-noirc_abi": "0.86.0-nightly.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "0.86.0-nightly.
|
|
49
|
-
"@aztec/noir-test-contracts.js": "0.86.0-nightly.
|
|
50
|
-
"@aztec/p2p": "0.86.0-nightly.
|
|
51
|
-
"@aztec/protocol-contracts": "0.86.0-nightly.
|
|
52
|
-
"@aztec/prover-client": "0.86.0-nightly.
|
|
53
|
-
"@aztec/prover-node": "0.86.0-nightly.
|
|
54
|
-
"@aztec/pxe": "0.86.0-nightly.
|
|
55
|
-
"@aztec/sequencer-client": "0.86.0-nightly.
|
|
56
|
-
"@aztec/simulator": "0.86.0-nightly.
|
|
57
|
-
"@aztec/stdlib": "0.86.0-nightly.
|
|
58
|
-
"@aztec/telemetry-client": "0.86.0-nightly.
|
|
59
|
-
"@aztec/validator-client": "0.86.0-nightly.
|
|
60
|
-
"@aztec/world-state": "0.86.0-nightly.
|
|
28
|
+
"@aztec/accounts": "0.86.0-nightly.20250501",
|
|
29
|
+
"@aztec/archiver": "0.86.0-nightly.20250501",
|
|
30
|
+
"@aztec/aztec": "0.86.0-nightly.20250501",
|
|
31
|
+
"@aztec/aztec-node": "0.86.0-nightly.20250501",
|
|
32
|
+
"@aztec/aztec.js": "0.86.0-nightly.20250501",
|
|
33
|
+
"@aztec/bb-prover": "0.86.0-nightly.20250501",
|
|
34
|
+
"@aztec/blob-lib": "0.86.0-nightly.20250501",
|
|
35
|
+
"@aztec/blob-sink": "0.86.0-nightly.20250501",
|
|
36
|
+
"@aztec/bot": "0.86.0-nightly.20250501",
|
|
37
|
+
"@aztec/cli": "0.86.0-nightly.20250501",
|
|
38
|
+
"@aztec/constants": "0.86.0-nightly.20250501",
|
|
39
|
+
"@aztec/entrypoints": "0.86.0-nightly.20250501",
|
|
40
|
+
"@aztec/epoch-cache": "0.86.0-nightly.20250501",
|
|
41
|
+
"@aztec/ethereum": "0.86.0-nightly.20250501",
|
|
42
|
+
"@aztec/foundation": "0.86.0-nightly.20250501",
|
|
43
|
+
"@aztec/kv-store": "0.86.0-nightly.20250501",
|
|
44
|
+
"@aztec/l1-artifacts": "0.86.0-nightly.20250501",
|
|
45
|
+
"@aztec/merkle-tree": "0.86.0-nightly.20250501",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.86.0-nightly.20250501",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250501",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.86.0-nightly.20250501",
|
|
49
|
+
"@aztec/noir-test-contracts.js": "0.86.0-nightly.20250501",
|
|
50
|
+
"@aztec/p2p": "0.86.0-nightly.20250501",
|
|
51
|
+
"@aztec/protocol-contracts": "0.86.0-nightly.20250501",
|
|
52
|
+
"@aztec/prover-client": "0.86.0-nightly.20250501",
|
|
53
|
+
"@aztec/prover-node": "0.86.0-nightly.20250501",
|
|
54
|
+
"@aztec/pxe": "0.86.0-nightly.20250501",
|
|
55
|
+
"@aztec/sequencer-client": "0.86.0-nightly.20250501",
|
|
56
|
+
"@aztec/simulator": "0.86.0-nightly.20250501",
|
|
57
|
+
"@aztec/stdlib": "0.86.0-nightly.20250501",
|
|
58
|
+
"@aztec/telemetry-client": "0.86.0-nightly.20250501",
|
|
59
|
+
"@aztec/validator-client": "0.86.0-nightly.20250501",
|
|
60
|
+
"@aztec/world-state": "0.86.0-nightly.20250501",
|
|
61
61
|
"@iarna/toml": "^2.2.5",
|
|
62
62
|
"@jest/globals": "^29.5.0",
|
|
63
63
|
"@noble/curves": "^1.0.0",
|
|
@@ -10,7 +10,7 @@ import type { TestProverNode } from '@aztec/prover-node/test';
|
|
|
10
10
|
import type { SequencerPublisher } from '@aztec/sequencer-client';
|
|
11
11
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
12
12
|
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
13
|
-
import type
|
|
13
|
+
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
14
14
|
|
|
15
15
|
import { join } from 'path';
|
|
16
16
|
import type { Hex } from 'viem';
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
// This can be lowered to as much as 2s in non-CI
|
|
27
27
|
export const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8;
|
|
28
28
|
export const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
29
|
+
export const L2_SLOT_DURATION_IN_S = L2_SLOT_DURATION_IN_L1_SLOTS * L1_BLOCK_TIME_IN_S;
|
|
30
|
+
|
|
29
31
|
export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
30
32
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
31
33
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
@@ -33,7 +35,13 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
33
35
|
export type EpochsTestOpts = Partial<
|
|
34
36
|
Pick<
|
|
35
37
|
SetupOptions,
|
|
36
|
-
|
|
38
|
+
| 'startProverNode'
|
|
39
|
+
| 'aztecProofSubmissionWindow'
|
|
40
|
+
| 'aztecEpochDuration'
|
|
41
|
+
| 'proverTestDelayMs'
|
|
42
|
+
| 'l1PublishRetryIntervalMS'
|
|
43
|
+
| 'txPropagationMaxQueryAttempts'
|
|
44
|
+
| 'proverNodeConfig'
|
|
37
45
|
>
|
|
38
46
|
>;
|
|
39
47
|
|
|
@@ -184,7 +192,7 @@ export class EpochsTestContext {
|
|
|
184
192
|
/** Waits until the given L2 block number is mined. */
|
|
185
193
|
public async waitUntilL2BlockNumber(target: number, timeout = 60) {
|
|
186
194
|
await retryUntil(
|
|
187
|
-
() => Promise.resolve(target
|
|
195
|
+
() => Promise.resolve(target <= this.monitor.l2BlockNumber),
|
|
188
196
|
`Wait until L2 block ${target}`,
|
|
189
197
|
timeout,
|
|
190
198
|
0.1,
|
|
@@ -194,11 +202,20 @@ export class EpochsTestContext {
|
|
|
194
202
|
/** Waits until the given L2 block number is marked as proven. */
|
|
195
203
|
public async waitUntilProvenL2BlockNumber(t: number, timeout = 60) {
|
|
196
204
|
await retryUntil(
|
|
197
|
-
() => Promise.resolve(t
|
|
205
|
+
() => Promise.resolve(t <= this.monitor.l2ProvenBlockNumber),
|
|
198
206
|
`Wait proven L2 block ${t}`,
|
|
199
207
|
timeout,
|
|
200
208
|
0.1,
|
|
201
209
|
);
|
|
210
|
+
return this.monitor.l2ProvenBlockNumber;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Waits until the end of the proof submission window for a given epoch. */
|
|
214
|
+
public async waitUntilEndOfProofSubmissionWindow(epochNumber: number | bigint) {
|
|
215
|
+
const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
|
|
216
|
+
const date = new Date(Number(deadline) * 1000);
|
|
217
|
+
this.logger.info(`Waiting until end of submission window for epoch ${epochNumber} at ${date}`, { deadline });
|
|
218
|
+
await waitUntilL1Timestamp(this.l1Client, deadline);
|
|
202
219
|
}
|
|
203
220
|
|
|
204
221
|
/** Waits for the aztec node to sync to the target block number. */
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, type Logger, type PXE, sleep } from '@aztec/aztec.js';
|
|
3
|
+
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
4
|
+
import { Fq } from '@aztec/foundation/fields';
|
|
5
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
|
|
7
|
+
import { jest } from '@jest/globals';
|
|
8
|
+
import type { Hex } from 'viem';
|
|
9
|
+
|
|
10
|
+
import { FeesTest } from './fees_test.js';
|
|
11
|
+
|
|
12
|
+
jest.setTimeout(300_000);
|
|
13
|
+
|
|
14
|
+
// Regression for https://github.com/AztecProtocol/aztec-packages/issues/12366
|
|
15
|
+
// Similar to e2e_fees/account_init but with no automine
|
|
16
|
+
describe('e2e_fees bridging_race', () => {
|
|
17
|
+
const ETHEREUM_SLOT_DURATION = 4;
|
|
18
|
+
const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
|
|
19
|
+
|
|
20
|
+
const t = new FeesTest('bridging_race', 1, {
|
|
21
|
+
ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
|
|
22
|
+
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
23
|
+
minTxsPerBlock: 0,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
beforeAll(async () => {
|
|
27
|
+
await t.applyInitialAccountsSnapshot();
|
|
28
|
+
await t.applyPublicDeployAccountsSnapshot();
|
|
29
|
+
await t.applySetupFeeJuiceSnapshot();
|
|
30
|
+
|
|
31
|
+
({ pxe, logger } = await t.setup());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterAll(async () => {
|
|
35
|
+
await t.teardown();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
let logger: Logger;
|
|
39
|
+
let pxe: PXE;
|
|
40
|
+
let bobsAddress: AztecAddress;
|
|
41
|
+
|
|
42
|
+
beforeEach(async () => {
|
|
43
|
+
const bobsSecretKey = Fr.random();
|
|
44
|
+
const bobsPrivateSigningKey = Fq.random();
|
|
45
|
+
const bobsAccountManager = await getSchnorrAccount(pxe, bobsSecretKey, bobsPrivateSigningKey, Fr.random());
|
|
46
|
+
const bobsCompleteAddress = await bobsAccountManager.getCompleteAddress();
|
|
47
|
+
bobsAddress = bobsCompleteAddress.address;
|
|
48
|
+
await bobsAccountManager.getWallet();
|
|
49
|
+
await bobsAccountManager.register();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('Alice bridges funds to Bob', async () => {
|
|
53
|
+
// Tweak the token manager so the bridging happens immediately before the end of the current L2 slot
|
|
54
|
+
// This caused the message to be "not in state" when tried to be used
|
|
55
|
+
const l1TokenManager = t.feeJuiceBridgeTestHarness.l1TokenManager;
|
|
56
|
+
const origApprove = l1TokenManager.approve.bind(l1TokenManager);
|
|
57
|
+
l1TokenManager.approve = async (amount: bigint, address: Hex, addressName = '') => {
|
|
58
|
+
await origApprove(amount, address, addressName);
|
|
59
|
+
const sleepTime = (Number(t.chainMonitor.l2BlockTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
|
|
60
|
+
logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
|
|
61
|
+
await sleep(sleepTime);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Waiting for the archiver to sync the message _before_ waiting for the mandatory 2 L2 blocks to pass fixed it
|
|
65
|
+
// This was added everywhere we wait for two blocks, which is spread across three different places in the codebase
|
|
66
|
+
// Yes, we need to REFACTOR it at some point
|
|
67
|
+
const amount = FEE_FUNDING_FOR_TESTER_ACCOUNT;
|
|
68
|
+
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, bobsAddress);
|
|
69
|
+
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
70
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send().wait();
|
|
71
|
+
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
72
|
+
expect(balance).toEqual(amount);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -310,17 +310,33 @@ export class FeesTest {
|
|
|
310
310
|
};
|
|
311
311
|
|
|
312
312
|
this.getProverFee = async (blockNumber: number) => {
|
|
313
|
+
const block = await this.pxe.getBlock(blockNumber);
|
|
314
|
+
|
|
313
315
|
const publicClient = getPublicClient({
|
|
314
316
|
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
315
317
|
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
316
318
|
});
|
|
317
319
|
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
318
320
|
|
|
319
|
-
|
|
321
|
+
// @todo @lherskind As we deal with #13601
|
|
322
|
+
// Right now the value is from `FeeLib.sol`
|
|
323
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
324
|
+
|
|
325
|
+
// We round up
|
|
326
|
+
const mulDiv = (a: bigint, b: bigint, c: bigint) => (a * b) / c + ((a * b) % c > 0n ? 1n : 0n);
|
|
327
|
+
|
|
328
|
+
const { baseFee } = await rollup.getL1FeesAt(block!.header.globalVariables.timestamp.toBigInt());
|
|
329
|
+
const proverCost =
|
|
330
|
+
mulDiv(
|
|
331
|
+
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await rollup.getEpochDuration()),
|
|
332
|
+
1n,
|
|
333
|
+
await rollup.getManaTarget(),
|
|
334
|
+
) + (await rollup.getProvingCostPerMana());
|
|
335
|
+
|
|
336
|
+
const price = await rollup.getFeeAssetPerEth();
|
|
320
337
|
|
|
321
|
-
const block = await this.pxe.getBlock(blockNumber);
|
|
322
338
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
323
|
-
return mana *
|
|
339
|
+
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
324
340
|
};
|
|
325
341
|
},
|
|
326
342
|
);
|