Skip to content

Commit 1dca51e

Browse files
committed
chore: reconsider life choices
1 parent 49e3608 commit 1dca51e

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
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_p2p/slash_veto_demo.test.ts

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

270270
const newSlasherAddress = await deployNewSlasher(vetoerL1Client, slasherType);
271271
debugLogger.info(`\n\nnewSlasherAddress: ${newSlasherAddress}\n\n`);
272-
const { receipt } = await createL1TxUtilsFromViemWallet(
273-
t.ctx.deployL1ContractsValues.l1Client,
274-
t.logger,
275-
t.ctx.dateProvider,
276-
).sendAndMonitorTransaction({
277-
to: rollup.address,
278-
data: encodeFunctionData({
279-
abi: RollupAbi,
280-
functionName: 'setSlasher',
281-
args: [newSlasherAddress.toString()],
282-
}),
272+
273+
// Need to impersonate governance to set the new slasher
274+
await t.ctx.cheatCodes.eth.startImpersonating(
275+
t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress,
276+
);
277+
278+
const setSlasherTx = await t.ctx.deployL1ContractsValues.l1Client.writeContract({
279+
address: rollup.address,
280+
abi: RollupAbi,
281+
functionName: 'setSlasher',
282+
args: [newSlasherAddress.toString()],
283+
account: t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress.toString(),
284+
});
285+
const receipt = await t.ctx.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
286+
hash: setSlasherTx,
283287
});
284288
expect(receipt.status).toEqual('success');
289+
290+
await t.ctx.cheatCodes.eth.stopImpersonating(t.ctx.deployL1ContractsValues.l1ContractAddresses.governanceAddress);
291+
285292
const slasherAddress = await rollup.getSlasher();
286293
expect(slasherAddress.toLowerCase()).toEqual(newSlasherAddress.toString().toLowerCase());
287294
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)