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

feat(sync): Basic sync logging improvement. #142

Merged
merged 6 commits into from
Feb 14, 2024
Merged

feat(sync): Basic sync logging improvement. #142

merged 6 commits into from
Feb 14, 2024

Conversation

itsdevbear
Copy link
Contributor

@itsdevbear itsdevbear commented Feb 14, 2024

We will need to refactor this later.

Summary by CodeRabbit

  • Refactor
    • Updated BeaconSyncProgress struct to use Status instead of status.
    • Moved initial sync check for execution client sync to RegisterAPIRoutes function.
    • Removed logic related to syncStatus in PreBlocker method.
    • Added new error variables for out-of-sync execution client cases.
    • Utilized syncService field to check synchronization status in proposal handling methods.
    • Added an extra argument in a function call within a test function.

@itsdevbear itsdevbear marked this pull request as ready for review February 14, 2024 00:52
Copy link
Contributor

coderabbitai bot commented Feb 14, 2024

Walkthrough

The changes focus on enhancing synchronization and context handling in the Beacon module. Updates include refining the BeaconSyncProgress struct, reorganizing initial sync checks, and improving error handling related to out-of-sync execution clients.

Changes

Files Summary
beacon/initial-sync/service.go, beacon/initial-sync/types.go Refactored BeaconSyncProgress struct to use Status instead of status.
examples/beacond/app/app.go Moved initial sync check for execution client sync to RegisterAPIRoutes. Improved context handling for API route registration.
runtime/abci.go Added syncService parameter in RegisterApp function call within BeaconKitRuntime.
runtime/abci/preblock/preblock.go Removed syncStatus logic in PreBlocker of BeaconPreBlockHandler. Commented on using BeaconConfig.
runtime/abci/proposal/errors.go Introduced ErrValidatorClientNotSynced and ErrClientNotSynced for out-of-sync client scenarios.
runtime/abci/proposal/proposal.go Added initialsync import, syncService field in Handler struct, and used it for synchronization checks in proposal handling.
runtime/abci/proposal/proposal_test.go Added nil argument in NewHandler call within TestRemoveBeaconBlockFromTxs.

Poem

Code changes dance like fireflies bright,
Synced structures now gleam in the light.
Errors caught before they grow,
Rabbit's code, a synchronized show. 🐇✨


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (5d96202) 28.04% compared to head (e1ad38c) 28.05%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #142      +/-   ##
==========================================
+ Coverage   28.04%   28.05%   +0.01%     
==========================================
  Files         102      102              
  Lines        3791     3793       +2     
  Branches        4        4              
==========================================
+ Hits         1063     1064       +1     
- Misses       2650     2651       +1     
  Partials       78       78              
Files Coverage Δ
runtime/abci/preblock/preblock.go 0.00% <ø> (ø)
runtime/abci.go 0.00% <0.00%> (ø)
runtime/abci/proposal/proposal.go 22.58% <11.11%> (+1.26%) ⬆️
beacon/initial-sync/service.go 0.00% <0.00%> (ø)
examples/beacond/app/app.go 3.15% <0.00%> (-0.11%) ⬇️

@itsdevbear itsdevbear enabled auto-merge February 14, 2024 14:37
@@ -168,10 +168,10 @@ func (s *Service) CheckSyncStatusAndForkchoice(ctx context.Context) error {

// If the beacon chain is ahead of the execution chain, we need to trigger a forkchoice
// update to get the execution chain to start syncing, otherwise we can just return.
if bss.status != StatusBeaconAhead {
if bss.Status == StatusExecutionAhead {
Copy link
Contributor

Choose a reason for hiding this comment

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

The above comment is confusing, consider change it to "If the execution chain is ahead of the beacon chain, we can just return, otherwise ..."

app.BeaconKitRunner.StartServices(ctx)

// Initial check for execution client sync.
if err := app.BeaconKitRunner.InitialSyncCheck(
Copy link
Contributor

Choose a reason for hiding this comment

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

DoingInitialSyncCheck here makes more sense to me!

// ErrValidatorClientNotSynced is an error for when a
// validator tries to propose a block with an out of sync
// execution client.
ErrValidatorClientNotSynced = errors.New(`your validator tried to propose a
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ErrValidatorClientNotSynced = errors.New(`your validator tried to propose a
ErrProposerClientNotSynced = errors.New(`your validator tried to propose a

Copy link
Contributor

@po-bera po-bera left a comment

Choose a reason for hiding this comment

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

lgtm! I left some minor comments which can be addressed later if we don't have time rn.

@itsdevbear itsdevbear added this pull request to the merge queue Feb 14, 2024
Merged via the queue into main with commit 944d351 Feb 14, 2024
9 checks passed
@itsdevbear itsdevbear deleted the check-4-sync branch February 14, 2024 17:12
abi87 pushed a commit that referenced this pull request Jan 18, 2025
…lock deposits (#142)

* fix(state-transition): Correctly enforce local validation of beacon block deposits

* lint cleanup

* Update state-transition/core/validation_deposits_test.go

Signed-off-by: Cal Bera <[email protected]>

* nit clean for loop

* nosec

---------

Signed-off-by: Cal Bera <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants