-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
test: live sync test to check make canonical #10131
Conversation
e9f015f
to
65a9afe
Compare
6fe0ab7
to
33a4a1a
Compare
crates/engine/tree/src/tree/mod.rs
Outdated
if self.is_sync_target_head(child_num_hash.hash) { | ||
self.make_canonical(child_num_hash.hash); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main change in the PR, without this the additional blocks after backfill sync were not being made canonical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh very nice, yeah I actually noticed this and was wondering
} | ||
|
||
self.provider.extend_blocks(block_data); | ||
self.provider.extend_headers(headers_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allows us to properly query the provider for data persisted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome find, love the tests that make it obvious what scenario is being tested.
I have one suggestion re when we actually call make_canonical on insert
crates/engine/tree/src/tree/mod.rs
Outdated
if self.is_sync_target_head(child_num_hash.hash) { | ||
self.make_canonical(child_num_hash.hash); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh very nice, yeah I actually noticed this and was wondering
crates/engine/tree/src/tree/mod.rs
Outdated
if self.is_sync_target_head(child_num_hash.hash) { | ||
self.make_canonical(child_num_hash.hash); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes perfect sense, but I think we should add an additional check here that ensures, this is a new block by checking the InsertPayloadOk
reth/crates/blockchain-tree-api/src/lib.rs
Lines 256 to 257 in 0173725
/// The payload was valid and inserted into the tree. | |
Inserted(BlockStatus), |
separately, we should consider not reusing this from legacy tree but roll our own that no longer needs the BlockAttachment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes perfect sense, but I think we should add an additional check here that ensures, this is a new block by checking the InsertPayloadOk
makes sense, done here b5b1b34
separately, we should consider not reusing this from legacy tree but roll our own that no longer needs the
BlockAttachment
sure I can work on this in a follow-up
… canonical chain commited event
…nical and recovered test_engine_tree_live_sync_transition_required_blocks_requested
…BlockStatus::Valid
0173725
to
b5b1b34
Compare
Towards: #10015
Adds a test to verify that the live synced blocks after a backfill sync are eventually made canonical.
These are the steps of the test
To make it work I needed to call
make_canonical
intry_connect_buffered_blocks
on successful insertion, otherwise, this was only done on the code path for downloaded blocks, pls let me know if this is advisable.There's also additional refactors and improvements in
TestHarness
, like setting up the inserted headers in mock provider to properly simulate a persisted chain.