From c239ffb78cf2cfc2bf2cafbce2dcfda82f3151aa Mon Sep 17 00:00:00 2001 From: Carl Beekhuizen Date: Tue, 17 Dec 2019 12:30:46 +0200 Subject: [PATCH] Linting fixes --- scripts/build_spec.py | 3 +-- specs/core/0_beacon-chain.md | 2 +- test_libs/pyspec/eth2spec/test/helpers/block.py | 2 +- test_libs/pyspec/eth2spec/test/helpers/block_header.py | 1 - test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py | 3 +-- test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py | 3 +-- test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py | 1 - test_libs/pyspec/eth2spec/test/sanity/test_blocks.py | 1 - test_libs/pyspec/eth2spec/utils/bls.py | 2 +- 9 files changed, 6 insertions(+), 12 deletions(-) diff --git a/scripts/build_spec.py b/scripts/build_spec.py index 0baa487c3e..caae39533e 100644 --- a/scripts/build_spec.py +++ b/scripts/build_spec.py @@ -25,11 +25,10 @@ Bytes1, Bytes4, Bytes8, Bytes32, Bytes48, Bytes96, Bitlist, Bitvector, ) from eth2spec.utils.bls import ( - Verify, Sign, + Verify, Aggregate, FastAggregateVerify, - bls_aggregate_pubkeys, ) from eth2spec.utils.hash_function import hash diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 271be3ef77..f2dd8d96c0 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1499,7 +1499,7 @@ def process_proposer_slashing(state: BeaconState, proposer_slashing: ProposerSla message = compute_domain_wrapper_root( object=signed_header.message, domain=get_domain(state, DOMAIN_BEACON_PROPOSER, compute_epoch_at_slot(signed_header.message.slot)), - ) + ) assert Verify(proposer.pubkey, message, signed_header.signature) slash_validator(state, proposer_slashing.proposer_index) diff --git a/test_libs/pyspec/eth2spec/test/helpers/block.py b/test_libs/pyspec/eth2spec/test/helpers/block.py index 2dac70d8dd..6d22dd5453 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/block.py +++ b/test_libs/pyspec/eth2spec/test/helpers/block.py @@ -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) privkey = privkeys[proposer_index] 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) diff --git a/test_libs/pyspec/eth2spec/test/helpers/block_header.py b/test_libs/pyspec/eth2spec/test/helpers/block_header.py index 5f439b6a2b..926cebee9b 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/block_header.py +++ b/test_libs/pyspec/eth2spec/test/helpers/block_header.py @@ -1,5 +1,4 @@ from eth2spec.utils.bls import Sign -from eth2spec.utils.ssz.ssz_impl import hash_tree_root def sign_block_header(spec, state, header, privkey): diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py b/test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py index c6983e71bf..cbb6cde754 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py +++ b/test_libs/pyspec/eth2spec/test/helpers/phase1/attestations.py @@ -24,11 +24,10 @@ def sign_shard_attestation(spec, beacon_state, shard_state, block, participants) privkey, ) ) - return Aggregate(signatures) 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) return Sign(privkey, message) diff --git a/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py b/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py index d8a4bcc60a..b0fe39209a 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py +++ b/test_libs/pyspec/eth2spec/test/helpers/phase1/shard_block.py @@ -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) privkey = privkeys[proposer_index] - - domain=spec.get_domain(beacon_state, spec.DOMAIN_SHARD_PROPOSER, compute_epoch_of_shard_slot(block.slot)) + domain = spec.get_domain(beacon_state, spec.DOMAIN_SHARD_PROPOSER, spec.compute_epoch_of_shard_slot(block.slot)) message = spec.compute_domain_wrapper(block, domain) block.signature = Sign(privkey, message) diff --git a/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py b/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py index 4f9fc7c30e..5c88f07e6f 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py +++ b/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py @@ -1,5 +1,4 @@ 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): diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py index c13bab9032..8103f7be2d 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py @@ -1,6 +1,5 @@ from copy import deepcopy -from eth2spec.utils.ssz.ssz_impl import hash_tree_root from eth2spec.utils.bls import Sign from eth2spec.test.helpers.state import get_balance, state_transition_and_sign_block, next_slot diff --git a/test_libs/pyspec/eth2spec/utils/bls.py b/test_libs/pyspec/eth2spec/utils/bls.py index 580d4e75b7..e5f6d8d00e 100644 --- a/test_libs/pyspec/eth2spec/utils/bls.py +++ b/test_libs/pyspec/eth2spec/utils/bls.py @@ -40,7 +40,7 @@ def FastAggregateVerify(PKs, message, signature): @only_with_bls(alt_return=STUB_PUBKEY) def bls_aggregate_pubkeys(PKs): - return bls.aggregate_pubkeys(pubkeys) + return bls.aggregate_pubkeys(PKs) @only_with_bls(alt_return=STUB_SIGNATURE)