From dbcce177691c3466bc964254b186bcf87e98b5f7 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Wed, 4 Sep 2019 09:00:59 -0700 Subject: [PATCH 1/3] Update sync_protocol.md --- specs/light_client/sync_protocol.md | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/specs/light_client/sync_protocol.md b/specs/light_client/sync_protocol.md index 207e0e63e..3425c0f54 100644 --- a/specs/light_client/sync_protocol.md +++ b/specs/light_client/sync_protocol.md @@ -13,9 +13,8 @@ - [Constants](#constants) - [Containers](#containers) - [`LightClientUpdate`](#lightclientupdate) - - [Helpers](#helpers) - [`LightClientMemory`](#lightclientmemory) - - [`unpack_compact_validator`](#unpack_compact_validator) + - [Helpers](#helpers) - [`get_persistent_committee_pubkeys_and_balances`](#get_persistent_committee_pubkeys_and_balances) - [Light client state updates](#light-client-state-updates) - [Data overhead](#data-overhead) @@ -62,12 +61,9 @@ class LightClientUpdate(container): committee_branch: Vector[Hash, PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT)] ``` -## Helpers - ### `LightClientMemory` ```python -@dataclass class LightClientMemory(object): shard: Shard # Randomly initialized and retained forever header: BeaconBlockHeader # Beacon header which is not expected to revert @@ -77,19 +73,7 @@ class LightClientMemory(object): next_committee: CompactCommittee ``` -### `unpack_compact_validator` - -```python -def unpack_compact_validator(compact_validator: CompactValidator) -> Tuple[ValidatorIndex, bool, uint64]: - """ - Return the index, slashed, effective_balance // EFFECTIVE_BALANCE_INCREMENT of ``compact_validator``. - """ - return ( - ValidatorIndex(compact_validator >> 16), - bool((compact_validator >> 15) % 2), - uint64(compact_validator & (2**15 - 1)), - ) -``` +## Helpers ### `get_persistent_committee_pubkeys_and_balances` From f1065faf9cd711fd6b2b03fd58b4b50fc201a4b8 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Thu, 5 Sep 2019 06:54:20 -0700 Subject: [PATCH 2/3] Update sync_protocol.md --- specs/light_client/sync_protocol.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/light_client/sync_protocol.md b/specs/light_client/sync_protocol.md index 3425c0f54..18810d48d 100644 --- a/specs/light_client/sync_protocol.md +++ b/specs/light_client/sync_protocol.md @@ -61,10 +61,13 @@ class LightClientUpdate(container): committee_branch: Vector[Hash, PERSISTENT_COMMITTEE_ROOT_IN_BEACON_STATE_DEPTH + log_2(SHARD_COUNT)] ``` +## Helpers + ### `LightClientMemory` ```python class LightClientMemory(object): + @dataclass shard: Shard # Randomly initialized and retained forever header: BeaconBlockHeader # Beacon header which is not expected to revert # Persistent committees corresponding to the beacon header @@ -73,8 +76,6 @@ class LightClientMemory(object): next_committee: CompactCommittee ``` -## Helpers - ### `get_persistent_committee_pubkeys_and_balances` ```python From 1e74cf5f0d2866d1811b5abb8548452c3db5be26 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Thu, 5 Sep 2019 06:55:40 -0700 Subject: [PATCH 3/3] Update sync_protocol.md --- specs/light_client/sync_protocol.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/light_client/sync_protocol.md b/specs/light_client/sync_protocol.md index 18810d48d..c3b035270 100644 --- a/specs/light_client/sync_protocol.md +++ b/specs/light_client/sync_protocol.md @@ -13,8 +13,8 @@ - [Constants](#constants) - [Containers](#containers) - [`LightClientUpdate`](#lightclientupdate) - - [`LightClientMemory`](#lightclientmemory) - [Helpers](#helpers) + - [`LightClientMemory`](#lightclientmemory) - [`get_persistent_committee_pubkeys_and_balances`](#get_persistent_committee_pubkeys_and_balances) - [Light client state updates](#light-client-state-updates) - [Data overhead](#data-overhead) @@ -66,8 +66,8 @@ class LightClientUpdate(container): ### `LightClientMemory` ```python +@dataclass class LightClientMemory(object): - @dataclass shard: Shard # Randomly initialized and retained forever header: BeaconBlockHeader # Beacon header which is not expected to revert # Persistent committees corresponding to the beacon header