Skip to content

[WIP] Add support for Substrate-compatible parachains#2198

Draft
tomaka wants to merge 5 commits intosmol-dot:mainfrom
tomaka:fix-2158
Draft

[WIP] Add support for Substrate-compatible parachains#2198
tomaka wants to merge 5 commits intosmol-dot:mainfrom
tomaka:fix-2158

Conversation

@tomaka
Copy link
Contributor

@tomaka tomaka commented Jan 12, 2026

This is a work-in-progress PR to add support for parachains that sync with the parachain network the same way as standalone/relay chains, but also get the finality information from the relay chain.

I went through the code, and contrary to what I've said in #2158 I think it's better to plug this to the standalone chain code.

The general plan would be:

  • Try to sync a parachain (without finality) using the existing standalone chains code and fix the potential problems that arise.
  • Extract the code in light-base/src/sync_service/parachain.rs that does runtime request into a separate file that gives events about the relay chain, and update parachain.rs to use this code.
  • Also use this code in substrate_compat.rs, adding any missing function in lib/src/sync such as a function to force-set the current finalized block.
  • Add some way to specify whether the chain is Substrate-compatible from the public JavaScript API. It's completely unclear to me how, but in terms of efforts it should be minimal anyway.
  • Consider removing the old parachain.rs altogether? Is there any parachain out there that doesn't use Substrate or has so heavily customized Substrate that it can't sync using smoldot?

@tomaka
Copy link
Contributor Author

tomaka commented Jan 12, 2026

One thing that's not clear to me is whether the parahead from the relay chain best block is important in some way or not.
From the perspective of the parachain, we can know the parablock that is likely to be finalized, but when it comes to smoldot we don't actually care about this information since we don't propagate it through the JSON-RPC layer.

cc @bkchr 🙏 Or is there something I'm forgetting?

@bkchr
Copy link
Contributor

bkchr commented Jan 12, 2026

Yeah you are right. The only other benefit you get is to know what the best block is. Otherwise it doesn't bring you any other advantage.

@tomaka
Copy link
Contributor Author

tomaka commented Jan 14, 2026

The new paraheads.rs file is basically the same as the existing parachain.rs but without any networking. It simply reports the new and finalized paraheads by following the relay chain and does nothing else.
Then parachain.rs combines this with the networking. Normally no behavior has changed so far compared to the main branch.

The next step will be to make the "substrate-compatible" sync service use this paraheads service when relevant.
I am on vacation for the next three weeks, but I'll go back to it afterwards.

@bkchr
Copy link
Contributor

bkchr commented Jan 14, 2026

@tomaka I wish you nice vacations.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 9, 2026

I'm now back from vacation. However, the plan was to fund my work through PAPI. Given that PAPI no longer has funding, I'm also stopping work on this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants