18
18
get_block_root ,
19
19
get_domain ,
20
20
)
21
- from eth .utils import (
21
+ from eth ._utils import (
22
22
bls
23
23
)
24
- from eth .beacon .utils .hash import (
24
+ from eth .beacon ._utils .hash import (
25
25
hash_eth2 ,
26
26
)
27
27
from eth .beacon .types .states import BeaconState # noqa: F401
32
32
#
33
33
# Attestation validation
34
34
#
35
- def validate_attestation (state : BeaconState ,
36
- attestation : Attestation ,
37
- epoch_length : int ,
38
- min_attestation_inclusion_delay : int ,
39
- is_validating_signatures : bool = True ) -> None :
35
+ def validate_serenity_attestation (state : BeaconState ,
36
+ attestation : Attestation ,
37
+ epoch_length : int ,
38
+ min_attestation_inclusion_delay : int ,
39
+ is_validating_signatures : bool = True ) -> None :
40
40
"""
41
41
Validate the given ``attestation``.
42
42
Raise ``ValidationError`` if it's invalid.
43
43
"""
44
44
45
- validate_attestation_slot (
46
- attestation_data = attestation .data ,
47
- current_slot = state .slot ,
48
- epoch_length = epoch_length ,
49
- min_attestation_inclusion_delay = min_attestation_inclusion_delay ,
45
+ validate_serenity_attestation_slot (
46
+ attestation .data ,
47
+ state .slot ,
48
+ epoch_length ,
49
+ min_attestation_inclusion_delay ,
50
50
)
51
51
52
- validate_attestation_justified_slot (
53
- attestation_data = attestation .data ,
54
- current_slot = state .slot ,
55
- previous_justified_slot = state .previous_justified_slot ,
56
- justified_slot = state .justified_slot ,
57
- epoch_length = epoch_length ,
52
+ validate_serenity_attestation_justified_slot (
53
+ attestation .data ,
54
+ state .slot ,
55
+ state .previous_justified_slot ,
56
+ state .justified_slot ,
57
+ epoch_length ,
58
58
)
59
59
60
- validate_attestation_justified_block_root (
61
- attestation_data = attestation .data ,
60
+ validate_serenity_attestation_justified_block_root (
61
+ attestation .data ,
62
62
justified_block_root = get_block_root (
63
63
state .latest_block_roots ,
64
64
current_slot = state .slot ,
65
65
slot = attestation .data .justified_slot ,
66
66
),
67
67
)
68
68
69
- validate_attestation_latest_crosslink_root (
70
- attestation_data = attestation .data ,
69
+ validate_serenity_attestation_latest_crosslink_root (
70
+ attestation .data ,
71
71
latest_crosslink_shard_block_root = (
72
72
state .latest_crosslinks [attestation .data .shard ].shard_block_root
73
73
),
74
74
)
75
75
76
- validate_attestation_shard_block_root ( attestation_data = attestation .data )
76
+ validate_serenity_attestation_shard_block_root ( attestation .data )
77
77
78
78
if is_validating_signatures :
79
- validate_attestation_aggregate_signature (
79
+ validate_serenity_attestation_aggregate_signature (
80
80
state ,
81
81
attestation ,
82
82
)
83
83
84
84
85
- def validate_attestation_slot (attestation_data : AttestationData ,
86
- current_slot : int ,
87
- epoch_length : int ,
88
- min_attestation_inclusion_delay : int ) -> None :
85
+ def validate_serenity_attestation_slot (attestation_data : AttestationData ,
86
+ current_slot : int ,
87
+ epoch_length : int ,
88
+ min_attestation_inclusion_delay : int ) -> None :
89
89
"""
90
90
Validate ``slot`` field of ``attestation_data``.
91
91
Raise ``ValidationError`` if it's invalid.
@@ -114,11 +114,11 @@ def validate_attestation_slot(attestation_data: AttestationData,
114
114
)
115
115
116
116
117
- def validate_attestation_justified_slot (attestation_data : AttestationData ,
118
- current_slot : int ,
119
- previous_justified_slot : int ,
120
- justified_slot : int ,
121
- epoch_length : int ) -> None :
117
+ def validate_serenity_attestation_justified_slot (attestation_data : AttestationData ,
118
+ current_slot : int ,
119
+ previous_justified_slot : int ,
120
+ justified_slot : int ,
121
+ epoch_length : int ) -> None :
122
122
"""
123
123
Validate ``justified_slot`` field of ``attestation_data``.
124
124
Raise ``ValidationError`` if it's invalid.
@@ -141,8 +141,8 @@ def validate_attestation_justified_slot(attestation_data: AttestationData,
141
141
)
142
142
143
143
144
- def validate_attestation_justified_block_root (attestation_data : AttestationData ,
145
- justified_block_root : Hash32 ) -> None :
144
+ def validate_serenity_attestation_justified_block_root (attestation_data : AttestationData ,
145
+ justified_block_root : Hash32 ) -> None :
146
146
"""
147
147
Validate ``justified_block_root`` field of ``attestation_data``.
148
148
Raise ``ValidationError`` if it's invalid.
@@ -160,8 +160,8 @@ def validate_attestation_justified_block_root(attestation_data: AttestationData,
160
160
)
161
161
162
162
163
- def validate_attestation_latest_crosslink_root (attestation_data : AttestationData ,
164
- latest_crosslink_shard_block_root : Hash32 ) -> None :
163
+ def validate_serenity_attestation_latest_crosslink_root (attestation_data : AttestationData ,
164
+ latest_crosslink_shard_block_root : Hash32 ) -> None :
165
165
"""
166
166
Validate that either the ``latest_crosslink_root`` or ``shard_block_root``
167
167
field of ``attestation_data`` is the provided ``latest_crosslink_shard_block_root``.
@@ -184,7 +184,7 @@ def validate_attestation_latest_crosslink_root(attestation_data: AttestationData
184
184
)
185
185
186
186
187
- def validate_attestation_shard_block_root (attestation_data : AttestationData ) -> None :
187
+ def validate_serenity_attestation_shard_block_root (attestation_data : AttestationData ) -> None :
188
188
"""
189
189
Validate ``shard_block_root`` field of `attestation_data`.
190
190
Raise ``ValidationError`` if it's invalid.
@@ -203,9 +203,9 @@ def validate_attestation_shard_block_root(attestation_data: AttestationData) ->
203
203
)
204
204
205
205
206
- def validate_attestation_aggregate_signature (state : BeaconState ,
207
- attestation : Attestation ,
208
- epoch_length : int ) -> None :
206
+ def validate_serenity_attestation_aggregate_signature (state : BeaconState ,
207
+ attestation : Attestation ,
208
+ epoch_length : int ) -> None :
209
209
"""
210
210
Validate ``aggregate_signature`` field of ``attestation``.
211
211
Raise ``ValidationError`` if it's invalid.
0 commit comments