33 BeaconBlock ,
44)
55from dvspec .utils .types import (
6+ BLSSignature ,
7+ Bytes32 ,
68 AttestationDuty ,
79 ProposerDuty ,
810 SlashingDB ,
911)
10- from dvspec .utils .helpers import (
11- is_slashable_attestation_data ,
12- is_slashable_block ,
13- )
1412from dvspec .consensus import (
1513 consensus_is_valid_attestation_data ,
1614 consensus_is_valid_block ,
1715)
1816
1917from tests .helpers .eth_node_interface import (
2018 bn_produce_attestation_data ,
19+ bn_produce_block ,
2120)
2221
2322
@@ -35,16 +34,18 @@ def consensus_on_attestation(slashing_db: SlashingDB, attestation_duty: Attestat
3534 """
3635 # TODO: Use this method in tests instead of dvspec.consensus.consensus_on_attestation
3736 attestation_data = bn_produce_attestation_data (attestation_duty .slot , attestation_duty .committee_index )
38- assert consensus_is_valid_attestation_data (slashing_db , attestation_data )
37+ assert consensus_is_valid_attestation_data (slashing_db , attestation_data , attestation_duty )
3938 return attestation_data
4039
4140
42- def consensus_on_block (slashing_db : SlashingDB , proposer_duty : ProposerDuty ) -> AttestationData :
41+ def consensus_on_block (slashing_db : SlashingDB , proposer_duty : ProposerDuty ) -> BeaconBlock :
4342 """Consensus protocol between distributed validator nodes for block values.
4443 Returns the decided value.
4544 If this DV is the leader, it must use `bn_produce_block` for the proposed value.
4645 The consensus protocol must use `consensus_is_valid_block` to determine
4746 validity of the proposed block value.
4847 """
49- # TODO: Implement & use this method in tests instead of dvspec.consensus.consensus_on_block
50- pass
48+ # TODO: Use this method in tests instead of dvspec.consensus.consensus_on_block
49+ block = bn_produce_block (proposer_duty .slot , BLSSignature (0x00 ), Bytes32 (0x00 ))
50+ assert consensus_is_valid_block (slashing_db , block , proposer_duty )
51+ return block
0 commit comments