@aztec/ethereum 2.1.0-rc.9 → 3.0.0-devnet.2
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/client.d.ts +1 -1
- package/dest/client.d.ts.map +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +13 -3
- package/dest/contracts/rollup.d.ts +2 -2
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +9 -6
- package/dest/contracts/tally_slashing_proposer.d.ts +7 -1
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +12 -2
- package/dest/deploy_l1_contracts.d.ts +4 -3
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +241 -205
- package/dest/l1_artifacts.d.ts +730 -192
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +5 -5
- package/dest/l1_reader.d.ts +1 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +1 -1
- package/dest/test/eth_cheat_codes.d.ts +15 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +17 -9
- package/dest/test/rollup_cheat_codes.d.ts +8 -8
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +36 -4
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +2 -1
- package/dest/zkPassportVerifierAddress.js +1 -1
- package/package.json +6 -6
- package/src/client.ts +1 -1
- package/src/config.ts +14 -4
- package/src/contracts/rollup.ts +9 -8
- package/src/contracts/tally_slashing_proposer.ts +12 -3
- package/src/deploy_l1_contracts.ts +221 -152
- package/src/l1_artifacts.ts +6 -6
- package/src/l1_reader.ts +2 -2
- package/src/test/eth_cheat_codes.ts +25 -12
- package/src/test/rollup_cheat_codes.ts +49 -12
- package/src/test/upgrade_utils.ts +2 -1
- package/src/zkPassportVerifierAddress.ts +1 -1
|
@@ -2,7 +2,7 @@ import { RollupContract, type ViemPublicClient } from '@aztec/ethereum';
|
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import type {
|
|
5
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
6
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -40,8 +40,12 @@ export class RollupCheatCodes {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
static create(
|
|
44
|
-
|
|
43
|
+
static create(
|
|
44
|
+
rpcUrls: string[],
|
|
45
|
+
addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
|
|
46
|
+
dateProvider: DateProvider,
|
|
47
|
+
): RollupCheatCodes {
|
|
48
|
+
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
45
49
|
return new RollupCheatCodes(ethCheatCodes, addresses);
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -114,8 +118,6 @@ export class RollupCheatCodes {
|
|
|
114
118
|
public async advanceToEpoch(
|
|
115
119
|
epoch: bigint | number,
|
|
116
120
|
opts: {
|
|
117
|
-
/** Optional test date provider to update with the epoch timestamp */
|
|
118
|
-
updateDateProvider?: TestDateProvider;
|
|
119
121
|
/** Offset in seconds */
|
|
120
122
|
offset?: number;
|
|
121
123
|
} = {},
|
|
@@ -133,19 +135,13 @@ export class RollupCheatCodes {
|
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
/** Warps time in L1 until the next epoch */
|
|
136
|
-
public async advanceToNextEpoch(
|
|
137
|
-
opts: {
|
|
138
|
-
/** Optional test date provider to update with the epoch timestamp */
|
|
139
|
-
updateDateProvider?: TestDateProvider;
|
|
140
|
-
} = {},
|
|
141
|
-
) {
|
|
138
|
+
public async advanceToNextEpoch() {
|
|
142
139
|
const slot = await this.getSlot();
|
|
143
140
|
const { epochDuration, slotDuration } = await this.getConfig();
|
|
144
141
|
const slotsUntilNextEpoch = epochDuration - (slot % epochDuration) + 1n;
|
|
145
142
|
const timeToNextEpoch = slotsUntilNextEpoch * slotDuration;
|
|
146
143
|
const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
|
|
147
144
|
await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
|
|
148
|
-
...opts,
|
|
149
145
|
silent: true,
|
|
150
146
|
resetBlockInterval: true,
|
|
151
147
|
});
|
|
@@ -211,6 +207,47 @@ export class RollupCheatCodes {
|
|
|
211
207
|
});
|
|
212
208
|
}
|
|
213
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Overrides the inProgress field of the Inbox contract state
|
|
212
|
+
* @param howMuch - How many blocks to move it forward
|
|
213
|
+
*/
|
|
214
|
+
public advanceInboxInProgress(howMuch: number | bigint): Promise<bigint> {
|
|
215
|
+
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
216
|
+
// Storage slot 2 contains the InboxState struct
|
|
217
|
+
const inboxStateSlot = 2n;
|
|
218
|
+
|
|
219
|
+
// Get inbox and its current state values
|
|
220
|
+
const inboxAddress = await this.rollup.read.getInbox();
|
|
221
|
+
const currentStateValue = await this.ethCheatCodes.load(EthAddress.fromString(inboxAddress), inboxStateSlot);
|
|
222
|
+
|
|
223
|
+
// Extract current values from the packed storage slot
|
|
224
|
+
// Storage layout: rollingHash (128 bits) | totalMessagesInserted (64 bits) | inProgress (64 bits)
|
|
225
|
+
const currentRollingHash = currentStateValue & ((1n << 128n) - 1n);
|
|
226
|
+
const currentTotalMessages = (currentStateValue >> 128n) & ((1n << 64n) - 1n);
|
|
227
|
+
const currentInProgress = currentStateValue >> 192n;
|
|
228
|
+
const newInProgress = currentInProgress + BigInt(howMuch);
|
|
229
|
+
|
|
230
|
+
// Pack new values: rollingHash (low 128 bits) | totalMessages (middle 64 bits) | inProgress (high 64 bits)
|
|
231
|
+
const newValue = (BigInt(newInProgress) << 192n) | (currentTotalMessages << 128n) | currentRollingHash;
|
|
232
|
+
|
|
233
|
+
await this.ethCheatCodes.store(EthAddress.fromString(inboxAddress), inboxStateSlot, newValue, {
|
|
234
|
+
silent: true,
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
this.logger.warn(`Inbox inProgress advanced from ${currentInProgress} to ${newInProgress}`, {
|
|
238
|
+
inbox: inboxAddress,
|
|
239
|
+
oldValue: '0x' + currentStateValue.toString(16),
|
|
240
|
+
newValue: '0x' + newValue.toString(16),
|
|
241
|
+
rollingHash: currentRollingHash,
|
|
242
|
+
totalMessages: currentTotalMessages,
|
|
243
|
+
oldInProgress: currentInProgress,
|
|
244
|
+
newInProgress,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
return newInProgress;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
214
251
|
/**
|
|
215
252
|
* Executes an action impersonated as the owner of the Rollup contract.
|
|
216
253
|
* @param action - The action to execute
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
2
3
|
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
3
4
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
4
5
|
|
|
@@ -30,7 +31,7 @@ export async function executeGovernanceProposal(
|
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, logger);
|
|
34
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), logger);
|
|
34
35
|
|
|
35
36
|
const timeToActive = proposal.creation + proposal.config.votingDelay;
|
|
36
37
|
logger.info(`Warping to ${timeToActive + 1n}`);
|
|
@@ -4,7 +4,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
4
4
|
* The address of the zk passport verifier on sepolia
|
|
5
5
|
* get address from: ROOT/l1-contracts/lib/circuits/src/solidity/deployments/deployment-11155111.json
|
|
6
6
|
*/
|
|
7
|
-
export const ZK_PASSPORT_VERIFIER_ADDRESS = EthAddress.fromString('
|
|
7
|
+
export const ZK_PASSPORT_VERIFIER_ADDRESS = EthAddress.fromString('0x3101Bad9eA5fACadA5554844a1a88F7Fe48D4DE0');
|
|
8
8
|
/**
|
|
9
9
|
* The default domain of the zk passport site
|
|
10
10
|
*/
|