mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
Use same fmt and clippy configs as in Substrate (#7611)
* Use same rustfmt.toml as Substrate Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * format format file Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Format with new config Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add Substrate Clippy config Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Print Clippy version in CI Otherwise its difficult to reproduce locally. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make fmt happy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update node/core/pvf/src/error.rs Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io> * Update node/core/pvf/src/error.rs Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
This commit is contained in:
committed by
GitHub
parent
ac435c96cf
commit
342d720573
@@ -125,8 +125,8 @@ where
|
||||
Self { fake_validation, fake_validation_error, distribution, spawner }
|
||||
}
|
||||
|
||||
/// Creates and sends the validation response for a given candidate. Queries the runtime to obtain the validation data for the
|
||||
/// given candidate.
|
||||
/// Creates and sends the validation response for a given candidate. Queries the runtime to
|
||||
/// obtain the validation data for the given candidate.
|
||||
pub fn send_validation_response<Sender>(
|
||||
&self,
|
||||
candidate_descriptor: CandidateDescriptor,
|
||||
@@ -203,7 +203,8 @@ where
|
||||
{
|
||||
type Message = CandidateValidationMessage;
|
||||
|
||||
// Capture all (approval and backing) candidate validation requests and depending on configuration fail them.
|
||||
// Capture all (approval and backing) candidate validation requests and depending on
|
||||
// configuration fail them.
|
||||
fn intercept_incoming(
|
||||
&self,
|
||||
subsystem_sender: &mut Sender,
|
||||
@@ -279,7 +280,8 @@ where
|
||||
},
|
||||
FakeCandidateValidation::ApprovalInvalid |
|
||||
FakeCandidateValidation::BackingAndApprovalInvalid => {
|
||||
// Set the validation result to invalid with probability `p` and trigger a dispute
|
||||
// Set the validation result to invalid with probability `p` and trigger a
|
||||
// dispute
|
||||
let behave_maliciously = self.distribution.sample(&mut rand::thread_rng());
|
||||
match behave_maliciously {
|
||||
true => {
|
||||
@@ -294,7 +296,8 @@ where
|
||||
&validation_result,
|
||||
);
|
||||
|
||||
// We're not even checking the candidate, this makes us appear faster than honest validators.
|
||||
// We're not even checking the candidate, this makes us appear
|
||||
// faster than honest validators.
|
||||
sender.send(Ok(validation_result)).unwrap();
|
||||
None
|
||||
},
|
||||
@@ -370,7 +373,8 @@ where
|
||||
);
|
||||
None
|
||||
},
|
||||
// If the `PoV` is malicious, we behave normally with some probability `(1-p)`
|
||||
// If the `PoV` is malicious, we behave normally with some probability
|
||||
// `(1-p)`
|
||||
false => Some(FromOrchestra::Communication {
|
||||
msg: CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
@@ -383,7 +387,8 @@ where
|
||||
},
|
||||
FakeCandidateValidation::BackingInvalid |
|
||||
FakeCandidateValidation::BackingAndApprovalInvalid => {
|
||||
// Maliciously set the validation result to invalid for a valid candidate with probability `p`
|
||||
// Maliciously set the validation result to invalid for a valid candidate
|
||||
// with probability `p`
|
||||
let behave_maliciously = self.distribution.sample(&mut rand::thread_rng());
|
||||
match behave_maliciously {
|
||||
true => {
|
||||
@@ -396,7 +401,8 @@ where
|
||||
"😈 Maliciously sending invalid validation result: {:?}.",
|
||||
&validation_result,
|
||||
);
|
||||
// We're not even checking the candidate, this makes us appear faster than honest validators.
|
||||
// We're not even checking the candidate, this makes us appear
|
||||
// faster than honest validators.
|
||||
response_sender.send(Ok(validation_result)).unwrap();
|
||||
None
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user