-
Notifications
You must be signed in to change notification settings - Fork 997
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
Active registry roots #1104
Active registry roots #1104
Conversation
Possible replacement of `latest_active_index_roots` with `latest_active_registry_roots` to allow for significantly more efficient light clients (see item 17 in #1054). Key changes: * Validator information (including indices) is pre-shuffled and grouped by committee. * Validator information relevant to light clients (`validator.effective_balance` and `validator.slashed`) is kept "close" to the validator index to avoid accessing `validator_registry`. * Validator information (`index`, `effective_balance`, `slashed`) is compactified into a `uint64` which is friendly to SSZ packing. * Shuffled pubkeys are available but kept separate from compact validator information. Light clients with pubkeys cached do not need to re-download and re-authenticate them.
specs/core/0_beacon-chain.md
Outdated
shard = (get_start_shard(state, epoch) + committee_number) % SHARD_COUNT | ||
for index in get_crosslink_committee(state, epoch, shard): | ||
validator = validator_registry[index] | ||
active_registry[shard].pubkeys.append(validator.pubkey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're sorting validators by their crosslink committee shard. This isn't going to be particularly useful for light clients unless we merge the two committees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Maybe we want to wait until phase 1 to put this light-client infrastructure in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The active_index_roots
in combination with the historical randaomixes being in state was generic enough to serve proofs about the historic crosslink and persistent committees.
If we go this new path, we should either wait or intend to put both committees in the registry root.
validator = validator_registry[index] | ||
committees[shard].pubkeys.append(validator.pubkey) | ||
# index (top 7 bytes) + slashed (8th bit) + effective_balance (bottom 7 bits) | ||
compact_validator = index << 8 + validator.slashed << 7 + validator.effective_balance // GWEI_PER_ETH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compact_validator = index << 8 + validator.slashed << 7 + validator.effective_balance // GWEI_PER_ETH | |
compact_validator = index << 8 + validator.slashed << 7 + validator.effective_balance // EFFECTIVE_BALANCE_INCREMENT |
Same value, but it might not be in other configurations / future. So let's use the increment constant instead.
"pre-shuffling": could this simplify the spec more? I.e. we compute a list of shuffled active indices after the randao (or effectively the shuffling seed) is updated, and then just have the data (committees, active indices) available when we need it? Clients can already optimize it themselves, but it may actually reduce the spec complexity (if we can have this index list somewhere around...). |
We actually used to store the shuffling entirely in state, but after much debate removed it to (1) reduce state size and (2) give optionality to clients esp in resource restricted environments. |
Close in favour of #1219. |
Possible replacement of
latest_active_index_roots
withlatest_active_registry_roots
to allow for significantly more efficient light clients (see item 17 in #1054). Key changes:validator.effective_balance
andvalidator.slashed
) is kept "close" to the validator index to avoid accessingvalidator_registry
.index
,effective_balance
,slashed
) is compactified into auint64
which is friendly to SSZ packing.