Add missing deposit root when performing Merkle verification
This commit is contained in:
parent
6f5a865508
commit
c5de2fe710
|
@ -1470,11 +1470,12 @@ For each `attestation` in `block.body.attestations`:
|
||||||
Verify that `len(block.body.deposits) <= MAX_DEPOSITS`.
|
Verify that `len(block.body.deposits) <= MAX_DEPOSITS`.
|
||||||
|
|
||||||
[TODO: add logic to ensure that deposits from 1.0 chain are processed in order]
|
[TODO: add logic to ensure that deposits from 1.0 chain are processed in order]
|
||||||
|
[TODO: update the call to `verify_merkle_branch` below if it needs to change after we process deposits in order]
|
||||||
|
|
||||||
For each `deposit` in `block.body.deposits`:
|
For each `deposit` in `block.body.deposits`:
|
||||||
|
|
||||||
* Let `serialized_deposit_data` be the serialized form of `deposit.deposit_data`. It should be 8 bytes for `deposit_data.value` followed by 8 bytes for `deposit_data.timestamp` and then the `DepositInput` bytes. That is, it should match `deposit_data` in the [Ethereum 1.0 deposit contract](#ethereum-10-deposit-contract) of which the hash was placed into the Merkle tree.
|
* Let `serialized_deposit_data` be the serialized form of `deposit.deposit_data`. It should be 8 bytes for `deposit_data.value` followed by 8 bytes for `deposit_data.timestamp` and then the `DepositInput` bytes. That is, it should match `deposit_data` in the [Ethereum 1.0 deposit contract](#ethereum-10-deposit-contract) of which the hash was placed into the Merkle tree.
|
||||||
* Verify that `verify_merkle_branch(hash(serialized_deposit_data), deposit.branch, DEPOSIT_CONTRACT_TREE_DEPTH, deposit.index)` is `True`.
|
* Verify that `verify_merkle_branch(hash(serialized_deposit_data), deposit.branch, DEPOSIT_CONTRACT_TREE_DEPTH, deposit.index, state.latest_deposit_root)` is `True`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def verify_merkle_branch(leaf: Hash32, branch: [Hash32], depth: int, index: int, root: Hash32) -> bool:
|
def verify_merkle_branch(leaf: Hash32, branch: [Hash32], depth: int, index: int, root: Hash32) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue