Skip to content

Commit a3a8cc8

Browse files
committed
Fix test_num_validators
1 parent de0570f commit a3a8cc8

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

tests/beacon/helpers.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from eth.beacon.enums.validator_status_codes import (
2+
ValidatorStatusCode,
3+
)
14
from eth.beacon.types.validator_records import (
25
ValidatorRecord,
36
)
@@ -6,14 +9,16 @@
69
)
710

811

9-
def mock_validator_record(pubkey, deposit_size, default_end_dynasty, start_dynasty=0):
12+
def mock_validator_record(pubkey, deposit_size):
1013
return ValidatorRecord(
1114
pubkey=pubkey,
1215
withdrawal_credentials=b'\x44' * 32,
1316
randao_commitment=b'\x55' * 32,
17+
randao_skips=0,
1418
balance=deposit_size,
15-
start_dynasty=start_dynasty,
16-
end_dynasty=default_end_dynasty
19+
status=ValidatorStatusCode.ACTIVE,
20+
last_status_change_slot=0,
21+
exit_seq=0,
1722
)
1823

1924

tests/beacon/types/test_states.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
blake,
1616
)
1717

18-
# from tests.beacon.helpers import (
19-
# mock_validator_record,
20-
# )
18+
from tests.beacon.helpers import (
19+
mock_validator_record,
20+
)
2121

2222

2323
@pytest.fixture
@@ -56,28 +56,24 @@ def test_defaults(sample_beacon_state_params):
5656
assert state.validators == sample_beacon_state_params['validators']
5757

5858

59-
@pytest.mark.xfail(reason="Need to be fixed when helper function is updated")
6059
@pytest.mark.parametrize(
61-
'expected', [(0), (1), (5)]
60+
'expected', [(0), (1)]
6261
)
6362
def test_num_validators(expected,
6463
deposit_size,
65-
default_end_dynasty,
66-
empty_crystallized_state):
64+
empty_beacon_state):
6765
validators = [
6866
mock_validator_record(
6967
pubkey,
7068
deposit_size,
71-
default_end_dynasty,
72-
start_dynasty=0,
7369
)
7470
for pubkey in range(expected)
7571
]
76-
crystallized_state = empty_crystallized_state.copy(
72+
state = empty_beacon_state.copy(
7773
validators=validators,
7874
)
7975

80-
assert crystallized_state.num_validators == expected
76+
assert state.num_validators == expected
8177

8278

8379
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)