mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 19:01:08 +00:00
Self-sufficient account ref-counting (#8221)
* Self-sufficient account ref-counting * Fixes * Update frame/system/src/lib.rs Co-authored-by: Jaco Greeff <jacogr@gmail.com> * Fixes * Fixes * Fixes * Fixes * Fixes * Update frame/system/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/system/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/system/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * fix build * Update frame/system/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Jaco Greeff <jacogr@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ use sp_runtime::{
|
||||
traits::Hash as HashT,
|
||||
transaction_validity::InvalidTransaction,
|
||||
};
|
||||
use frame_system::{self, EventRecord, Phase};
|
||||
use frame_system::{self, EventRecord, Phase, AccountInfo};
|
||||
|
||||
use node_runtime::{
|
||||
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
|
||||
@@ -227,11 +227,17 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
|
||||
let mut t = new_test_ext(compact_code_unwrap(), false);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
|
||||
(0u32, 0u32, 0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
|
||||
(0u32, 0u32, 0u32, 0 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(),
|
||||
@@ -270,11 +276,17 @@ fn successful_execution_with_foreign_code_gives_ok() {
|
||||
let mut t = new_test_ext(bloaty_code_unwrap(), false);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
|
||||
(0u32, 0u32, 0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
|
||||
(0u32, 0u32, 0u32, 0 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(),
|
||||
@@ -704,7 +716,10 @@ fn panic_execution_gives_error() {
|
||||
let mut t = new_test_ext(bloaty_code_unwrap(), false);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
|
||||
(0u32, 0u32, 0u32, 0 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(), 0_u128.encode());
|
||||
t.insert(<frame_system::BlockHash<Runtime>>::hashed_key_for(0), vec![0u8; 32]);
|
||||
@@ -733,11 +748,17 @@ fn successful_execution_gives_ok() {
|
||||
let mut t = new_test_ext(compact_code_unwrap(), false);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(alice()),
|
||||
(0u32, 0u32, 0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (111 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<frame_system::Account<Runtime>>::hashed_key_for(bob()),
|
||||
(0u32, 0u32, 0u32, 0 * DOLLARS, 0u128, 0u128, 0u128).encode()
|
||||
AccountInfo::<<Runtime as frame_system::Config>::Index, _> {
|
||||
data: (0 * DOLLARS, 0u128, 0u128, 0u128),
|
||||
.. Default::default()
|
||||
}.encode(),
|
||||
);
|
||||
t.insert(
|
||||
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec(),
|
||||
|
||||
@@ -129,6 +129,7 @@ fn new_account_info(free_dollars: u128) -> Vec<u8> {
|
||||
nonce: 0u32,
|
||||
consumers: 0,
|
||||
providers: 0,
|
||||
sufficients: 0,
|
||||
data: (free_dollars * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS),
|
||||
}.encode()
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ fn submitted_transaction_should_be_valid() {
|
||||
let author = extrinsic.signature.clone().unwrap().0;
|
||||
let address = Indices::lookup(author).unwrap();
|
||||
let data = pallet_balances::AccountData { free: 5_000_000_000_000, ..Default::default() };
|
||||
let account = frame_system::AccountInfo { nonce: 0, consumers: 0, providers: 0, data };
|
||||
let account = frame_system::AccountInfo { data, .. Default::default() };
|
||||
<frame_system::Account<Runtime>>::insert(&address, account);
|
||||
|
||||
// check validity
|
||||
|
||||
Reference in New Issue
Block a user