Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eth2Client: improvements, refactoring #882

Merged
merged 20 commits into from
Apr 5, 2023
Merged

Conversation

karim-en
Copy link
Collaborator

@karim-en karim-en commented Mar 29, 2023

Refactor the eth2 light client to resolve an issue of missing finality for more than 5 epochs.

  • Added two modes SubmitLightClientUpdate and SubmitHeader.
  • By default, the client is in SubmitLightClientUpdate and it turns into SubmitHeader after submitting a light client update.
  • Added integration tests for migration logic.
  • The relayer can submit a LightClientUpdate after any number of epochs/blocks, but those can be finalized only if the size of the gap between the current finalized block and the subsequent finalized block is higher than hashes_gc_threshold, otherwise, the GC can't be applied correctly.
  • Update Eth2-to-Near relay and eth2near crates to v0.3.0.

Copy link
Contributor

@sept-en sept-en left a comment

Choose a reason for hiding this comment

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

Having these changes, we also need to add an extra verification to make sure that the chain is convergent. So block_hash_safe() method would need to add a check that the block is safe only when block_number <= finalized_execution_header.block_number.

But consequently, this also means that finalized_execution_blocks variable no longer represents finalized blocks because the only finalized_execution_header is actually final.

contracts/near/eth2-client/src/lib.rs Outdated Show resolved Hide resolved
contracts/near/eth2-client/src/lib.rs Outdated Show resolved Hide resolved
contracts/near/eth2-client/src/lib.rs Outdated Show resolved Hide resolved
contracts/near/eth2-client/src/lib.rs Outdated Show resolved Hide resolved
contracts/near/eth2-client/src/lib.rs Show resolved Hide resolved
@karim-en karim-en marked this pull request as ready for review March 31, 2023 02:26
@sept-en sept-en requested a review from olga24912 March 31, 2023 11:53
karim-en and others added 3 commits April 4, 2023 18:36
* utilize client modes for light client and execution blocks submission.
* add checks for unfinalized tail block number.
* add binsearch for a slot by block number.
* delete unused functions.
* remove irrelevant tests.
* fix tests.

---------

Co-authored-by: Karim <karim@aurora.dev>
Co-authored-by: Kirill <kirill@aurora.dev>
@sept-en sept-en changed the title Refactoring eth2 client Eth2Client: improvements, refactoring. Apr 5, 2023
@sept-en sept-en changed the title Eth2Client: improvements, refactoring. Eth2Client: improvements, refactoring Apr 5, 2023
@sept-en sept-en added enhancement dependencies Pull requests that update a dependency file labels Apr 5, 2023
@sept-en sept-en merged commit 1117f95 into master Apr 5, 2023
@sept-en sept-en deleted the refactoring-eth2-client branch April 5, 2023 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants