Skip to content

Commit 80df609

Browse files
authored
chore(tooling): Add ruff ARG002, 003, 005 rules and fix all violations (ethereum#2291)
1 parent 809e4a1 commit 80df609

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

frontier/scenarios/programs/all_frontier_opcodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ class ProgramAllFrontierOpcodes(ScenarioTestProgram):
479479

480480
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
481481
"""Test code."""
482+
del pre, fork
482483
return make_all_opcode_program()
483484

484485
@cached_property

frontier/scenarios/programs/context_calls.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ProgramAddress(ScenarioTestProgram):
2222

2323
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
2424
"""Test code."""
25+
del pre, fork
2526
return Op.MSTORE(0, Op.ADDRESS) + Op.RETURN(0, 32)
2627

2728
@cached_property
@@ -41,6 +42,7 @@ class ProgramBalance(ScenarioTestProgram):
4142

4243
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
4344
"""Test code."""
45+
del fork
4446
external_address = pre.deploy_contract(code=Op.ADD(1, 1), balance=self.external_balance)
4547
return Op.MSTORE(0, Op.BALANCE(external_address)) + Op.RETURN(0, 32)
4648

@@ -59,6 +61,7 @@ class ProgramOrigin(ScenarioTestProgram):
5961

6062
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
6163
"""Test code."""
64+
del pre, fork
6265
return Op.MSTORE(0, Op.ORIGIN) + Op.RETURN(0, 32)
6366

6467
@cached_property
@@ -76,6 +79,7 @@ class ProgramCaller(ScenarioTestProgram):
7679

7780
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
7881
"""Test code."""
82+
del pre, fork
7983
return Op.MSTORE(0, Op.CALLER) + Op.RETURN(0, 32)
8084

8185
@cached_property
@@ -93,6 +97,7 @@ class ProgramCallValue(ScenarioTestProgram):
9397

9498
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
9599
"""Test code."""
100+
del pre, fork
96101
return Op.MSTORE(0, Op.CALLVALUE) + Op.RETURN(0, 32)
97102

98103
@cached_property
@@ -110,6 +115,7 @@ class ProgramCallDataLoad(ScenarioTestProgram):
110115

111116
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
112117
"""Test code."""
118+
del pre, fork
113119
return Op.MSTORE(0, Op.CALLDATALOAD(0)) + Op.RETURN(0, 32)
114120

115121
@cached_property
@@ -127,6 +133,7 @@ class ProgramCallDataSize(ScenarioTestProgram):
127133

128134
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
129135
"""Test code."""
136+
del pre, fork
130137
return Op.MSTORE(0, Op.CALLDATASIZE) + Op.RETURN(0, 32)
131138

132139
@cached_property
@@ -144,6 +151,7 @@ class ProgramCallDataCopy(ScenarioTestProgram):
144151

145152
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
146153
"""Test code."""
154+
del pre, fork
147155
return Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE) + Op.RETURN(0, 32)
148156

149157
@cached_property
@@ -161,6 +169,7 @@ class ProgramCodeCopyCodeSize(ScenarioTestProgram):
161169

162170
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
163171
"""Test code."""
172+
del pre, fork
164173
return Op.MSTORE(0, Op.CODESIZE) + Op.CODECOPY(0, 0, 30) + Op.RETURN(0, 32)
165174

166175
@cached_property
@@ -180,6 +189,7 @@ class ProgramGasPrice(ScenarioTestProgram):
180189

181190
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
182191
"""Test code."""
192+
del fork
183193
gas_hash = make_gas_hash_contract(pre)
184194

