mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 03:21:06 +00:00
Composite accounts (#4820)
* Basic account composition. * Add try_mutate_exists * De-duplicate * Refactor away the UpdateBalanceOutcome * Expunge final UpdateBalanceOutcome refs * Refactor transfer * Refactor reservable currency stuff. * Test with the alternative setup. * Fixes * Test with both setups. * Fixes * Fix * Fix macros * Make indices opt-in * Remove CreationFee, and make indices opt-in. * Fix construct_runtime * Fix last few bits * Fix tests * Update trait impls * Don't hardcode the system event * Make tests build and fix some stuff. * Pointlessly bump runtime version * Fix benchmark * Another fix * Whitespace * Make indices module economically safe * Migrations for indices. * Fix * Whilespace * Trim defunct migrations * Remove unused storage item * More contains_key fixes * Docs. * Bump runtime * Remove unneeded code * Fix test * Fix test * Update frame/balances/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Fix ED logic * Repatriate reserved logic * Typo * Fix typo * Update frame/system/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/system/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Last few fixes * Another fix * Build fix Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Jaco Greeff <jacogr@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -50,7 +50,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
{
|
||||
// Constants
|
||||
let ed = T::ExistentialDeposit::get();
|
||||
|
||||
|
||||
// Select an account
|
||||
let u = components.iter().find(|&c| c.0 == BenchmarkParameter::U).unwrap().1;
|
||||
let user = account::<T>("user", u);
|
||||
@@ -58,8 +58,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
|
||||
// Give some multiple of the existential deposit + creation fee + transfer fee
|
||||
let e = components.iter().find(|&c| c.0 == BenchmarkParameter::E).unwrap().1;
|
||||
let mut balance = ed.saturating_mul(e.into());
|
||||
balance += T::CreationFee::get();
|
||||
let balance = ed.saturating_mul(e.into());
|
||||
let _ = <Balances<T> as Currency<_>>::make_free_balance_be(&user, balance);
|
||||
|
||||
// Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user.
|
||||
@@ -90,7 +89,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
{
|
||||
// Constants
|
||||
let ed = T::ExistentialDeposit::get();
|
||||
|
||||
|
||||
// Select a sender
|
||||
let u = components.iter().find(|&c| c.0 == BenchmarkParameter::U).unwrap().1;
|
||||
let user = account::<T>("user", u);
|
||||
@@ -135,7 +134,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
{
|
||||
// Constants
|
||||
let ed = T::ExistentialDeposit::get();
|
||||
|
||||
|
||||
// Select a sender
|
||||
let u = components.iter().find(|&c| c.0 == BenchmarkParameter::U).unwrap().1;
|
||||
let user = account::<T>("user", u);
|
||||
@@ -176,7 +175,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
{
|
||||
// Constants
|
||||
let ed = T::ExistentialDeposit::get();
|
||||
|
||||
|
||||
// Select a sender
|
||||
let u = components.iter().find(|&c| c.0 == BenchmarkParameter::U).unwrap().1;
|
||||
let user = account::<T>("user", u);
|
||||
@@ -208,7 +207,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
|
||||
{
|
||||
// Constants
|
||||
let ed = T::ExistentialDeposit::get();
|
||||
|
||||
|
||||
// Select a sender
|
||||
let u = components.iter().find(|&c| c.0 == BenchmarkParameter::U).unwrap().1;
|
||||
let user = account::<T>("user", u);
|
||||
@@ -275,7 +274,7 @@ impl<T: Trait> Benchmarking<BenchmarkResults> for Module<T> {
|
||||
sp_io::benchmarking::commit_db();
|
||||
sp_io::benchmarking::wipe_db();
|
||||
|
||||
let components = <SelectedBenchmark as BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>>>::components(&selected_benchmark);
|
||||
let components = <SelectedBenchmark as BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>>>::components(&selected_benchmark);
|
||||
// results go here
|
||||
let mut results: Vec<BenchmarkResults> = Vec::new();
|
||||
// Select the component we will be benchmarking. Each component will be benchmarked.
|
||||
|
||||
Reference in New Issue
Block a user