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

add config validity conditions #407

Closed
djrtwo opened this issue Jan 8, 2019 · 12 comments · Fixed by #2444
Closed

add config validity conditions #407

djrtwo opened this issue Jan 8, 2019 · 12 comments · Fixed by #2444
Labels
general:enhancement New feature or request scope:v-guide Validator guide

Comments

@djrtwo
Copy link
Contributor

djrtwo commented Jan 8, 2019

Issue

There are many conditions that are implicit for a configuration of constants to be valid.

To name a few:

  • MIN_ATTESTATION_INCLUSION_DELAY > 0
  • MAX_DEPOSIT >= MIN_DEPOSIT
  • ENTRY_EXIT_DELAY >= SEED_LOOKAHEAD

Proposed implementation

I propose we add an accompanying document on configuration to make these conditions explicit. This will aid in testing/testnets and will help if some party is looking to deploy a different instantiation of the protocol.

@djrtwo djrtwo added the general:enhancement New feature or request label Jan 8, 2019
@vbuterin
Copy link
Contributor

vbuterin commented Jan 8, 2019

ENTRY_EXIT_DELAY > SEED_LOOKAHEAD

>=, no?

Also, is that even technically a requirement?

There's probably a pile of constants that need to be nonzero because we're dividing or moduloing by them; SHARD_COUNT and EPOCH_LENGTH come up as trivial examples.

There's also a bunch of divisibility requirements (eg.SHARD_COUNT % EPOCH_LENGTH = 0 is I think a requirement at least if we want things to work out nicely without extra special case code) that we don't need to think about because everything is a power of two, but people making alternate networks might decide to turn into not being a power of two.

A bunch of stuff that gets Merkle-tree'd must be a power of two.

@djrtwo
Copy link
Contributor Author

djrtwo commented Jan 8, 2019

>=, no?

yes (edited)

Also, is that even technically a requirement?

You're right it is not technically a requirement, but might be a source of error for validators depending on implementation and/or the helpers provided in the spec. If SEED_LOOKAHEAD > ENTRY_EXIT_DELAY, then although the seed was know SEED_LOOKAHEAD slots ago, the shuffling cannot be predicted until ENTRY_EXIT_DELAY slots ago.

@JustinDrake
Copy link
Contributor

Another approach could be to have "reduced constant sets" for testing, maybe just one to start with. That way all implementers can converge on the same constant set for testing.

@hwwhww
Copy link
Contributor

hwwhww commented May 3, 2019

plus: LATEST_RANDAO_MIXES_LENGTH > MIN_SEED_LOOKAHEAD per #1027

@ralexstokes
Copy link
Member

Was chatting w/ @djrtwo and this one came up:

ETH1_FOLLOW_DISTANCE << 24hrs

there is effectively a "dynamic constant" between the time of the Eth2Genesis event and the genesis_time. the range of this duration is between 24 and 48 hours, based on the computation performed in the deposit contract.

the ETH1_FOLLOW_DISTANCE should be no smaller than the minimum of this range to ensure that proposers will be able to submit useful Eth1Data in the early beacon chain blocks. if this invariant does not hold, early proposers will essentially have to coordinate to prevent consensus on the initial latest_eth1_data

@djrtwo
Copy link
Contributor Author

djrtwo commented May 20, 2019

I'm working on this (finally) :)

@djrtwo
Copy link
Contributor Author

djrtwo commented Jun 26, 2019

MIN_SLASHING_PENALTY_QUOTIENT >= WHISTLEBLOWING_REWARD_QUOTIENT to ensure no eth is minted in slash_validator

@ralexstokes
Copy link
Member

ran into this one while working on some tests...

SHARD_COUNT >= SLOTS_PER_EPOCH is required to maintain the invariant that every validator is sampled exactly once every epoch to perform an attestation. the math under get_epoch_committee_count seems to break down if there are not enough shards

credits to @protolambda for recognizing this one

@JustinDrake
Copy link
Contributor

MIN_SLASHING_PENALTY_QUOTIENT <= WHISTLEBLOWER_REWARD_QUOTIENT to avoid printing money when slashing

@JustinDrake
Copy link
Contributor

"MAX_EPOCHS_PER_CROSSLINK should be a small constant times SHARD_COUNT // SLOTS_PER_EPOCH"

@ralexstokes
Copy link
Member

SLOTS_PER_HISTORICAL_ROOT >= SLOTS_PER_EPOCH

@hwwhww
Copy link
Contributor

hwwhww commented Jun 8, 2020

I created a spreadsheet of phase 0 configuration: https://docs.google.com/spreadsheets/d/1xKwwjA3QO7k7VuqomsYc_uPeOSAV4VKRGo7m6Pb5TYA/edit?usp=sharing

Comments here or on the spreadsheet are most welcome and appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:enhancement New feature or request scope:v-guide Validator guide
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants