Skip to content
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

Panic in runtime_service #492

Closed
tomaka opened this issue May 1, 2023 · 2 comments · Fixed by #497
Closed

Panic in runtime_service #492

tomaka opened this issue May 1, 2023 · 2 comments · Fixed by #497

Comments

@tomaka
Copy link
Contributor

tomaka commented May 1, 2023

108, 208, 22, 139, 191, 235, 131, 226, 1, 110, 7, 202, 77, 219, 57, 0, 127]), amount: 105642100001001 }), Ibc(Events { events: [Ok(UpdateClient { client_id: [49, 48, 45, 103, 114, 97, 110, 100, 112, 97, 45, 50, 56], client_type: [49, 48, 45, 103, 114, 97, 110, 100, 112, 97], revision_height: 1915715, revision_number: 2019, consensus_height: 2310752, consensus_revision_number: 2087 })] }), Balances(Deposit { who: AccountId32([109, 111, 100, 108, 80, 111, 116, 83, 116, 97, 107, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), amount: 26410525000250 }), Balances(Deposit { who: AccountId32([109, 111, 100, 108, 108, 121, 97, 114, 116, 114, 115, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), amount: 79231575000751 })]
thread 'async-std/runtime' panicked at 'called `Option::unwrap()` on a `None` value', /home/dz/.cargo/git/checkouts/smoldot-2dcbf637e11a77d4/e4ebb26/light-base/src/runtime_service.rs:1403:118
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After some hours of running, got

                            match &mut guarded.tree {
                                GuardedInner::FinalizedBlockRuntimeKnown {
                                    tree, ..
                                } => {
                                    let idx = tree.input_iter_unordered().find(|block| block.user_data.hash == hash).unwrap().id; // 1403
                                    tree.input_set_best_block(idx);
                                }
                                GuardedInner::FinalizedBlockRuntimeUnknown { tree, .. } => {
                                    let idx = tree.input_iter_unordered().find(|block| block.user_data.hash == hash).unwrap().id;
                                    tree.input_set_best_block(idx);
                                }
                            }
smoldot-light = { git = "https://github.com/smol-dot/smoldot.git", default-features = false, features = ["std"]  }
smoldot = { git = "https://github.com/smol-dot/smoldot.git", default-features = false, features = ["std"] }
[[package]]
name = "smoldot"
version = "0.6.0"
source = "git+https://github.com/smol-dot/smoldot.git#e4ebb264b40a6f869285110b2ff860ed40c2925b"
dependencies = [

i have no idea how to report better. i guess at least making expect instead of unwrap would be huge improvement

Originally posted by @dzmitry-lahoda in #490 (comment)

@tomaka
Copy link
Contributor Author

tomaka commented May 2, 2023

I've managed to reproduce with Westmint.

logs.txt

@tomaka
Copy link
Contributor Author

tomaka commented May 2, 2023

Seems to happen when there's a reorg on the relay chain, and the new best block (after the reorg) has a parahead that is equal to the finalized parahead, while the previous best block had a different parahead.

Anyway, the "when it happens" isn't so important. The issue is simply that the panicking block of code doesn't properly handle the situation where the best block is equal to the finalized block.

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 a pull request may close this issue.

1 participant