mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +00:00
BREAKING: Rename Origin (#12258)
* BREAKING: Rename Origin * more renaming * a bit more renaming * fix * more fixing * fix in frame_support * even more fixes * fix * small fix * ... * update .stderr * docs * update docs * update docs * docs
This commit is contained in:
@@ -529,7 +529,7 @@ mod tests {
|
||||
use crate::{
|
||||
mock::{
|
||||
balances, raw_solution, roll_to, Balances, ExtBuilder, MockedWeightInfo, MultiPhase,
|
||||
Origin, Runtime, SignedMaxRefunds, SignedMaxSubmissions, SignedMaxWeight,
|
||||
Runtime, RuntimeOrigin, SignedMaxRefunds, SignedMaxSubmissions, SignedMaxWeight,
|
||||
},
|
||||
Error, Perbill, Phase,
|
||||
};
|
||||
@@ -546,7 +546,7 @@ mod tests {
|
||||
let solution = raw_solution();
|
||||
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(10), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(10), Box::new(solution)),
|
||||
Error::<Runtime>::PreDispatchEarlySubmission,
|
||||
);
|
||||
})
|
||||
@@ -561,7 +561,7 @@ mod tests {
|
||||
let solution = raw_solution();
|
||||
assert_eq!(balances(&99), (100, 0));
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
|
||||
assert_eq!(balances(&99), (95, 5));
|
||||
assert_eq!(MultiPhase::signed_submissions().iter().next().unwrap().deposit, 5);
|
||||
@@ -577,7 +577,7 @@ mod tests {
|
||||
let solution = raw_solution();
|
||||
assert_eq!(balances(&99), (100, 0));
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
assert_eq!(balances(&99), (95, 5));
|
||||
|
||||
assert!(MultiPhase::finalize_signed_phase());
|
||||
@@ -597,7 +597,7 @@ mod tests {
|
||||
// make the solution invalid.
|
||||
solution.score.minimal_stake += 1;
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
assert_eq!(balances(&99), (95, 5));
|
||||
|
||||
// no good solution was stored.
|
||||
@@ -618,11 +618,11 @@ mod tests {
|
||||
assert_eq!(balances(&999), (100, 0));
|
||||
|
||||
// submit as correct.
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution.clone())));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution.clone())));
|
||||
|
||||
// make the solution invalid and weaker.
|
||||
solution.score.minimal_stake -= 1;
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(999), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(999), Box::new(solution)));
|
||||
assert_eq!(balances(&99), (95, 5));
|
||||
assert_eq!(balances(&999), (95, 5));
|
||||
|
||||
@@ -648,7 +648,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + s).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
}
|
||||
|
||||
// weaker.
|
||||
@@ -658,7 +658,7 @@ mod tests {
|
||||
};
|
||||
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(99), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)),
|
||||
Error::<Runtime>::SignedQueueFull,
|
||||
);
|
||||
})
|
||||
@@ -679,7 +679,7 @@ mod tests {
|
||||
let mut solution = raw_solution();
|
||||
solution.score.minimal_stake -= s as u128;
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(account), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(account), Box::new(solution)));
|
||||
assert_eq!(balances(&account), (95, 5));
|
||||
}
|
||||
|
||||
@@ -719,7 +719,7 @@ mod tests {
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
|
||||
// This is 10% better, so does not meet the 20% threshold and is therefore rejected.
|
||||
solution = RawSolution {
|
||||
@@ -732,7 +732,7 @@ mod tests {
|
||||
};
|
||||
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(99), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)),
|
||||
Error::<Runtime>::SignedQueueFull,
|
||||
);
|
||||
|
||||
@@ -746,7 +746,7 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
})
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + s).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(account), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(account), Box::new(solution)));
|
||||
assert_eq!(balances(&account), (95, 5));
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: 20, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(999), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(999), Box::new(solution)));
|
||||
|
||||
// the one with score 5 was rejected, the new one inserted.
|
||||
assert_eq!(
|
||||
@@ -809,14 +809,14 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + s).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
}
|
||||
|
||||
let solution = RawSolution {
|
||||
score: ElectionScore { minimal_stake: 4, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
|
||||
assert_eq!(
|
||||
MultiPhase::signed_submissions()
|
||||
@@ -831,7 +831,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: 5, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
|
||||
// the one with score 5 was rejected, the new one inserted.
|
||||
assert_eq!(
|
||||
@@ -856,7 +856,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + s).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
}
|
||||
|
||||
assert_eq!(balances(&99).1, 2 * 5);
|
||||
@@ -867,7 +867,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: 20, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(999), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(999), Box::new(solution)));
|
||||
|
||||
// got one bond back.
|
||||
assert_eq!(balances(&99).1, 2 * 4);
|
||||
@@ -886,7 +886,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + i).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
}
|
||||
assert_eq!(
|
||||
MultiPhase::signed_submissions()
|
||||
@@ -902,7 +902,7 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(99), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)),
|
||||
Error::<Runtime>::SignedQueueFull,
|
||||
);
|
||||
})
|
||||
@@ -924,18 +924,18 @@ mod tests {
|
||||
let solution = raw_solution();
|
||||
|
||||
// submit a correct one.
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution.clone())));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution.clone())));
|
||||
|
||||
// make the solution invalidly better and submit. This ought to be slashed.
|
||||
let mut solution_999 = solution.clone();
|
||||
solution_999.score.minimal_stake += 1;
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(999), Box::new(solution_999)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(999), Box::new(solution_999)));
|
||||
|
||||
// make the solution invalidly worse and submit. This ought to be suppressed and
|
||||
// returned.
|
||||
let mut solution_9999 = solution.clone();
|
||||
solution_9999.score.minimal_stake -= 1;
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(9999), Box::new(solution_9999)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(9999), Box::new(solution_9999)));
|
||||
|
||||
assert_eq!(
|
||||
MultiPhase::signed_submissions().iter().map(|x| x.who).collect::<Vec<_>>(),
|
||||
@@ -975,14 +975,14 @@ mod tests {
|
||||
assert_eq!(raw.solution.voter_count(), 5);
|
||||
assert_eq!(<Runtime as Config>::SignedMaxWeight::get(), Weight::from_ref_time(40));
|
||||
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(raw.clone())));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(raw.clone())));
|
||||
|
||||
<SignedMaxWeight>::set(Weight::from_ref_time(30));
|
||||
|
||||
// note: resubmitting the same solution is technically okay as long as the queue has
|
||||
// space.
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(99), Box::new(raw)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(raw)),
|
||||
Error::<Runtime>::SignedTooMuchWeight,
|
||||
);
|
||||
})
|
||||
@@ -998,7 +998,7 @@ mod tests {
|
||||
|
||||
assert_eq!(balances(&123), (0, 0));
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(123), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(123), Box::new(solution)),
|
||||
Error::<Runtime>::SignedCannotPayDeposit,
|
||||
);
|
||||
|
||||
@@ -1020,7 +1020,7 @@ mod tests {
|
||||
score: ElectionScore { minimal_stake: (5 + s).into(), ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
}
|
||||
|
||||
// this solution has a higher score than any in the queue
|
||||
@@ -1034,7 +1034,7 @@ mod tests {
|
||||
|
||||
assert_eq!(balances(&123), (0, 0));
|
||||
assert_noop!(
|
||||
MultiPhase::submit(Origin::signed(123), Box::new(solution)),
|
||||
MultiPhase::submit(RuntimeOrigin::signed(123), Box::new(solution)),
|
||||
Error::<Runtime>::SignedCannotPayDeposit,
|
||||
);
|
||||
|
||||
@@ -1063,7 +1063,7 @@ mod tests {
|
||||
let solution = raw_solution();
|
||||
|
||||
// submit a correct one.
|
||||
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(solution)));
|
||||
assert_ok!(MultiPhase::submit(RuntimeOrigin::signed(99), Box::new(solution)));
|
||||
|
||||
// _some_ good solution was stored.
|
||||
assert!(MultiPhase::finalize_signed_phase());
|
||||
|
||||
Reference in New Issue
Block a user