Skip to content

Commit 95d852d

Browse files
committed
fix lint
1 parent b7dfd0f commit 95d852d

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

upgrade/fullUpgradeV12/fullUpgradeV12.test.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
172172
logger.info('\n========== INDIVIDUAL EXECUTION TEST ==========');
173173
logger.info('Executing all batch operations individually from timelock contract...');
174174

175-
const targets = upgradeOutput.decodedScheduleData.targets;
176-
const values = upgradeOutput.decodedScheduleData.values;
175+
const { targets } = upgradeOutput.decodedScheduleData;
176+
const { values } = upgradeOutput.decodedScheduleData;
177177
const datas = upgradeOutput.decodedScheduleData.payloads;
178178

179179
// Impersonate the timelock contract to simulate calls from its perspective
@@ -200,13 +200,13 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
200200
// Actually send the transaction from timelock's perspective
201201
const tx = await timelockSigner.sendTransaction({
202202
to: target,
203-
value: value,
204-
data: data,
203+
value,
204+
data,
205205
gasLimit: 3000000,
206206
});
207207
const receipt = await tx.wait();
208208

209-
logger.info(` ✅ Execution SUCCESS (gas used: ${receipt.gasUsed}, block: ${receipt.blockNumber})`);
209+
logger.info(` ✅ Execution SUCCESS (gas used: ${receipt?.gasUsed}, block: ${receipt?.blockNumber})`);
210210
} catch (error: any) {
211211
allSimulationsSuccess = false;
212212
failedOperations.push({
@@ -222,7 +222,7 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
222222
try {
223223
const decodedError = ethers.AbiCoder.defaultAbiCoder().decode(
224224
['string'],
225-
'0x' + error.data.slice(10),
225+
`0x${error.data.slice(10)}`,
226226
);
227227
logger.error(` Revert reason: ${decodedError[0]}`);
228228
} catch (e) {
@@ -240,6 +240,7 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
240240
logger.info(`✅ All ${targets.length} operations executed successfully individually!`);
241241
} else {
242242
logger.error(`❌ ${failedOperations.length} operation(s) failed execution:`);
243+
// eslint-disable-next-line no-restricted-syntax
243244
for (const failed of failedOperations) {
244245
logger.error(` - Operation ${failed.index + 1} to ${failed.target}: ${failed.error}`);
245246
}
@@ -279,7 +280,7 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
279280
gasLimit: 6000000,
280281
};
281282
const executeTx = await (await proposerRoleSigner.sendTransaction(txExecuteUpgrade)).wait();
282-
logger.info(`✅ Batch execution SUCCESS (gas used: ${executeTx.gasUsed})`);
283+
logger.info(`✅ Batch execution SUCCESS (gas used: ${executeTx?.gasUsed})`);
283284
logger.info('============================================\n');
284285

285286
// Validate all contracts after upgrade
@@ -414,7 +415,6 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
414415

415416
// Check if this was originally a PP rollup (will have ECDSA type now)
416417
// or AL gateway rollup (will have FEP type now)
417-
const rollupType = await rollupManagerContract.rollupTypeMap(rollupData.rollupTypeID);
418418
if (rollupData.rollupTypeID === ecdsaRollupTypeID) {
419419
PPRollups.push(rollupObject);
420420
} else if (rollupData.rollupTypeID === fepRollupTypeID) {
@@ -428,6 +428,7 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
428428

429429
// 7. Verify FEP rollups were upgraded correctly
430430
const aggchainFEPFactory = await ethers.getContractFactory('AggchainFEP');
431+
// eslint-disable-next-line no-restricted-syntax
431432
for (const rollup of ALgatewayRollups) {
432433
const aggchainFEPContract = aggchainFEPFactory.attach(rollup.rollupContract as string) as AggchainFEP;
433434

@@ -475,6 +476,7 @@ describe('Should shadow fork network, execute upgrade and validate Upgrade V12',
475476

476477
// 8. Verify ECDSA rollups were upgraded correctly
477478
const aggchainECDSAFactory = await ethers.getContractFactory('AggchainECDSAMultisig');
479+
// eslint-disable-next-line no-restricted-syntax
478480
for (const rollup of PPRollups) {
479481
const aggchainECDSAContract = aggchainECDSAFactory.attach(
480482
rollup.rollupContract as string,

upgrade/fullUpgradeV12/fullUpgradeV12.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import * as dotenv from 'dotenv';
77
import { ethers, upgrades } from 'hardhat';
88
import { logger } from '../../src/logger';
99
import { AgglayerManager, AgglayerBridge } from '../../typechain-types';
10-
import { genTimelockOperation, decodeScheduleData, decodeScheduleBatchData, genTimelockBatchOperation } from '../utils';
10+
import { genTimelockOperation, decodeScheduleBatchData, genTimelockBatchOperation } from '../utils';
1111
import { checkParams, getProviderAdjustingMultiplierGas, getDeployerFromParameters } from '../../src/utils';
12-
import { addInfoOutput } from '../../tools/utils';
1312
import * as upgradeParameters from './upgrade_parameters.json';
1413

1514
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
@@ -64,6 +63,7 @@ async function main() {
6463
expect(await upgrades.erc1967.getAdminAddress(globalExitRootV2Address as string)).to.be.equal(proxyAdmin.target);
6564

6665
// Validate AgglayerGateway initialization parameters
66+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
6767
const signersToAdd = _validateAgglayerGatewayInitialization(initializeAgglayerGateway);
6868
const timelockAddress = await proxyAdmin.owner();
6969

@@ -72,7 +72,7 @@ async function main() {
7272
const timelockContract = await timelockContractFactory.attach(timelockAddress);
7373

7474
// Determine timelock delay: use parameter if provided, otherwise use contract's min delay
75-
const contractMinDelay = await timelockContract.getMinDelay();
75+
const contractMinDelay = await (timelockContract as any).getMinDelay();
7676
const paramsMinDelay = upgradeParameters.timelockDelay;
7777

7878
let timelockDelay;
@@ -244,8 +244,10 @@ async function main() {
244244

245245
const aggchianFEPFactory = (await ethers.getContractFactory('AggchainFEP', deployer)) as any;
246246

247+
// eslint-disable-next-line no-restricted-syntax
247248
for (const rollup of ALgatewayRollups) {
248249
const aggchainFEPContract = await aggchianFEPFactory.attach(rollup.rollupContract as string);
250+
// eslint-disable-next-line eqeqeq
249251
if ((await aggchainFEPContract.AGGCHAIN_TYPE()) != 1n) {
250252
throw new Error(`Rollup ${rollup.rollupID} is not an FEP rollup`);
251253
}
@@ -324,7 +326,9 @@ async function main() {
324326
const computedNewRollupTypeECDSA = rollupTypeCount + 2n;
325327

326328
// generate transaction to upgrade all FEP rollups to the new FEP implementation
329+
// eslint-disable-next-line no-restricted-syntax
327330
for (const rollup of ALgatewayRollups) {
331+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
328332
const isInitialized = await _isInitialized(rollup.rollupContract, ethers);
329333
const encodedData = isInitialized
330334
? aggchianFEPFactory.interface.encodeFunctionData('upgradeFromPreviousFEP')
@@ -349,7 +353,9 @@ async function main() {
349353
}
350354

351355
// generate transaction to upgrade all PP rollups to the new ECDSAMultisig implementation
356+
// eslint-disable-next-line no-restricted-syntax
352357
for (const rollup of PPRollups) {
358+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
353359
const isInitialized = await _isInitialized(rollup.rollupContract, ethers);
354360
const encodedData = isInitialized
355361
? aggchainECDSAFactory.interface.encodeFunctionData('migrateFromLegacyConsensus')
@@ -377,6 +383,7 @@ async function main() {
377383
const targets = [];
378384
const values = [];
379385
const datas = [];
386+
// eslint-disable-next-line no-restricted-syntax
380387
for (const operation of timelockOperations) {
381388
targets.push(operation.target);
382389
values.push(operation.value);
@@ -433,7 +440,7 @@ async function main() {
433440
];
434441
const objectDecoded = await decodeScheduleBatchData(scheduleData, contractFactories);
435442
(outputJson as any).decodedScheduleData = objectDecoded;
436-
} catch (error) {
443+
} catch (error: any) {
437444
logger.warn('⚠️ Could not decode schedule data:', error.message);
438445
(outputJson as any).decodedScheduleData = { error: 'Failed to decode', message: error.message };
439446
}
@@ -459,6 +466,7 @@ main().catch((e) => {
459466
process.exit(1);
460467
});
461468

469+
// eslint-disable-next-line @typescript-eslint/naming-convention
462470
function _validateAgglayerGatewayInitialization(initializeAgglayerGateway: any): Array<{ addr: string; url: string }> {
463471
logger.info('Validating AgglayerGateway initialization parameters...');
464472

@@ -526,9 +534,10 @@ function _validateAgglayerGatewayInitialization(initializeAgglayerGateway: any):
526534
return signersToAdd;
527535
}
528536

529-
async function _isInitialized(contractAddress: string, ethers: any): Promise<boolean> {
537+
// eslint-disable-next-line @typescript-eslint/naming-convention
538+
async function _isInitialized(contractAddress: string, ethersLib: any): Promise<boolean> {
530539
// Read storage slot 0 which contains uint8 private _initialized (OpenZeppelin Initializable pattern)
531-
const storageValue = await ethers.provider.getStorage(contractAddress, 0);
540+
const storageValue = await ethersLib.provider.getStorage(contractAddress, 0);
532541

533542
// The _initialized flag is a uint8 (1 byte) stored at the rightmost position in slot 0
534543
// Mask with 0xFF to extract only the last byte

upgrade/fullUpgradeV12/verifyUpgradeV12.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async function main() {
9797
// 8. Verify AggchainFEP Implementation (if exists)
9898
if (deployedContracts.aggchainFEPImplementation) {
9999
logger.info('Verifying AggchainFEP Implementation...');
100-
verificationResults['AggchainFEP'] = await trackVerification(
100+
verificationResults.AggchainFEP = await trackVerification(
101101
'AggchainFEP',
102102
deployedContracts.aggchainFEPImplementation,
103103
[globalExitRootV2Address, polAddress, bridgeV2Address, rollupManagerAddress, aggLayerGatewayAddress],
@@ -107,7 +107,7 @@ async function main() {
107107
// 9. Verify AggchainECDSA Implementation (if exists)
108108
if (deployedContracts.aggchainECDSAImplementation) {
109109
logger.info('Verifying AggchainECDSA Implementation...');
110-
verificationResults['AggchainECDSA'] = await trackVerification(
110+
verificationResults.AggchainECDSA = await trackVerification(
111111
'AggchainECDSA',
112112
deployedContracts.aggchainECDSAImplementation,
113113
[globalExitRootV2Address, polAddress, bridgeV2Address, rollupManagerAddress, aggLayerGatewayAddress],

upgrade/importOZState/importOZState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dotenv.config({ path: path.resolve(__dirname, '../../.env') });
1010

1111
// Configuration: Set the RollupManager or AgglayerManager address here
1212
// You can also set this via environment variable: ROLLUP_MANAGER_ADDRESS
13-
const ROLLUP_MANAGER_ADDRESS = process.env.ROLLUP_MANAGER_ADDRESS;
13+
const { ROLLUP_MANAGER_ADDRESS } = process.env;
1414

1515
/**
1616
* Plain script to import OpenZeppelin upgrade state for all proxy contracts

upgrade/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async function verifyContractEtherscan(
8383
contract: contractPath,
8484
});
8585
logger.info(`✅ Contract ${implementationAddress} verified successfully on Etherscan`);
86-
} catch (error) {
86+
} catch (error: any) {
8787
if (error.name === 'ContractAlreadyVerifiedError') {
8888
logger.info(`✅ Contract ${implementationAddress} is already verified on Etherscan`);
8989
return true;
@@ -219,17 +219,17 @@ async function decodeScheduleBatchData(scheduleData: any, contractFactories: any
219219
// Try to decode single data with multiple factories
220220
const data = timelockTx?.args[i];
221221
let decodedData = null;
222-
let usedFactory = null;
223222

223+
// eslint-disable-next-line no-restricted-syntax
224224
for (const factory of contractFactories) {
225225
try {
226226
const decodedAttempt = factory.interface.parseTransaction({ data });
227227
if (decodedAttempt) {
228228
decodedData = decodedAttempt;
229-
usedFactory = factory;
230229
break;
231230
}
232231
} catch (error) {
232+
// eslint-disable-next-line no-continue
233233
continue;
234234
}
235235
}
@@ -253,18 +253,18 @@ async function decodeScheduleBatchData(scheduleData: any, contractFactories: any
253253
for (let j = 0; j < payloads.length; j++) {
254254
const data = payloads[j];
255255
let decodedProxyAdmin = null;
256-
let usedFactory = null;
257256

258257
// Try to decode with each contract factory
258+
// eslint-disable-next-line no-restricted-syntax
259259
for (const factory of contractFactories) {
260260
try {
261261
const decodedAttempt = factory.interface.parseTransaction({ data });
262262
if (decodedAttempt) {
263263
decodedProxyAdmin = decodedAttempt;
264-
usedFactory = factory;
265264
break;
266265
}
267266
} catch (error) {
267+
// eslint-disable-next-line no-continue
268268
continue;
269269
}
270270
}

0 commit comments

Comments
 (0)