Compact `get_domain` calls

This commit is contained in:
Carl Beekhuizen 2019-07-01 01:06:27 +02:00
parent ca731d32cf
commit 7ef98f7478
No known key found for this signature in database
GPG Key ID: D05CA176D0020646
1 changed files with 3 additions and 15 deletions

View File

@ -217,11 +217,7 @@ def get_epoch_signature(state: BeaconState, block: BeaconBlock, privkey: int) ->
return bls_sign( return bls_sign(
privkey=privkey, # privkey stored locally privkey=privkey, # privkey stored locally
message_hash=hash_tree_root(slot_to_epoch(block.slot)), message_hash=hash_tree_root(slot_to_epoch(block.slot)),
domain=get_domain( domain=get_domain(state, DOMAIN_RANDAO, slot_to_epoch(block.slot))
state=state,
domain_type=DOMAIN_RANDAO,
message_epoch=slot_to_epoch(block.slot),
)
) )
``` ```
@ -258,11 +254,7 @@ def get_block_signature(state: BeaconState, header: BeaconBlockHeader, privkey:
return bls_sign( return bls_sign(
privkey=privkey, # privkey stored locally privkey=privkey, # privkey stored locally
message_hash=signing_root(header), message_hash=signing_root(header),
domain=get_domain( domain=get_domain(state, DOMAIN_BEACON_PROPOSER, slot_to_epoch(header.slot))
state=state,
domain_type=DOMAIN_BEACON_PROPOSER,
message_epoch=slot_to_epoch(header.slot),
)
) )
``` ```
@ -364,11 +356,7 @@ def get_signed_attestation_data(state: BeaconState, attestation: IndexedAttestat
return bls_sign( return bls_sign(
privkey=privkey, # privkey stored locally privkey=privkey, # privkey stored locally
message_hash=hash_tree_root(attestation_data_and_custody_bit), message_hash=hash_tree_root(attestation_data_and_custody_bit),
domain=get_domain( domain=get_domain(state, DOMAIN_ATTESTATION, attestation.data.target.epoch)
state=state,
domain_type=DOMAIN_ATTESTATION,
message_epoch=attestation.data.target.epoch,
)
) )
``` ```