185195
return (
@@ -206,6 +216,8 @@ class ProgramExtCodeCopyExtCodeSize(ScenarioTestProgram):
206216

207217
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
208218
"""Test code."""
219+
del fork
220+
209221
external_address = pre.deploy_contract(code=Op.ADD(1, 1), balance=self.external_balance)
210222
return (
211223
Op.MSTORE(0, Op.EXTCODESIZE(external_address))
@@ -230,6 +242,7 @@ class ProgramReturnDataSize(ScenarioTestProgram):
230242

231243
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
232244
"""Test code."""
245+
del pre, fork
233246
return (
234247
Op.MSTORE(0, Op.RETURNDATASIZE)
235248
+ Op.CALL(100000, 2, 0, 0, 10, 32, 20)
@@ -252,6 +265,7 @@ class ProgramReturnDataCopy(ScenarioTestProgram):
252265

253266
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
254267
"""Test code."""
268+
del pre, fork
255269
return (
256270
Op.CALL(100000, 2, 0, 0, 10, 32, 20) + Op.RETURNDATACOPY(0, 0, 32) + Op.RETURN(0, 32)
257271
)
@@ -274,6 +288,8 @@ class ProgramExtCodehash(ScenarioTestProgram):
274288

275289
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
276290
"""Test code."""
291+
del fork
292+
277293
external_address = pre.deploy_contract(code=Op.ADD(1, 1), balance=123)
278294
return Op.MSTORE(0, Op.EXTCODEHASH(external_address)) + Op.RETURN(0, 32)
279295

@@ -297,6 +313,8 @@ class ProgramBlockhash(ScenarioTestProgram):
297313

298314
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
299315
"""Test code."""
316+
del fork
317+
300318
# Calculate gas hash of Op.BLOCKHASH(0) value
301319
gas_hash = make_gas_hash_contract(pre)
302320

@@ -322,6 +340,7 @@ class ProgramCoinbase(ScenarioTestProgram):
322340

323341
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
324342
"""Test code."""
343+
del pre, fork
325344
return Op.MSTORE(0, Op.COINBASE) + Op.RETURN(0, 32)
326345

327346
@cached_property
@@ -339,6 +358,8 @@ class ProgramTimestamp(ScenarioTestProgram):
339358

340359
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
341360
"""Test code."""
361+
del fork
362+
342363
gas_hash = make_gas_hash_contract(pre)
343364
return (
344365
Op.MSTORE(64, Op.TIMESTAMP)
@@ -362,6 +383,7 @@ class ProgramNumber(ScenarioTestProgram):
362383

363384
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
364385
"""Test code."""
386+
del pre, fork
365387
return Op.MSTORE(0, Op.NUMBER) + Op.RETURN(0, 32)
366388

367389
@cached_property
@@ -379,6 +401,8 @@ class ProgramDifficultyRandao(ScenarioTestProgram):
379401

380402
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
381403
"""Test code."""
404+
del fork
405+
382406
# Calculate gas hash of DIFFICULTY value
383407
gas_hash = make_gas_hash_contract(pre)
384408
return (
@@ -404,6 +428,7 @@ class ProgramGasLimit(ScenarioTestProgram):
404428

405429
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
406430
"""Test code."""
431+
del pre, fork
407432
return Op.MSTORE(0, Op.GASLIMIT) + Op.RETURN(0, 32)
408433

409434
@cached_property
@@ -421,6 +446,7 @@ class ProgramChainid(ScenarioTestProgram):
421446

422447
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
423448
"""Test code."""
449+
del pre, fork
424450
return Op.MSTORE(0, Op.CHAINID) + Op.RETURN(0, 32)
425451

426452
@cached_property
@@ -441,6 +467,7 @@ class ProgramSelfbalance(ScenarioTestProgram):
441467

442468
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
443469
"""Test code."""
470+
del pre, fork
444471
return Op.MSTORE(0, Op.SELFBALANCE) + Op.RETURN(0, 32)
445472

446473
@cached_property
@@ -458,6 +485,8 @@ class ProgramBasefee(ScenarioTestProgram):
458485

459486
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
460487
"""Test code."""
488+
del fork
489+
461490
gas_hash = make_gas_hash_contract(pre)
462491
return (
463492
Op.MSTORE(64, Op.BASEFEE)
@@ -481,6 +510,7 @@ class ProgramBlobhash(ScenarioTestProgram):
481510

482511
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
483512
"""Test code."""
513+
del pre, fork
484514
return Op.MSTORE(0, Op.BLOBHASH(0)) + Op.RETURN(0, 32)
485515

486516
@cached_property
@@ -498,6 +528,8 @@ class ProgramBlobBaseFee(ScenarioTestProgram):
498528

499529
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
500530
"""Test code."""
531+
del fork
532+
501533
gas_hash = make_gas_hash_contract(pre)
502534
return (
503535
Op.MSTORE(64, Op.BLOBBASEFEE)
@@ -521,6 +553,7 @@ class ProgramTload(ScenarioTestProgram):
521553

522554
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
523555
"""Test code."""
556+
del pre, fork
524557
return Op.MSTORE(0, Op.TLOAD(0)) + Op.RETURN(0, 32)
525558

526559
@cached_property
@@ -538,6 +571,7 @@ class ProgramMcopy(ScenarioTestProgram):
538571

539572
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
540573
"""Test code."""
574+
del pre, fork
541575
return (
542576
Op.MSTORE(0, 0)
543577
+ Op.MSTORE(32, 0x000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F)
@@ -563,6 +597,7 @@ class ProgramPush0(ScenarioTestProgram):
563597

564598
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
565599
"""Test code."""
600+
del pre, fork
566601
return Op.PUSH1(10) + Op.PUSH0 + Op.MSTORE + Op.RETURN(0, 32)
567602

568603
@cached_property

frontier/scenarios/programs/static_violation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ProgramSstoreSload(ScenarioTestProgram):
1414

1515
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
1616
"""Test code."""
17+
del pre, fork
1718
return (
1819
Op.SSTORE(0, 11)
1920
+ Op.MSTORE(0, Op.ADD(Op.MLOAD(0), Op.SLOAD(0)))
@@ -37,6 +38,7 @@ class ProgramTstoreTload(ScenarioTestProgram):
3738

3839
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
3940
"""Test code."""
41+
del pre, fork
4042
return Op.TSTORE(0, 11) + Op.MSTORE(0, Op.TLOAD(0)) + Op.RETURN(0, 32)
4143

4244
@cached_property
@@ -54,6 +56,7 @@ class ProgramLogs(ScenarioTestProgram):
5456

5557
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
5658
"""Test code."""
59+
del pre, fork
5760
return (
5861
Op.MSTORE(0, 0x1122334455667788991011121314151617181920212223242526272829303132)
5962
+ Op.LOG0(0, 1)
@@ -80,6 +83,7 @@ class ProgramSuicide(ScenarioTestProgram):
8083

8184
def make_test_code(self, pre: Alloc, fork: Fork) -> Bytecode:
8285
"""Test code."""
86+
del pre, fork
8387
return Op.MSTORE(0, 1) + Op.SELFDESTRUCT(0) + Op.RETURN(0, 32)
8488

8589
@cached_property

prague/eip6110_deposits/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def log(self, *, include_abi_encoding: bool = True) -> bytes:
186186

187187
def with_source_address(self, source_address: Address) -> "DepositRequest":
188188
"""Return a copy."""
189+
del source_address
189190
return self.copy()
190191

191192

0 commit comments

Comments
 (0)