def test_validate_deposit_proof(config, keymap, pubkeys,
                                deposit_contract_tree_depth, genesis_state,
                                success):
    state = genesis_state
    withdrawal_credentials = b"\x34" * 32
    state, deposit = create_mock_deposit(state, pubkeys[0], keymap,
                                         withdrawal_credentials, config)

    if success:
        validate_deposit_proof(state, deposit, deposit_contract_tree_depth)
    else:
        deposit = deposit.transform(("data", "withdrawal_credentials"),
                                    b"\x23" * 32)
        with pytest.raises(ValidationError):
            validate_deposit_proof(state, deposit, deposit_contract_tree_depth)
def test_validate_deposit_proof(config, keymap, pubkeys,
                                deposit_contract_tree_depth, genesis_state,
                                success):
    state = genesis_state
    withdrawal_credentials = b'\x34' * 32
    state, deposit = create_mock_deposit(
        state,
        pubkeys[0],
        keymap,
        withdrawal_credentials,
        config,
    )

    if success:
        validate_deposit_proof(state, deposit, deposit_contract_tree_depth)
    else:
        deposit = deposit.copy(
            data=deposit.data.copy(withdrawal_credentials=b'\x23' * 32, ))
        with pytest.raises(ValidationError):
            validate_deposit_proof(state, deposit, deposit_contract_tree_depth)
Exemple #3
0
def test_validate_deposit_proof(config, sample_beacon_state_params, keymap,
                                pubkeys, deposit_contract_tree_depth,
                                deposit_index, success):
    validator_index = 0
    withdrawal_credentials = b'\x34' * 32
    state, deposit = create_mock_deposit(
        config,
        sample_beacon_state_params,
        keymap,
        pubkeys,
        withdrawal_credentials,
        validator_index,
    )
    deposit = deposit.copy(index=deposit_index, )

    if success:
        validate_deposit_proof(state, deposit, deposit_contract_tree_depth)
    else:
        with pytest.raises(ValidationError):
            validate_deposit_proof(state, deposit, deposit_contract_tree_depth)