Open fend25 opened 1 year ago
Hi,
Thanks for reporting this issue and for the amount of details provided in it.
I noticed the following in your code-snipped:
const relayProvider = new ScProvider(Sc, Sc.WellKnownChain.polkadot)
const provider = new ScProvider(Sc, parachainSpec, relayProvider)
console.time('connect')
await provider.connect()
could you please try doing this, instead:
const relayProvider = new ScProvider(Sc, Sc.WellKnownChain.polkadot)
const provider = new ScProvider(Sc, parachainSpec, relayProvider)
console.time('connect')
await relayProvider.connect()
await provider.connect()
and let me know if that fixes the issue? 🙏
I know, I know... Why should you first connect to the relay-chain yourself, when the parachain provider knows about the existence of the relay-chain, right? Why doesn't it do it automatically for you?
Great question! I wish I had a good answer for you 😅 In the meanwhile, could you please try that and let me know if that fixes the current issue? 🙏
Thanks!
FWIW: I'm don't think that what I've suggested will fix this issue. So, I'm going to first try and see if this is an issue with the ScProvider
(which is part of polkadotjs) or with substrate-connect.
Hi @fend25 !
So, I've did some digging and there seems to be an issue with the bootnodes of your chainspec? b/c smoldot
is unable to find any peers. Later today, I will try to recreate the issue using smoldot
directly, just to make sure that this is not an issue with substrate-connect
.
Please have a look at this stackblitz demo, which produces the following output:
Hi @josepot! Thank you for such warm response!
Adding await relayProvider.connect()
did not help; it continues to print "[smoldot]..." messages and does not subscribe to new heads.
Hi @josepot! Thank you for such warm response!
Adding await
relayProvider.connect()
did not help; it continues to print "[smoldot]..." messages and does not subscribe to new heads.
Hi @fend25 ! Did you have a chance to review see my second response? 🙏
Yes, the second option works, but it only provides an RPC connection, as far as I can see. The initial idea was to seamlessly use the Polkadot.js library. However, given that I still require a fully synchronized node on the same host to quickly access historic data, making an HTTP request to localhost might not add significantly more overhead compared to using a light node. But it will require to manually parse encoded data from storage (for extrinsic args for example)...
Issue Description
Hi!
I'm trying to connect to the Polkadot parachain called Unique, and I'm using the code from the documentation found at: https://github.com/paritytech/substrate-connect/blob/main/packages/connect/README.md?plain=1#L58-L76
However, the code doesn't reach the initialization finish and gets stuck on the
await ApiPromise.create({provider})
expression, with a message printed once per minute, saying:And running almost the same code but for relay chain (I've tested Polkadot and Kusama) it's working properly and not getting stuck.
I'm running this code in Node.js, not in the browser. My goal is to write a block indexer, and my clue is that the light node should speed up scanning significantly.
Here's a gist to reproduce the issue with the code and chain spec: https://gist.github.com/fend25/bcff059ad868f95480c306c7d6ddc87e
Steps to reproduce the issue
Describe the results you received
Describe the results you expected
The expected result is that the code finishes the initialization and runs further.
Substrate-Connect version
0.7.30
Provider
Other (Specify below)
Browser version
node.js version 20.3.0
@substrate/connect@0.7.30 @polkadot/api@10.9.1 @polkadot/rpc-provider@10.9.1
Additional environment details
The same result is obtained on Ubuntu 20.04, macOS 13 and Windows 10.