Skip to content

Commit 8f872a0

Browse files
chore(tooling): enforce ruff rule c420 (#2146)
* enforce c420 * enforce ruff rule c420 * Update tests/prague/eip7702_set_code_tx/test_gas.py Co-authored-by: danceratopz <[email protected]> * Update tests/cancun/eip1153_tstore/test_tstorage.py Co-authored-by: danceratopz <[email protected]> * Update tests/cancun/eip1153_tstore/test_tstorage.py Co-authored-by: danceratopz <[email protected]> * Update tests/cancun/eip1153_tstore/test_tstorage.py Co-authored-by: danceratopz <[email protected]> --------- Co-authored-by: danceratopz <[email protected]>
1 parent 291fe00 commit 8f872a0

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ line-length = 99
129129
[tool.ruff.lint]
130130
select = ["E", "F", "B", "W", "I", "A", "N", "D", "C"]
131131
fixable = ["I", "B", "E", "F", "W", "D", "C"]
132-
ignore = ["D205", "D203", "D212", "D415", "C901", "A005", "C420"]
132+
ignore = ["D205", "D203", "D212", "D415", "C901", "A005"]
133133

134134
[tool.mypy]
135135
disable_error_code = ["import-untyped"]

tests/cancun/eip1153_tstore/test_tstorage.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_transient_storage_unset_values(state_test: StateTestFiller, pre: Alloc)
4545

4646
code_address = pre.deploy_contract(
4747
code=code, # type: ignore
48-
storage={slot: 1 for slot in slots_under_test},
48+
storage=dict.fromkeys(slots_under_test, 1),
4949
)
5050

5151
tx = Transaction(
@@ -54,7 +54,7 @@ def test_transient_storage_unset_values(state_test: StateTestFiller, pre: Alloc)
5454
gas_limit=1_000_000,
5555
)
5656

57-
post = {code_address: Account(storage={slot: 0 for slot in slots_under_test})}
57+
post = {code_address: Account(storage=dict.fromkeys(slots_under_test, 0))}
5858

5959
state_test(
6060
env=env,
@@ -79,7 +79,7 @@ def test_tload_after_tstore(state_test: StateTestFiller, pre: Alloc):
7979
)
8080
code_address = pre.deploy_contract(
8181
code=code, # type: ignore
82-
storage={slot: 0xFF for slot in slots_under_test},
82+
storage=dict.fromkeys(slots_under_test, 0xFF),
8383
)
8484

8585
tx = Transaction(
@@ -114,7 +114,7 @@ def test_tload_after_sstore(state_test: StateTestFiller, pre: Alloc):
114114
)
115115
code_address = pre.deploy_contract(
116116
code=code, # type: ignore
117-
storage={slot: 1 for slot in slots_under_test},
117+
storage=dict.fromkeys(slots_under_test, 1),
118118
)
119119

120120
tx = Transaction(
@@ -127,7 +127,7 @@ def test_tload_after_sstore(state_test: StateTestFiller, pre: Alloc):
127127
code_address: Account(
128128
code=code,
129129
storage={slot - 1: 0xFF for slot in slots_under_test}
130-
| {slot: 0 for slot in slots_under_test},
130+
| dict.fromkeys(slots_under_test, 0),
131131
)
132132
}
133133

@@ -157,7 +157,7 @@ def test_tload_after_tstore_is_zero(state_test: StateTestFiller, pre: Alloc):
157157

158158
code_address = pre.deploy_contract(
159159
code=code, # type: ignore
160-
storage={slot: 0xFFFF for slot in slots_to_write + slots_to_read},
160+
storage=dict.fromkeys(slots_to_write + slots_to_read, 0xFFFF),
161161
)
162162

163163
tx = Transaction(
@@ -168,7 +168,7 @@ def test_tload_after_tstore_is_zero(state_test: StateTestFiller, pre: Alloc):
168168

169169
post = {
170170
code_address: Account(
171-
storage={slot: 0 for slot in slots_to_read} | {slot: 0xFFFF for slot in slots_to_write}
171+
storage=dict.fromkeys(slots_to_read, 0) | dict.fromkeys(slots_to_write, 0xFFFF)
172172
)
173173
}
174174

tests/cancun/eip4788_beacon_root/spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def expected_storage(
5858
- validity of the timestamp input used within the call.
5959
"""
6060
# By default assume the call is unsuccessful and all keys are zero
61-
storage = Storage({k: 0 for k in range(4)}) # type: ignore
61+
storage = Storage(dict.fromkeys(range(4), 0)) # type: ignore
6262
if valid_call and valid_input:
6363
# beacon root contract call is successful
6464
storage[0] = 1

tests/cancun/eip4844_blobs/test_blobhash_opcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def blob_tx(address: Address, tx_type: int):
387387
storage={i: random_blob_hashes[i] for i in range(max_blobs_per_tx)}
388388
)
389389
if address in (addresses[1], addresses[3])
390-
else Account(storage={i: 0 for i in range(max_blobs_per_tx)})
390+
else Account(storage=dict.fromkeys(range(max_blobs_per_tx), 0))
391391
for address in addresses
392392
}
393393
blockchain_test(

tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ def test_precompile_during_fork(
700700

701701
post = {
702702
precompile_caller_address: Account(
703-
storage={b: 1 for b in range(1, len(PRE_FORK_BLOCK_RANGE) + 1)},
703+
storage=dict.fromkeys(range(1, len(PRE_FORK_BLOCK_RANGE) + 1), 1),
704704
# Only the call in the last block's tx fails; storage 0 by default.
705705
),
706706
Address(Spec.POINT_EVALUATION_PRECOMPILE_ADDRESS): Account(

tests/prague/eip7702_set_code_tx/test_gas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ def test_account_warming(
959959
callee_code += Op.STOP
960960
callee_address = pre.deploy_contract(
961961
callee_code,
962-
storage={check_address: 0xDEADBEEF for check_address in addresses_to_check},
962+
storage=dict.fromkeys(addresses_to_check, 0xDEADBEEF),
963963
)
964964

965965
tx = Transaction(

tests/prague/eip7702_set_code_tx/test_set_code_txs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_self_sponsored_set_code(
128128
pre=pre,
129129
tx=tx,
130130
post={
131-
set_code_to_address: Account(storage={k: 0 for k in storage}),
131+
set_code_to_address: Account(storage=dict.fromkeys(storage, 0)),
132132
sender: Account(
133133
nonce=2,
134134
code=Spec.delegation_designation(set_code_to_address),
@@ -208,7 +208,7 @@ def test_set_code_to_sstore(
208208
tx=tx,
209209
post={
210210
set_code_to_address: Account(
211-
storage={k: 0 for k in storage},
211+
storage=dict.fromkeys(storage, 0),
212212
),
213213
auth_signer: Account(
214214
nonce=2 if self_sponsored else 1,
@@ -799,8 +799,8 @@ def test_set_code_call_set_code(
799799
pre=pre,
800800
tx=tx,
801801
post={
802-
set_code_to_address_1: Account(storage={k: 0 for k in storage_1}),
803-
set_code_to_address_2: Account(storage={k: 0 for k in storage_2}),
802+
set_code_to_address_1: Account(storage=dict.fromkeys(storage_1, 0)),
803+
set_code_to_address_2: Account(storage=dict.fromkeys(storage_2, 0)),
804804
auth_signer_1: Account(
805805
nonce=1,
806806
code=Spec.delegation_designation(set_code_to_address_1),

tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ def test_set_code_type_tx_pre_fork(
17451745
pre=pre,
17461746
tx=tx,
17471747
post={
1748-
set_code_to_address: Account(storage={k: 0 for k in storage}),
1748+
set_code_to_address: Account(storage=dict.fromkeys(storage, 0)),
17491749
sender: Account(
17501750
nonce=0,
17511751
code="",

tests/unscheduled/eip7692_eof_v1/eip3540_eof_v1/test_execution_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def test_eof_functions_contract_call_within_deep_nested(
419419
sender=sender,
420420
)
421421
post = {
422-
callee_address: Account(storage={i: 1 for i in range(MAX_CODE_SECTIONS)}),
422+
callee_address: Account(storage=dict.fromkeys(range(MAX_CODE_SECTIONS), 1)),
423423
nested_callee_address: Account(
424424
storage={
425425
0: 1,

0 commit comments

Comments
 (0)