Example #1
0
def test_get_genesis_crystallized_state(genesis_validators,
                                        init_shuffling_seed,
                                        config):
    crystallized_state = get_genesis_crystallized_state(
        genesis_validators,
        init_shuffling_seed,
        config,
    )
    len_shard_and_committee_for_slots = config['cycle_length'] * 2
    total_deposits = config['deposit_size'] * len(genesis_validators)

    assert crystallized_state.validators == genesis_validators
    assert crystallized_state.last_state_recalc == 0
    assert len(crystallized_state.shard_and_committee_for_slots) == \
        len_shard_and_committee_for_slots
    assert crystallized_state.last_justified_slot == 0
    assert crystallized_state.justified_streak == 0
    assert crystallized_state.last_finalized_slot == 0
    assert crystallized_state.current_dynasty == 1
    assert len(crystallized_state.crosslink_records) == config['shard_count']
    for crosslink in crystallized_state.crosslink_records:
        assert crosslink.hash == ZERO_HASH32
        assert crosslink.slot == 0
        assert crosslink.dynasty == 0
    assert crystallized_state.total_deposits == total_deposits
    assert crystallized_state.dynasty_seed == init_shuffling_seed
    assert crystallized_state.dynasty_start == 0
Example #2
0
def genesis_crystallized_state(genesis_validators, init_shuffling_seed,
                               config):
    return get_genesis_crystallized_state(
        genesis_validators,
        init_shuffling_seed,
        config,
    )
Example #3
0
def test_get_genesis_crystallized_state(genesis_validators,
                                        init_shuffling_seed, config):
    crystallized_state = get_genesis_crystallized_state(
        genesis_validators,
        init_shuffling_seed,
        config,
    )
    len_indices_for_slots = config['cycle_length'] * 2
    total_deposits = config['deposit_size'] * len(genesis_validators)

    assert crystallized_state.validators == genesis_validators
    assert crystallized_state.last_state_recalc == 0
    assert len(crystallized_state.indices_for_slots) == len_indices_for_slots
    assert crystallized_state.last_justified_slot == 0
    assert crystallized_state.justified_streak == 0
    assert crystallized_state.last_finalized_slot == 0
    assert crystallized_state.current_dynasty == 1
    assert crystallized_state.crosslinking_start_shard == 0
    assert len(crystallized_state.crosslink_records) == config['shard_count']
    assert crystallized_state.total_deposits == total_deposits
    assert crystallized_state.dynasty_seed == init_shuffling_seed
    assert crystallized_state.dynasty_seed_last_reset == 1