diff --git a/tests/core/pyspec/eth_consensus_specs/test/helpers/deposits.py b/tests/core/pyspec/eth_consensus_specs/test/helpers/deposits.py index c609e9a5e54..9040d05446b 100644 --- a/tests/core/pyspec/eth_consensus_specs/test/helpers/deposits.py +++ b/tests/core/pyspec/eth_consensus_specs/test/helpers/deposits.py @@ -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): diff --git a/tests/core/pyspec/eth_consensus_specs/utils/bls.py b/tests/core/pyspec/eth_consensus_specs/utils/bls.py index b077d610065..d0ce13030c7 100644 --- a/tests/core/pyspec/eth_consensus_specs/utils/bls.py +++ b/tests/core/pyspec/eth_consensus_specs/utils/bls.py @@ -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