Skip to content

Modular block request handler#1524

Merged
dmitry-markin merged 8 commits into
paritytech:masterfrom
rahulksnv:modular-block-handler
Sep 15, 2023
Merged

Modular block request handler#1524
dmitry-markin merged 8 commits into
paritytech:masterfrom
rahulksnv:modular-block-handler

Conversation

@rahulksnv

@rahulksnv rahulksnv commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

Submit the outstanding PRs from the old repos(these were already reviewed and approved before the repo rorg, but not yet submitted):
Main PR: paritytech/substrate#14014
Companion PRs: paritytech/polkadot#7134, paritytech/cumulus#2489

The changes in the PR:

  1. ChainSync currently calls into the block request handler directly. Instead, move the block request handler behind a trait. This allows new protocols to be plugged into ChainSync.
  2. BuildNetworkParams is changed so that custom relay protocol implementations can be (optionally) passed in during network creation time. If custom protocol is not specified, it defaults to the existing block handler
  3. BlockServer and BlockDownloader traits are introduced for the protocol implementation. The existing block handler has been changed to implement these traits
  4. Other changes:
    [X] Make TxHash serializable. This is needed for exchanging the serialized hash in the relay protocol messages
    [X] Clean up types no longer used(OpaqueBlockRequest, OpaqueBlockResponse)

@rahulksnv rahulksnv force-pushed the modular-block-handler branch from 3e6dd57 to 7096f91 Compare September 12, 2023 19:49
@rahulksnv rahulksnv marked this pull request as ready for review September 12, 2023 19:50
@bkchr bkchr requested a review from a team September 13, 2023 07:42
@altonen

altonen commented Sep 13, 2023

Copy link
Copy Markdown
Contributor

I haven't looked at the changes yet but this may have to wait a little while since @dmitry-markin is doing refactoring on ChainSync, especially w.r.t. to request handling.

@nazar-pc

Copy link
Copy Markdown
Contributor

PR was out at the old repo since April, I was really hoping we can upstream this since it touches pretty fundamental internals and every time something changes upstream it is a bit of PITA to rebase it.

@altonen

altonen commented Sep 13, 2023

Copy link
Copy Markdown
Contributor

Understandable and apologies for stalling with the review of the original PR. We've finally found time to start refactoring the syncing code which is long overdue and the idea is to convert ChainSync to do no I/O or polling, which, after a brief look, is at odds with the changes of this PR. We're most likely doing a facelift for the request/response code relatively soon as well.

@dmitry-markin can you give an estimate how much work is it to rebase your changes on top of these changes?

Comment thread substrate/client/network/sync/src/lib.rs Outdated
Comment thread substrate/client/network/sync/src/lib.rs Outdated
Comment thread substrate/client/network/sync/src/block_relay_protocol.rs Outdated
@dmitry-markin

Copy link
Copy Markdown
Contributor

@dmitry-markin can you give an estimate how much work is it to rebase your changes on top of these changes?

I think we can merge this, the changes of this PR are mostly self contained and don't interfere in a bad way (and even simplify some things) with work on extracting request-responses. I'll just move the BlockDownloader one level up to the SyncingEngine.

As a side note, the situation around this PR seems quite weird, because the original PR was approved a long time ago, just nobody pressed the "merge" button.

@dmitry-markin dmitry-markin added the T0-node This PR/Issue is related to the topic “node”. label Sep 14, 2023
Comment thread substrate/client/network/sync/src/lib.rs
@rahulksnv

Copy link
Copy Markdown
Contributor Author

As a side note, the situation around this PR seems quite weird, because the original PR was approved a long time ago, just nobody pressed the "merge" button.

Apologies on that. I had a hard time getting green on all three PRs (the main one + two in the companion repos) .. by the time I get green, something would have changed and had to resync/retry. At some point I got busy with other stuff and this went to the back burner. So glad that the companion repos have been consolidated into one repo now

