Skip to content

Commit 38c74e5

Browse files
authored
block: rename message to block in SignedBlock (#465)
1 parent d232a99 commit 38c74e5

File tree

22 files changed

+96
-96
lines changed

22 files changed

+96
-96
lines changed

packages/testing/src/consensus_testing/test_fixtures/fork_choice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def make_fixture(self) -> Self:
263263
)
264264

265265
# Store the filled block for serialization.
266-
block = signed_block.message
266+
block = signed_block.block
267267
step._filled_block = block
268268

269269
# Register labeled blocks for fork building.
@@ -449,7 +449,7 @@ def _build_block_from_spec(
449449

450450
# Assemble the signed block.
451451
return SignedBlock(
452-
message=final_block,
452+
block=final_block,
453453
signature=BlockSignatures(
454454
attestation_signatures=attestation_signatures_blob,
455455
proposer_signature=proposer_signature,

packages/testing/src/consensus_testing/test_fixtures/verify_signatures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def _build_block_from_spec(
286286
proposer_signature = create_dummy_signature()
287287

288288
return SignedBlock(
289-
message=final_block,
289+
block=final_block,
290290
signature=BlockSignatures(
291291
attestation_signatures=attestation_signatures,
292292
proposer_signature=proposer_signature,

src/lean_spec/subspecs/containers/block/block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class BlockSignatures(Container):
8989
class SignedBlock(Container):
9090
"""Envelope carrying a block and its aggregated signatures."""
9191

92-
message: Block
92+
block: Block
9393
"""The block being signed."""
9494

9595
signature: BlockSignatures
@@ -116,9 +116,9 @@ def verify_signatures(
116116
Raises:
117117
AssertionError: On verification failure.
118118
"""
119-
block = self.message
119+
block = self.block
120120
signatures = self.signature
121-
aggregated_attestations = block.body.attestations
121+
aggregated_attestations = self.block.body.attestations
122122
attestation_signatures = signatures.attestation_signatures
123123

124124
# Each attestation in the body must have a corresponding signature entry.

src/lean_spec/subspecs/forkchoice/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def on_block(
481481
Raises:
482482
AssertionError: If parent block/state not found in store.
483483
"""
484-
block = signed_block.message
484+
block = signed_block.block
485485
block_root = hash_tree_root(block)
486486

487487
# Skip duplicate blocks (idempotent operation)

src/lean_spec/subspecs/networking/service/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async def publish_block(self, block: SignedBlock) -> None:
212212
compressed = compress(ssz_bytes)
213213

214214
await self.event_source.publish(topic.to_topic_id(), compressed)
215-
logger.debug("Published block at slot %s", block.message.slot)
215+
logger.debug("Published block at slot %s", block.block.slot)
216216

217217
async def publish_attestation(
218218
self, attestation: SignedAttestation, subnet_id: SubnetId

src/lean_spec/subspecs/sync/block_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def add(
186186
Returns:
187187
The PendingBlock wrapper, either newly created or existing.
188188
"""
189-
block_inner = block.message
189+
block_inner = block.block
190190
root = hash_tree_root(block_inner)
191191

192192
# Deduplication: if we already have this block, return the existing entry.

src/lean_spec/subspecs/sync/head_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def on_gossip_block(
161161
Tuple of (result describing what happened, updated store).
162162
The store is unchanged if the block was cached.
163163
"""
164-
block_inner = block.message
164+
block_inner = block.block
165165
block_root = hash_tree_root(block_inner)
166166
parent_root = block_inner.parent_root
167167
slot = block_inner.slot
@@ -234,8 +234,8 @@ async def _process_block_with_descendants(
234234
Returns:
235235
Result and updated store.
236236
"""
237-
block_root = hash_tree_root(block.message)
238-
slot = block.message.slot
237+
block_root = hash_tree_root(block.block)
238+
slot = block.block.slot
239239
self._processing.add(block_root)
240240

241241
try:
@@ -366,7 +366,7 @@ async def _cache_and_backfill(
366366
Returns:
367367
Result indicating the block was cached, and unchanged store.
368368
"""
369-
block_inner = block.message
369+
block_inner = block.block
370370
parent_root = block_inner.parent_root
371371

372372
# Add to cache.

src/lean_spec/subspecs/sync/service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _process_block_wrapper(
272272
# This is write-through: data is persisted synchronously after processing.
273273
# The database call is optional - nodes can run without persistence.
274274
if self.database is not None:
275-
self._persist_block(new_store, block.message)
275+
self._persist_block(new_store, block.block)
276276

277277
return new_store
278278

@@ -423,7 +423,7 @@ async def on_gossip_block(
423423
logger.info(
424424
"Block received from peer %s slot=%s (state=%s)",
425425
peer_id,
426-
block.message.slot,
426+
block.block.slot,
427427
self._state.name,
428428
)
429429

@@ -445,8 +445,8 @@ async def on_gossip_block(
445445
#
446446
# A block may be cached instead of processed if its parent is unknown.
447447
if result.processed:
448-
slot = block.message.slot
449-
block_root = hash_tree_root(block.message)
448+
slot = block.block.slot
449+
block_root = hash_tree_root(block.block)
450450
logger.info(
451451
"Block processed slot=%s root=%s from peer %s",
452452
slot,

src/lean_spec/subspecs/validator/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def _sign_block(
405405
)
406406

407407
return SignedBlock(
408-
message=block,
408+
block=block,
409409
signature=signature,
410410
)
411411

tests/consensus/devnet/ssz/test_consensus_containers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def test_signed_block_minimal(ssz: SSZTestFiller) -> None:
297297
)
298298
ssz(
299299
type_name="SignedBlock",
300-
value=SignedBlock(message=block, signature=signature),
300+
value=SignedBlock(block=block, signature=signature),
301301
)
302302

303303

0 commit comments

Comments
 (0)