Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

malus: dont panic on missing validation data #6952

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions node/malus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ rand = "0.8.5"

[features]
default = []
fast-runtime = ["polkadot-cli/fast-runtime"]
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 needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not 100% sure anymore, but it doesn't hurt either 🤣


[dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
Expand Down
11 changes: 8 additions & 3 deletions node/malus/src/variants/suggest_garbage_candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,22 @@ where
{
Ok(Some((validation_data, validation_code))) => {
sender
.send((validation_data, validation_code, n_validators))
.send(Some((
validation_data,
validation_code,
n_validators,
)))
.expect("channel is still open");
},
_ => {
panic!("Unable to fetch validation data");
sender.send(None).expect("channel is still open");
},
}
}),
);

let (validation_data, validation_code, n_validators) = receiver.recv().unwrap();
let (validation_data, validation_code, n_validators) =
receiver.recv().unwrap()?;

let validation_data_hash = validation_data.hash();
let validation_code_hash = validation_code.hash();
Expand Down