-
Notifications
You must be signed in to change notification settings - Fork 680
/
Copy pathconftest.py
50 lines (43 loc) · 1.45 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import pytest
from eth.beacon.db.chain import BeaconChainDB
from eth.beacon.state_machines.configs import BeaconConfig
from eth.beacon.state_machines.forks.serenity import (
SerenityStateMachine,
)
@pytest.fixture
def config(base_reward_quotient,
default_end_dynasty,
deposit_size,
cycle_length,
min_committee_size,
min_dynasty_length,
shard_count,
slot_duration,
sqrt_e_drop_time):
return BeaconConfig(
BASE_REWARD_QUOTIENT=base_reward_quotient,
DEFAULT_END_DYNASTY=default_end_dynasty,
DEPOSIT_SIZE=deposit_size,
CYCLE_LENGTH=cycle_length,
MIN_COMMITTEE_SIZE=min_committee_size,
MIN_DYNASTY_LENGTH=min_dynasty_length,
SHARD_COUNT=shard_count,
SLOT_DURATION=slot_duration,
SQRT_E_DROP_TIME=sqrt_e_drop_time,
)
@pytest.fixture
def fixture_sm_class(config):
return SerenityStateMachine.configure(
__name__='SerenityStateMachineForTesting',
config=config,
)
@pytest.fixture
def initial_chaindb(base_db,
genesis_block,
genesis_crystallized_state,
genesis_active_state):
chaindb = BeaconChainDB(base_db)
chaindb.persist_block(genesis_block)
chaindb.persist_crystallized_state(genesis_crystallized_state)
chaindb.persist_active_state(genesis_active_state, genesis_crystallized_state.hash)
return chaindb