Skip to content
Closed
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
4 changes: 4 additions & 0 deletions specs/phase0/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,10 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
amount = deposit.data.amount
validator_pubkeys = [v.pubkey for v in state.validators]
if pubkey not in validator_pubkeys:
# Validate the public key which is not checked by the deposit contract
if not bls.KeyValidate(pubkey):
return

# Verify the deposit signature (proof of possession) which is not checked by the deposit contract
deposit_message = DepositMessage(
pubkey=deposit.data.pubkey,
Expand Down
11 changes: 11 additions & 0 deletions tests/core/pyspec/eth2spec/utils/bls.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ def Sign(SK, message):
return bls.Sign(SK.to_bytes(32, 'big'), message)


@only_with_bls(alt_return=True)
def KeyValidate(pubkey):
try:
# Fallback to py_ecc as milagro_bls_binding has no KeyValidate binding
result = py_ecc_bls.KeyValidate(pubkey)
except Exception:
result = False
finally:
return result


@only_with_bls(alt_return=STUB_COORDINATES)
def signature_to_G2(signature):
return _signature_to_G2(signature)
Expand Down