mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-17 13:06:34 +00:00
Compute LIGHT_CLIENT_UPDATE_TIMEOUT
in lieu of maintaining a constant
This commit is contained in:
parent
7a168be862
commit
3b80324119
@ -47,8 +47,6 @@ ALTAIR_FORK_EPOCH: 18446744073709551615
|
|||||||
MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
||||||
# 2**13
|
# 2**13
|
||||||
MAX_VALID_LIGHT_CLIENT_UPDATES: 8192
|
MAX_VALID_LIGHT_CLIENT_UPDATES: 8192
|
||||||
# 2**13 (=8192)
|
|
||||||
LIGHT_CLIENT_UPDATE_TIMEOUT: 8192
|
|
||||||
|
|
||||||
|
|
||||||
# Validator
|
# Validator
|
||||||
|
@ -47,8 +47,6 @@ ALTAIR_FORK_EPOCH: 18446744073709551615
|
|||||||
MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
||||||
# [customized]
|
# [customized]
|
||||||
MAX_VALID_LIGHT_CLIENT_UPDATES: 32
|
MAX_VALID_LIGHT_CLIENT_UPDATES: 32
|
||||||
# [customized]
|
|
||||||
LIGHT_CLIENT_UPDATE_TIMEOUT: 32
|
|
||||||
|
|
||||||
# Validator
|
# Validator
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
- [Constants](#constants)
|
- [Constants](#constants)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Misc](#misc)
|
- [Misc](#misc)
|
||||||
- [Time parameters](#time-parameters)
|
|
||||||
- [Containers](#containers)
|
- [Containers](#containers)
|
||||||
- [`LightClientSnapshot`](#lightclientsnapshot)
|
- [`LightClientSnapshot`](#lightclientsnapshot)
|
||||||
- [`LightClientUpdate`](#lightclientupdate)
|
- [`LightClientUpdate`](#lightclientupdate)
|
||||||
@ -53,12 +52,6 @@ uses sync committees introduced in [this beacon chain extension](./beacon-chain.
|
|||||||
| `MIN_SYNC_COMMITTEE_PARTICIPANTS` | `1` |
|
| `MIN_SYNC_COMMITTEE_PARTICIPANTS` | `1` |
|
||||||
| `MAX_VALID_LIGHT_CLIENT_UPDATES` | `uint64(2**64 - 1)` |
|
| `MAX_VALID_LIGHT_CLIENT_UPDATES` | `uint64(2**64 - 1)` |
|
||||||
|
|
||||||
### Time parameters
|
|
||||||
|
|
||||||
| Name | Value | Unit | Duration |
|
|
||||||
| - | - | :-: | :-: |
|
|
||||||
| `LIGHT_CLIENT_UPDATE_TIMEOUT` | `Slot(2**13)` | slots | ~27 hours |
|
|
||||||
|
|
||||||
## Containers
|
## Containers
|
||||||
|
|
||||||
### `LightClientSnapshot`
|
### `LightClientSnapshot`
|
||||||
@ -184,6 +177,7 @@ def process_light_client_update(store: LightClientStore, update: LightClientUpda
|
|||||||
validate_light_client_update(store.snapshot, update, genesis_validators_root)
|
validate_light_client_update(store.snapshot, update, genesis_validators_root)
|
||||||
store.valid_updates.append(update)
|
store.valid_updates.append(update)
|
||||||
|
|
||||||
|
update_timeout = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||||
if (
|
if (
|
||||||
sum(update.sync_committee_bits) * 3 >= len(update.sync_committee_bits) * 2
|
sum(update.sync_committee_bits) * 3 >= len(update.sync_committee_bits) * 2
|
||||||
and update.finality_header != BeaconBlockHeader()
|
and update.finality_header != BeaconBlockHeader()
|
||||||
@ -193,7 +187,7 @@ def process_light_client_update(store: LightClientStore, update: LightClientUpda
|
|||||||
# It may be changed to re-organizable light client design. See the on-going issue eth2.0-specs#2182.
|
# It may be changed to re-organizable light client design. See the on-going issue eth2.0-specs#2182.
|
||||||
apply_light_client_update(store.snapshot, update)
|
apply_light_client_update(store.snapshot, update)
|
||||||
store.valid_updates = []
|
store.valid_updates = []
|
||||||
elif current_slot > store.snapshot.header.slot + LIGHT_CLIENT_UPDATE_TIMEOUT:
|
elif current_slot > store.snapshot.header.slot + update_timeout:
|
||||||
# Forced best update when the update timeout has elapsed
|
# Forced best update when the update timeout has elapsed
|
||||||
apply_light_client_update(store.snapshot,
|
apply_light_client_update(store.snapshot,
|
||||||
max(store.valid_updates, key=lambda update: sum(update.sync_committee_bits)))
|
max(store.valid_updates, key=lambda update: sum(update.sync_committee_bits)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user