Skip to content

Commit

Permalink
Root next_sync_committee in attested_header, ref: ethereum/consen…
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed Sep 28, 2022
1 parent d4986e5 commit 2b92bc7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions contracts/bridge/src/truth/eth/BeaconLightClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,16 @@ contract BeaconLightClient is BeaconChain, Bitfield {
emit FinalizedHeaderImported(header_update.finalized_header);
}

import_next_sync_committee(sc_update);
}

function import_next_sync_committee(SyncCommitteePeriodUpdate calldata update) internal {
require(verify_next_sync_committee(
update.next_sync_committee,
update.next_sync_committee_branch,
finalized_header.state_root),
sc_update.next_sync_committee,
sc_update.next_sync_committee_branch,
header_update.attested_header.state_root),
"!next_sync_committee"
);

uint64 current_period = compute_sync_committee_period(finalized_header.slot);
uint64 next_period = current_period + 1;
uint64 next_period = signature_period + 1;
require(sync_committee_roots[next_period] == bytes32(0), "imported");
bytes32 next_sync_committee_root = hash_tree_root(update.next_sync_committee);
bytes32 next_sync_committee_root = hash_tree_root(sc_update.next_sync_committee);
sync_committee_roots[next_period] = next_sync_committee_root;
emit NextSyncCommitteeImported(next_period, next_sync_committee_root);
}
Expand Down

0 comments on commit 2b92bc7

Please sign in to comment.