コード例 #1
0
def test_bad_merkle_proof(state):
    validator_index = len(state.validator_registry)
    amount = spec.MAX_EFFECTIVE_BALANCE
    deposit = prepare_state_and_deposit(state, validator_index, amount)

    # mess up merkle branch
    deposit.proof[-1] = spec.ZERO_HASH

    sign_deposit_data(state, deposit.data, privkeys[validator_index])

    yield from run_deposit_processing(state,
                                      deposit,
                                      validator_index,
                                      valid=False)
コード例 #2
0
def test_wrong_index(state):
    validator_index = len(state.validator_registry)
    amount = spec.MAX_EFFECTIVE_BALANCE
    deposit = prepare_state_and_deposit(state, validator_index, amount)

    # mess up deposit_index
    deposit.index = state.deposit_index + 1

    sign_deposit_data(state, deposit.data, privkeys[validator_index])

    yield from run_deposit_processing(state,
                                      deposit,
                                      validator_index,
                                      valid=False)
コード例 #3
0
def test_bad_merkle_proof(spec, state):
    validator_index = len(state.validators)
    amount = spec.MAX_EFFECTIVE_BALANCE
    deposit = prepare_state_and_deposit(spec, state, validator_index, amount)

    # mess up merkle branch
    deposit.proof[5] = spec.Bytes32()

    sign_deposit_data(spec,
                      deposit.data,
                      privkeys[validator_index],
                      state=state)

    yield from run_deposit_processing(spec,
                                      state,
                                      deposit,
                                      validator_index,
                                      valid=False)