File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ from eth_typing import (
2
+ Hash32 ,
3
+ )
4
+ import rlp
5
+
6
+ from eth .beacon .utils .hash import (
7
+ hash_eth2 ,
8
+ )
9
+ from eth .rlp .sedes import (
10
+ hash32 ,
11
+ uint24 ,
12
+ uint384 ,
13
+ uint64 ,
14
+ )
15
+
16
+
17
+ class ValidatorRegistryDeltaBlock (rlp .Serializable ):
18
+ """
19
+ Note: using RLP until we have standardized serialization format.
20
+ """
21
+ fields = [
22
+ ('latest_registry_delta_root' , hash32 ),
23
+ ('validator_index' , uint24 ),
24
+ ('pubkey' , uint384 ),
25
+ ('flag' , uint64 )
26
+ ]
27
+
28
+ def __init__ (self ,
29
+ latest_registry_delta_root : Hash32 ,
30
+ validator_index : int ,
31
+ pubkey : int ,
32
+ flag : int ) -> None :
33
+ super ().__init__ (
34
+ latest_registry_delta_root = latest_registry_delta_root ,
35
+ validator_index = validator_index ,
36
+ pubkey = pubkey ,
37
+ flag = flag ,
38
+ )
39
+
40
+ _hash = None
41
+
42
+ @property
43
+ def hash (self ) -> Hash32 :
44
+ if self ._hash is None :
45
+ self ._hash = hash_eth2 (rlp .encode (self ))
46
+ return self ._hash
47
+
48
+ @property
49
+ def root (self ) -> Hash32 :
50
+ # Alias of `hash`.
51
+ # Using flat hash, might change to SSZ tree hash.
52
+ return self .hash
You can’t perform that action at this time.
0 commit comments