Ejemplo n.º 1
0
def test_determine_slashing_penalty(genesis_state, config, slots_per_epoch,
                                    current_epoch,
                                    epochs_per_slashed_balances_vector,
                                    total_penalties, total_balance,
                                    expected_penalty):
    state = genesis_state.copy(slot=get_epoch_start_slot(
        current_epoch, slots_per_epoch), )
    validator_index = 0
    penalty = _determine_slashing_penalty(
        total_penalties,
        total_balance,
        state.validators[validator_index].effective_balance,
        config.MIN_SLASHING_PENALTY_QUOTIENT,
    )
    assert penalty == expected_penalty
Ejemplo n.º 2
0
def test_determine_slashing_penalty(genesis_state, config, slots_per_epoch,
                                    current_epoch, epochs_per_slashings_vector,
                                    total_penalties, total_balance,
                                    expected_penalty):
    state = genesis_state.copy(slot=compute_start_slot_of_epoch(
        current_epoch, slots_per_epoch), )
    # if the size of the v-set changes then update the parameters above
    assert len(state.validators) == 10
    validator_index = 0
    penalty = _determine_slashing_penalty(
        total_penalties,
        total_balance,
        state.validators[validator_index].effective_balance,
        config.EFFECTIVE_BALANCE_INCREMENT,
    )
    assert penalty == expected_penalty