mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-04 14:54:53 +00:00
sync protocol: clarify committee type
Updates at period boundaries occur per period committee, not per persistent committee
This commit is contained in:
parent
7a5cdc2a9d
commit
51a0d8059d
@ -39,8 +39,8 @@ We define the following Python custom types for type hinting and readability:
|
|||||||
| - | - |
|
| - | - |
|
||||||
| `BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_DEPTH` | `4` |
|
| `BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_DEPTH` | `4` |
|
||||||
| `BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_INDEX` | **TBD** |
|
| `BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_INDEX` | **TBD** |
|
||||||
| `PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH` | `5` |
|
| `PERIOD_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH` | `5` |
|
||||||
| `PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_INDEX` | **TBD** |
|
| `PERIOD_COMMITTEE_ROOT_IN_BEACON_STATE_INDEX` | **TBD** |
|
||||||
|
|
||||||
## Containers
|
## Containers
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ class LightClientUpdate(container):
|
|||||||
# Updated beacon header (and authenticating branch)
|
# Updated beacon header (and authenticating branch)
|
||||||
header: BeaconBlockHeader
|
header: BeaconBlockHeader
|
||||||
header_branch: Vector[Hash, BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_DEPTH]
|
header_branch: Vector[Hash, BEACON_CHAIN_ROOT_IN_SHARD_BLOCK_HEADER_DEPTH]
|
||||||
# Updated persistent committee (and authenticating branch)
|
# Updated period committee (and authenticating branch)
|
||||||
committee: CompactCommittee
|
committee: CompactCommittee
|
||||||
committee_branch: Vector[Hash, PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT)]
|
committee_branch: Vector[Hash, PERIOD_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT)]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Helpers
|
## Helpers
|
||||||
@ -70,7 +70,7 @@ class LightClientUpdate(container):
|
|||||||
class LightClientMemory(object):
|
class LightClientMemory(object):
|
||||||
shard: Shard # Randomly initialized and retained forever
|
shard: Shard # Randomly initialized and retained forever
|
||||||
header: BeaconBlockHeader # Beacon header which is not expected to revert
|
header: BeaconBlockHeader # Beacon header which is not expected to revert
|
||||||
# Persistent committees corresponding to the beacon header
|
# period committees corresponding to the beacon header
|
||||||
previous_committee: CompactCommittee
|
previous_committee: CompactCommittee
|
||||||
current_committee: CompactCommittee
|
current_committee: CompactCommittee
|
||||||
next_committee: CompactCommittee
|
next_committee: CompactCommittee
|
||||||
@ -137,13 +137,13 @@ def update_memory(memory: LightClientMemory, update: LightClientUpdate) -> None:
|
|||||||
domain = compute_domain(DOMAIN_SHARD_ATTESTER, update.fork_version)
|
domain = compute_domain(DOMAIN_SHARD_ATTESTER, update.fork_version)
|
||||||
assert bls_verify(pubkey, update.shard_block_root, update.signature, domain)
|
assert bls_verify(pubkey, update.shard_block_root, update.signature, domain)
|
||||||
|
|
||||||
# Update persistent committees if entering a new period
|
# Update period committees if entering a new period
|
||||||
if next_period == current_period + 1:
|
if next_period == current_period + 1:
|
||||||
assert is_valid_merkle_branch(
|
assert is_valid_merkle_branch(
|
||||||
leaf=hash_tree_root(update.committee),
|
leaf=hash_tree_root(update.committee),
|
||||||
branch=update.committee_branch,
|
branch=update.committee_branch,
|
||||||
depth=PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT),
|
depth=PERIOD_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT),
|
||||||
index=PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_INDEX << log_2(SHARD_COUNT) + memory.shard,
|
index=PERIOD_COMMITTEE_ROOT_IN_BEACON_STATE_INDEX << log_2(SHARD_COUNT) + memory.shard,
|
||||||
root=hash_tree_root(update.header),
|
root=hash_tree_root(update.header),
|
||||||
)
|
)
|
||||||
memory.previous_committee = memory.current_committee
|
memory.previous_committee = memory.current_committee
|
||||||
|
Loading…
x
Reference in New Issue
Block a user