rahulksnv and others added 5 commits September 14, 2023 10:29
Patch the outstanding PRs from the old repos:
paritytech/substrate#14014
paritytech/polkadot#7134
paritytech/cumulus#2489

These were already reviewed and approved, but not yet
submitted.
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
@rahulksnv rahulksnv force-pushed the modular-block-handler branch from 3aeb10a to 2fcbba7 Compare September 14, 2023 17:35
@rahulksnv

Copy link
Copy Markdown
Contributor Author

@dmitry-markin @altonen Addressed the comments, please let me know what else is needed in order to merge the PR, thanks.

@dmitry-markin

Copy link
Copy Markdown
Contributor

bot fmt

@command-bot

command-bot Bot commented Sep 15, 2023

Copy link
Copy Markdown

@dmitry-markin https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3704149 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 5-6f203b54-1fd3-419a-b655-322cd76803f4 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot

command-bot Bot commented Sep 15, 2023

Copy link
Copy Markdown

@dmitry-markin Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3704149 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3704149/artifacts/download.

@dmitry-markin dmitry-markin enabled auto-merge (squash) September 15, 2023 07:00
@dmitry-markin dmitry-markin merged commit b35b28c into paritytech:master Sep 15, 2023
@nazar-pc

Copy link
Copy Markdown
Contributor

Thanks you for quick progress here!

@dmitry-markin

Copy link
Copy Markdown
Contributor

@dmitry-markin @altonen Addressed the comments, please let me know what else is needed in order to merge the PR, thanks.

All is good, the PR is merged. Thanks for contributing!

@rahulksnv

Copy link
Copy Markdown
Contributor Author

@dmitry-markin @altonen Addressed the comments, please let me know what else is needed in order to merge the PR, thanks.

All is good, the PR is merged. Thanks for contributing!

Thanks @dmitry-markin @altonen for the help in getting this merged

JoshOrndorff pushed a commit to Off-Narrative-Labs/Tuxedo that referenced this pull request Oct 23, 2023
JoshOrndorff added a commit to Off-Narrative-Labs/Tuxedo that referenced this pull request Oct 23, 2023
@Polkadot-Forum

Copy link
Copy Markdown

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/polkadot-release-analysis-v1-2-0/4451/1

bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
Submit the outstanding PRs from the old repos(these were already
reviewed and approved before the repo rorg, but not yet submitted):
Main PR: paritytech/substrate#14014
Companion PRs: paritytech/polkadot#7134,
paritytech/cumulus#2489

The changes in the PR:
1. ChainSync currently calls into the block request handler directly.
Instead, move the block request handler behind a trait. This allows new
protocols to be plugged into ChainSync.
2. BuildNetworkParams is changed so that custom relay protocol
implementations can be (optionally) passed in during network creation
time. If custom protocol is not specified, it defaults to the existing
block handler
3. BlockServer and BlockDownloader traits are introduced for the
protocol implementation. The existing block handler has been changed to
implement these traits
4. Other changes:
[X] Make TxHash serializable. This is needed for exchanging the
serialized hash in the relay protocol messages
[X] Clean up types no longer used(OpaqueBlockRequest,
OpaqueBlockResponse)

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: command-bot <>
aurexav added a commit to darwinia-network/darwinia that referenced this pull request Jun 21, 2024
aurexav added a commit to darwinia-network/darwinia that referenced this pull request Jun 28, 2024
* Setup deps

* Remove Koi from account migration test

* paritytech/polkadot-sdk#1495

* Bump

* paritytech/polkadot-sdk#1524

* !! paritytech/polkadot-sdk#1363

* paritytech/polkadot-sdk#1492

* paritytech/polkadot-sdk#1911

* paritytech/polkadot-sdk#1900

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1661

* paritytech/polkadot-sdk#2144

* paritytech/polkadot-sdk#2048

* paritytech/polkadot-sdk#1672

* paritytech/polkadot-sdk#2303

* paritytech/polkadot-sdk#1256

