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

Write range sync tests in external event-driven form #6618

Open
wants to merge 4 commits into
base: unstable
Choose a base branch
from

Conversation

dapplion
Copy link
Collaborator

@dapplion dapplion commented Nov 27, 2024

Issue Addressed

Re-write existing range sync tests into an event-driven format to accommodate the refactor introduced in

This format was introduced in

and does not make assumptions about internal functions, it treats sync as a black box inputting actual events used in production.

Note: I've removed the generics used in range sync since now we don't unit test directly

@dapplion dapplion added work-in-progress PR is a work-in-progress syncing labels Nov 27, 2024
@dapplion dapplion marked this pull request as ready for review November 27, 2024 13:53
@dapplion dapplion added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Nov 27, 2024
@jimmygchen jimmygchen self-assigned this Dec 10, 2024
rig.remember_block(finalized_peer_block);

// Add an additional peer to the second chain to make range update it's status
rig.add_finalized_peer();
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand what this line does - do we need to assert for some condition after doing this?

let block_root =
tokio::runtime::Runtime::new()
.unwrap()
.block_on(self.harness.extend_chain(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe consider using async/await here instead of creating a new tokio::Runtime - might keep things simpler and avoid the extra overhead?

fn remember_block(&mut self, block: SignedBeaconBlock<E>) {
tokio::runtime::Runtime::new()
.unwrap()
.block_on(self.harness.process_block(
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@jimmygchen
Copy link
Member

Nice! Looks clean and easy to read 👍

@jimmygchen jimmygchen added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syncing waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants