Skip to content

Commit 132fa98

Browse files
committed
chore(fw): rename blob count to blobs per block.
1 parent d91fb50 commit 132fa98

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

src/ethereum_test_fixtures/blockchain.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class FixtureHeader(CamelModel):
111111
None
112112
)
113113
requests_hash: Annotated[Hash, HeaderForkRequirement("requests")] | None = Field(None)
114-
target_blob_count: Annotated[
115-
ZeroPaddedHexNumber, HeaderForkRequirement("target_blob_count")
114+
target_blobs_per_block: Annotated[
115+
ZeroPaddedHexNumber, HeaderForkRequirement("target_blobs_per_block")
116116
] | None = Field(None)
117117

118118
fork: Fork | None = Field(None, exclude=True)
@@ -202,7 +202,7 @@ class FixtureExecutionPayload(CamelModel):
202202
blob_gas_used: HexNumber | None = Field(None)
203203
excess_blob_gas: HexNumber | None = Field(None)
204204

205-
target_blob_count: HexNumber | None = Field(None)
205+
target_blobs_per_block: HexNumber | None = Field(None)
206206

207207
block_hash: Hash
208208

@@ -310,11 +310,11 @@ def from_fixture_header(
310310
raise ValueError(f"Requests are required for ${fork}.")
311311
params.append(requests)
312312

313-
if fork.engine_new_payload_target_blob_count(header.number, header.timestamp):
314-
target_blob_count = header.target_blob_count
315-
if target_blob_count is None:
316-
raise ValueError(f"Target blob count is required for ${fork}.")
317-
params.append(target_blob_count)
313+
if fork.engine_new_payload_target_blobs_per_block(header.number, header.timestamp):
314+
target_blobs_per_block = header.target_blobs_per_block
315+
if target_blobs_per_block is None:
316+
raise ValueError(f"Target blobs per block is required for ${fork}.")
317+
params.append(target_blobs_per_block)
318318

319319
payload_params: EngineNewPayloadParameters = tuple(params)
320320
new_payload = cls(

src/ethereum_test_fixtures/tests/test_blockchain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
excess_blob_gas=18,
669669
parent_beacon_block_root=19,
670670
requests_hash=20,
671-
target_blob_count=10,
671+
target_blobs_per_block=10,
672672
),
673673
transactions=[
674674
Transaction(
@@ -1192,7 +1192,7 @@ def test_json_deserialization(
11921192
withdrawals_root=Hash(16),
11931193
blob_gas_used=17,
11941194
excess_blob_gas=18,
1195-
target_blob_count=10,
1195+
target_blobs_per_block=10,
11961196
),
11971197
transactions=[
11981198
Transaction(

src/ethereum_test_forks/base_fork.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ def transaction_intrinsic_cost_calculator(
248248

249249
@classmethod
250250
@abstractmethod
251-
def header_target_blob_count_required(cls, block_number: int, timestamp: int) -> bool:
251+
def header_target_blobs_per_block_required(cls, block_number: int, timestamp: int) -> bool:
252252
"""
253-
Returns true if the header must contain target blob count
253+
Returns true if the header must contain target blobs per block.
254254
"""
255255
pass
256256

@@ -264,7 +264,7 @@ def blob_gas_per_blob(cls, block_number: int, timestamp: int) -> int:
264264

265265
@classmethod
266266
@abstractmethod
267-
def target_blob_count(cls, block_number: int, timestamp: int) -> int:
267+
def target_blobs_per_block(cls, block_number: int, timestamp: int) -> int:
268268
"""
269269
Returns the target blobs per block for a given fork.
270270
"""
@@ -375,9 +375,9 @@ def engine_new_payload_requests(cls, block_number: int = 0, timestamp: int = 0)
375375

376376
@classmethod
377377
@abstractmethod
378-
def engine_new_payload_target_blob_count(cls, block_number: int = 0, timestamp: int = 0) -> bool:
378+
def engine_new_payload_target_blobs_per_block(cls, block_number: int = 0, timestamp: int = 0) -> bool:
379379
"""
380-
returns true if the engine api version requires new payload calls to include target blob count.
380+
returns true if the engine api version requires new payload calls to include target blobs per block.
381381
"""
382382
pass
383383

src/ethereum_test_forks/forks/forks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def blob_gas_per_blob(cls, block_number: int, timestamp: int) -> int:
943943
return 2**17
944944

945945
@classmethod
946-
def target_blob_count(cls, block_number: int, timestamp: int) -> int:
946+
def target_blobs_per_block(cls, block_number: int, timestamp: int) -> int:
947947
"""
948948
Blobs are enabled starting from Cancun, with a static target of 3 blobs.
949949
"""
@@ -1184,10 +1184,10 @@ def header_requests_required(cls, block_number: int, timestamp: int) -> bool:
11841184
return True
11851185

11861186
@classmethod
1187-
def header_target_blob_count_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
1187+
def header_target_blobs_per_block_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
11881188
"""
11891189
Prague requires that the execution layer header contains the beacon
1190-
chain target blob count.
1190+
chain target blobs per block.
11911191
"""
11921192
return True
11931193

@@ -1199,9 +1199,9 @@ def engine_new_payload_requests(cls, block_number: int = 0, timestamp: int = 0)
11991199
return True
12001200

12011201
@classmethod
1202-
def engine_new_payload_target_blob_count(cls, block_number: int = 0, timestamp: int = 0) -> bool:
1202+
def engine_new_payload_target_blobs_per_block(cls, block_number: int = 0, timestamp: int = 0) -> bool:
12031203
"""
1204-
Starting at Prague, new payloads include the target blob count as a parameter.
1204+
Starting at Prague, new payloads include the target blobs per block as a parameter.
12051205
"""
12061206
return True
12071207

src/ethereum_test_specs/blockchain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Header(CamelModel):
119119
excess_blob_gas: Removable | HexNumber | None = None
120120
parent_beacon_block_root: Removable | Hash | None = None
121121
requests_hash: Removable | Hash | None = None
122-
target_blob_count: Removable | HexNumber | None = None
122+
target_blobs_per_block: Removable | HexNumber | None = None
123123

124124
REMOVE_FIELD: ClassVar[Removable] = Removable()
125125
"""
@@ -362,8 +362,8 @@ def make_genesis(
362362
requests_hash=Requests(max_request_type=fork.max_request_type(0, 0))
363363
if fork.header_requests_required(0, 0)
364364
else None,
365-
target_blob_count=fork.target_blob_count(0, 0)
366-
if fork.header_target_blob_count_required(0, 0)
365+
target_blobs_per_block=fork.target_blobs_per_block(0, 0)
366+
if fork.header_target_blobs_per_block_required(0, 0)
367367
else None,
368368
fork=fork,
369369
)

src/ethereum_test_types/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class EnvironmentGeneric(CamelModel, Generic[NumberBoundTypeVar]):
389389
difficulty: NumberBoundTypeVar | None = Field(None, alias="currentDifficulty")
390390
base_fee_per_gas: NumberBoundTypeVar | None = Field(None, alias="currentBaseFee")
391391
excess_blob_gas: NumberBoundTypeVar | None = Field(None, alias="currentExcessBlobGas")
392-
target_blob_count: NumberBoundTypeVar | None = Field(None, alias="currentTargetBlobCount")
392+
target_blobs_per_block: NumberBoundTypeVar | None = Field(None, alias="currentTargetBlobsPerBlock")
393393

394394
parent_difficulty: NumberBoundTypeVar | None = Field(None)
395395
parent_timestamp: NumberBoundTypeVar | None = Field(None)
@@ -475,8 +475,8 @@ def set_fork_requirements(self, fork: Fork) -> "Environment":
475475
):
476476
updated_values["parent_beacon_block_root"] = 0
477477

478-
if fork.header_target_blob_count_required(number, timestamp) and self.target_blob_count is None:
479-
updated_values["target_blob_count"] = fork.target_blob_count(number, timestamp)
478+
if fork.header_target_blobs_per_block_required(number, timestamp) and self.target_blobs_per_block is None:
479+
updated_values["target_blobs_per_block"] = fork.target_blobs_per_block(number, timestamp)
480480

481481
return self.copy(**updated_values)
482482

src/pytest_plugins/execute/rpc/hive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ def base_pre_genesis(
264264
block_number=block_number, timestamp=timestamp
265265
)
266266
else None,
267-
target_blob_count=base_fork.target_blob_count(
267+
target_blobs_per_block=base_fork.target_blobs_per_block(
268268
block_number=block_number, timestamp=timestamp
269269
)
270-
if base_fork.header_target_blob_count_required(
270+
if base_fork.header_target_blobs_per_block_required(
271271
block_number=block_number, timestamp=timestamp
272272
)
273273
else None,

0 commit comments

Comments
 (0)