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

Replace cycles with epochs #149

Merged
merged 36 commits into from
Nov 27, 2018
Merged

Replace cycles with epochs #149

merged 36 commits into from
Nov 27, 2018

Conversation

vbuterin
Copy link
Contributor

Also adjusted constants to keep interest rates and the quadratic leak period the same.

Also, did some simplifications of the cycle calculation procedure. Make the decision to remove automatic registration of a validator as a proposer when they join, because that can just happen on its own due to the reshuffling procedure.

vbuterin and others added 6 commits November 19, 2018 11:07
Also adjusted constants to keep interest rates and the quadratic leak period the same.

Also, did some simplifications of the cycle calculation procedure. Make the decision to remove automatic registration of a validator as a proposer when they join, because that can just happen on its own due to the reshuffling procedure.
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Show resolved Hide resolved
vbuterin and others added 5 commits November 24, 2018 09:41
Suppose B1, B2, B3, B4 are consecutive blocks and we are now processing the end of the cycle containing B4.

* If B4 is justified using source B3, then B3 is finalized.
* If B4 is justified using source B2, and B3 has been justified, then B2 is finalized.
* If B3 is justified using source B1, and B1 has been justified, then B1 is finalized.
* Added rewards for proposers
* Added declining rewards for greater inclusion distance
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@JustinDrake
Copy link
Collaborator

Looking forward to having this PR merged :)

One suggestion is to split attester_bitfield into signature_bitfield and custody_bitfield for cleaner logic and more modularity.

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@@ -1003,11 +1057,39 @@ If `last_state_recalculation_slot % POW_RECEIPT_ROOT_VOTING_PERIOD == 0`, then:
* If for any `x` in `state.candidate_pow_receipt_root`, `x.votes * 2 >= POW_RECEIPT_ROOT_VOTING_PERIOD` set `state.processed_pow_receipt_root = x.receipt_root`.
* Set `state.candidate_pow_receipt_roots = []`.

### Validator set change
#### Proposer reshuffling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we move this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah, I think my goal was to move it out of the then-overloaded "Finally" section. We could move it to happen right before Finally if desired. I'm not sure what order is best.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order doesn't particularly matter (I think).

The only reason I noticed was -- if we have it before the change validator section then it might produce some ShardReassignmentRecords that immediately get wiped out when removing validators in change_validators.

Again... not a pressing concern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I set the order back to how it was.

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@djrtwo
Copy link
Contributor

djrtwo commented Nov 26, 2018

Not quite ready @JustinDrake !

@JustinDrake
Copy link
Collaborator

@djrtwo Yeah, a bunch of cleanup is required but want to avoid merge conflicts :)

@djrtwo
Copy link
Contributor

djrtwo commented Nov 26, 2018

I've been keeping it up to date with master :)
Should be clean to merge when ready

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Show resolved Hide resolved
Co-Authored-By: vbuterin <v@buterin.com>
djrtwo and others added 7 commits November 26, 2018 18:33
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
… objects

Makes the code cleaner this way; returning an object that then gets mutated is confusing.
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some nitpicks.

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
# Slot of last justified beacon block
'justified_slot': 'uint64',
# Hash of last justified beacon block
'justified_block_hash': 'hash32',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indent.

# Signed data
'data': AttestationSignedData,
# Attester participation bitfield (2 bits per attester)
'attester_bitfield': 'bytes',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 bit per attester now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two bitfields, attester_bitfield and poc_bitfield. More modular that way 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I sorry, I mean the comment:

    # Attester participation bitfield (2 bits per attester)
    'attester_bitfield': 'bytes',
    # Proof of custody bitfield
    'poc_bitfield': 'bytes',

Maybe just say "Attester participation bitfield" for attester_bitfield:

    # Attester participation bitfield
    'attester_bitfield': 'bytes',
    # Proof of custody bitfield
    'poc_bitfield': 'bytes',

specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@djrtwo djrtwo merged commit 9f26fbb into master Nov 27, 2018
@djrtwo djrtwo deleted the vbuterin-patch-1 branch November 27, 2018 16:13
hwwhww added a commit to hwwhww/py-evm that referenced this pull request Nov 28, 2018
The following is a function that determines the validators that participated in an attestation:

```python
def get_attestation_participants(state: State,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeds

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

Successfully merging this pull request may close these issues.

5 participants