Update sync-protocol.md
This commit is contained in:
parent
25f2efab19
commit
013e814d2d
|
@ -156,10 +156,8 @@ def validate_light_client_update(snapshot: LightClientSnapshot,
|
||||||
|
|
||||||
# Verify update header root is the finalized root of the finality header, if specified
|
# Verify update header root is the finalized root of the finality header, if specified
|
||||||
if update.finality_header == BeaconBlockHeader():
|
if update.finality_header == BeaconBlockHeader():
|
||||||
signed_header = update.header
|
|
||||||
assert update.finality_branch == [Bytes32() for _ in range(floorlog2(FINALIZED_ROOT_INDEX))]
|
assert update.finality_branch == [Bytes32() for _ in range(floorlog2(FINALIZED_ROOT_INDEX))]
|
||||||
else:
|
else:
|
||||||
signed_header = update.finality_header
|
|
||||||
assert is_valid_merkle_branch(
|
assert is_valid_merkle_branch(
|
||||||
leaf=hash_tree_root(update.header),
|
leaf=hash_tree_root(update.header),
|
||||||
branch=update.finality_branch,
|
branch=update.finality_branch,
|
||||||
|
@ -188,7 +186,7 @@ def validate_light_client_update(snapshot: LightClientSnapshot,
|
||||||
# Verify sync committee aggregate signature
|
# Verify sync committee aggregate signature
|
||||||
participant_pubkeys = [pubkey for (bit, pubkey) in zip(update.sync_committee_bits, sync_committee.pubkeys) if bit]
|
participant_pubkeys = [pubkey for (bit, pubkey) in zip(update.sync_committee_bits, sync_committee.pubkeys) if bit]
|
||||||
domain = compute_domain(DOMAIN_SYNC_COMMITTEE, update.fork_version, genesis_validators_root)
|
domain = compute_domain(DOMAIN_SYNC_COMMITTEE, update.fork_version, genesis_validators_root)
|
||||||
signing_root = compute_signing_root(signed_header, domain)
|
signing_root = compute_signing_root(get_signed_header(update), domain)
|
||||||
assert bls.FastAggregateVerify(participant_pubkeys, signing_root, update.sync_committee_signature)
|
assert bls.FastAggregateVerify(participant_pubkeys, signing_root, update.sync_committee_signature)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue