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

Tunable genesis time #1849

Closed
djrtwo opened this issue May 27, 2020 · 2 comments · Fixed by #1866
Closed

Tunable genesis time #1849

djrtwo opened this issue May 27, 2020 · 2 comments · Fixed by #1866

Comments

@djrtwo
Copy link
Contributor

djrtwo commented May 27, 2020

Currently the genesis time is not very tune-able and is instead always at a timestamp where genesis_time % MIN_GENESIS_DELAY == 0. Due to the desire to generally configure testnets at "mainnet" config, MIN_GENESIS_DELAY == 24hrs and thus genesis_time is always at midnight UTC for mainnet configuration.

Depending on who is working on the testnet (e.g. @q9f), this can lead undesirable late nights.

Background

The genesis time is computed such that regardless of when MIN_GENESIS_ACTIVE_VALIDATOR_COUNT is hit, genesis_time is always at the exact same time of day.

genesis_time=eth1_timestamp - eth1_timestamp % MIN_GENESIS_DELAY + 2 * MIN_GENESIS_DELAY

This is so even if the exact day is known the exact time of some day is known so the teams can plan accordingly. (this being a very important feature is probably debatable).

Option 0

Don't change anything and just deal with it.

If @q9f does weekly testnet restarts (under discussion), this will suck for him but be great for our friends in Australia.

Option 1

This option preserves the notion of knowing exactly what time of day genesis will be, but instead allows us to tune that time. It is backwards compatible for networks that use the default configuration values.

It simply takes the previous calculation and adds GENESIS_TIME_OFFSET to the result to tune the precise time of day. A GENESIS_TIME_OFFSET of 0 would result in the same genesis time as in current specs.

genesis_time=(
    eth1_timestamp
    - eth1_timestamp % MIN_GENESIS_DELAY
    + 2 * MIN_GENESIS_DELAY
    + GENESIS_TIME_OFFSET
)

For example, if we use MIN_GENESIS_DELAY = 86400 and GENESIS_TIME_OFFSET = 21600 (6hrs), then genesis time will be at 6am UTC.

Option 2

This option does not preserve knowing exactly what time of day genesis will happen. This instead just uses a fixed offset from the initial eth1 block timestamp at which point genesis conditions were first met.

genesis_time=eth1_timestamp + GENESIS_DELAY

In cases in which MIN_GENESIS_ACTIVE_VALIDATOR_COUNT is hit prior to MIN_GENESIS_TIME - GENESIS_DELAY, genesis will be approximately at MIN_GENESIS_TIME (thus highly predictable on most smaller test/devnet scenarios). The time becomes much less predictable in larger testnets and/or mainnet where the MIN_GENESIS_ACTIVE_VALIDATOR_COUNT is not guaranteed to happen at a certain time.

@q9f
Copy link
Contributor

q9f commented May 29, 2020

So, my personal opinion on this as I brought this up. This is low priority and just a cosmetic change.

  • 🤷 If we stick to Option 0, we'll be probably fine.
  • ✖️ Option 1 is just unnecessarily adding another constant.
  • ✔️ I'm personally in favor of Option 2.
    • 📝 It's not much of a difficult change, requires a minor spec version bump though.
    • 🥳 It introduces some randomness and makes launching chains so much more fun.
    • ⏳ It's still very predictable especially when launching testnets.
    • 👶 It significantly reduces complexity of the genesis_time formula.

@paulhauner
Copy link
Contributor

I don't feel strongly, but would lean towards option 2. If we do this, I would suggest doubling MIN_GENESIS_TIME to 48 hrs for mainnet.

Perhaps this is tangential, but I would even advocate for making MIN_GENESIS_TIME a few days to give us plenty of time to test the genesis state and distribute it in binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants