Fix semantics of ExistenceRequirement::KeepAlive. (#3796)

* Fix semantics of ExistenceRequirement::KeepAlive.

* Bump runtime version
This commit is contained in:
Gavin Wood
2019-10-11 13:59:26 +02:00
committed by GitHub
parent 4dbc9265ee
commit eba7df9a7b
4 changed files with 49 additions and 3 deletions
+36
View File
@@ -25,6 +25,7 @@ use support::{
traits::{LockableCurrency, LockIdentifier, WithdrawReason, WithdrawReasons,
Currency, ReservableCurrency}
};
use sr_primitives::weights::DispatchClass;
use system::RawOrigin;
const ID_1: LockIdentifier = *b"1 ";
@@ -783,6 +784,41 @@ fn signed_extension_take_fees_is_bounded() {
});
}
#[test]
fn signed_extension_allows_free_transactions() {
ExtBuilder::default()
.transaction_fees(100, 1, 1)
.monied(false)
.build()
.execute_with(|| {
// 1 ain't have a penny.
assert_eq!(Balances::free_balance(&1), 0);
// like a FreeOperational
let operational_transaction = DispatchInfo {
weight: 0,
class: DispatchClass::Operational
};
let len = 100;
assert!(
TakeFees::<Runtime>::from(0)
.validate(&1, CALL, operational_transaction , len)
.is_ok()
);
// like a FreeNormal
let free_transaction = DispatchInfo {
weight: 0,
class: DispatchClass::Normal
};
assert!(
TakeFees::<Runtime>::from(0)
.validate(&1, CALL, free_transaction , len)
.is_err()
);
});
}
#[test]
fn burn_must_work() {
ExtBuilder::default().monied(true).build().execute_with(|| {