Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
17d7f63
Basic account composition.
gavofyork Feb 3, 2020
ae6f092
Add try_mutate_exists
gavofyork Feb 4, 2020
21e1565
De-duplicate
gavofyork Feb 4, 2020
c202dda
Refactor away the UpdateBalanceOutcome
gavofyork Feb 4, 2020
7aa6647
Expunge final UpdateBalanceOutcome refs
gavofyork Feb 4, 2020
b03d937
Refactor transfer
gavofyork Feb 4, 2020
1b74a2c
Refactor reservable currency stuff.
gavofyork Feb 4, 2020
74db69f
Test with the alternative setup.
gavofyork Feb 4, 2020
02d039d
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 4, 2020
d153672
Fixes
gavofyork Feb 4, 2020
459c30b
Test with both setups.
gavofyork Feb 5, 2020
f4ab417
Fixes
gavofyork Feb 5, 2020
35fcb32
Fix
gavofyork Feb 5, 2020
158863b
Fix macros
bkchr Feb 5, 2020
d7ce210
Make indices opt-in
gavofyork Feb 5, 2020
51ea88b
Remove CreationFee, and make indices opt-in.
gavofyork Feb 5, 2020
9c5539a
Fix construct_runtime
bkchr Feb 5, 2020
aed4da9
Fix last few bits
gavofyork Feb 6, 2020
21254ed
Fix tests
bkchr Feb 6, 2020
f929007
Update trait impls
gavofyork Feb 6, 2020
234ca8a
Don't hardcode the system event
bkchr Feb 6, 2020
c12175d
Make tests build and fix some stuff.
gavofyork Feb 6, 2020
ae0a7c6
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 6, 2020
133c060
Pointlessly bump runtime version
gavofyork Feb 6, 2020
5870f62
Fix benchmark
gavofyork Feb 6, 2020
2579ff7
Another fix
gavofyork Feb 6, 2020
571e209
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 6, 2020
f9adced
Whitespace
gavofyork Feb 6, 2020
2cc84bd
Make indices module economically safe
gavofyork Feb 7, 2020
06cd3a0
Migrations for indices.
gavofyork Feb 7, 2020
b656032
Fix
gavofyork Feb 7, 2020
6d02d1d
Whilespace
gavofyork Feb 7, 2020
091bf0e
Trim defunct migrations
gavofyork Feb 8, 2020
48a3450
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 8, 2020
ae75d69
Remove unused storage item
gavofyork Feb 8, 2020
10d28d2
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 9, 2020
02e67b7
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 9, 2020
e4a398a
More contains_key fixes
gavofyork Feb 9, 2020
9f01bf0
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 10, 2020
1a59997
Docs.
gavofyork Feb 10, 2020
fd6adae
Bump runtime
gavofyork Feb 10, 2020
29cefa1
Merge branch 'master' into gav-composite-account
gavofyork Feb 10, 2020
740e8a3
Merge branch 'master' into gav-composite-account
jacogr Feb 11, 2020
30cee70
Remove unneeded code
gavofyork Feb 11, 2020
6afee76
Merge branch 'gav-composite-account' of github.com:paritytech/substra…
gavofyork Feb 11, 2020
6444cc1
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 12, 2020
5890e24
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 12, 2020
411595d
Fix test
gavofyork Feb 12, 2020
a26c44d
Fix test
gavofyork Feb 12, 2020
bbacb94
Merge branch 'master' into gav-composite-account
gavofyork Feb 12, 2020
2f07990
Update frame/balances/src/lib.rs
gavofyork Feb 13, 2020
680c1f7
Fix ED logic
gavofyork Feb 13, 2020
446ace0
Merge branch 'gav-composite-account' of github.com:paritytech/substra…
gavofyork Feb 13, 2020
3c29022
Repatriate reserved logic
gavofyork Feb 13, 2020
cc6edb8
Typo
gavofyork Feb 13, 2020
df85e74
Fix typo
shawntabrizi Feb 13, 2020
db5c064
Merge branch 'gav-composite-account' of github.com:paritytech/substra…
gavofyork Feb 13, 2020
a7d2980
Update frame/system/src/lib.rs
gavofyork Feb 13, 2020
49bc2e0
Update frame/system/src/lib.rs
gavofyork Feb 13, 2020
c9e852c
Last few fixes
gavofyork Feb 13, 2020
86b132e
Merge branch 'gav-composite-account' of github.com:paritytech/substra…
gavofyork Feb 13, 2020
c472b53
Another fix
gavofyork Feb 13, 2020
dedc512
Merge remote-tracking branch 'origin/master' into gav-composite-account
gavofyork Feb 13, 2020
e424b22
Build fix
gavofyork Feb 13, 2020
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
Prev Previous commit
Next Next commit
Last few fixes
  • Loading branch information
