This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
sc-network-test::Peer: block push methods return hashes vec #12944
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit reworks the block generation/push methods in sc-network-test::Peer. Now methods are providing the vector of hashes that were built. This allows to get rid of redundant `block_hash_from_id` call, as all hashes are known just after being built. Similar approach was taken in BeefyTestNet::generate_blocks_and_sync method. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
michalkucharczyk
requested review from
acatangiu and
andresilva
as code owners
December 15, 2022 16:22
michalkucharczyk
added
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
labels
Dec 15, 2022
// Sanity checks. | ||
context | ||
.client | ||
.state_at(hash) | ||
.state_at(self.block.header.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.
note: this is not related to other changes, just removed excessive call to expect_block_hash_from_id
.
@@ -285,13 +284,13 @@ fn sync_justifications() { | |||
runtime.block_on(futures::future::poll_fn::<(), _>(|cx| { | |||
net.poll(cx); | |||
|
|||
for hash in [hashof10, hashof15, hashof20] { | |||
if net.peer(0).client().justifications(hash).unwrap() != | |||
for height in (10..21).step_by(5) { |
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 was just reverted to original form (as it was before BlockId
-refactor:
substrate/client/network/test/src/sync.rs
Lines 280 to 291 in 97ad64b
for height in (10..21).step_by(5) { | |
if net.peer(0).client().justifications(&BlockId::Number(height)).unwrap() != | |
Some(Justifications::from((*b"FRNK", Vec::new()))) | |
{ | |
return Poll::Pending | |
} | |
if net.peer(1).client().justifications(&BlockId::Number(height)).unwrap() != | |
Some(Justifications::from((*b"FRNK", Vec::new()))) | |
{ | |
return Poll::Pending | |
} | |
} |
altonen
approved these changes
Dec 16, 2022
acatangiu
approved these changes
Dec 16, 2022
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.
Looks good!
bkchr
approved these changes
Dec 16, 2022
Co-authored-by: Bastian Köcher <git@kchr.de>
bot merge |
ltfschoen
pushed a commit
to ltfschoen/substrate
that referenced
this pull request
Feb 22, 2023
…ch#12944) * sc-network-test::Peer: block push methods return hashes vec This commit reworks the block generation/push methods in sc-network-test::Peer. Now methods are providing the vector of hashes that were built. This allows to get rid of redundant `block_hash_from_id` call, as all hashes are known just after being built. Similar approach was taken in BeefyTestNet::generate_blocks_and_sync method. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * fix * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de>
ark0f
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Feb 27, 2023
…ch#12944) * sc-network-test::Peer: block push methods return hashes vec This commit reworks the block generation/push methods in sc-network-test::Peer. Now methods are providing the vector of hashes that were built. This allows to get rid of redundant `block_hash_from_id` call, as all hashes are known just after being built. Similar approach was taken in BeefyTestNet::generate_blocks_and_sync method. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * fix * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit reworks the block generation/push methods in
sc-network-test::Peer
.Now methods are providing the vector of hashes that were built.
This allows to get rid of redundant
block_hash_from_id
call, as all hashes are known just after being built.Similar approach was taken in
BeefyTestNet::generate_blocks_and_sync
method.This PR is part of
BlockId::Number
refactoring analysis (paritytech/polkadot-sdk#53)