* Remove identity and vesting

* Fixes

* paritytech/polkadot-sdk#2657

* paritytech/polkadot-sdk#1313

* paritytech/polkadot-sdk#2331

* paritytech/polkadot-sdk#2409 part.1

* paritytech/polkadot-sdk#2767

* paritytech/polkadot-sdk#2521

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1222

* paritytech/polkadot-sdk#1234 part.1

* Satisfy compiler

* XCM V4 part.1

* paritytech/polkadot-sdk#1246

* Remove pallet-democracy part.1

* paritytech/polkadot-sdk#2142

* paritytech/polkadot-sdk#2428

* paritytech/polkadot-sdk#3228

* XCM V4 part.2

* Bump

* Build all runtimes

* Build node

* Remove pallet-democracy

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* Format

* Fix pallet tests

* Fix precompile tests

* Format

* Fixes

* Async, remove council, common pallet config

* Fix `ethtx-forward` test case (#1519)

* Fix ethtx-forward tests

* Format

* Fix following the review

* Fixes

* Fixes

* Use default impl

* Benchmark helper

* Bench part.1

* Bench part.2

* Bench part.3

* Fix all tests

* Typo

* Feat

* Fix EVM tracing build

* Reuse upstream `proof_size_base_cost()` (#1521)

* Format issue

* Fixes

* Fix CI

---------

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Bear Wang <boundless.forest@outlook.com>
Patrick8rz added a commit to Patrick8rz/darwinia that referenced this pull request Sep 6, 2025
* Setup deps

* Remove Koi from account migration test

* paritytech/polkadot-sdk#1495

* Bump

* paritytech/polkadot-sdk#1524

* !! paritytech/polkadot-sdk#1363

* paritytech/polkadot-sdk#1492

* paritytech/polkadot-sdk#1911

* paritytech/polkadot-sdk#1900

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1661

* paritytech/polkadot-sdk#2144

* paritytech/polkadot-sdk#2048

* paritytech/polkadot-sdk#1672

* paritytech/polkadot-sdk#2303

* paritytech/polkadot-sdk#1256

* Remove identity and vesting

* Fixes

* paritytech/polkadot-sdk#2657

* paritytech/polkadot-sdk#1313

* paritytech/polkadot-sdk#2331

* paritytech/polkadot-sdk#2409 part.1

* paritytech/polkadot-sdk#2767

* paritytech/polkadot-sdk#2521

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1222

* paritytech/polkadot-sdk#1234 part.1

* Satisfy compiler

* XCM V4 part.1

* paritytech/polkadot-sdk#1246

* Remove pallet-democracy part.1

* paritytech/polkadot-sdk#2142

* paritytech/polkadot-sdk#2428

* paritytech/polkadot-sdk#3228

* XCM V4 part.2

* Bump

* Build all runtimes

* Build node

* Remove pallet-democracy

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* Format

* Fix pallet tests

* Fix precompile tests

* Format

* Fixes

* Async, remove council, common pallet config

* Fix `ethtx-forward` test case (#1519)

* Fix ethtx-forward tests

* Format

* Fix following the review

* Fixes

* Fixes

* Use default impl

* Benchmark helper

* Bench part.1

* Bench part.2

* Bench part.3

* Fix all tests

* Typo

* Feat

* Fix EVM tracing build

* Reuse upstream `proof_size_base_cost()` (#1521)

* Format issue

* Fixes

* Fix CI

---------

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Bear Wang <boundless.forest@outlook.com>
aiden94a added a commit to aiden94a/Tuxedo that referenced this pull request Sep 7, 2025
jacksonLewis88 added a commit to jacksonLewis88/darwinia that referenced this pull request Sep 25, 2025
* Setup deps

* Remove Koi from account migration test

* paritytech/polkadot-sdk#1495

* Bump

* paritytech/polkadot-sdk#1524

* !! paritytech/polkadot-sdk#1363

* paritytech/polkadot-sdk#1492

* paritytech/polkadot-sdk#1911

* paritytech/polkadot-sdk#1900

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1661

* paritytech/polkadot-sdk#2144

* paritytech/polkadot-sdk#2048

* paritytech/polkadot-sdk#1672

* paritytech/polkadot-sdk#2303

* paritytech/polkadot-sdk#1256

* Remove identity and vesting

* Fixes

* paritytech/polkadot-sdk#2657

* paritytech/polkadot-sdk#1313

* paritytech/polkadot-sdk#2331

* paritytech/polkadot-sdk#2409 part.1

* paritytech/polkadot-sdk#2767

* paritytech/polkadot-sdk#2521

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1222

* paritytech/polkadot-sdk#1234 part.1

* Satisfy compiler

* XCM V4 part.1

* paritytech/polkadot-sdk#1246

* Remove pallet-democracy part.1

* paritytech/polkadot-sdk#2142

* paritytech/polkadot-sdk#2428

* paritytech/polkadot-sdk#3228

* XCM V4 part.2

* Bump

* Build all runtimes

* Build node

* Remove pallet-democracy

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* Format

* Fix pallet tests

* Fix precompile tests

* Format

* Fixes

* Async, remove council, common pallet config

* Fix `ethtx-forward` test case (#1519)

* Fix ethtx-forward tests

* Format

* Fix following the review

* Fixes

* Fixes

* Use default impl

* Benchmark helper

* Bench part.1

* Bench part.2

* Bench part.3

* Fix all tests

* Typo

* Feat

* Fix EVM tracing build

* Reuse upstream `proof_size_base_cost()` (#1521)

* Format issue

* Fixes

* Fix CI

---------

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Bear Wang <boundless.forest@outlook.com>
kinetic-smith803tr added a commit to kinetic-smith803tr/darwinia that referenced this pull request Sep 26, 2025
* Setup deps

* Remove Koi from account migration test

* paritytech/polkadot-sdk#1495

* Bump

* paritytech/polkadot-sdk#1524

* !! paritytech/polkadot-sdk#1363

* paritytech/polkadot-sdk#1492

* paritytech/polkadot-sdk#1911

* paritytech/polkadot-sdk#1900

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1661

* paritytech/polkadot-sdk#2144

* paritytech/polkadot-sdk#2048

* paritytech/polkadot-sdk#1672

* paritytech/polkadot-sdk#2303

* paritytech/polkadot-sdk#1256

* Remove identity and vesting

* Fixes

* paritytech/polkadot-sdk#2657

* paritytech/polkadot-sdk#1313

* paritytech/polkadot-sdk#2331

* paritytech/polkadot-sdk#2409 part.1

* paritytech/polkadot-sdk#2767

* paritytech/polkadot-sdk#2521

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* paritytech/polkadot-sdk#1222

* paritytech/polkadot-sdk#1234 part.1

* Satisfy compiler

* XCM V4 part.1

* paritytech/polkadot-sdk#1246

* Remove pallet-democracy part.1

* paritytech/polkadot-sdk#2142

* paritytech/polkadot-sdk#2428

* paritytech/polkadot-sdk#3228

* XCM V4 part.2

* Bump

* Build all runtimes

* Build node

* Remove pallet-democracy

Signed-off-by: Xavier Lau <xavier@inv.cafe>

* Format

* Fix pallet tests

* Fix precompile tests

* Format

* Fixes

* Async, remove council, common pallet config

* Fix `ethtx-forward` test case (#1519)

* Fix ethtx-forward tests

* Format

* Fix following the review

* Fixes

* Fixes

* Use default impl

* Benchmark helper

* Bench part.1

* Bench part.2

* Bench part.3

* Fix all tests

* Typo

* Feat

* Fix EVM tracing build

* Reuse upstream `proof_size_base_cost()` (#1521)

* Format issue

* Fixes

* Fix CI

---------

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Bear Wang <boundless.forest@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants