Linting fixes
This commit is contained in:
parent
80eb721895
commit
c239ffb78c
|
@ -25,11 +25,10 @@ from eth2spec.utils.ssz.ssz_typing import (
|
||||||
Bytes1, Bytes4, Bytes8, Bytes32, Bytes48, Bytes96, Bitlist, Bitvector,
|
Bytes1, Bytes4, Bytes8, Bytes32, Bytes48, Bytes96, Bitlist, Bitvector,
|
||||||
)
|
)
|
||||||
from eth2spec.utils.bls import (
|
from eth2spec.utils.bls import (
|
||||||
Verify,
|
|
||||||
Sign,
|
Sign,
|
||||||
|
Verify,
|
||||||
Aggregate,
|
Aggregate,
|
||||||
FastAggregateVerify,
|
FastAggregateVerify,
|
||||||
bls_aggregate_pubkeys,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from eth2spec.utils.hash_function import hash
|
from eth2spec.utils.hash_function import hash
|
||||||
|
|
|
@ -1499,7 +1499,7 @@ def process_proposer_slashing(state: BeaconState, proposer_slashing: ProposerSla
|
||||||
message = compute_domain_wrapper_root(
|
message = compute_domain_wrapper_root(
|
||||||
object=signed_header.message,
|
object=signed_header.message,
|
||||||
domain=get_domain(state, DOMAIN_BEACON_PROPOSER, compute_epoch_at_slot(signed_header.message.slot)),
|
domain=get_domain(state, DOMAIN_BEACON_PROPOSER, compute_epoch_at_slot(signed_header.message.slot)),
|
||||||
)
|
)
|
||||||
assert Verify(proposer.pubkey, message, signed_header.signature)
|
assert Verify(proposer.pubkey, message, signed_header.signature)
|
||||||
|
|
||||||
slash_validator(state, proposer_slashing.proposer_index)
|
slash_validator(state, proposer_slashing.proposer_index)
|
||||||
|
|
|
@ -41,7 +41,7 @@ def apply_sig(spec, state, signed_block, proposer_index=None):
|
||||||
proposer_index = get_proposer_index_maybe(spec, state, block.slot, proposer_index)
|
proposer_index = get_proposer_index_maybe(spec, state, block.slot, proposer_index)
|
||||||
privkey = privkeys[proposer_index]
|
privkey = privkeys[proposer_index]
|
||||||
domain = spec.get_domain(state, spec.DOMAIN_BEACON_PROPOSER, spec.compute_epoch_at_slot(block.slot))
|
domain = spec.get_domain(state, spec.DOMAIN_BEACON_PROPOSER, spec.compute_epoch_at_slot(block.slot))
|
||||||
message = compute_domain_wrapper_root(block, domain)
|
message = spec.compute_domain_wrapper_root(block, domain)
|
||||||
|
|
||||||
signed_block.signature = Sign(privkey, message)
|
signed_block.signature = Sign(privkey, message)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from eth2spec.utils.bls import Sign
|
from eth2spec.utils.bls import Sign
|
||||||
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
|
||||||
|
|
||||||
|
|
||||||
def sign_block_header(spec, state, header, privkey):
|
def sign_block_header(spec, state, header, privkey):
|
||||||
|
|
|
@ -24,11 +24,10 @@ def sign_shard_attestation(spec, beacon_state, shard_state, block, participants)
|
||||||
privkey,
|
privkey,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return Aggregate(signatures)
|
return Aggregate(signatures)
|
||||||
|
|
||||||
|
|
||||||
def get_attestation_signature(spec, beacon_state, shard_state, message_hash, block_epoch, privkey):
|
def get_attestation_signature(spec, beacon_state, shard_state, message_hash, block_epoch, privkey):
|
||||||
domain=spec.get_domain(beacon_state, spec.DOMAIN_SHARD_ATTESTER, block_epoch)
|
domain = spec.get_domain(beacon_state, spec.DOMAIN_SHARD_ATTESTER, block_epoch)
|
||||||
message = spec.compute_domain_wrapper(message_hash, domain)
|
message = spec.compute_domain_wrapper(message_hash, domain)
|
||||||
return Sign(privkey, message)
|
return Sign(privkey, message)
|
||||||
|
|
|
@ -20,8 +20,7 @@ def sign_shard_block(spec, beacon_state, shard_state, block, proposer_index=None
|
||||||
proposer_index = spec.get_shard_proposer_index(beacon_state, shard_state.shard, block.slot)
|
proposer_index = spec.get_shard_proposer_index(beacon_state, shard_state.shard, block.slot)
|
||||||
|
|
||||||
privkey = privkeys[proposer_index]
|
privkey = privkeys[proposer_index]
|
||||||
|
domain = spec.get_domain(beacon_state, spec.DOMAIN_SHARD_PROPOSER, spec.compute_epoch_of_shard_slot(block.slot))
|
||||||
domain=spec.get_domain(beacon_state, spec.DOMAIN_SHARD_PROPOSER, compute_epoch_of_shard_slot(block.slot))
|
|
||||||
message = spec.compute_domain_wrapper(block, domain)
|
message = spec.compute_domain_wrapper(block, domain)
|
||||||
block.signature = Sign(privkey, message)
|
block.signature = Sign(privkey, message)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from eth2spec.utils.bls import Sign
|
from eth2spec.utils.bls import Sign
|
||||||
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
|
||||||
|
|
||||||
|
|
||||||
def sign_voluntary_exit(spec, state, voluntary_exit, privkey):
|
def sign_voluntary_exit(spec, state, voluntary_exit, privkey):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
|
||||||
from eth2spec.utils.bls import Sign
|
from eth2spec.utils.bls import Sign
|
||||||
|
|
||||||
from eth2spec.test.helpers.state import get_balance, state_transition_and_sign_block, next_slot
|
from eth2spec.test.helpers.state import get_balance, state_transition_and_sign_block, next_slot
|
||||||
|
|
|
@ -40,7 +40,7 @@ def FastAggregateVerify(PKs, message, signature):
|
||||||
|
|
||||||
@only_with_bls(alt_return=STUB_PUBKEY)
|
@only_with_bls(alt_return=STUB_PUBKEY)
|
||||||
def bls_aggregate_pubkeys(PKs):
|
def bls_aggregate_pubkeys(PKs):
|
||||||
return bls.aggregate_pubkeys(pubkeys)
|
return bls.aggregate_pubkeys(PKs)
|
||||||
|
|
||||||
|
|
||||||
@only_with_bls(alt_return=STUB_SIGNATURE)
|
@only_with_bls(alt_return=STUB_SIGNATURE)
|
||||||
|
|
Loading…
Reference in New Issue