14
14
hash32 ,
15
15
uint384 ,
16
16
)
17
+ from eth .beacon .utils .hash import hash_eth2
17
18
18
19
19
20
class DepositInput (rlp .Serializable ):
@@ -23,12 +24,12 @@ class DepositInput(rlp.Serializable):
23
24
fields = [
24
25
# BLS pubkey
25
26
('pubkey' , uint384 ),
26
- # BLS proof of possession (a BLS signature)
27
- ('proof_of_possession' , CountableList (uint384 )),
28
27
# Withdrawal credentials
29
28
('withdrawal_credentials' , hash32 ),
30
29
# Initial RANDAO commitment
31
30
('randao_commitment' , hash32 ),
31
+ # BLS proof of possession (a BLS signature)
32
+ ('proof_of_possession' , CountableList (uint384 )),
32
33
]
33
34
34
35
def __init__ (self ,
@@ -37,8 +38,16 @@ def __init__(self,
37
38
randao_commitment : Hash32 ,
38
39
proof_of_possession : Sequence [int ]= (0 , 0 )) -> None :
39
40
super ().__init__ (
40
- pubkey ,
41
- proof_of_possession ,
42
- withdrawal_credentials ,
43
- randao_commitment ,
41
+ pubkey = pubkey ,
42
+ withdrawal_credentials = withdrawal_credentials ,
43
+ randao_commitment = randao_commitment ,
44
+ proof_of_possession = proof_of_possession ,
44
45
)
46
+
47
+ _root = None
48
+
49
+ @property
50
+ def root (self ) -> Hash32 :
51
+ if self ._root is None :
52
+ self ._root = hash_eth2 (rlp .encode (self ))
53
+ return self ._root
0 commit comments