Skip to content

Commit

Permalink
Merge pull request #594 from ethereum/vbuterin-patch-3
Browse files Browse the repository at this point in the history
Add mandatory deposit index ordering
  • Loading branch information
djrtwo authored Feb 9, 2019
2 parents 4a2416a + 019fe89 commit 311cf00
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
# Ethereum 1.0 chain data
'latest_eth1_data': Eth1Data,
'eth1_data_votes': [Eth1DataVote],
'deposit_index': 'uint64'
}
```

Expand Down Expand Up @@ -1478,6 +1479,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
# Ethereum 1.0 chain data
latest_eth1_data=latest_eth1_data,
eth1_data_votes=[],
deposit_index=len(initial_validator_deposits)
)

# Process initial deposits
Expand Down Expand Up @@ -1717,6 +1719,7 @@ Verify that `len(block.body.deposits) <= MAX_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.
* 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`.

```python
Expand Down Expand Up @@ -1745,6 +1748,8 @@ process_deposit(
)
```

* Set `state.deposit_index += 1`.

##### Exits

Verify that `len(block.body.exits) <= MAX_EXITS`.
Expand Down

0 comments on commit 311cf00

Please sign in to comment.