Skip to content

Commit b83116f

Browse files
committed
chore(ruff): changes to tests/shanghai/.
1 parent 9b2606d commit b83116f

File tree

14 files changed

+82
-158
lines changed

14 files changed

+82
-158
lines changed

tests/shanghai/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Test cases for EVM functionality introduced in Shanghai.
3-
"""
1+
"""Test cases for EVM functionality introduced in Shanghai."""
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
"""
2-
Fixtures for the EIP-3651 warm coinbase tests.
3-
"""
1+
"""Fixtures for the EIP-3651 warm coinbase tests."""
42

53
import pytest
64

75
from ethereum_test_tools import EOA, Alloc, Environment
86

97

108
@pytest.fixture
11-
def env() -> Environment: # noqa: D103
9+
def env() -> Environment:
10+
"""Environment fixture."""
1211
return Environment()
1312

1413

1514
@pytest.fixture
16-
def post() -> Alloc: # noqa: D103
15+
def post() -> Alloc:
16+
"""Post state fixture."""
1717
return Alloc()
1818

1919

2020
@pytest.fixture
2121
def sender(pre: Alloc) -> EOA:
22-
"""
23-
Funded EOA used for sending transactions.
24-
"""
22+
"""Funded EOA used for sending transactions."""
2523
return pre.fund_eoa()

tests/shanghai/eip3651_warm_coinbase/spec.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
"""
2-
Defines EIP-3651 specification constants and functions.
3-
"""
1+
"""Defines EIP-3651 specification constants and functions."""
42

53
from dataclasses import dataclass
64

75

86
@dataclass(frozen=True)
97
class ReferenceSpec:
10-
"""
11-
Defines the reference spec version and git path.
12-
"""
8+
"""Defines the reference spec version and git path."""
139

1410
git_path: str
1511
version: str

tests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_warm_coinbase_call_out_of_gas(
8181
):
8282
"""
8383
Test that the coinbase is warm by accessing the COINBASE with each
84-
of the following opcodes:
84+
of the following opcodes.
8585
8686
- CALL
8787
- CALLCODE
@@ -219,7 +219,7 @@ def test_warm_coinbase_gas_usage(
219219
code_gas_measure: Bytecode,
220220
):
221221
"""
222-
Test the gas usage of opcodes affected by assuming a warm coinbase:
222+
Test the gas usage of opcodes affected by assuming a warm coinbase.
223223
224224
- EXTCODESIZE
225225
- EXTCODECOPY
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
"""
2-
Fixtures for the EIP-3855 PUSH0 tests.
3-
"""
1+
"""Fixtures for the EIP-3855 PUSH0 tests."""
42

53
import pytest
64

75
from ethereum_test_tools import EOA, Alloc, Environment
86

97

108
@pytest.fixture
11-
def env() -> Environment: # noqa: D103
9+
def env() -> Environment:
10+
"""Environment fixture."""
1211
return Environment()
1312

1413

1514
@pytest.fixture
16-
def post() -> Alloc: # noqa: D103
15+
def post() -> Alloc:
16+
"""Post state fixture."""
1717
return Alloc()
1818

1919

2020
@pytest.fixture
2121
def sender(pre: Alloc) -> EOA:
22-
"""
23-
Funded EOA used for sending transactions.
24-
"""
22+
"""Funded EOA used for sending transactions."""
2523
return pre.fund_eoa()

tests/shanghai/eip3855_push0/spec.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
"""
2-
Defines EIP-3855 specification constants and functions.
3-
"""
1+
"""Defines EIP-3855 specification constants and functions."""
42

53
from dataclasses import dataclass
64

75

86
@dataclass(frozen=True)
97
class ReferenceSpec:
10-
"""
11-
Defines the reference spec version and git path.
12-
"""
8+
"""Defines the reference spec version and git path."""
139

1410
git_path: str
1511
version: str

tests/shanghai/eip3855_push0/test_push0.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ def test_push0_contracts(
8282
contract_code: Bytecode,
8383
expected_storage: Account,
8484
):
85-
"""
86-
Tests PUSH0 within various deployed contracts.
87-
"""
85+
"""Tests PUSH0 within various deployed contracts."""
8886
push0_contract = pre.deploy_contract(contract_code)
8987
tx = Transaction(to=push0_contract, gas_limit=100_000, sender=sender)
9088
post[push0_contract] = expected_storage
@@ -97,14 +95,12 @@ class TestPush0CallContext:
9795
- CALL
9896
- CALLCODE
9997
- DELEGATECALL
100-
- STATICCALL
98+
- STATICCALL.
10199
"""
102100

103101
@pytest.fixture
104102
def push0_contract_callee(self, pre: Alloc) -> Address:
105-
"""
106-
Deploys a PUSH0 contract callee to the pre alloc returning its address.
107-
"""
103+
"""Deploys a PUSH0 contract callee to the pre alloc returning its address."""
108104
push0_contract = pre.deploy_contract(Op.MSTORE8(Op.PUSH0, 0xFF) + Op.RETURN(Op.PUSH0, 1))
109105
return push0_contract
110106

@@ -113,7 +109,8 @@ def push0_contract_caller(
113109
self, pre: Alloc, call_opcode: Op, push0_contract_callee: Address
114110
) -> Address:
115111
"""
116-
Deploys a contract responsible for calling the callee PUSH0 contract returning its address.
112+
Deploy contract responsible for calling the callee PUSH0 contract
113+
returning its address.
117114
"""
118115
call_code = (
119116
Op.SSTORE(0, call_opcode(gas=100_000, address=push0_contract_callee))
@@ -142,9 +139,7 @@ def test_push0_contract_during_call_contexts(
142139
sender: EOA,
143140
push0_contract_caller: Address,
144141
):
145-
"""
146-
Test PUSH0 during various call contexts.
147-
"""
142+
"""Test PUSH0 during various call contexts."""
148143
tx = Transaction(to=push0_contract_caller, gas_limit=100_000, sender=sender)
149144
post[push0_contract_caller] = Account(storage={0x00: 0x01, 0x01: 0xFF})
150145
state_test(env=env, pre=pre, post=post, tx=tx)
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
"""
2-
Fixtures for the EIP-3860 initcode tests.
3-
"""
1+
"""Fixtures for the EIP-3860 initcode tests."""
42

53
import pytest
64

75
from ethereum_test_tools import EOA, Alloc, Environment
86

97

108
@pytest.fixture
11-
def env() -> Environment: # noqa: D103
9+
def env() -> Environment:
10+
"""Environment fixture."""
1211
return Environment()
1312

1413

1514
@pytest.fixture
16-
def post() -> Alloc: # noqa: D103
15+
def post() -> Alloc:
16+
"""Post state fixture."""
1717
return Alloc()
1818

1919

2020
@pytest.fixture
2121
def sender(pre: Alloc) -> EOA:
22-
"""
23-
Funded EOA used for sending transactions.
24-
"""
22+
"""Funded EOA used for sending transactions."""
2523
return pre.fund_eoa()
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Helpers for the EIP-3860 initcode tests.
3-
"""
1+
"""Helpers for the EIP-3860 initcode tests."""
42

53
from ethereum_test_tools import Initcode
64
from ethereum_test_tools.vm.opcode import Opcodes as Op
@@ -9,15 +7,10 @@
97

108

119
def get_initcode_name(val: Initcode):
12-
"""
13-
Helper function that returns an Initcode object's name to generate test
14-
ids.
15-
"""
10+
"""Return Initcode object's name to generate test ids."""
1611
return val._name_
1712

1813

1914
def get_create_id(opcode: Op):
20-
"""
21-
Helper function that returns the opcode name for the test id.
22-
"""
15+
"""Return the opcode name for the test id."""
2316
return opcode._name_.lower()

tests/shanghai/eip3860_initcode/spec.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
"""
2-
Defines EIP-3860 specification constants and functions.
3-
"""
1+
"""Defines EIP-3860 specification constants and functions."""
42

53
from dataclasses import dataclass
64

75

86
@dataclass(frozen=True)
97
class ReferenceSpec:
10-
"""
11-
Defines the reference spec version and git path.
12-
"""
8+
"""Defines the reference spec version and git path."""
139

1410
git_path: str
1511
version: str
@@ -22,7 +18,7 @@ class ReferenceSpec:
2218
class Spec:
2319
"""
2420
Parameters from the EIP-3860 specifications as defined at
25-
https://eips.ethereum.org/EIPS/eip-3860#parameters
21+
https://eips.ethereum.org/EIPS/eip-3860#parameters.
2622
"""
2723

2824
MAX_INITCODE_SIZE = 49152

0 commit comments

Comments
 (0)