-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread 'tokio-runtime-worker' panicked at 'Header of imported block must exist; qed', /mnt/Data2/src/github.com/subspace/subspace/domains/client/domain-executor/src/domain_worker.rs:113 #1143
Comments
The reason is likely that block is not imported YET. That notification specifically is fired right before block import is finished, so it is not in the history yet. IIRC there is another subscription on the client that is fire by Substrate AFTER block is fully imported, you should use that one instead. |
Well, we can use the subscription from substrate. If so, I wonder whether the block import notification in sc-consensus-subspace is necessary if the one from substrate is sufficient, as from what I see, now the consumers of our own subscription are the archiver (start archiving on K-depth) and executor (process each imported primary block), they could both use the subscription from substrate. BTW, if we choose to switch, the primary block import throttling may also need to be reworked, currently, the ack sender is part of the notification from sc-consensus-subspace. |
Well, that subscription was created specifically for archiving because it has to run before block import finishes, that was we can guarantee root block information will be included into the very next block. The fact that it subscription is also used for other things is an accident and turns out to be a bug even. We probably need to stop exposing it unless we need to pause block importing for any other reason. |
I had another look and found we can't directly use the subscription from substrate because I agree we should consider using the subscription in which the block import is completed as invoking |
BTW, why do you even need |
Since you mentioned building the branches from the consensus chain, I realized that using the substrate subscription may have another benefit: we likely don't have to calculate the tree route on our own as it's already part of the substrate block import notification. Will take a closer look, and now I feel switching to the substrate subscription is potentially better practically. |
paritytech/substrate#13315 is needed to use the notification fired after finishing the block import pipeline, will create a PR upstream soon.
With the local experiment, I found this doesn't work as the tree route in the notification is calculated from the new best to the old best's parent, which has a problem in that after a reorg, we still need some work to find the appropriate domain parent to build the next domain block, so it doesn't simplify the code. In short, we'll just replace the notification stream in the domain executor once paritytech/substrate#13315 is resolved. |
It will make things easier, with the trade-off being execution of the forks that may never become canonical, wasting precious computational resources. |
https://github.com/subspace/subspace/blob/074e0aecc2fd72f91a90668370001db6fce298a4/domains/client/domain-executor/src/domain_worker.rs#L108-L114
Looks like the expect is not fine even on
Option
, I have no idea what happened exactly, but I think we simply avoid it by passing theblock_hash
in the original primary block notification. cc @nazar-pchttps://github.com/subspace/subspace/blob/074e0aecc2fd72f91a90668370001db6fce298a4/crates/sc-consensus-subspace/src/lib.rs#L1175-L1180
The text was updated successfully, but these errors were encountered: