Skip to content

Commit 77a0e30

Browse files
committed
chore: reconsider life choices
1 parent 32e7d86 commit 77a0e30

File tree

7 files changed

+33
-24
lines changed

7 files changed

+33
-24
lines changed

l1-contracts/src/mock/TestERC20.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ contract TestERC20 is ERC20, IMintableERC20, Ownable2Step {
3434
}
3535

3636
function acceptOwnership() public virtual override(Ownable2Step) {
37-
address oldOwner = owner();
3837
address newOwner = pendingOwner();
3938
super.acceptOwnership();
40-
41-
removeMinter(oldOwner);
4239
addMinter(newOwner);
4340
}
4441
}

l1-contracts/test/test_erc20/transferOwnership.t.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ contract TransferOwnershipTest is TestERC20TestBase {
6464

6565
assertEq(testERC20.owner(), _newOwner);
6666
assertEq(testERC20.minters(_newOwner), true);
67-
if (_newOwner != oldOwner) {
68-
assertEq(testERC20.minters(oldOwner), false);
69-
}
67+
assertEq(testERC20.minters(oldOwner), true);
7068
}
7169
}

yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class EpochsTestContext {
9292
: DEFAULT_L1_BLOCK_TIME;
9393
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
9494
const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
95-
const aztecEpochDuration = opts.aztecEpochDuration ?? 4;
95+
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
9696
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
9797
return { ethereumSlotDuration, aztecSlotDuration, aztecEpochDuration, aztecProofSubmissionEpochs };
9898
}

yarn-project/end-to-end/src/e2e_epochs/epochs_upload_failed_proof.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('e2e_epochs/epochs_upload_failed_proof', () => {
7373
// Wait until the start of epoch one so prover node starts proving epoch 0,
7474
// and wait for the data to be uploaded to the remote file store
7575
await test.waitUntilEpochStarts(1);
76-
await retryUntil(() => epochUploadUrl !== undefined, 'Upload epoch failure', 120, 1);
76+
await retryUntil(() => epochUploadUrl !== undefined, 'Upload epoch failure', 240, 1);
7777

7878
// Stop everything, we're going to prove on a fresh instance
7979
await test.teardown();

yarn-project/end-to-end/src/e2e_p2p/slash_veto_demo.test.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,26 @@ describe('veto slash', () => {
264264

265265
const newSlasherAddress = await deployNewSlasher(vetoerL1Client, slasherType);
266266
debugLogger.info(`\n\nnewSlasherAddress: ${newSlasherAddress}\n\n`);
267-
const { receipt } = await createL1TxUtilsFromViemWallet(
268-
t.ctx.deployL1ContractsValues.l1Client,
269-
t.logger,
270-
t.ctx.dateProvider,
271-
).sendAndMonitorTransaction({
272-
to: rollup.address,
273-
data: encodeFunctionData({
274-
abi: RollupAbi,
275-
functionName: 'setSlasher',
276-
args: [newSlasherAddress.toString()],
277-
}),
267+
268+
// Need to impersonate governance to set the new slasher
269+
await t.ctx.cheatCodes.eth.startImpersonating(
270+
t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress,
271+
);
272+
273+
const setSlasherTx = await t.ctx.deployL1ContractsValues.l1Client.writeContract({
274+
address: rollup.address,
275+
abi: RollupAbi,
276+
functionName: 'setSlasher',
277+
args: [newSlasherAddress.toString()],
278+
account: t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress.toString(),
279+
});
280+
const receipt = await t.ctx.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
281+
hash: setSlasherTx,
278282
});
279283
expect(receipt.status).toEqual('success');
284+
285+
await t.ctx.cheatCodes.eth.stopImpersonating(t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress);
286+
280287
const slasherAddress = await rollup.getSlasher();
281288
expect(slasherAddress.toLowerCase()).toEqual(newSlasherAddress.toString().toLowerCase());
282289
debugLogger.info(`\n\nnew slasher address: ${slasherAddress}\n\n`);

yarn-project/ethereum/src/test/eth_cheat_codes.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { toBigIntBE, toHex } from '@aztec/foundation/bigint-buffer';
22
import { keccak256 } from '@aztec/foundation/crypto';
3-
import type { EthAddress } from '@aztec/foundation/eth-address';
3+
import { EthAddress } from '@aztec/foundation/eth-address';
44
import { jsonStringify } from '@aztec/foundation/json-rpc';
55
import { createLogger } from '@aztec/foundation/log';
66
import type { TestDateProvider } from '@aztec/foundation/timer';
@@ -112,7 +112,7 @@ export class EthCheatCodes {
112112
* @param account - The account to set the balance for
113113
* @param balance - The balance to set
114114
*/
115-
public async setBalance(account: EthAddress, balance: bigint): Promise<void> {
115+
public async setBalance(account: EthAddress | Hex, balance: bigint): Promise<void> {
116116
try {
117117
await this.rpcCall('anvil_setBalance', [account.toString(), toHex(balance)]);
118118
} catch (err) {
@@ -121,6 +121,11 @@ export class EthCheatCodes {
121121
this.logger.warn(`Set balance for ${account} to ${balance}`);
122122
}
123123

124+
public async getBalance(account: EthAddress | Hex): Promise<bigint> {
125+
const res = await this.rpcCall('eth_getBalance', [account.toString(), 'latest']);
126+
return BigInt(res);
127+
}
128+
124129
/**
125130
* Set the interval between successive blocks (block time). This does NOT enable interval mining.
126131
* @param interval - The interval to use between blocks
@@ -300,6 +305,11 @@ export class EthCheatCodes {
300305
*/
301306
public async startImpersonating(who: EthAddress | Hex): Promise<void> {
302307
try {
308+
// Since the `who` impersonated will sometimes be a contract without funds, we fund it if needed.
309+
if ((await this.getBalance(who)) === 0n) {
310+
await this.setBalance(who, 10n * 10n ** 18n);
311+
}
312+
303313
await this.rpcCall('hardhat_impersonateAccount', [who.toString()]);
304314
} catch (err) {
305315
throw new Error(`Error impersonating ${who}: ${err}`);

yarn-project/ethereum/src/test/rollup_cheat_codes.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ export class RollupCheatCodes {
258258
*/
259259
public async setProvingCostPerMana(ethValue: bigint) {
260260
await this.asOwner(async (account, rollup) => {
261-
// We are minting funds for the `account` since we seem to sometimes ends up with just a poor account :shrug:.
262-
await this.ethCheatCodes.setBalance(EthAddress.fromString(account), 10n * 10n ** 18n);
263-
264261
const hash = await rollup.write.setProvingCostPerMana([ethValue], {
265262
account,
266263
chain: this.client.chain,

0 commit comments

Comments
 (0)