Add `test_key_validate_invalid_decompression`

This commit is contained in:
Hsiao-Wei Wang 2022-09-12 22:59:29 +08:00
parent e4407c64e3
commit 4d2cfff2d6
No known key found for this signature in database
GPG Key ID: AE3D6B174F971DE4
1 changed files with 17 additions and 1 deletions

View File

@ -237,7 +237,7 @@ def test_bad_merkle_proof(spec, state):
@with_all_phases @with_all_phases
@spec_state_test @spec_state_test
def test_key_validate_invalid(spec, state): def test_key_validate_invalid_subgroup(spec, state):
validator_index = len(state.validators) validator_index = len(state.validators)
amount = spec.MAX_EFFECTIVE_BALANCE amount = spec.MAX_EFFECTIVE_BALANCE
@ -247,3 +247,19 @@ def test_key_validate_invalid(spec, state):
deposit = prepare_state_and_deposit(spec, state, validator_index, amount, pubkey=pubkey, signed=True) deposit = prepare_state_and_deposit(spec, state, validator_index, amount, pubkey=pubkey, signed=True)
yield from run_deposit_processing(spec, state, deposit, validator_index) yield from run_deposit_processing(spec, state, deposit, validator_index)
@with_all_phases
@spec_state_test
def test_key_validate_invalid_decompression(spec, state):
validator_index = len(state.validators)
amount = spec.MAX_EFFECTIVE_BALANCE
# `deserialization_fails_infinity_with_true_b_flag` BLS G1 deserialization test case.
# This pubkey would not pass `bls.KeyValidate`, but `process_deposit` would not throw exception.
pubkey_hex = 'c01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
pubkey = bytes.fromhex(pubkey_hex)
deposit = prepare_state_and_deposit(spec, state, validator_index, amount, pubkey=pubkey, signed=True)
yield from run_deposit_processing(spec, state, deposit, validator_index)