Skip to content

Commit 43f28ea

Browse files
Bhargavasomuhwwhww
authored andcommitted
Add tests for validating proposer signature
1 parent 801b52e commit 43f28ea

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from eth.beacon.state_machines.validation import (
2+
validate_proposer_signature,
3+
)
4+
5+
from eth.beacon.types.blocks import BaseBeaconBlock
6+
from eth.beacon.types.states import BeaconState
7+
8+
from tests.beacon.helpers import mock_validator_record
9+
from tests.beacon.test_helpers import (
10+
get_sample_shard_committees_at_slots,
11+
)
12+
13+
14+
def test_validate_proposer_signature(
15+
beacon_chain_shard_number,
16+
epoch_length,
17+
sample_beacon_block_params,
18+
sample_beacon_state_params,
19+
sample_shard_committee_params):
20+
block = BaseBeaconBlock(**sample_beacon_block_params)
21+
state = BeaconState(**sample_beacon_state_params).copy(
22+
validator_registry=[
23+
mock_validator_record(
24+
pubkey=0,
25+
max_deposit=0,
26+
)
27+
for _ in range(10)
28+
],
29+
shard_committees_at_slots=get_sample_shard_committees_at_slots(
30+
num_slot=128,
31+
num_shard_committee_per_slot=10,
32+
sample_shard_committee_params=sample_shard_committee_params,
33+
),
34+
)
35+
36+
validate_proposer_signature(
37+
state,
38+
block,
39+
beacon_chain_shard_number,
40+
epoch_length,
41+
)

0 commit comments

Comments
 (0)