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

Bsc block import #14784

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Bsc block import #14784

wants to merge 11 commits into from

Conversation

loocapro
Copy link
Contributor

@loocapro loocapro commented Mar 1, 2025

Block Import Process for BSC

This PR enables block import for BSC with the following steps:

  1. Receive a NewBlockMessage from the network.
  2. Validate the block to ensure it adheres to consensus rules.
  3. Convert the block into execution data.
  4. Send the execution data to the engine service.
  5. Handle Parlia Fork Choice Update (FCU) based on block height and hash.
  6. Send the FCU message to the engine service.
  • BscBlockImport trait: wrapper on 2 channels to pass and receive messages back from the service
  • BscBlockImportService: standalone future that knows how to communicate with the EngineService and make a new block the new head
  • FCU handling: follow highest height, same height select lower block hash
  • Tests

@emhane emhane added A-networking Related to networking in general C-example Examples labels Mar 10, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

some suggestions, but overall this is pretty good already

Comment on lines 55 to 60
/// Engine error
#[error(transparent)]
Engine(#[from] BeaconOnNewPayloadError),
/// Invalid payload
#[error("invalid payload: {0}")]
InvalidPayload(String),
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you want to open another pr that introduces a Other<Box<dyn Error> variant for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here you go:

#14938

@jenpaff jenpaff linked an issue Mar 11, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general C-example Examples
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

SDK example for Reth-BSC
3 participants