-
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 <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Signed-off-by: Andrei Sandu <[email protected]>
…ate` implementation (#5011) * Implement fake validation results Signed-off-by: Andrei Sandu <[email protected]> * refactor Signed-off-by: Andrei Sandu <[email protected]> * cargo lock Signed-off-by: Andrei Sandu <[email protected]> * spell check Signed-off-by: Andrei Sandu <[email protected]> * spellcheck Signed-off-by: Andrei Sandu <[email protected]> * typos Signed-off-by: Andrei Sandu <[email protected]> * Review feedback Signed-off-by: Andrei Sandu <[email protected]> * move stuff around Signed-off-by: Andrei Sandu <[email protected]> * chores Signed-off-by: Andrei Sandu <[email protected]> * Impl valid - still wip Signed-off-by: Andrei Sandu <[email protected]> * fixes Signed-off-by: Andrei Sandu <[email protected]> * fmt Signed-off-by: Andrei Sandu <[email protected]> * Pull Ladi's implementation: #4711 Co-authored-by: Lldenaurois <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Signed-off-by: Andrei Sandu <[email protected]> * Fix build Signed-off-by: Andrei Sandu <[email protected]> * Logs and comments Signed-off-by: Andrei Sandu <[email protected]> * WIP: suggest garbage candidate + implement validation result caching Signed-off-by: Andrei Sandu <[email protected]> * fix Signed-off-by: Andrei Sandu <[email protected]> * Do commitment hash checks in candidate validation Signed-off-by: Andrei Sandu <[email protected]> * Minor refactor in approval, backing, dispute-coord Signed-off-by: Andrei Sandu <[email protected]> * Working version of suggest garbage candidate Signed-off-by: Andrei Sandu <[email protected]> * Dedup Signed-off-by: Andrei Sandu <[email protected]> * cleanup #1 Signed-off-by: Andrei Sandu <[email protected]> * Fix tests Signed-off-by: Andrei Sandu <[email protected]> * remove debug leftovers Signed-off-by: Andrei Sandu <[email protected]> * fmt Signed-off-by: Andrei Sandu <[email protected]> * Accidentally commited some local test Signed-off-by: Andrei Sandu <[email protected]> * spellcheck Signed-off-by: Andrei Sandu <[email protected]> * some more fixes Signed-off-by: Andrei Sandu <[email protected]> * Refactor and fix it Signed-off-by: Andrei Sandu <[email protected]> * review feedback Signed-off-by: Andrei Sandu <[email protected]> * typo Signed-off-by: Andrei Sandu <[email protected]> * tests review feedback Signed-off-by: Andrei Sandu <[email protected]> * refactor disputer Signed-off-by: Andrei Sandu <[email protected]> * fix tests Signed-off-by: Andrei Sandu <[email protected]> * Fix zombienet disputes test Signed-off-by: Andrei Sandu <[email protected]> * spellcheck Signed-off-by: Andrei Sandu <[email protected]> * fix Signed-off-by: Andrei Sandu <[email protected]> * Fix ui tests Signed-off-by: Andrei Sandu <[email protected]> * fix typo Signed-off-by: Andrei Sandu <[email protected]> Co-authored-by: Lldenaurois <[email protected]>
@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.