Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deposit issues #198

Closed
3 tasks done
djrtwo opened this issue Nov 30, 2018 · 3 comments
Closed
3 tasks done

Deposit issues #198

djrtwo opened this issue Nov 30, 2018 · 3 comments
Labels
general:bug Something isn't working

Comments

@djrtwo
Copy link
Contributor

djrtwo commented Nov 30, 2018

Issue

There are some known issues in the current deposit contract and deposit processing. This issue will probably be resolved via a couple of PRs

Known issues:

  • by removing assert deposit_size == DEPOSIT_SIZE for the creation of a validator, a user can now create a validator with as little as 1 ETH. This validator would be inducted and immediately be kicked out of the validator set.
  • Beyond that, this allows validators to enter the validator set (and begin participating) with as little as 16 ETH. The deposit mechanism should enforce 32 ETH as initial deposit to prevent validators entering with low and risky deposits.
  • The deposit contract is incorrectly using full_deposit_count to create and broadcast the leaves of the merkle tree. If a < 32 ETH deposit is made, it does not update full_deposit_count but update the merkle tree, overwriting the previously written leaf. We need to maintain deposit_count separately from full_deposit_count. deposit_count should be incremented upon every successful deposit, should be used to construct the index into the merkle tree, and should be broadcast in the HashChainValue instead of full_deposit_count.
@vbuterin
Copy link
Contributor

vbuterin commented Dec 1, 2018

by removing assert deposit_size == DEPOSIT_SIZE for the creation of a validator, a user can now create a validator with as little as 1 ETH. This validator would be inducted and immediately be kicked out of the validator set.

Is this that bad? Their ETH is just stuck and they'll get it out in phase 2

Beyond that, this allows validators to enter the validator set (and begin participating) with as little as 16 ETH. The deposit mechanism should enforce 32 ETH as initial deposit to prevent validators entering with low and risky deposits.

I'm inclined to agree. I don't think the deposit contract needs to be too paternalistic; it's already (unavoidably) possible to deposit with a bad randao preimage, for example; we could just make deposits fail if they have less than 32 ETH.

The deposit contract is incorrectly using full_deposit_count to create and broadcast the leaves of the merkle tree. If a < 32 ETH deposit is made, it does not update full_deposit_count but update the merkle tree, overwriting the previously written leaf. We need to maintain deposit_count separately from full_deposit_count. deposit_count should be incremented upon every successful deposit, should be used to construct the index into the merkle tree, and should be broadcast in the HashChainValue instead of full_deposit_count.

Agree!

@hwwhww hwwhww added the general:bug Something isn't working label Dec 1, 2018
@djrtwo
Copy link
Contributor Author

djrtwo commented Dec 3, 2018

we could just make deposits fail if they have less than 32 ETH.

I'm inclined to go this route. If less than 32 eth and no existing validator for the pubkey, then fail.

@djrtwo
Copy link
Contributor Author

djrtwo commented Dec 4, 2018

addressed in #228

@djrtwo djrtwo closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants