Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Deprecate Currency; introduce holds and freezing into fungible traits #12951

Merged
merged 174 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
ccd2ebb
First reworking of fungibles API
gavofyork Dec 14, 2022
de93255
New API and docs
gavofyork Dec 16, 2022
31ba6f2
More fungible::* API improvements
gavofyork Dec 16, 2022
0c8a27c
New ref-counting logic for old API
gavofyork Dec 19, 2022
97f7460
Missing files
gavofyork Dec 19, 2022
5027cb1
Fixes
gavofyork Dec 19, 2022
b42a687
Use the new transfer logic
gavofyork Dec 20, 2022
77d4c8e
Use fungibles for the dispatchables
gavofyork Dec 20, 2022
4485cd6
Use shelve/restore names
gavofyork Dec 20, 2022
67d8a7d
Locking works with total balance.
gavofyork Dec 22, 2022
77152ab
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Dec 23, 2022
04a4c75
repotting and removal
gavofyork Dec 27, 2022
e84fbb5
Separate Holds from Reserves
gavofyork Jan 6, 2023
11306ed
Introduce freezes
gavofyork Jan 16, 2023
872bbcc
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Jan 17, 2023
3f33588
Missing files
gavofyork Jan 17, 2023
900fef3
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Jan 18, 2023
359d858
Tests for freezing
gavofyork Jan 18, 2023
428a41c
Fix hold+freeze combo
gavofyork Jan 19, 2023
f009268
More tests
gavofyork Jan 19, 2023
1d5a2d8
Fee-free dispatchable for upgrading accounts
gavofyork Jan 19, 2023
3807bb4
Benchmarks and a few fixes
gavofyork Jan 19, 2023
db5d596
Another test
gavofyork Jan 20, 2023
c609d74
Docs and refactor to avoid blanket impls
gavofyork Jan 20, 2023
3af6d09
Repot
gavofyork Jan 20, 2023
cd9343a
Fit out ItemOf fully
gavofyork Jan 20, 2023
5f5e6d1
Add events to Balanced traits
gavofyork Jan 20, 2023
176f92d
Introduced events into Hold traits
gavofyork Jan 20, 2023
1e0219a
Fix Assets pallet tests
gavofyork Jan 20, 2023
7cfd446
Assets benchmarks pass
gavofyork Jan 20, 2023
0f92a6b
Missing files and fixes
gavofyork Jan 21, 2023
4745cb8
Fixes
gavofyork Jan 21, 2023
4ee2a44
Fixes
gavofyork Jan 23, 2023
aa0eccf
Benchmarks fixes
gavofyork Jan 23, 2023
14beb70
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Jan 23, 2023
84049b1
Fix balance benchmarks
gavofyork Jan 23, 2023
857efce
Formatting
gavofyork Jan 23, 2023
bf24b91
Expose fungible sub modules
gavofyork Jan 23, 2023
0ab291c
Merge branch 'gav-hold-freeze' into gav-nis-hold
gavofyork Jan 23, 2023
72fce5f
Move NIS to fungible API
gavofyork Jan 23, 2023
b2cae2a
Fix broken impl and add test
gavofyork Jan 23, 2023
020d11a
Merge branch 'gav-hold-freeze' into gav-nis-hold
gavofyork Jan 23, 2023
4b28afb
Fix tests
gavofyork Jan 23, 2023
d4da1a1
API for `transfer_and_hold`
gavofyork Jan 23, 2023
49fd3fc
Merge branch 'gav-hold-freeze' into gav-nis-hold
gavofyork Jan 23, 2023
bee7038
Use composite APIs
gavofyork Jan 23, 2023
f438f86
Merge branch 'gav-nis-hold' into gav-hold-freeze
gavofyork Jan 23, 2023
947d2b3
Formatting
gavofyork Jan 23, 2023
b469b45
Upgraded event
gavofyork Jan 23, 2023
ecb1765
Fixes
gavofyork Jan 23, 2023
79cf354
Fixes
gavofyork Jan 23, 2023
4c28b9d
Fixes
gavofyork Jan 23, 2023
01caead
Fixes
gavofyork Jan 23, 2023
83f47cb
Repot tests and some fixed
gavofyork Jan 24, 2023
16bdba7
Fix some bits
gavofyork Jan 24, 2023
cad82e8
Fix dust tests
gavofyork Jan 24, 2023
7b0b55c
Rename `set_balance`
gavofyork Jan 26, 2023
30de46d
becomes
gavofyork Jan 26, 2023
81dedbd
Move dust handling to fungibles API
gavofyork Jan 27, 2023
e0c1dc5
Formatting
gavofyork Jan 27, 2023
63e1698
Merge branch 'master' into gav-hold-freeze
gavofyork Jan 27, 2023
b210e19
Fixes and more refactoring
gavofyork Jan 27, 2023
6289a64
Fixes
gavofyork Jan 27, 2023
732e102
Fixes
gavofyork Jan 27, 2023
607b36a
Fixes
gavofyork Jan 27, 2023
37b999a
Fixes
gavofyork Jan 27, 2023
be3b91a
Fixes
gavofyork Jan 27, 2023
cdbd9b1
Merge branch 'master' into gav-hold-freeze
gavofyork Jan 27, 2023
dec5e42
Fixes
gavofyork Jan 28, 2023
242a8a1
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Jan 28, 2023
f8439c1
Fixes
gavofyork Jan 28, 2023
1beffe4
Fixes
gavofyork Jan 28, 2023
75d5924
Fixes
gavofyork Jan 28, 2023
804f776
Use reducible_balance for better correctness on fees
gavofyork Feb 7, 2023
a5b6971
Reducing hold to zero should remove entry.
gavofyork Feb 7, 2023
c982d1b
Add test
gavofyork Feb 7, 2023
696b859
Docs
gavofyork Feb 7, 2023
32ee5dc
Update frame/support/src/traits/tokens/fungibles/hold.rs
gavofyork Feb 7, 2023
576f8a1
Update frame/support/src/traits/tokens/fungibles/regular.rs
gavofyork Feb 7, 2023
4a124cb
Update frame/support/src/traits/tokens/fungible/hold.rs
gavofyork Feb 7, 2023
574cdec
Update frame/support/src/traits/tokens/fungible/regular.rs
gavofyork Feb 7, 2023
c0c320d
Docs
gavofyork Feb 7, 2023
07d8132
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Feb 7, 2023
b632c9f
Docs
gavofyork Feb 7, 2023
436fea7
Docs
gavofyork Feb 7, 2023
49caee7
Merge branch 'master' into gav-hold-freeze
gavofyork Feb 7, 2023
91b7343
Fix NIS benchmarks
gavofyork Feb 9, 2023
53fbf7d
Doc comment
gavofyork Feb 9, 2023
c7459ae
Remove post_mutation
gavofyork Feb 9, 2023
864f46a
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Feb 23, 2023
7360c20
Fix some tests
gavofyork Feb 23, 2023
6dbdca4
Fix some grumbles
gavofyork Feb 23, 2023
543713b
Enumify bool args to fungible(s) functions
gavofyork Feb 23, 2023
78a6b18
Fix up assets and balances
gavofyork Feb 23, 2023
35760c0
Formatting
gavofyork Feb 23, 2023
0d1a458
Fix contracts
gavofyork Feb 23, 2023
1f292ae
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Feb 24, 2023
1415e77
Fix tests & benchmarks build
gavofyork Feb 24, 2023
dd6e45f
Typify minted boolean arg
gavofyork Feb 24, 2023
4d69fb8
Typify on_hold boolean arg; renames
gavofyork Feb 24, 2023
3e513e1
Fix numerous tests
gavofyork Feb 24, 2023
e14456e
Fix dependency issue
gavofyork Feb 24, 2023
0f1cd51
Privatize dangerous API mutate_account
gavofyork Feb 24, 2023
dd200cd
Fix contracts (@alext - please check this commit)
gavofyork Feb 24, 2023
5c1ea9d
Remove println
gavofyork Feb 24, 2023
354aa13
Fix tests for contracts
athei Feb 24, 2023
82ace53
Fix broken rename
gavofyork Feb 24, 2023
36ae88e
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Feb 24, 2023
fcb69a8
Fix broken rename
gavofyork Feb 24, 2023
a3579af
Fix broken rename
gavofyork Feb 24, 2023
a40f3a8
Docs
gavofyork Feb 24, 2023
ba9ff68
Update frame/support/src/traits/tokens/fungible/hold.rs
gavofyork Mar 3, 2023
9d5e61f
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 3, 2023
22595ef
remove from_ref_time
gavofyork Mar 3, 2023
f9ca2ae
Update frame/executive/src/lib.rs
gavofyork Mar 6, 2023
ef22af2
Update frame/executive/src/lib.rs
gavofyork Mar 6, 2023
d6f71e3
Reenable test
gavofyork Mar 6, 2023
7ab3d21
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Mar 6, 2023
114d623
Update frame/support/src/traits/tokens/fungibles/hold.rs
gavofyork Mar 6, 2023
b1a20d8
Update frame/support/src/traits/tokens/fungible/hold.rs
gavofyork Mar 6, 2023
5c712bd
Update frame/support/src/traits/tokens/fungible/hold.rs
gavofyork Mar 6, 2023
1607004
Update frame/support/src/traits/tokens/fungible/hold.rs
gavofyork Mar 6, 2023
a50dde8
Update frame/support/src/traits/tokens/currency.rs
gavofyork Mar 6, 2023
c3cdb70
Update frame/lottery/src/tests.rs
gavofyork Mar 6, 2023
57a4140
Update frame/support/src/traits/tokens/fungible/mod.rs
gavofyork Mar 6, 2023
176b6a1
Update frame/support/src/traits/tokens/fungible/regular.rs
gavofyork Mar 6, 2023
bbcace9
Update frame/support/src/traits/tokens/fungibles/freeze.rs
gavofyork Mar 6, 2023
a84e900
Update frame/support/src/traits/tokens/fungible/regular.rs
gavofyork Mar 6, 2023
96644e5
Update frame/support/src/traits/tokens/fungibles/hold.rs
gavofyork Mar 6, 2023
58f0a32
Update frame/support/src/traits/tokens/fungibles/hold.rs
gavofyork Mar 6, 2023
73b49d3
Update frame/support/src/traits/tokens/fungibles/hold.rs
gavofyork Mar 6, 2023
4fd8bc2
Rename UnwantedRemoval to UnwantedAccountRemoval
gavofyork Mar 6, 2023
200e274
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Mar 6, 2023
f88ed63
Docs
gavofyork Mar 6, 2023
aa681b2
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 6, 2023
a1117e8
Formatting
gavofyork Mar 6, 2023
b5884b2
Update frame/balances/src/lib.rs
gavofyork Mar 13, 2023
d78b14a
Update primitives/runtime/src/lib.rs
gavofyork Mar 13, 2023
68f1acb
handle_raw_dust oes nothing
gavofyork Mar 13, 2023
d288318
Formatting
gavofyork Mar 14, 2023
fc5ff3d
Fixes
gavofyork Mar 14, 2023
cc1bd4f
Grumble
gavofyork Mar 14, 2023
516cc00
Fixes
gavofyork Mar 14, 2023
69fedb7
Add test
gavofyork Mar 14, 2023
4a8e549
Add test
gavofyork Mar 14, 2023
ebdc4b9
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 14, 2023
c6fdad5
Tests for reducible_balance
gavofyork Mar 14, 2023
535c918
Fixes
gavofyork Mar 14, 2023
deae58f
Fix Salary
gavofyork Mar 14, 2023
0e2f5d9
Fixes
gavofyork Mar 14, 2023
d9c3c22
Disable broken test
gavofyork Mar 14, 2023
e8ff2b2
Disable nicely
gavofyork Mar 14, 2023
a2cdc2f
Fixes
gavofyork Mar 15, 2023
39fa2fc
Fixes
gavofyork Mar 15, 2023
07d9e48
Fixes
gavofyork Mar 15, 2023
9e56f0d
Rename some events
gavofyork Mar 15, 2023
b8a13c0
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 15, 2023
68dbc16
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 16, 2023
2e30a2a
Fix nomination pools breakage
gavofyork Mar 16, 2023
f546870
Add compatibility stub for transfer tx
gavofyork Mar 16, 2023
5686ca4
Reinstate a safely compatible version of Balances set_balance
gavofyork Mar 16, 2023
590b780
Fixes
gavofyork Mar 16, 2023
181bcd5
Grumble
gavofyork Mar 16, 2023
880fac6
Update frame/nis/src/lib.rs
gavofyork Mar 16, 2023
58dca36
Merge branch 'master' of https://github.com/paritytech/substrate into…
Mar 17, 2023
1d47200
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
Mar 17, 2023
d025e95
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 17, 2023
be47675
disable flakey tests
gavofyork Mar 17, 2023
3f1a752
Update frame/balances/src/lib.rs
gavofyork Mar 17, 2023
66e7acc
Grumbles
gavofyork Mar 17, 2023
a730846
Merge branch 'gav-hold-freeze' of github.com:paritytech/substrate int…
gavofyork Mar 17, 2023
938db17
Grumble
gavofyork Mar 17, 2023
a76f91c
Merge branch 'master' into gav-hold-freeze
gavofyork Mar 17, 2023
d59d300
Merge remote-tracking branch 'origin/master' into gav-hold-freeze
gavofyork Mar 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ impl pallet_balances::Config for Runtime {
type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = ();
type MaxHolds = ();
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/benches/block_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn prepare_benchmark(client: &FullClient) -> (usize, Vec<OpaqueExtrinsic>) {
let extrinsic: OpaqueExtrinsic = create_extrinsic(
client,
src.clone(),
BalancesCall::transfer { dest: dst.clone(), value: 1 * DOLLARS },
BalancesCall::transfer_allow_death { dest: dst.clone(), value: 1 * DOLLARS },
Some(nonce),
)
.into();
Expand Down
8 changes: 3 additions & 5 deletions bin/node/cli/benches/transaction_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ fn create_account_extrinsics(
Sr25519Keyring::Alice.pair(),
SudoCall::sudo {
call: Box::new(
BalancesCall::set_balance {
BalancesCall::force_set_balance {
who: AccountId::from(a.public()).into(),
new_free: 0,
new_reserved: 0,
}
.into(),
),
Expand All @@ -156,10 +155,9 @@ fn create_account_extrinsics(
Sr25519Keyring::Alice.pair(),
SudoCall::sudo {
call: Box::new(
BalancesCall::set_balance {
BalancesCall::force_set_balance {
who: AccountId::from(a.public()).into(),
new_free: 1_000_000 * DOLLARS,
new_reserved: 0,
}
.into(),
),
Expand All @@ -184,7 +182,7 @@ fn create_benchmark_extrinsics(
create_extrinsic(
client,
account.clone(),
BalancesCall::transfer {
BalancesCall::transfer_allow_death {
dest: Sr25519Keyring::Bob.to_account_id().into(),
value: 1 * DOLLARS,
},
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ mod tests {
};
let signer = charlie.clone();

let function = RuntimeCall::Balances(BalancesCall::transfer {
let function = RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: to.into(),
value: amount,
});
Expand Down
4 changes: 3 additions & 1 deletion bin/node/cli/tests/temp_base_path_works.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use std::{

pub mod common;

#[tokio::test]
#[allow(dead_code)]
// Apparently `#[ignore]` doesn't actually work to disable this one.
//#[tokio::test]
async fn temp_base_path_works() {
common::run_with_timeout(Duration::from_secs(60 * 10), async move {
let mut cmd = Command::new(cargo_bin("substrate"));
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn test_blocks(
}];
block1_extrinsics.extend((0..20).map(|i| CheckedExtrinsic {
signed: Some((alice(), signed_extra(i, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: bob().into(),
value: 1 * DOLLARS,
}),
Expand Down
57 changes: 35 additions & 22 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn changes_trie_block() -> (Vec<u8>, Hash) {
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: bob().into(),
value: 69 * DOLLARS,
}),
Expand All @@ -116,7 +116,7 @@ fn blocks() -> ((Vec<u8>, Hash), (Vec<u8>, Hash)) {
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: bob().into(),
value: 69 * DOLLARS,
}),
Expand All @@ -136,14 +136,14 @@ fn blocks() -> ((Vec<u8>, Hash), (Vec<u8>, Hash)) {
},
CheckedExtrinsic {
signed: Some((bob(), signed_extra(0, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: alice().into(),
value: 5 * DOLLARS,
}),
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(1, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: bob().into(),
value: 15 * DOLLARS,
}),
Expand Down Expand Up @@ -183,7 +183,12 @@ fn panic_execution_with_foreign_code_gives_error() {
let mut t = new_test_ext(bloaty_code_unwrap());
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
(69u128, 0u32, 0u128, 0u128, 0u128).encode(),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
providers: 1,
data: (69u128, 0u128, 0u128, 1u128 << 127),
..Default::default()
}
.encode(),
);
t.insert(<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(), 69_u128.encode());
t.insert(<frame_system::BlockHash<Runtime>>::hashed_key_for(0), vec![0u8; 32]);
Expand All @@ -204,9 +209,14 @@ fn bad_extrinsic_with_native_equivalent_code_gives_error() {
let mut t = new_test_ext(compact_code_unwrap());
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
(0u32, 0u32, 0u32, 69u128, 0u128, 0u128, 0u128).encode(),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
providers: 1,
data: (69u128, 0u128, 0u128, 1u128 << 127),
..Default::default()
}
.encode(),
);
t.insert(<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(), 69_u128.encode());
t.insert(<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(), 69u128.encode());
t.insert(<frame_system::BlockHash<Runtime>>::hashed_key_for(0), vec![0u8; 32]);

let r =
Expand All @@ -226,17 +236,18 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
providers: 1,
data: (111 * DOLLARS, 0u128, 0u128, 1u128 << 127),
..Default::default()
}
.encode(),
);
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
..Default::default()
}
AccountInfo::<
<Runtime as frame_system::Config>::Index,
<Runtime as frame_system::Config>::AccountData,
>::default()
.encode(),
);
t.insert(
Expand Down Expand Up @@ -267,17 +278,18 @@ fn successful_execution_with_foreign_code_gives_ok() {
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
providers: 1,
data: (111 * DOLLARS, 0u128, 0u128, 1u128 << 127),
..Default::default()
}
.encode(),
);
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
..Default::default()
}
AccountInfo::<
<Runtime as frame_system::Config>::Index,
<Runtime as frame_system::Config>::AccountData,
>::default()
.encode(),
);
t.insert(
Expand Down Expand Up @@ -784,17 +796,18 @@ fn successful_execution_gives_ok() {
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
providers: 1,
data: (111 * DOLLARS, 0u128, 0u128, 1u128 << 127),
..Default::default()
}
.encode(),
);
t.insert(
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
..Default::default()
}
AccountInfo::<
<Runtime as frame_system::Config>::Index,
<Runtime as frame_system::Config>::AccountData,
>::default()
.encode(),
);
t.insert(
Expand Down
5 changes: 4 additions & 1 deletion bin/node/executor/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ pub fn sign(xt: CheckedExtrinsic) -> UncheckedExtrinsic {
}

pub fn default_transfer_call() -> pallet_balances::Call<Runtime> {
pallet_balances::Call::<Runtime>::transfer { dest: bob().into(), value: 69 * DOLLARS }
pallet_balances::Call::<Runtime>::transfer_allow_death {
dest: bob().into(),
value: 69 * DOLLARS,
}
}

pub fn from_block_number(n: u32) -> Header {
Expand Down
6 changes: 3 additions & 3 deletions bin/node/executor/tests/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ fn new_account_info(free_dollars: u128) -> Vec<u8> {
frame_system::AccountInfo {
nonce: 0u32,
consumers: 0,
providers: 0,
providers: 1,
sufficients: 0,
data: (free_dollars * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS),
data: (free_dollars * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 1u128 << 127),
}
.encode()
}
Expand Down Expand Up @@ -214,7 +214,7 @@ fn block_weight_capacity_report() {
let mut xts = (0..num_transfers)
.map(|i| CheckedExtrinsic {
signed: Some((charlie(), signed_extra(nonce + i as Index, 0))),
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
dest: bob().into(),
value: 0,
}),
Expand Down
12 changes: 6 additions & 6 deletions bin/node/executor/tests/submit_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn should_submit_signed_transaction() {
t.execute_with(|| {
let results =
Signer::<Runtime, TestAuthorityId>::all_accounts().send_signed_transaction(|_| {
pallet_balances::Call::transfer {
pallet_balances::Call::transfer_allow_death {
dest: Alice.to_account_id().into(),
value: Default::default(),
}
Expand Down Expand Up @@ -123,7 +123,7 @@ fn should_submit_signed_twice_from_the_same_account() {
t.execute_with(|| {
let result =
Signer::<Runtime, TestAuthorityId>::any_account().send_signed_transaction(|_| {
pallet_balances::Call::transfer {
pallet_balances::Call::transfer_allow_death {
dest: Alice.to_account_id().into(),
value: Default::default(),
}
Expand All @@ -135,7 +135,7 @@ fn should_submit_signed_twice_from_the_same_account() {
// submit another one from the same account. The nonce should be incremented.
let result =
Signer::<Runtime, TestAuthorityId>::any_account().send_signed_transaction(|_| {
pallet_balances::Call::transfer {
pallet_balances::Call::transfer_allow_death {
dest: Alice.to_account_id().into(),
value: Default::default(),
}
Expand Down Expand Up @@ -174,7 +174,7 @@ fn should_submit_signed_twice_from_all_accounts() {
t.execute_with(|| {
let results = Signer::<Runtime, TestAuthorityId>::all_accounts()
.send_signed_transaction(|_| {
pallet_balances::Call::transfer { dest: Alice.to_account_id().into(), value: Default::default() }
pallet_balances::Call::transfer_allow_death { dest: Alice.to_account_id().into(), value: Default::default() }
});

let len = results.len();
Expand All @@ -185,7 +185,7 @@ fn should_submit_signed_twice_from_all_accounts() {
// submit another one from the same account. The nonce should be incremented.
let results = Signer::<Runtime, TestAuthorityId>::all_accounts()
.send_signed_transaction(|_| {
pallet_balances::Call::transfer { dest: Alice.to_account_id().into(), value: Default::default() }
pallet_balances::Call::transfer_allow_death { dest: Alice.to_account_id().into(), value: Default::default() }
});

let len = results.len();
Expand Down Expand Up @@ -238,7 +238,7 @@ fn submitted_transaction_should_be_valid() {
t.execute_with(|| {
let results =
Signer::<Runtime, TestAuthorityId>::all_accounts().send_signed_transaction(|_| {
pallet_balances::Call::transfer {
pallet_balances::Call::transfer_allow_death {
dest: Alice.to_account_id().into(),
value: Default::default(),
}
Expand Down
4 changes: 2 additions & 2 deletions bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
use frame_support::{
pallet_prelude::*,
traits::{
fungibles::{Balanced, CreditOf},
fungibles::{Balanced, Credit},
Currency, OnUnbalanced,
},
};
Expand All @@ -45,7 +45,7 @@ impl OnUnbalanced<NegativeImbalance> for Author {
/// Will drop and burn the assets in case the transfer fails.
pub struct CreditToBlockAuthor;
impl HandleCredit<AccountId, Assets> for CreditToBlockAuthor {
fn handle_credit(credit: CreditOf<AccountId, Assets>) {
fn handle_credit(credit: Credit<AccountId, Assets>) {
if let Some(author) = pallet_authorship::Pallet::<Runtime>::author() {
// Drop the result which will trigger the `OnDrop` of the imbalance in case of error.
let _ = Assets::resolve(&author, credit);
Expand Down
21 changes: 17 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use pallet_nis::WithMaximumOf;
use pallet_session::historical as pallet_session_historical;
pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment};
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use scale_info::TypeInfo;
use sp_api::impl_runtime_apis;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_grandpa::AuthorityId as GrandpaId;
Expand Down Expand Up @@ -432,6 +433,15 @@ parameter_types! {
pub const MaxReserves: u32 = 50;
}

/// A reason for placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, Debug, TypeInfo,
)]
pub enum HoldReason {
/// The NIS Pallet has reserved it for a non-fungible receipt.
Nis,
}

impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
Expand All @@ -442,6 +452,10 @@ impl pallet_balances::Config for Runtime {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Pallet<Runtime>;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = HoldReason;
type MaxHolds = ConstU32<1>;
}

parameter_types! {
Expand Down Expand Up @@ -1481,7 +1495,6 @@ impl pallet_assets::Config for Runtime {
}

parameter_types! {
pub IgnoredIssuance: Balance = Treasury::pot();
pub const QueueCount: u32 = 300;
pub const MaxQueueLen: u32 = 1000;
pub const FifoQueueLen: u32 = 500;
Expand All @@ -1493,7 +1506,7 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub Target: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisReserveId: [u8; 8] = *b"py/nis ";
pub const NisHoldReason: HoldReason = HoldReason::Nis;
}

impl pallet_nis::Config for Runtime {
Expand All @@ -1505,7 +1518,7 @@ impl pallet_nis::Config for Runtime {
type Counterpart = ItemOf<Assets, ConstU32<9u32>, AccountId>;
type CounterpartAmount = WithMaximumOf<ConstU128<21_000_000_000_000_000_000u128>>;
type Deficit = ();
type IgnoredIssuance = IgnoredIssuance;
type IgnoredIssuance = ();
type Target = Target;
type PalletId = NisPalletId;
type QueueCount = QueueCount;
Expand All @@ -1517,7 +1530,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle;
type ReserveId = NisReserveId;
type HoldReason = NisHoldReason;
}

parameter_types! {
Expand Down
Loading