Skip to content

Conversation

@tmpolaczyk
Copy link
Contributor

@tmpolaczyk tmpolaczyk commented Oct 28, 2025

paritytech/polkadot-sdk#8072

Latest polkadot-sdk release includes a new feature that allows parachain nodes to advertise their IP address in the relay chain DHT (kademlia). This allows other nodes to discover peers without a centralized peer list.

In this PR we implement it for all nodes, including collators and data preservers. Container chain collators do not advertise their IP address, but they do discover bootnodes for the chain they are assigned to. The reason for not advertising is that collators may rotate frequently, and also that they don't have the full block history. So collators can only be valid targets for warp sync, not for full sync.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

WASM runtime size check:

Compared to target branch

dancebox runtime: 1896 KB (no changes) ✅

flashbox runtime: 1128 KB (no changes) ✅

dancelight runtime: 2656 KB (-16 KB) 🚨

starlight runtime: 2568 KB (+4 KB) 🚨

container chain template simple runtime: 1472 KB (no changes) ✅

container chain template frontier runtime: 1832 KB (no changes) ✅

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

Coverage Report

(master)

@@                   Coverage Diff                    @@
##           master   tomasz-dht-bootnodes      +/-   ##
========================================================
+ Coverage   69.75%                 70.60%   +0.85%     
+ Files         542                    548       +6     
+ Lines       72268                  74858    +2590     
========================================================
+ Hits        50409                  52849    +2440     
+ Misses      21859                  22009     +150     
Files Changed Coverage
/chains/integration-tests/xcm/emulated/tests/assets/dancelight/src/tests/erc20_token_transfer_from_container_to_eth.rs 100.00% (+0.22%)
/chains/orchestrator-relays/runtime/starlight/src/lib.rs 36.79% (+0.95%)
/chains/orchestrator-relays/runtime/starlight/src/tests/common/mod.rs 90.82% (+0.01%)
/chains/orchestrator-relays/runtime/starlight/src/tests/container_token_transfers.rs 99.12% (+0.32%)
/chains/orchestrator-relays/runtime/starlight/src/weights/xcm/mod.rs 28.22% (+11.55%)
/chains/orchestrator-relays/runtime/starlight/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs 53.49% (+11.63%)
/chains/orchestrator-relays/runtime/starlight/src/weights/xcm/pallet_xcm_benchmarks_generic.rs 18.42% (+15.64%)
/chains/runtime-common/src/relay.rs 82.24% (-0.10%)
/client/node-common/src/service/node_builder.rs 41.10% (-3.23%)
/client/service-container-chain-spawner/src/service.rs 1.64% (-0.27%)
/client/service-container-chain-spawner/src/spawner.rs 38.75% (-0.12%)

Coverage generated


#[allow(deprecated)]
use sc_executor::NativeElseWasmExecutor;
use sc_network::request_responses::IncomingRequest;
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a lot of places with 2 different use styles - combined and separate lines.
Should we follow one of them? Or should we use different ones depending on specific conditions? Like here - you have aggregated use and you add separated lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sadly rustfmt config for this is nightly only and has issues.

I'm in favor of combined style unless it has different attribute (#[allow(deprecated)] here only applies to the NativeElseWasmExecutor import. grouping also allows not repeating the attribute for multiple uses)

} = start_bootnode_params;

// Advertise parachain bootnode address in relay chain DHT
start_bootnode_tasks(StartBootnodeTasksParams {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add tests for this?
Maybe pick something from here if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add it as a new zombienet suite. We don't have any rust tests using zombienet_sdk and I don't want to be the first to add one.

The test will simply spawn tanssi-relay but with --no-mdns flag to disable peer discovery, and no bootnodes in chain spec or in tanssi pallet data preservers. Then we can simply check that all collators find a bootnode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tests but they don't work because collators don't have the bootnode discovery task. I will try to add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, but now I added data preservers as well so I need to test that 🫠

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the end I did the data preservers test manually, because to register a data preserver you need to put your bootnode address on chain, and it is hard to enforce that other nodes don't look at the on chain address. I verified that the address is advertised correctly, and other nodes discover that address (verified by looking at trace logs), but I didn't verify that other nodes can connect to the data preserver using that address only.

Base automatically changed from tanssi-polkadot-stable2506 to master November 3, 2025 12:21
But not for collators nor data preservers
@tmpolaczyk tmpolaczyk changed the title Impl DHT bootnodes support for templates and tanssi-node Impl DHT bootnodes support for all nodes Nov 19, 2025
@tmpolaczyk tmpolaczyk marked this pull request as ready for review November 19, 2025 14:54
@tmpolaczyk tmpolaczyk added B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes breaking Needs to be mentioned in breaking changes A8-mergeoncegreen Pull request is reviewed well. labels Nov 20, 2025
@tmpolaczyk tmpolaczyk added the D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. label Dec 4, 2025
.database_params
.database = Some(Database::ParityDb);

// TODO: need to modify anything from here?
Copy link
Contributor

Choose a reason for hiding this comment

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

is this TODO still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already fixed yes, will remove the TODO

]
},
{
"name": "zombie_tanssi_relay_dht_bootnodes",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider this feature as important to run on merge once ready @tmpolaczyk ? I think we should, but I trust you on this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. Because this is an "optional" feature, it's an additional way for nodes to discover peers. But if we don't test it explicitly, it is possible that it breaks and we never notice, precisely because its optional. Maybe adding this to the weekly run is enough, if I haven't done that already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A8-mergeoncegreen Pull request is reviewed well. B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants