Skip to content

Commit e0e23c2

Browse files
committed
Fix DepositInput
1 parent 9c0ada5 commit e0e23c2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

eth/beacon/types/deposit_input.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
hash32,
1515
uint384,
1616
)
17+
from eth.beacon.utils.hash import hash_eth2
1718

1819

1920
class DepositInput(rlp.Serializable):
@@ -23,12 +24,12 @@ class DepositInput(rlp.Serializable):
2324
fields = [
2425
# BLS pubkey
2526
('pubkey', uint384),
26-
# BLS proof of possession (a BLS signature)
27-
('proof_of_possession', CountableList(uint384)),
2827
# Withdrawal credentials
2928
('withdrawal_credentials', hash32),
3029
# Initial RANDAO commitment
3130
('randao_commitment', hash32),
31+
# BLS proof of possession (a BLS signature)
32+
('proof_of_possession', CountableList(uint384)),
3233
]
3334

3435
def __init__(self,
@@ -37,8 +38,16 @@ def __init__(self,
3738
randao_commitment: Hash32,
3839
proof_of_possession: Sequence[int]=(0, 0)) -> None:
3940
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,
4445
)
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

Comments
 (0)