gavofyork committed Feb 13, 2020
commit c9e852caea94a47540c8960418707dd8dabb76aa
2 changes: 1 addition & 1 deletion frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ impl<T: Trait<I>, I: Instance> ReservableCurrency<T::AccountId> for Module<T, I>
if slashed == beneficiary {
return match status {
Status::Free => Ok(Self::unreserve(slashed, value)),
Status::Reserved => Ok(Self::reserved_balance(slashed)),
Status::Reserved => Ok(value.saturating_sub(Self::reserved_balance(slashed))),
};
}

Expand Down
26 changes: 13 additions & 13 deletions frame/identity/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
Judgement::Reasonable
)?;
}

// Create identity info with x additional fields
let x = components.iter().find(|&c| c.0 == BenchmarkParameter::X).unwrap().1;
// 32 byte data that we reuse below
Expand All @@ -171,7 +171,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// Generic data to be used.
let data = Data::Raw(vec![0; 32]);

Expand Down Expand Up @@ -212,7 +212,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
Expand Down Expand Up @@ -262,7 +262,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
Expand Down Expand Up @@ -296,7 +296,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
Expand Down Expand Up @@ -330,7 +330,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
Expand Down Expand Up @@ -359,7 +359,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
Expand Down Expand Up @@ -388,7 +388,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
Expand All @@ -410,7 +410,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for
}
}

// Benchmark `provide_judgement` extrinsic.
// Benchmark `provide_judgement` extrinsic.g
struct ProvideJudgement;
impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for ProvideJudgement {

Expand All @@ -425,7 +425,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// Add r registrars
let r = components.iter().find(|&c| c.0 == BenchmarkParameter::R).unwrap().1;
benchmarking::add_registrars::<T>(r)?;
Expand Down Expand Up @@ -477,7 +477,7 @@ impl<T: Trait> BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>> for

fn instance(&self, components: &[(BenchmarkParameter, u32)])
-> Result<(crate::Call<T>, RawOrigin<T::AccountId>), &'static str>
{
{
// The target user
let caller = account::<T>("caller", 0);
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
Expand Down Expand Up @@ -550,8 +550,8 @@ impl<T: Trait> Benchmarking<BenchmarkResults> for Module<T> {
sp_io::benchmarking::commit_db();
sp_io::benchmarking::wipe_db();

// first one is set_identity.
let components = <SelectedBenchmark as BenchmarkingSetup<T, crate::Call<T>, RawOrigin<T::AccountId>>>::components(&selected_benchmark);
// first one is set_identity.
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.
Expand Down
6 changes: 3 additions & 3 deletions frame/indices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use sp_std::prelude::*;
use codec::Codec;
use sp_runtime::traits::{
SimpleArithmetic, StaticLookup, Member, LookupError, Zero, One, BlakeTwo256, Hash
SimpleArithmetic, StaticLookup, Member, LookupError, Zero, One, BlakeTwo256, Hash, Saturating
};
use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure};
use frame_support::dispatch::DispatchResult;
Expand Down Expand Up @@ -152,8 +152,8 @@ decl_module! {
Accounts::<T>::try_mutate(index, |maybe_value| {
let (account, amount) = maybe_value.take().ok_or(Error::<T>::NotAssigned)?;
ensure!(&account == &who, Error::<T>::NotOwner);
*maybe_value = Some((new.clone(), amount));
T::Currency::repatriate_reserved(&who, &new, amount, Reserved).map(|_| ())
let lost = T::Currency::repatriate_reserved(&who, &new, amount, Reserved)?;
*maybe_value = Some((new.clone(), amount.saturating_sub(lost)));
})?;
Self::deposit_event(RawEvent::IndexAssigned(new, index));
}
Expand Down
3 changes: 2 additions & 1 deletion frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ decl_module! {
type Error = Error<T>;

/// A big dispatch that will disallow any other transaction to be included.
// TODO: this must be preferable available for testing really (not possible at the moment).
// TODO: This should only be available for testing, rather than in general usage, but
// that's not possible at present (since it's within the decl_module macro).
#[weight = SimpleDispatchInfo::MaxOperational]
fn fill_block(origin) {
ensure_root(origin)?;
Expand Down