@aztec/end-to-end 2.0.0-nightly.20250827 → 2.0.0-nightly.20250828
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_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +2 -1
- package/dest/e2e_p2p/p2p_network.d.ts +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +3 -6
- package/dest/e2e_p2p/shared.d.ts +13 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +76 -38
- package/package.json +36 -36
- package/src/e2e_fees/fees_test.ts +2 -1
- package/src/e2e_p2p/p2p_network.ts +7 -7
- package/src/e2e_p2p/shared.ts +101 -58
|
@@ -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,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,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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EAAG,UAAU,CAAC;IACtC,yBAAyB,EAAG,UAAU,CAAC;IACvC,YAAY,EAAG,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/D,SAAgB,qBAAqB,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;IAgB5D,KAAK;IASL,QAAQ;IAKd,oBAAoB,CAAC,CAAC,EAAE,OAAO;IAIzB,kBAAkB;IAOlB,eAAe;;;;IAcf,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAMzF,sFAAsF;IAChF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAajD,kBAAkB;IAOzB,4BAA4B;IAyB5B,iCAAiC;IAMjC,0BAA0B;IA4B1B,8BAA8B;IA6BvB,qBAAqB;IAwErB,8BAA8B;IAoB9B,yBAAyB;IAczB,gCAAgC;CAS9C"}
|
|
@@ -75,7 +75,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
75
75
|
if (!numberOfAccounts) {
|
|
76
76
|
throw new Error('There must be at least 1 initial account.');
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
setupOptions.coinbase ??= EthAddress.random();
|
|
79
|
+
this.coinbase = setupOptions.coinbase;
|
|
79
80
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
80
81
|
this.snapshotManager = createSnapshotManager(`e2e_fees/${testName}-${numberOfAccounts}`, dataPath, {
|
|
81
82
|
startProverNode: true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { type AccountWalletWithSecretKey, AztecAddress } from '@aztec/aztec.js';
|
|
4
|
-
import { type Operator, RollupContract, type ViemClient } from '@aztec/ethereum';
|
|
4
|
+
import { type EmpireSlashingProposerContract, type Operator, RollupContract, type TallySlashingProposerContract, type ViemClient } from '@aztec/ethereum';
|
|
5
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
6
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
7
|
-
import {
|
|
7
|
+
import { SlasherAbi } from '@aztec/l1-artifacts';
|
|
8
8
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
9
9
|
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
|
|
10
10
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
@@ -87,7 +87,7 @@ export declare class P2PNetworkTest {
|
|
|
87
87
|
getContracts(): Promise<{
|
|
88
88
|
rollup: RollupContract;
|
|
89
89
|
slasherContract: GetContractReturnType<typeof SlasherAbi, ViemClient>;
|
|
90
|
-
slashingProposer:
|
|
90
|
+
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
91
91
|
slashFactory: SlashFactoryContract;
|
|
92
92
|
}>;
|
|
93
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,KAAK,0BAA0B,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AAChG,OAAO,
|
|
1
|
+
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yB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AAW;;;;YAIH,YAAY;IAQpB,KAAK;IAcL,SAAS,CAAC,KAAK,EAAE,gBAAgB,EAAE;IAanC,QAAQ;IAMR,YAAY,IAAI,OAAO,CAAC;QAC5B,MAAM,EAAE,cAAc,CAAC;QACvB,eAAe,EAAE,qBAAqB,CAAC,OAAO,UAAU,EAAE,UAAU,CAAC,CAAC;QACtE,gBAAgB,EAAE,8BAA8B,GAAG,6BAA6B,GAAG,SAAS,CAAC;QAC7F,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CA0BH"}
|
|
@@ -4,7 +4,7 @@ import { GSEContract, MultiAdderArtifact, RollupContract, createL1TxUtilsFromVie
|
|
|
4
4
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
-
import {
|
|
7
|
+
import { RollupAbi, SlasherAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
8
8
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
9
9
|
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
10
10
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
@@ -280,11 +280,8 @@ export class P2PNetworkTest {
|
|
|
280
280
|
abi: SlasherAbi,
|
|
281
281
|
client: this.ctx.deployL1ContractsValues.l1Client
|
|
282
282
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
abi: EmpireSlashingProposerAbi,
|
|
286
|
-
client: this.ctx.deployL1ContractsValues.l1Client
|
|
287
|
-
});
|
|
283
|
+
// Get the actual slashing proposer from rollup (which handles both empire and tally)
|
|
284
|
+
const slashingProposer = await rollup.getSlashingProposer();
|
|
288
285
|
const slashFactory = new SlashFactoryContract(this.ctx.deployL1ContractsValues.l1Client, getAddress(this.ctx.deployL1ContractsValues.l1ContractAddresses.slashFactoryAddress.toString()));
|
|
289
286
|
return {
|
|
290
287
|
rollup,
|
package/dest/e2e_p2p/shared.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
|
2
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { AztecAddress, type Logger, ProvenTx, type SentTx } from '@aztec/aztec.js';
|
|
4
4
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
5
|
-
import type { RollupContract,
|
|
6
|
-
import type {
|
|
5
|
+
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
6
|
+
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
7
7
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
8
8
|
import { PXEService } from '@aztec/pxe/server';
|
|
9
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
9
10
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
10
|
-
import type { GetContractReturnType } from 'viem';
|
|
11
11
|
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
12
12
|
export declare const submitComplexTxsTo: (logger: Logger, from: AztecAddress, spamContract: SpamContract, numTxs: number, opts?: {
|
|
13
13
|
callPublic?: boolean;
|
|
@@ -18,24 +18,30 @@ export declare function createPXEServiceAndPrepareTransactions(logger: Logger, n
|
|
|
18
18
|
txs: ProvenTx[];
|
|
19
19
|
node: AztecNodeService;
|
|
20
20
|
}>;
|
|
21
|
-
export declare function awaitProposalExecution(slashingProposer:
|
|
21
|
+
export declare function awaitProposalExecution(slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract, timeoutSeconds: number, logger: Logger): Promise<bigint>;
|
|
22
22
|
export declare function awaitCommitteeExists({ rollup, logger, }: {
|
|
23
23
|
rollup: RollupContract;
|
|
24
24
|
logger: Logger;
|
|
25
25
|
}): Promise<readonly `0x${string}`[]>;
|
|
26
|
+
export declare function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, }: {
|
|
27
|
+
nodeAdmin: AztecNodeAdmin;
|
|
28
|
+
logger: Logger;
|
|
29
|
+
slashingRoundSize: number;
|
|
30
|
+
epochDuration: number;
|
|
31
|
+
}): Promise<import("@aztec/slasher").Offense[]>;
|
|
26
32
|
/**
|
|
27
33
|
* Await the committee to be slashed out of the validator set.
|
|
28
34
|
* Currently assumes that the committee is the same size as the validator set.
|
|
29
35
|
*/
|
|
30
|
-
export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger,
|
|
36
|
+
export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger, dateProvider, }: {
|
|
31
37
|
rollup: RollupContract;
|
|
32
38
|
cheatCodes: RollupCheatCodes;
|
|
33
39
|
committee: readonly `0x${string}`[];
|
|
34
40
|
slashFactory: SlashFactoryContract;
|
|
35
|
-
slashingProposer:
|
|
41
|
+
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
36
42
|
slashingRoundSize: number;
|
|
37
43
|
aztecSlotDuration: number;
|
|
44
|
+
dateProvider: TestDateProvider;
|
|
38
45
|
logger: Logger;
|
|
39
|
-
sendDummyTx: () => Promise<void>;
|
|
40
46
|
}): Promise<void>;
|
|
41
47
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,YAAY,EAEZ,KAAK,MAAM,EACX,QAAQ,EACR,KAAK,MAAM,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAA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CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB,iBAkEA"}
|
package/dest/e2e_p2p/shared.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Fr, TxStatus, getContractInstanceFromInstantiationParams, retryUntil }
|
|
|
3
3
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
4
4
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
5
5
|
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
6
|
+
import { getRoundForOffense } from '@aztec/slasher';
|
|
6
7
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
7
8
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
8
9
|
export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opts = {})=>{
|
|
@@ -71,17 +72,31 @@ export async function createPXEServiceAndPrepareTransactions(logger, node, numTx
|
|
|
71
72
|
node
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
|
-
export
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
export function awaitProposalExecution(slashingProposer, timeoutSeconds, logger) {
|
|
76
|
+
return new Promise((resolve, reject)=>{
|
|
77
|
+
const timeout = setTimeout(()=>{
|
|
78
|
+
logger.warn(`Timed out waiting for proposal execution`);
|
|
79
|
+
reject(new Error(`Timeout waiting for proposal execution after ${timeoutSeconds}s`));
|
|
80
|
+
}, timeoutSeconds * 1000);
|
|
81
|
+
if (slashingProposer.type === 'empire') {
|
|
82
|
+
const unwatch = slashingProposer.listenToPayloadSubmitted((args)=>{
|
|
83
|
+
logger.warn(`Proposal ${args.payload} from round ${args.round} executed`);
|
|
84
|
+
clearTimeout(timeout);
|
|
85
|
+
unwatch();
|
|
86
|
+
resolve(args.round);
|
|
87
|
+
});
|
|
88
|
+
} else if (slashingProposer.type === 'tally') {
|
|
89
|
+
const unwatch = slashingProposer.listenToRoundExecuted((args)=>{
|
|
90
|
+
logger.warn(`Slash from round ${args.round} executed`);
|
|
91
|
+
clearTimeout(timeout);
|
|
92
|
+
unwatch();
|
|
93
|
+
resolve(args.round);
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
clearTimeout(timeout);
|
|
97
|
+
reject(new Error(`Unknown slashing proposer type: ${slashingProposer.type}`));
|
|
79
98
|
}
|
|
80
|
-
|
|
81
|
-
const roundNumber = event.args.round;
|
|
82
|
-
const payload = event.args.payload;
|
|
83
|
-
return roundNumber && payload;
|
|
84
|
-
}, 'payload submitted', timeoutSeconds, 1);
|
|
99
|
+
});
|
|
85
100
|
}
|
|
86
101
|
export async function awaitCommitteeExists({ rollup, logger }) {
|
|
87
102
|
logger.info(`Waiting for committee to be set`);
|
|
@@ -92,49 +107,72 @@ export async function awaitCommitteeExists({ rollup, logger }) {
|
|
|
92
107
|
}, 'non-empty committee', 60);
|
|
93
108
|
return committee;
|
|
94
109
|
}
|
|
110
|
+
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration }) {
|
|
111
|
+
logger.info(`Waiting for an offense to be detected`);
|
|
112
|
+
const offenses = await retryUntil(async ()=>{
|
|
113
|
+
const offenses = await nodeAdmin.getSlashOffenses('all');
|
|
114
|
+
if (offenses.length > 0) {
|
|
115
|
+
return offenses;
|
|
116
|
+
}
|
|
117
|
+
}, 'non-empty offenses', 60);
|
|
118
|
+
logger.info(`Hit ${offenses.length} offenses on rounds ${unique(offenses.map((o)=>getRoundForOffense(o, {
|
|
119
|
+
slashingRoundSize,
|
|
120
|
+
epochDuration
|
|
121
|
+
})))}`, offenses);
|
|
122
|
+
return offenses;
|
|
123
|
+
}
|
|
95
124
|
/**
|
|
96
125
|
* Await the committee to be slashed out of the validator set.
|
|
97
126
|
* Currently assumes that the committee is the same size as the validator set.
|
|
98
|
-
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger,
|
|
99
|
-
|
|
127
|
+
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger, dateProvider }) {
|
|
128
|
+
if (!slashingProposer) {
|
|
129
|
+
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
130
|
+
}
|
|
131
|
+
logger.info(`Advancing epochs so we start slashing`);
|
|
100
132
|
await cheatCodes.debugRollup();
|
|
101
|
-
await cheatCodes.advanceToNextEpoch(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
await cheatCodes.advanceToNextEpoch({
|
|
134
|
+
updateDateProvider: dateProvider
|
|
135
|
+
});
|
|
136
|
+
await cheatCodes.advanceToNextEpoch({
|
|
137
|
+
updateDateProvider: dateProvider
|
|
138
|
+
});
|
|
139
|
+
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
140
|
+
if (slashingProposer.type === 'empire') {
|
|
141
|
+
const slashPayloadEvents = await retryUntil(async ()=>{
|
|
142
|
+
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
143
|
+
return events.length > 0 ? events : undefined;
|
|
144
|
+
}, 'slash payload created', 120, 1);
|
|
145
|
+
expect(slashPayloadEvents.length).toBe(1);
|
|
146
|
+
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
147
|
+
expect(unique(slashPayloadEvents[0].slashes.map((slash)=>slash.validator.toString()))).toHaveLength(committee.length);
|
|
148
|
+
}
|
|
111
149
|
const attestersPre = await rollup.getAttesters();
|
|
112
150
|
expect(attestersPre.length).toBe(committee.length);
|
|
113
151
|
for (const attester of attestersPre){
|
|
114
152
|
const attesterInfo = await rollup.getAttesterView(attester);
|
|
115
|
-
//
|
|
116
|
-
expect(attesterInfo.status).toEqual(1);
|
|
153
|
+
expect(attesterInfo.status).toEqual(1); // Validating
|
|
117
154
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// but they should be reduced to the "living" status
|
|
155
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
156
|
+
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
157
|
+
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
158
|
+
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
122
159
|
await cheatCodes.debugRollup();
|
|
123
160
|
const committeePostSlashing = await rollup.getCurrentEpochCommittee();
|
|
124
161
|
expect(committeePostSlashing?.length).toBe(attestersPre.length);
|
|
125
162
|
const attestersPostSlashing = await rollup.getAttesters();
|
|
126
163
|
expect(attestersPostSlashing.length).toBe(0);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// }
|
|
164
|
+
for (const attester of attestersPre){
|
|
165
|
+
const attesterInfo = await rollup.getAttesterView(attester);
|
|
166
|
+
expect(attesterInfo.status).toEqual(2); // Living
|
|
167
|
+
}
|
|
168
|
+
logger.info(`Advancing two epochs to check current committee`);
|
|
133
169
|
await cheatCodes.debugRollup();
|
|
134
|
-
await cheatCodes.advanceToNextEpoch(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
await
|
|
170
|
+
await cheatCodes.advanceToNextEpoch({
|
|
171
|
+
updateDateProvider: dateProvider
|
|
172
|
+
});
|
|
173
|
+
await cheatCodes.advanceToNextEpoch({
|
|
174
|
+
updateDateProvider: dateProvider
|
|
175
|
+
});
|
|
138
176
|
await cheatCodes.debugRollup();
|
|
139
177
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
140
178
|
// The committee should be undefined, since the validator set is empty
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.20250828",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,41 +25,41 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "2.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "2.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "2.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "2.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "2.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "2.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "2.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "2.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "2.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "2.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "2.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "2.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "2.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "2.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "2.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "2.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "2.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "2.0.0-nightly.
|
|
46
|
-
"@aztec/node-keystore": "2.0.0-nightly.
|
|
47
|
-
"@aztec/noir-contracts.js": "2.0.0-nightly.
|
|
48
|
-
"@aztec/noir-noirc_abi": "2.0.0-nightly.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.
|
|
50
|
-
"@aztec/noir-test-contracts.js": "2.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "2.0.0-nightly.
|
|
52
|
-
"@aztec/protocol-contracts": "2.0.0-nightly.
|
|
53
|
-
"@aztec/prover-client": "2.0.0-nightly.
|
|
54
|
-
"@aztec/prover-node": "2.0.0-nightly.
|
|
55
|
-
"@aztec/pxe": "2.0.0-nightly.
|
|
56
|
-
"@aztec/sequencer-client": "2.0.0-nightly.
|
|
57
|
-
"@aztec/simulator": "2.0.0-nightly.
|
|
58
|
-
"@aztec/slasher": "2.0.0-nightly.
|
|
59
|
-
"@aztec/stdlib": "2.0.0-nightly.
|
|
60
|
-
"@aztec/telemetry-client": "2.0.0-nightly.
|
|
61
|
-
"@aztec/validator-client": "2.0.0-nightly.
|
|
62
|
-
"@aztec/world-state": "2.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "2.0.0-nightly.20250828",
|
|
29
|
+
"@aztec/archiver": "2.0.0-nightly.20250828",
|
|
30
|
+
"@aztec/aztec": "2.0.0-nightly.20250828",
|
|
31
|
+
"@aztec/aztec-node": "2.0.0-nightly.20250828",
|
|
32
|
+
"@aztec/aztec.js": "2.0.0-nightly.20250828",
|
|
33
|
+
"@aztec/bb-prover": "2.0.0-nightly.20250828",
|
|
34
|
+
"@aztec/blob-lib": "2.0.0-nightly.20250828",
|
|
35
|
+
"@aztec/blob-sink": "2.0.0-nightly.20250828",
|
|
36
|
+
"@aztec/bot": "2.0.0-nightly.20250828",
|
|
37
|
+
"@aztec/cli": "2.0.0-nightly.20250828",
|
|
38
|
+
"@aztec/constants": "2.0.0-nightly.20250828",
|
|
39
|
+
"@aztec/entrypoints": "2.0.0-nightly.20250828",
|
|
40
|
+
"@aztec/epoch-cache": "2.0.0-nightly.20250828",
|
|
41
|
+
"@aztec/ethereum": "2.0.0-nightly.20250828",
|
|
42
|
+
"@aztec/foundation": "2.0.0-nightly.20250828",
|
|
43
|
+
"@aztec/kv-store": "2.0.0-nightly.20250828",
|
|
44
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250828",
|
|
45
|
+
"@aztec/merkle-tree": "2.0.0-nightly.20250828",
|
|
46
|
+
"@aztec/node-keystore": "2.0.0-nightly.20250828",
|
|
47
|
+
"@aztec/noir-contracts.js": "2.0.0-nightly.20250828",
|
|
48
|
+
"@aztec/noir-noirc_abi": "2.0.0-nightly.20250828",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250828",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "2.0.0-nightly.20250828",
|
|
51
|
+
"@aztec/p2p": "2.0.0-nightly.20250828",
|
|
52
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250828",
|
|
53
|
+
"@aztec/prover-client": "2.0.0-nightly.20250828",
|
|
54
|
+
"@aztec/prover-node": "2.0.0-nightly.20250828",
|
|
55
|
+
"@aztec/pxe": "2.0.0-nightly.20250828",
|
|
56
|
+
"@aztec/sequencer-client": "2.0.0-nightly.20250828",
|
|
57
|
+
"@aztec/simulator": "2.0.0-nightly.20250828",
|
|
58
|
+
"@aztec/slasher": "2.0.0-nightly.20250828",
|
|
59
|
+
"@aztec/stdlib": "2.0.0-nightly.20250828",
|
|
60
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250828",
|
|
61
|
+
"@aztec/validator-client": "2.0.0-nightly.20250828",
|
|
62
|
+
"@aztec/world-state": "2.0.0-nightly.20250828",
|
|
63
63
|
"@iarna/toml": "^2.2.5",
|
|
64
64
|
"@jest/globals": "^30.0.0",
|
|
65
65
|
"@noble/curves": "=1.0.0",
|
|
@@ -108,7 +108,8 @@ export class FeesTest {
|
|
|
108
108
|
if (!numberOfAccounts) {
|
|
109
109
|
throw new Error('There must be at least 1 initial account.');
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
setupOptions.coinbase ??= EthAddress.random();
|
|
112
|
+
this.coinbase = setupOptions.coinbase!;
|
|
112
113
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
113
114
|
this.snapshotManager = createSnapshotManager(
|
|
114
115
|
`e2e_fees/${testName}-${numberOfAccounts}`,
|
|
@@ -3,11 +3,13 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import { type AccountWalletWithSecretKey, AztecAddress, EthAddress, Fr } from '@aztec/aztec.js';
|
|
5
5
|
import {
|
|
6
|
+
type EmpireSlashingProposerContract,
|
|
6
7
|
type ExtendedViemWalletClient,
|
|
7
8
|
GSEContract,
|
|
8
9
|
MultiAdderArtifact,
|
|
9
10
|
type Operator,
|
|
10
11
|
RollupContract,
|
|
12
|
+
type TallySlashingProposerContract,
|
|
11
13
|
type ViemClient,
|
|
12
14
|
createL1TxUtilsFromViemWallet,
|
|
13
15
|
deployL1Contract,
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
17
19
|
import { SecretValue } from '@aztec/foundation/config';
|
|
18
20
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
19
|
-
import {
|
|
21
|
+
import { RollupAbi, SlasherAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
20
22
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
21
23
|
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
|
|
22
24
|
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
@@ -71,6 +73,7 @@ export class P2PNetworkTest {
|
|
|
71
73
|
|
|
72
74
|
public deployedAccounts: InitialAccountData[] = [];
|
|
73
75
|
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
76
|
+
|
|
74
77
|
// The re-execution test needs a wallet and a spam contract
|
|
75
78
|
public wallet?: AccountWalletWithSecretKey;
|
|
76
79
|
public defaultAccountAddress?: AztecAddress;
|
|
@@ -392,7 +395,7 @@ export class P2PNetworkTest {
|
|
|
392
395
|
async getContracts(): Promise<{
|
|
393
396
|
rollup: RollupContract;
|
|
394
397
|
slasherContract: GetContractReturnType<typeof SlasherAbi, ViemClient>;
|
|
395
|
-
slashingProposer:
|
|
398
|
+
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
396
399
|
slashFactory: SlashFactoryContract;
|
|
397
400
|
}> {
|
|
398
401
|
if (!this.ctx.deployL1ContractsValues) {
|
|
@@ -410,11 +413,8 @@ export class P2PNetworkTest {
|
|
|
410
413
|
client: this.ctx.deployL1ContractsValues.l1Client,
|
|
411
414
|
});
|
|
412
415
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
abi: EmpireSlashingProposerAbi,
|
|
416
|
-
client: this.ctx.deployL1ContractsValues.l1Client,
|
|
417
|
-
});
|
|
416
|
+
// Get the actual slashing proposer from rollup (which handles both empire and tally)
|
|
417
|
+
const slashingProposer = await rollup.getSlashingProposer();
|
|
418
418
|
|
|
419
419
|
const slashFactory = new SlashFactoryContract(
|
|
420
420
|
this.ctx.deployL1ContractsValues.l1Client,
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
retryUntil,
|
|
13
13
|
} from '@aztec/aztec.js';
|
|
14
14
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
15
|
-
import type { RollupContract,
|
|
15
|
+
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
16
16
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
17
|
-
import type {
|
|
17
|
+
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
18
18
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
19
19
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
20
20
|
import { PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
21
|
+
import { getRoundForOffense } from '@aztec/slasher';
|
|
22
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
21
23
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
22
24
|
|
|
23
|
-
import type { GetContractReturnType } from 'viem';
|
|
24
|
-
|
|
25
25
|
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
26
26
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
27
27
|
|
|
@@ -107,25 +107,36 @@ export async function createPXEServiceAndPrepareTransactions(
|
|
|
107
107
|
return { txs, pxeService: pxe, node };
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
export
|
|
111
|
-
slashingProposer:
|
|
110
|
+
export function awaitProposalExecution(
|
|
111
|
+
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract,
|
|
112
112
|
timeoutSeconds: number,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
logger: Logger,
|
|
114
|
+
): Promise<bigint> {
|
|
115
|
+
return new Promise<bigint>((resolve, reject) => {
|
|
116
|
+
const timeout = setTimeout(() => {
|
|
117
|
+
logger.warn(`Timed out waiting for proposal execution`);
|
|
118
|
+
reject(new Error(`Timeout waiting for proposal execution after ${timeoutSeconds}s`));
|
|
119
|
+
}, timeoutSeconds * 1000);
|
|
120
|
+
|
|
121
|
+
if (slashingProposer.type === 'empire') {
|
|
122
|
+
const unwatch = slashingProposer.listenToPayloadSubmitted(args => {
|
|
123
|
+
logger.warn(`Proposal ${args.payload} from round ${args.round} executed`);
|
|
124
|
+
clearTimeout(timeout);
|
|
125
|
+
unwatch();
|
|
126
|
+
resolve(args.round);
|
|
127
|
+
});
|
|
128
|
+
} else if (slashingProposer.type === 'tally') {
|
|
129
|
+
const unwatch = slashingProposer.listenToRoundExecuted(args => {
|
|
130
|
+
logger.warn(`Slash from round ${args.round} executed`);
|
|
131
|
+
clearTimeout(timeout);
|
|
132
|
+
unwatch();
|
|
133
|
+
resolve(args.round);
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
clearTimeout(timeout);
|
|
137
|
+
reject(new Error(`Unknown slashing proposer type: ${(slashingProposer as any).type}`));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
129
140
|
}
|
|
130
141
|
|
|
131
142
|
export async function awaitCommitteeExists({
|
|
@@ -148,6 +159,35 @@ export async function awaitCommitteeExists({
|
|
|
148
159
|
return committee!;
|
|
149
160
|
}
|
|
150
161
|
|
|
162
|
+
export async function awaitOffenseDetected({
|
|
163
|
+
logger,
|
|
164
|
+
nodeAdmin,
|
|
165
|
+
slashingRoundSize,
|
|
166
|
+
epochDuration,
|
|
167
|
+
}: {
|
|
168
|
+
nodeAdmin: AztecNodeAdmin;
|
|
169
|
+
logger: Logger;
|
|
170
|
+
slashingRoundSize: number;
|
|
171
|
+
epochDuration: number;
|
|
172
|
+
}) {
|
|
173
|
+
logger.info(`Waiting for an offense to be detected`);
|
|
174
|
+
const offenses = await retryUntil(
|
|
175
|
+
async () => {
|
|
176
|
+
const offenses = await nodeAdmin.getSlashOffenses('all');
|
|
177
|
+
if (offenses.length > 0) {
|
|
178
|
+
return offenses;
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
'non-empty offenses',
|
|
182
|
+
60,
|
|
183
|
+
);
|
|
184
|
+
logger.info(
|
|
185
|
+
`Hit ${offenses.length} offenses on rounds ${unique(offenses.map(o => getRoundForOffense(o, { slashingRoundSize, epochDuration })))}`,
|
|
186
|
+
offenses,
|
|
187
|
+
);
|
|
188
|
+
return offenses;
|
|
189
|
+
}
|
|
190
|
+
|
|
151
191
|
/**
|
|
152
192
|
* Await the committee to be slashed out of the validator set.
|
|
153
193
|
* Currently assumes that the committee is the same size as the validator set.
|
|
@@ -161,52 +201,58 @@ export async function awaitCommitteeKicked({
|
|
|
161
201
|
slashingRoundSize,
|
|
162
202
|
aztecSlotDuration,
|
|
163
203
|
logger,
|
|
164
|
-
|
|
204
|
+
dateProvider,
|
|
165
205
|
}: {
|
|
166
206
|
rollup: RollupContract;
|
|
167
207
|
cheatCodes: RollupCheatCodes;
|
|
168
208
|
committee: readonly `0x${string}`[];
|
|
169
209
|
slashFactory: SlashFactoryContract;
|
|
170
|
-
slashingProposer:
|
|
210
|
+
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
171
211
|
slashingRoundSize: number;
|
|
172
212
|
aztecSlotDuration: number;
|
|
213
|
+
dateProvider: TestDateProvider;
|
|
173
214
|
logger: Logger;
|
|
174
|
-
sendDummyTx: () => Promise<void>;
|
|
175
215
|
}) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
await cheatCodes.advanceToNextEpoch();
|
|
216
|
+
if (!slashingProposer) {
|
|
217
|
+
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
218
|
+
}
|
|
180
219
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return events.length > 0 ? events : undefined;
|
|
186
|
-
},
|
|
187
|
-
'slash payload created',
|
|
188
|
-
120,
|
|
189
|
-
1,
|
|
190
|
-
);
|
|
191
|
-
expect(slashPayloadEvents.length).toBe(1);
|
|
220
|
+
logger.info(`Advancing epochs so we start slashing`);
|
|
221
|
+
await cheatCodes.debugRollup();
|
|
222
|
+
await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
|
|
223
|
+
await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
|
|
192
224
|
|
|
193
|
-
//
|
|
194
|
-
|
|
225
|
+
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
226
|
+
if (slashingProposer.type === 'empire') {
|
|
227
|
+
const slashPayloadEvents = await retryUntil(
|
|
228
|
+
async () => {
|
|
229
|
+
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
230
|
+
return events.length > 0 ? events : undefined;
|
|
231
|
+
},
|
|
232
|
+
'slash payload created',
|
|
233
|
+
120,
|
|
234
|
+
1,
|
|
235
|
+
);
|
|
236
|
+
expect(slashPayloadEvents.length).toBe(1);
|
|
237
|
+
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
238
|
+
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
239
|
+
committee.length,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
195
242
|
|
|
196
243
|
const attestersPre = await rollup.getAttesters();
|
|
197
244
|
expect(attestersPre.length).toBe(committee.length);
|
|
198
245
|
|
|
199
246
|
for (const attester of attestersPre) {
|
|
200
247
|
const attesterInfo = await rollup.getAttesterView(attester);
|
|
201
|
-
//
|
|
202
|
-
expect(attesterInfo.status).toEqual(1);
|
|
248
|
+
expect(attesterInfo.status).toEqual(1); // Validating
|
|
203
249
|
}
|
|
204
250
|
|
|
205
|
-
|
|
206
|
-
|
|
251
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
252
|
+
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
253
|
+
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
207
254
|
|
|
208
|
-
// The attesters should still form the committee
|
|
209
|
-
// but they should be reduced to the "living" status
|
|
255
|
+
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
210
256
|
await cheatCodes.debugRollup();
|
|
211
257
|
const committeePostSlashing = await rollup.getCurrentEpochCommittee();
|
|
212
258
|
expect(committeePostSlashing?.length).toBe(attestersPre.length);
|
|
@@ -214,18 +260,15 @@ export async function awaitCommitteeKicked({
|
|
|
214
260
|
const attestersPostSlashing = await rollup.getAttesters();
|
|
215
261
|
expect(attestersPostSlashing.length).toBe(0);
|
|
216
262
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// expect(attesterInfo.status).toEqual(2);
|
|
222
|
-
// }
|
|
263
|
+
for (const attester of attestersPre) {
|
|
264
|
+
const attesterInfo = await rollup.getAttesterView(attester);
|
|
265
|
+
expect(attesterInfo.status).toEqual(2); // Living
|
|
266
|
+
}
|
|
223
267
|
|
|
268
|
+
logger.info(`Advancing two epochs to check current committee`);
|
|
224
269
|
await cheatCodes.debugRollup();
|
|
225
|
-
await cheatCodes.advanceToNextEpoch();
|
|
226
|
-
await
|
|
227
|
-
await cheatCodes.advanceToNextEpoch();
|
|
228
|
-
await sendDummyTx();
|
|
270
|
+
await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
|
|
271
|
+
await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
|
|
229
272
|
await cheatCodes.debugRollup();
|
|
230
273
|
|
|
231
274
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|