コード例 #1
0
def test_transition_with_non_empty_activation_queue(state, fork_epoch, spec,
                                                    post_spec, pre_tag,
                                                    post_tag):
    """
    Create some deposits before the transition
    """
    transition_until_fork(spec, state, fork_epoch)

    deposited_indices = set_some_new_deposits(spec,
                                              state,
                                              rng=random.Random(5566))

    assert spec.get_current_epoch(state) < fork_epoch
    assert len(deposited_indices) > 0
    for validator_index in deposited_indices:
        assert not spec.is_active_validator(state.validators[validator_index],
                                            spec.get_current_epoch(state))

    yield "pre", state

    # irregular state transition to handle fork:
    blocks = []
    state, block = do_fork(state, spec, post_spec, fork_epoch)
    blocks.append(post_tag(block))

    # continue regular state transition with new spec into next epoch
    transition_to_next_epoch_and_append_blocks(post_spec,
                                               state,
                                               post_tag,
                                               blocks,
                                               only_last_block=True)

    yield "blocks", blocks
    yield "post", state
コード例 #2
0
ファイル: rewards.py プロジェクト: benjaminion/eth2.0-specs
def run_test_with_not_yet_activated_validators(spec, state, rng=Random(5555)):
    set_some_new_deposits(spec, state, rng)
    cached_prepare_state_with_attestations(spec, state)

    yield from run_deltas(spec, state)