Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Optimized Ethereum beacon light client and E2E test #166

Merged
merged 55 commits into from
Jun 13, 2022
Merged

Conversation

hujw77
Copy link
Collaborator

@hujw77 hujw77 commented May 27, 2022

  • An optimized Ethereum beacon light client
// Current arthitecture diverges from spec's proposed updated splitting them into:
// - Finalized header updates: To import a recent finalized header signed by a known sync committee by `import_finalized_header`.
// - Sync period updates: To advance to the next committee by `import_next_sync_committee`.
//
// To stay synced to the current sync period it needs:
// - Get finalized_header_update and sync_period_update at least once per period.
//
// To get light-client best finalized update at period N:
// - Fetch best finalized block's sync_aggregate_header in period N
// - Fetch parent_block/attested_block by sync_aggregate_header's parent_root
// - Fetch finalized_checkpoint_root and finalized_checkpoint_root_witness in attested_block
// - Fetch finalized_header by finalized_checkpoint_root
//
// - sync_aggregate -> parent_block/attested_block -> finalized_checkpoint -> finalized_header
//
// To get light-client sync period update at period N:
// - Fetch the finalized_header in light-client
// - Fetch the finalized_block by finalized_header.slot
// - Fetch next_sync_committee and next_sync_committee_witness in finalized_block
//
// - finalized_header -> next_sync_committee
//
// ```
//                       Finalized               Block   Sync
//                       Checkpoint              Header  Aggreate
// ----------------------|-----------------------|-------|---------> time
//                        <---------------------   <----
//                         finalizes               signs
// ```
//
// To initialize, it needs:
// - BLS verify contract
// - Trust finalized_header
// - current_sync_committee of the trust finalized_header
// - genesis_validators_root of genesis state
//
// When to trigger a committee update sync:
//
//  period 0         period 1         period 2
// -|----------------|----------------|----------------|-> time
//              | now
//               - active current_sync_committee
//               - known next_sync_committee, signed by current_sync_committee
//
//
// next_sync_committee can be imported at any time of the period, not strictly at the period borders.
// - No need to query for period 0 next_sync_committee until the end of period 0
// - After the import next_sync_committee of period 0, populate period 1's committee
  • E2E test for Ethereum beacon light client

@hujw77 hujw77 changed the title echo eth2.0 opt Optimized Ethereum beacon light client May 27, 2022
@hujw77 hujw77 changed the title Optimized Ethereum beacon light client Optimized Ethereum beacon light client and E2E test Jun 10, 2022
@hujw77 hujw77 marked this pull request as ready for review June 10, 2022 11:07
@hujw77 hujw77 requested review from hackfisher and xiaoch05 June 10, 2022 11:07
Copy link
Contributor

@hackfisher hackfisher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hackfisher hackfisher added the C1-neeedaudit Need audit label Jun 13, 2022
@hackfisher hackfisher merged commit aa98a6c into master Jun 13, 2022
@hackfisher hackfisher deleted the echo-eth2.0-opt branch June 13, 2022 09:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C1-neeedaudit Need audit
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants