Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def sign_deposit_data(spec, deposit_data, privkey, fork_version=None):
else:
domain = spec.compute_domain(spec.DOMAIN_DEPOSIT)
signing_root = spec.compute_signing_root(deposit_message, domain)
deposit_data.signature = bls.Sign(privkey, signing_root)
# Real signature even with BLS verification disabled, its validity is state data
deposit_data.signature = bls.SignUnconditionally(privkey, signing_root)


def build_deposit(spec, deposit_data_list, pubkey, privkey, amount, withdrawal_credentials, signed):
Expand Down
13 changes: 11 additions & 2 deletions tests/core/pyspec/eth_consensus_specs/utils/bls.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,21 @@ def Aggregate(signatures):
return aggregate.to_compressed_bytes()


@only_with_bls(alt_return=STUB_SIGNATURE)
def Sign(SK, message):
# Deposit signatures must be computed even when BLS is inactive: unlike other
# signatures, an invalid deposit signature causes the deposit to be ignored
# rather than failing the state transition, so its validity is reflected in
# the beacon state, which clients must be able to reproduce regardless of the
# `bls_setting` in use.
def SignUnconditionally(SK, message):
signature_point = _hash_to_G2(message) * _sk_to_scalar(SK)
return signature_point.to_compressed_bytes()


@only_with_bls(alt_return=STUB_SIGNATURE)
def Sign(SK, message):
return SignUnconditionally(SK, message)


# Pubkey aggregation must be computed even when BLS is inactive: unlike
# signature verification, its result is data written into the beacon state
# (e.g. `next_sync_committee.aggregate_pubkey`), which clients must be able
Expand Down