|
@@ -17,7 +17,7 @@ use crate::tests::mock::{
|
|
|
STAKING_ACCOUNT_ID_FOR_ZERO_STAKE,
|
|
|
};
|
|
|
use crate::types::StakeParameters;
|
|
|
-use crate::{DefaultInstance, Error, OpeningType, Penalty, RawEvent, StakePolicy, Worker};
|
|
|
+use crate::{DefaultInstance, Error, OpeningType, RawEvent, StakePolicy, Worker};
|
|
|
use common::working_group::WorkingGroupAuthenticator;
|
|
|
use fixtures::{
|
|
|
increase_total_balance_issuance_using_account_id, AddOpeningFixture, ApplyOnOpeningFixture,
|
|
@@ -1187,18 +1187,13 @@ fn slash_worker_stake_succeeds() {
|
|
|
let account_id = 1;
|
|
|
let total_balance = 300;
|
|
|
let stake = 200;
|
|
|
- let slash_stake = 100;
|
|
|
+ let penalty = 100;
|
|
|
|
|
|
let stake_policy = Some(StakePolicy {
|
|
|
stake_amount: stake,
|
|
|
leaving_unstaking_period: 10,
|
|
|
});
|
|
|
|
|
|
- let penalty = Penalty {
|
|
|
- slashing_amount: slash_stake,
|
|
|
- slashing_text: Vec::new(),
|
|
|
- };
|
|
|
-
|
|
|
increase_total_balance_issuance_using_account_id(account_id, total_balance);
|
|
|
|
|
|
let worker_id = HireRegularWorkerFixture::default()
|
|
@@ -1210,7 +1205,7 @@ fn slash_worker_stake_succeeds() {
|
|
|
|
|
|
slash_stake_fixture.call_and_assert(Ok(()));
|
|
|
|
|
|
- EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(worker_id, slash_stake));
|
|
|
+ EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(worker_id, penalty));
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1219,12 +1214,7 @@ fn slash_worker_stake_fails_with_no_staking_account() {
|
|
|
build_test_externalities().execute_with(|| {
|
|
|
let account_id = 1;
|
|
|
let total_balance = 300;
|
|
|
- let slash_stake = 100;
|
|
|
-
|
|
|
- let penalty = Penalty {
|
|
|
- slashing_amount: slash_stake,
|
|
|
- slashing_text: Vec::new(),
|
|
|
- };
|
|
|
+ let penalty = 100;
|
|
|
|
|
|
increase_total_balance_issuance_using_account_id(account_id, total_balance);
|
|
|
|
|
@@ -1254,18 +1244,13 @@ fn slash_leader_stake_succeeds() {
|
|
|
|
|
|
let account_id = 1;
|
|
|
let total_balance = 300;
|
|
|
- let stake = 200;
|
|
|
+ let penalty = 200;
|
|
|
|
|
|
let stake_policy = Some(StakePolicy {
|
|
|
- stake_amount: stake,
|
|
|
+ stake_amount: penalty,
|
|
|
leaving_unstaking_period: 10,
|
|
|
});
|
|
|
|
|
|
- let penalty = Penalty {
|
|
|
- slashing_amount: stake,
|
|
|
- slashing_text: Vec::new(),
|
|
|
- };
|
|
|
-
|
|
|
increase_total_balance_issuance_using_account_id(account_id, total_balance);
|
|
|
let leader_worker_id = HireLeadFixture::default()
|
|
|
.with_stake_policy(stake_policy)
|
|
@@ -1277,7 +1262,7 @@ fn slash_leader_stake_succeeds() {
|
|
|
|
|
|
slash_stake_fixture.call_and_assert(Ok(()));
|
|
|
|
|
|
- EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(leader_worker_id, stake));
|
|
|
+ EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(leader_worker_id, penalty));
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1318,11 +1303,6 @@ fn slash_worker_stake_fails_with_zero_balance() {
|
|
|
leaving_unstaking_period: 10,
|
|
|
});
|
|
|
|
|
|
- let penalty = Penalty {
|
|
|
- slashing_amount: 0,
|
|
|
- slashing_text: Vec::new(),
|
|
|
- };
|
|
|
-
|
|
|
increase_total_balance_issuance_using_account_id(account_id, total_balance);
|
|
|
|
|
|
let worker_id = HireRegularWorkerFixture::default()
|
|
@@ -1330,7 +1310,7 @@ fn slash_worker_stake_fails_with_zero_balance() {
|
|
|
.hire();
|
|
|
|
|
|
let slash_stake_fixture =
|
|
|
- SlashWorkerStakeFixture::default_for_worker_id(worker_id).with_penalty(penalty);
|
|
|
+ SlashWorkerStakeFixture::default_for_worker_id(worker_id).with_penalty(0);
|
|
|
|
|
|
slash_stake_fixture.call_and_assert(Err(
|
|
|
Error::<Test, DefaultInstance>::StakeBalanceCannotBeZero.into(),
|