Skip to content

Commit c8b5f09

Browse files
Bhargavasomuhwwhww
authored andcommitted
Make block_without_signature_root as property of Beacon Block
1 parent 90b4d4f commit c8b5f09

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

eth/beacon/state_machines/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def validate_proposer_signature(state: BeaconState,
2828
block: BaseBeaconBlock,
2929
beacon_chain_shard_number: int,
3030
epoch_length: int) -> None:
31-
block_without_signature_root = BaseBeaconBlock.get_block_without_signature_root(block)
31+
block_without_signature_root = block.block_without_signature_root
3232

3333
# TODO: Replace this root with tree hash root
3434
proposal_root = ProposalSignedData(

eth/beacon/types/blocks.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ def root(self) -> Hash32:
114114
def num_attestations(self) -> int:
115115
return len(self.body.attestations)
116116

117-
@classmethod
118-
def get_block_without_signature_root(
119-
cls,
120-
block: 'BaseBeaconBlock') -> Hash32:
121-
return block.copy(
117+
@property
118+
def block_without_signature_root(self) -> Hash32:
119+
return self.copy(
122120
signature=EMPTY_SIGNATURE
123121
).root

tests/beacon/state_machines/test_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_validate_proposer_signature(
6464
)
6565

6666
default_block = BaseBeaconBlock(**sample_beacon_block_params)
67-
empty_signature_block_root = BaseBeaconBlock.get_block_without_signature_root(default_block)
67+
empty_signature_block_root = default_block.block_without_signature_root
6868

6969
proposal_root = ProposalSignedData(
7070
state.slot,

0 commit comments

Comments
 (0)