Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fixed block response limit check #9692

Merged
3 commits merged into from
Sep 6, 2021
Merged

Fixed block response limit check #9692

3 commits merged into from
Sep 6, 2021

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Sep 4, 2021

When computing block response size, the code was incorrectly counting extrinsics rather than bytes.

Also decreased MAX_BLOCKS_TO_REQUEST so that the nodes can sync without waiting for others to upgrade and tweaked timeout value.

Fixes paritytech/polkadot#3778

@arkpar arkpar added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C9-critical ‼️ D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Sep 4, 2021
@arkpar arkpar requested review from tomaka and bkchr September 4, 2021 07:43
@@ -355,7 +355,8 @@ impl<B: BlockT> BlockRequestHandler<B> {
indexed_body,
};

total_size += block_data.body.len();
total_size += block_data.body.iter().map(|ex| ex.len()).sum::<usize>();
total_size += block_data.indexed_body.iter().map(|ex| ex.len()).sum::<usize>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Might this work well as a size() function on block_data?

Copy link
Member Author

Choose a reason for hiding this comment

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

BlockData struct is auto generated from protobuf description. Also, we don't need all of the field to be sized here, just the bodies. The rest do not vary much and should definitely fit in the margin.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Adding a test would be nice

@@ -62,7 +62,7 @@ pub fn generate_protocol_config(protocol_id: &ProtocolId) -> ProtocolConfig {
name: generate_protocol_name(protocol_id).into(),
max_request_size: 1024 * 1024,
max_response_size: 16 * 1024 * 1024,
request_timeout: Duration::from_secs(40),
request_timeout: Duration::from_secs(20),
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change the timeout?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit off-topic for this PR, but this timeout is too high anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right it was too high in the first place, and since I've also decreased the number of requested blocks the timeout should be readjusted.

@arkpar arkpar added B5-clientnoteworthy and removed B0-silent Changes should not be mentioned in any release notes labels Sep 5, 2021
@arkpar
Copy link
Member Author

arkpar commented Sep 5, 2021

Added a test and fixed response start block detection. Rather than trusting that it matches the request it should be detected from the response.

@bkchr
Copy link
Member

bkchr commented Sep 5, 2021

@arkpar did you missed to push the test changes?

@bkchr
Copy link
Member

bkchr commented Sep 6, 2021

bot merge

@ghost
Copy link

ghost commented Sep 6, 2021

Trying merge.

@ghost ghost merged commit e7b93e1 into master Sep 6, 2021
@ghost ghost deleted the a-block-response-limit branch September 6, 2021 07:25
chevdor pushed a commit that referenced this pull request Sep 6, 2021
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
crystalin pushed a commit to moonbeam-foundation/substrate that referenced this pull request Sep 6, 2021
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
GopherJ pushed a commit to parallel-finance/substrate that referenced this pull request Sep 14, 2021
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
jasl added a commit to Phala-Network/khala-parachain that referenced this pull request Sep 20, 2021
frisitano added a commit to frisitano/reef-chain that referenced this pull request Oct 8, 2021
jordy25519 pushed a commit to cennznet/substrate that referenced this pull request Nov 4, 2021
jordy25519 added a commit to cennznet/substrate that referenced this pull request Nov 4, 2021
Neopallium pushed a commit to PolymeshAssociation/substrate that referenced this pull request Jan 10, 2022
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
Neopallium pushed a commit to PolymeshAssociation/substrate that referenced this pull request Jan 10, 2022
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
Neopallium pushed a commit to PolymeshAssociation/substrate that referenced this pull request Jan 10, 2022
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
adamdossa pushed a commit to PolymeshAssociation/substrate that referenced this pull request Jan 14, 2022
* Fixed block response limit check

* Fixed start block detection and added a test

* Missing test
Githubinspiration added a commit to Githubinspiration/reef_chain-rust that referenced this pull request May 10, 2024
pjakekell added a commit to pjakekell/chain-node that referenced this pull request Aug 5, 2024
0xchainlover pushed a commit to Reef-network/reef-chain that referenced this pull request Nov 8, 2024
This pull request was closed.
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. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kusama Node Fails to Sync Beyond 8949248
5 participants