Skip to content

Commit d254d9c

Browse files
committed
Merge branch 'master' into attestation-validation
2 parents fb1d9e7 + 39f8d42 commit d254d9c

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

eth/beacon/state_machines/configs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
('BLS_WITHDRAWAL_PREFIX_BYTE', bytes),
2020
('MAX_CASPER_VOTES', int),
2121
('LATEST_BLOCK_ROOTS_LENGTH', int),
22+
('LATEST_RANDAO_MIXES_LENGTH', int),
2223
# EMPTY_SIGNATURE is defined in constants.py
2324
# Deposit contract
2425
('DEPOSIT_CONTRACT_ADDRESS', Address),

eth/beacon/state_machines/forks/serenity/configs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
BLS_WITHDRAWAL_PREFIX_BYTE=b'\x00',
1515
MAX_CASPER_VOTES=2**10, # (= 1,024) votes
1616
LATEST_BLOCK_ROOTS_LENGTH=2**13, # (= 8,192) block roots
17+
LATEST_RANDAO_MIXES_LENGTH=2**13, # (= 8,192) randao mixes
1718
# Deposit contract
1819
DEPOSIT_CONTRACT_ADDRESS=ZERO_ADDRESS, # TBD
1920
DEPOSIT_CONTRACT_TREE_DEPTH=2**5, # (= 32)

eth/beacon/types/states.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class BeaconState(rlp.Serializable):
5050
('validator_registry_delta_chain_tip', hash32), # For light clients to easily track delta
5151

5252
# Randomness and committees
53-
('randao_mix', hash32),
54-
('next_seed', hash32),
53+
('latest_randao_mixes', CountableList(hash32)),
54+
('latest_vdf_outputs', CountableList(hash32)),
5555
('shard_committees_at_slots', CountableList(CountableList((ShardCommittee)))),
5656
('persistent_committees', CountableList(CountableList(uint24))),
5757
('persistent_committee_reassignments', CountableList(ShardReassignmentRecord)),
@@ -82,15 +82,15 @@ def __init__(
8282
validator_registry_latest_change_slot: int,
8383
validator_registry_exit_count: int,
8484
validator_registry_delta_chain_tip: Hash32,
85-
randao_mix: Hash32,
86-
next_seed: Hash32,
8785
previous_justified_slot: int,
8886
justified_slot: int,
8987
justification_bitfield: int,
9088
finalized_slot: int,
9189
processed_pow_receipt_root: Hash32,
9290
validator_registry: Sequence[ValidatorRecord]=(),
9391
validator_balances: Sequence[int]=(),
92+
latest_randao_mixes: Sequence[Hash32]=(),
93+
latest_vdf_outputs: Sequence[Hash32]=(),
9494
shard_committees_at_slots: Sequence[Sequence[ShardCommittee]]=(),
9595
persistent_committees: Sequence[Sequence[int]]=(),
9696
persistent_committee_reassignments: Sequence[ShardReassignmentRecord]=(),
@@ -113,8 +113,8 @@ def __init__(
113113
validator_registry_exit_count=validator_registry_exit_count,
114114
validator_registry_delta_chain_tip=validator_registry_delta_chain_tip,
115115
# Randomness and committees
116-
randao_mix=randao_mix,
117-
next_seed=next_seed,
116+
latest_randao_mixes=latest_randao_mixes,
117+
latest_vdf_outputs=latest_vdf_outputs,
118118
shard_committees_at_slots=shard_committees_at_slots,
119119
persistent_committees=persistent_committees,
120120
persistent_committee_reassignments=persistent_committee_reassignments,

tests/beacon/conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ def sample_beacon_state_params(sample_fork_data_params):
151151
'validator_registry_latest_change_slot': 10,
152152
'validator_registry_exit_count': 10,
153153
'validator_registry_delta_chain_tip': b'\x55' * 32,
154-
'randao_mix': ZERO_HASH32,
155-
'next_seed': ZERO_HASH32,
154+
'latest_randao_mixes': (),
155+
'latest_vdf_outputs': (),
156156
'shard_committees_at_slots': (),
157157
'persistent_committees': (),
158158
'persistent_committee_reassignments': (),
@@ -386,6 +386,11 @@ def latest_block_roots_length():
386386
return SERENITY_CONFIG.LATEST_BLOCK_ROOTS_LENGTH
387387

388388

389+
@pytest.fixture
390+
def latest_randao_mixes_length():
391+
return SERENITY_CONFIG.LATEST_RANDAO_MIXES_LENGTH
392+
393+
389394
@pytest.fixture
390395
def deposit_contract_address():
391396
return SERENITY_CONFIG.DEPOSIT_CONTRACT_ADDRESS

tests/beacon/state_machines/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def config(
1616
bls_withdrawal_prefix_byte,
1717
max_casper_votes,
1818
latest_block_roots_length,
19+
latest_randao_mixes_length,
1920
deposit_contract_address,
2021
deposit_contract_tree_depth,
2122
min_deposit,
@@ -49,6 +50,7 @@ def config(
4950
BLS_WITHDRAWAL_PREFIX_BYTE=bls_withdrawal_prefix_byte,
5051
MAX_CASPER_VOTES=max_casper_votes,
5152
LATEST_BLOCK_ROOTS_LENGTH=latest_block_roots_length,
53+
LATEST_RANDAO_MIXES_LENGTH=latest_randao_mixes_length,
5254
DEPOSIT_CONTRACT_ADDRESS=deposit_contract_address,
5355
DEPOSIT_CONTRACT_TREE_DEPTH=deposit_contract_tree_depth,
5456
MIN_DEPOSIT=min_deposit,

tests/beacon/state_machines/test_validation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def test_validate_proposer_signature(
5050

5151
state = BeaconState(**sample_beacon_state_params).copy(
5252
validator_registry=[
53-
mock_validator_record(
54-
pubkey=proposer_pubkey,
55-
)
53+
mock_validator_record(proposer_pubkey)
5654
for _ in range(10)
5755
],
5856
shard_committees_at_slots=get_sample_shard_committees_at_slots(

tests/beacon/types/test_states.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def empty_beacon_state():
3434
validator_registry_latest_change_slot=10,
3535
validator_registry_exit_count=10,
3636
validator_registry_delta_chain_tip=b'\x55' * 32,
37-
randao_mix=b'\x55' * 32,
38-
next_seed=b'\x55' * 32,
37+
latest_randao_mixes=(),
38+
latest_vdf_outputs=(),
3939
shard_committees_at_slots=(),
4040
persistent_committees=(),
4141
persistent_committee_reassignments=(),
@@ -74,7 +74,7 @@ def test_num_validators(expected,
7474
],
7575
validator_balances=(
7676
max_deposit
77-
for _ in range(10)
77+
for _ in range(expected)
7878
)
7979
)
8080

0 commit comments

Comments
 (0)