31
31
Configurable ,
32
32
)
33
33
34
+ from eth .beacon .block_proposal import BlockProposal
34
35
from eth .beacon .db .chain import BaseBeaconChainDB
35
36
from eth .beacon .helpers import (
36
37
create_signing_message ,
@@ -379,9 +380,7 @@ def propose_block(
379
380
self ,
380
381
crystallized_state : CrystallizedState ,
381
382
active_state : ActiveState ,
382
- block : BaseBeaconBlock ,
383
- shard_id : int ,
384
- shard_block_hash : Hash32 ,
383
+ block_proposal : 'BlockProposal' ,
385
384
chaindb : BaseBeaconChainDB ,
386
385
config : BeaconConfig ,
387
386
private_key : int
@@ -392,7 +391,7 @@ def propose_block(
392
391
block , post_crystallized_state , post_active_state = self .process_block (
393
392
crystallized_state ,
394
393
active_state ,
395
- block ,
394
+ block_proposal . block ,
396
395
chaindb ,
397
396
config ,
398
397
)
@@ -402,13 +401,16 @@ def propose_block(
402
401
crystallized_state_root = post_crystallized_state .hash ,
403
402
active_state_root = post_active_state .hash ,
404
403
)
404
+ block_proposal = BlockProposal (
405
+ block = post_block ,
406
+ shard_id = block_proposal .shard_id ,
407
+ shard_block_hash = block_proposal .shard_block_hash ,
408
+ )
405
409
406
410
proposer_attestation = self .attest_proposed_block (
407
411
post_crystallized_state ,
408
412
post_active_state ,
409
- post_block ,
410
- shard_id ,
411
- shard_block_hash ,
413
+ block_proposal ,
412
414
chaindb ,
413
415
config .CYCLE_LENGTH ,
414
416
private_key ,
@@ -424,9 +426,7 @@ def _update_the_states(self,
424
426
def attest_proposed_block (self ,
425
427
post_crystallized_state : CrystallizedState ,
426
428
post_active_state : ActiveState ,
427
- block : BaseBeaconBlock ,
428
- shard_id : int ,
429
- shard_block_hash : Hash32 ,
429
+ block_proposal : 'BlockProposal' ,
430
430
chaindb : BaseBeaconChainDB ,
431
431
cycle_length : int ,
432
432
private_key : int ) -> 'AttestationRecord' :
@@ -436,7 +436,7 @@ def attest_proposed_block(self,
436
436
The proposer broadcasts their attestation with the proposed block.
437
437
"""
438
438
block_committees_info = get_block_committees_info (
439
- block ,
439
+ block_proposal . block ,
440
440
post_crystallized_state ,
441
441
cycle_length ,
442
442
)
@@ -453,14 +453,14 @@ def attest_proposed_block(self,
453
453
# Get signing message and sign it
454
454
parent_hashes = get_hashes_to_sign (
455
455
post_active_state .recent_block_hashes ,
456
- block ,
456
+ block_proposal . block ,
457
457
cycle_length ,
458
458
)
459
459
message = create_signing_message (
460
- block .slot_number ,
460
+ block_proposal . block .slot_number ,
461
461
parent_hashes ,
462
- shard_id ,
463
- shard_block_hash ,
462
+ block_proposal . shard_id ,
463
+ block_proposal . shard_block_hash ,
464
464
justified_slot ,
465
465
)
466
466
sigs = [
@@ -472,10 +472,10 @@ def attest_proposed_block(self,
472
472
aggregate_sig = bls .aggregate_sigs (sigs )
473
473
474
474
return self .get_attestation_record_class ()(
475
- slot = block .slot_number ,
476
- shard_id = shard_id ,
475
+ slot = block_proposal . block .slot_number ,
476
+ shard_id = block_proposal . shard_id ,
477
477
oblique_parent_hashes = (),
478
- shard_block_hash = shard_block_hash ,
478
+ shard_block_hash = block_proposal . shard_block_hash ,
479
479
attester_bitfield = attester_bitfield ,
480
480
justified_slot = justified_slot ,
481
481
justified_block_hash = justified_block_hash ,
0 commit comments