diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index f3e10c9be..d1371483a 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -591,7 +591,6 @@ Specifically, eth2 uses the `BLS_SIG_BLS12381G2-SHA256-SSWU-RO-_POP_` ciphersuit * `def Sign(SK: int, message: Bytes) -> BLSSignature` * `def Verify(PK: BLSPubkey, message: Bytes, signature: BLSSignature) -> bool` * `def Aggregate(signatures: Sequence[BLSSignature]) -> BLSSignature` -* `def bls_aggregate_pubkeys(PKs: Sequence[BLSPubkey]) -> BLSPubkey` * `def FastAggregateVerify(PKs: Sequence[BLSSignature], message: Bytes, signature: BLSSignature) -> bool` ### Predicates @@ -799,9 +798,9 @@ def compute_domain(domain_type: DomainType, fork_version: Version=Version()) -> ### `compute_domain_wrapper_root` ```python -def compute_domain_wrapper_root(object: SSZObject, domain: Domain) -> Root: +def compute_domain_wrapper_root(ssz_object: SSZObject, domain: Domain) -> Root: domain_wrapped_object = DomainWrapper( - root=hash_tree_root(object), + root=hash_tree_root(ssz_object), domain=domain, ) return hash_tree_root(domain_wrapped_object) @@ -1497,10 +1496,8 @@ def process_proposer_slashing(state: BeaconState, proposer_slashing: ProposerSla assert is_slashable_validator(proposer, get_current_epoch(state)) # Signatures are valid for signed_header in (proposer_slashing.signed_header_1, proposer_slashing.signed_header_2): - message = compute_domain_wrapper_root( - 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)) + message = compute_domain_wrapper_root(signed_header.message, domain) assert Verify(proposer.pubkey, message, signed_header.signature) slash_validator(state, proposer_slashing.proposer_index) diff --git a/specs/light_client/sync_protocol.md b/specs/light_client/sync_protocol.md index 05180516b..fd3fe2eb5 100644 --- a/specs/light_client/sync_protocol.md +++ b/specs/light_client/sync_protocol.md @@ -135,9 +135,10 @@ def update_memory(memory: LightClientMemory, update: LightClientUpdate) -> None: assert 3 * sum(filter(lambda i: update.aggregation_bits[i], balances)) > 2 * sum(balances) # Verify shard attestations - pubkey = bls_aggregate_pubkeys(filter(lambda i: update.aggregation_bits[i], pubkeys)) + pubkeys = filter(lambda i: update.aggregation_bits[i], pubkeys) domain = compute_domain(DOMAIN_SHARD_ATTESTER, update.fork_version) - assert bls_verify(pubkey, update.shard_block_root, update.signature, domain) + message = compute_domain_wrapper_root(update.shard_block_root, domain) + assert FastAggregateVerify(pubkey, message, update.signature) # Update period committees if entering a new period if next_period == current_period + 1: diff --git a/specs/validator/0_beacon-chain-validator.md b/specs/validator/0_beacon-chain-validator.md index 5e80e84a6..bb53946e0 100644 --- a/specs/validator/0_beacon-chain-validator.md +++ b/specs/validator/0_beacon-chain-validator.md @@ -312,7 +312,7 @@ def compute_new_state_root(state: BeaconState, block: BeaconBlock) -> Root: ```python def get_block_signature(state: BeaconState, header: BeaconBlockHeader, privkey: int) -> BLSSignature: domain = get_domain(state, DOMAIN_BEACON_PROPOSER, compute_epoch_at_slot(header.slot)) - message = compute_domain_wrapper_root(compute_epoch_at_slot(header), domain) + message = compute_domain_wrapper_root(header, domain) return Sign(privkey, message) ``` diff --git a/test_libs/pyspec/eth2spec/utils/bls.py b/test_libs/pyspec/eth2spec/utils/bls.py index 6aba2c35a..4b0ed6445 100644 --- a/test_libs/pyspec/eth2spec/utils/bls.py +++ b/test_libs/pyspec/eth2spec/utils/bls.py @@ -38,11 +38,6 @@ def FastAggregateVerify(PKs, message, signature): return bls.verify(pubkey=aggregate_pubkey, message_hash=message, signature=signature, domain=b'') -# @only_with_bls(alt_return=STUB_PUBKEY) -# def bls_aggregate_pubkeys(PKs): -# return bls.aggregate_pubkeys(PKs) - - @only_with_bls(alt_return=STUB_SIGNATURE) def Aggregate(signatures): return bls.aggregate_signatures(signatures) @@ -50,8 +45,7 @@ def Aggregate(signatures): @only_with_bls(alt_return=STUB_SIGNATURE) def Sign(SK, message): - return bls.sign(message_hash=message, privkey=SK, - domain=b'') + return bls.sign(message_hash=message, privkey=SK, domain=b'') @only_with_bls(alt_return=STUB_COORDINATES)