Add mandatory deposit index ordering

Co-requisite with #589
This commit is contained in:
vbuterin 2019-02-08 19:37:34 -06:00 committed by GitHub
parent 4a2416add7
commit 057364a7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -526,6 +526,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
# Ethereum 1.0 chain data # Ethereum 1.0 chain data
'latest_eth1_data': Eth1Data, 'latest_eth1_data': Eth1Data,
'eth1_data_votes': [Eth1DataVote], 'eth1_data_votes': [Eth1DataVote],
'deposit_count': 'uint64'
} }
``` ```
@ -1717,6 +1718,7 @@ Verify that `len(block.body.deposits) <= MAX_DEPOSITS`.
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.amount` 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.amount` 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 `deposit.index == state.deposit_index`.
* Verify that `verify_merkle_branch(hash(serialized_deposit_data), deposit.branch, DEPOSIT_CONTRACT_TREE_DEPTH, deposit.index, state.latest_eth1_data.deposit_root)` is `True`. * Verify that `verify_merkle_branch(hash(serialized_deposit_data), deposit.branch, DEPOSIT_CONTRACT_TREE_DEPTH, deposit.index, state.latest_eth1_data.deposit_root)` is `True`.
```python ```python
@ -1745,6 +1747,8 @@ process_deposit(
) )
``` ```
* Set `state.deposit_index += 1`.
##### Exits ##### Exits
Verify that `len(block.body.exits) <= MAX_EXITS`. Verify that `len(block.body.exits) <= MAX_EXITS`.