Skip to content

Commit dc1bdef

Browse files
committed
fix(specs): Replace EIP-4844 constants with Fork method calls
1 parent 4b1152a commit dc1bdef

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/ethereum_test_specs/state.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
from .debugging import print_traces
3333
from .helpers import verify_transactions
3434

35-
TARGET_BLOB_GAS_PER_BLOCK = 393216
36-
3735

3836
class StateTest(BaseTest):
3937
"""
@@ -58,7 +56,7 @@ class StateTest(BaseTest):
5856
TransactionPost,
5957
]
6058

61-
def _generate_blockchain_genesis_environment(self) -> Environment:
59+
def _generate_blockchain_genesis_environment(self, *, fork: Fork) -> Environment:
6260
"""
6361
Generate the genesis environment for the BlockchainTest formatted test.
6462
"""
@@ -79,8 +77,8 @@ def _generate_blockchain_genesis_environment(self) -> Environment:
7977
# set the excess blob gas by setting the excess blob gas of the genesis block
8078
# to the expected value plus the TARGET_BLOB_GAS_PER_BLOCK, which is the value
8179
# that will be subtracted from the excess blob gas when the first block is mined.
82-
updated_values["excess_blob_gas"] = (
83-
self.env.excess_blob_gas + TARGET_BLOB_GAS_PER_BLOCK
80+
updated_values["excess_blob_gas"] = self.env.excess_blob_gas + (
81+
fork.target_blobs_per_block() * fork.blob_gas_per_blob()
8482
)
8583

8684
return self.env.copy(**updated_values)
@@ -107,12 +105,12 @@ def _generate_blockchain_blocks(self) -> List[Block]:
107105
)
108106
]
109107

110-
def generate_blockchain_test(self) -> BlockchainTest:
108+
def generate_blockchain_test(self, *, fork: Fork) -> BlockchainTest:
111109
"""
112110
Generate a BlockchainTest fixture from this StateTest fixture.
113111
"""
114112
return BlockchainTest(
115-
genesis_environment=self._generate_blockchain_genesis_environment(),
113+
genesis_environment=self._generate_blockchain_genesis_environment(fork=fork),
116114
pre=self.pre,
117115
post=self.post,
118116
blocks=self._generate_blockchain_blocks(),
@@ -195,7 +193,7 @@ def generate(
195193
Generate the BlockchainTest fixture.
196194
"""
197195
if fixture_format in BlockchainTest.supported_fixture_formats:
198-
return self.generate_blockchain_test().generate(
196+
return self.generate_blockchain_test(fork=fork).generate(
199197
request=request, t8n=t8n, fork=fork, fixture_format=fixture_format, eips=eips
200198
)
201199
elif fixture_format == StateFixture:

0 commit comments

Comments
 (0)