-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Malus: Implement storing invalid chunks #4711
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a first pass, will take a second one and pay more attention to details vs reference impl.
node/core/av-store/src/lib.rs
Outdated
@@ -1039,6 +1039,7 @@ fn process_message( | |||
let _ = tx.send(a); | |||
}, | |||
AvailabilityStoreMessage::QueryChunk(candidate, validator_index, tx) => { | |||
println!("THIS IS MOST DEFF WORKING"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println!("THIS IS MOST DEFF WORKING"); | |
println!("THIS IS MOST DEFF WORKING"); |
node/malus/src/malus.rs
Outdated
@@ -65,8 +65,8 @@ impl MalusCli { | |||
match self.variant { | |||
NemesisVariant::BackGarbageCandidate(cmd) => | |||
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidate)?, | |||
NemesisVariant::SuggestGarbageCandidate(cmd) => | |||
polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, | |||
NemesisVariant::SuggestGarbageCandidate(_cmd) => panic! {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this on purpose ?
node/malus/src/malus.rs
Outdated
NemesisVariant::SuggestGarbageCandidate(cmd) => | ||
polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, | ||
NemesisVariant::SuggestGarbageCandidate(_cmd) => panic! {}, | ||
//polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, | |
//polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, |
@@ -131,7 +134,8 @@ fn integrity_test_pass() { | |||
AvailabilityStoreMessage::QueryChunk(Default::default(), 0.into(), tx), | |||
) | |||
.await; | |||
let _ = rx.timeout(std::time::Duration::from_millis(100)).await.unwrap(); | |||
let resp = rx.timeout(std::time::Duration::from_secs(10)).await.unwrap(); | |||
println!("RESP {:?}", resp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add these as logs ?
|
||
/// Unix time wrapper with big-endian encoding. | ||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord)] | ||
struct BETimestamp(u64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates https://github.com/paritytech/polkadot/blob/master/node/core/av-store/src/lib.rs#L78. We can reuse that to reduce the amount of code written in malus.
@@ -0,0 +1,353 @@ | |||
// Copyright 2021 Parity Technologies (UK) Ltd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid duplicating this file: https://github.com/paritytech/polkadot/blob/master/node/core/av-store/src/lib.rs ?
NemesisVariant::StoreMaliciousAvailableData(cmd) => | ||
polkadot_cli::run_node(run_cmd(cmd), StoreMaliciousAvailableDataWrapper)?, | ||
NemesisVariant::SuggestGarbageCandidate(cmd) => | ||
polkadot_cli::run_node(run_cmd(cmd), SuggestGarbageCandidate)?, | ||
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidateWrapper)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to maybe combine these eventually? So we can run tests with malicious stored available data and dispute valid candidates for example.
filter, | ||
) | ||
}) | ||
.replace_candidate_backing(move |cb| InterceptedSubsystem::new(cb, filter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
#4711 Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com> Co-authored-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
…ate` implementation (#5011) * Implement fake validation results Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * refactor Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo lock Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * spell check Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * spellcheck Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * typos Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Review feedback Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * move stuff around Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * chores Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Impl valid - still wip Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Pull Ladi's implementation: #4711 Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com> Co-authored-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix build Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Logs and comments Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * WIP: suggest garbage candidate + implement validation result caching Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Do commitment hash checks in candidate validation Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Minor refactor in approval, backing, dispute-coord Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Working version of suggest garbage candidate Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Dedup Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cleanup #1 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove debug leftovers Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Accidentally commited some local test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * spellcheck Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * some more fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Refactor and fix it Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * review feedback Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * tests review feedback Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * refactor disputer Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix zombienet disputes test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * spellcheck Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix ui tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
@sandreim does this bring any additional coverage to what we have? If not let's close this |
This PR implements a first attempt at intercepting AvailabilityStoreMessages and writing invalid chunks into the availability store for every
StoreAvailableData
message intercepted by the MessageInterceptor.