mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Fuzz testing for nomination pools (#12002)
* some additional tests and stuff * make sanity public * add some sort of fuzz test for pools * breaks every now and then * breaks every now and then * IT WORKS AND PASSES 100k TESTS * cleanup * safe id addition * fix assert_eq_error_rate * Update frame/nomination-pools/src/tests.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/nomination-pools/src/tests.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * add some doc * Fix * ".git/.scripts/fmt.sh" 1 Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -151,10 +151,10 @@ pub trait DefensiveOption<T> {
|
||||
|
||||
/// Defensively transform this option to a result, mapping `None` to the return value of an
|
||||
/// error closure.
|
||||
fn defensive_ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E>;
|
||||
fn defensive_ok_or_else<E: sp_std::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E>;
|
||||
|
||||
/// Defensively transform this option to a result, mapping `None` to a default value.
|
||||
fn defensive_ok_or<E>(self, err: E) -> Result<T, E>;
|
||||
fn defensive_ok_or<E: sp_std::fmt::Debug>(self, err: E) -> Result<T, E>;
|
||||
|
||||
/// Exactly the same as `map`, but it prints the appropriate warnings if the value being mapped
|
||||
/// is `None`.
|
||||
@@ -318,16 +318,17 @@ impl<T> DefensiveOption<T> for Option<T> {
|
||||
)
|
||||
}
|
||||
|
||||
fn defensive_ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
|
||||
fn defensive_ok_or_else<E: sp_std::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
|
||||
self.ok_or_else(|| {
|
||||
defensive!();
|
||||
err()
|
||||
let err_value = err();
|
||||
defensive!(err_value);
|
||||
err_value
|
||||
})
|
||||
}
|
||||
|
||||
fn defensive_ok_or<E>(self, err: E) -> Result<T, E> {
|
||||
fn defensive_ok_or<E: sp_std::fmt::Debug>(self, err: E) -> Result<T, E> {
|
||||
self.ok_or_else(|| {
|
||||
defensive!();
|
||||
defensive!(err);
|
||||
err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user