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

Tweak inclusion delay rewards and set BASE_REWARD_FACTOR #1159

Merged
merged 2 commits into from
Jun 17, 2019

Conversation

JustinDrake
Copy link
Collaborator

@JustinDrake JustinDrake commented Jun 10, 2019

Substantive changes:

  1. Split the inclusion delay reward between attester and proposer to add up to at most one base reward. This is analogous to the reward logic in slash_validator, and makes the BASE_REWARDS_PER_EPOCH constant include proposer rewards.
  2. Double BASE_REWARD_FACTOR to 2^6 (addressing item 4 in Phase 0 state transition checklist—take 5 #1054). When the total effective balance is 2^17 ETH then maximum annual issuance is a bit below 2^21 ETH. Maximum annual issuance happens when a) all validators make perfect attestations (matching source, target, head, as well as consistent crosslink data), b) all attestations are included as fast as possible (in particular, no skip blocks), and c) there are no slashings.
BASE_REWARD_FACTOR = 2**6
SLOTS_PER_EPOCH = 2**6
SECONDS_PER_SLOT = 6
BASE_REWARDS_PER_EPOCH = 5
GWEI_PER_ETH = 10**9
MAX_TOTAL_EFFECTIVE_BALANCE = 2**27 * GWEI_PER_ETH
TARGET_MAX_ISSUANCE = 2**21 * GWEI_PER_ETH

def integer_squareroot(n: int) -> int:
    """
    The largest integer ``x`` such that ``x**2`` is less than or equal to ``n``.
    """
    assert n >= 0
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x

MAX_REWARDS_PER_EPOCH = MAX_TOTAL_EFFECTIVE_BALANCE * BASE_REWARD_FACTOR // integer_squareroot(MAX_TOTAL_EFFECTIVE_BALANCE) // BASE_REWARDS_PER_EPOCH * BASE_REWARDS_PER_EPOCH
EPOCHS_PER_YEAR = 365.25*24*60*60 / (SECONDS_PER_SLOT * SLOTS_PER_EPOCH)
MAX_REWARDS_PER_YEAR = EPOCHS_PER_YEAR * MAX_REWARDS_PER_EPOCH

print(MAX_REWARDS_PER_YEAR / TARGET_MAX_ISSUANCE)

Substantive changes:

1) Split the inclusion delay reward between attester and proposer to add up to at most one base reward. This is analogous to the reward logic in `slash_validator`, and makes the `BASE_REWARDS_PER_EPOCH` constant include proposer rewards.
2) Double `BASE_REWARD_FACTOR` to 2^6 (addressing item 4 in #1054). When the total effective balance is 2^17 ETH then maximum annual issuance is a bit below 2^21 ETH. Maximum annual issuance happens when a) all validators make perfect attestations (matching source, target, head, as well as consistent crosslink data), b) all attestations are included as fast as possible (in particular, no skip blocks), and c) there are no slashings.

```python
BASE_REWARD_FACTOR = 2**6
SLOTS_PER_EPOCH = 2**6
SECONDS_PER_SLOT = 6
BASE_REWARDS_PER_EPOCH = 5
GWEI_PER_ETH = 10**9
MAX_TOTAL_EFFECTIVE_BALANCE = 2**27 * GWEI_PER_ETH
TARGET_MAX_ISSUANCE = 2**21 * GWEI_PER_ETH

def integer_squareroot(n: int) -> int:
    """
    The largest integer ``x`` such that ``x**2`` is less than or equal to ``n``.
    """
    assert n >= 0
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x

MAX_REWARDS_PER_EPOCH = MAX_TOTAL_EFFECTIVE_BALANCE * BASE_REWARD_FACTOR // integer_squareroot(MAX_TOTAL_EFFECTIVE_BALANCE) // BASE_REWARDS_PER_EPOCH
EPOCHS_PER_YEAR = 365.25*24*60*60 / (SECONDS_PER_SLOT * SLOTS_PER_EPOCH)
MAX_REWARDS_PER_YEAR = EPOCHS_PER_YEAR * MAX_REWARDS_PER_EPOCH * BASE_REWARDS_PER_EPOCH

print(MAX_REWARDS_PER_YEAR / TARGET_MAX_ISSUANCE)
```
@JustinDrake JustinDrake marked this pull request as ready for review June 10, 2019 14:23
@djrtwo
Copy link
Contributor

djrtwo commented Jun 12, 2019

This seems reasonable... The counter argument is it's just as simple to bound issuance with as BASE_REWARDS_PER_EPOCH + 1 / PROPOSER_REWARD_QUOTIENT, and we want to insure that we incentivize validators to not delay in creating their attestation.

Also need to remember there will be participation rewards on shard chains.

This also might not be the final adjustment for [2] until we lock down slot time

@JustinDrake
Copy link
Collaborator Author

JustinDrake commented Jun 12, 2019

This also might not be the final adjustment for [2] until we lock down slot time

I suggest keeping the slot time at 6 seconds for the spec freeze to "stress test" the cross-client testnet. So it could be the last adjustment before freeze (though possibly not before finalization).

@JustinDrake JustinDrake added the milestone:June 30 freeze 🥶 Phase 0 spec freeze for long-lived cross-client testnet label Jun 15, 2019
@djrtwo djrtwo merged commit a1ca0f8 into dev Jun 17, 2019
@djrtwo djrtwo deleted the JustinDrake-patch-14 branch June 17, 2019 22:39
@ethereum ethereum deleted a comment Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
milestone:June 30 freeze 🥶 Phase 0 spec freeze for long-lived cross-client testnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants