Skip to content

Commit fa65eff

Browse files
authored
Refactor as_sub to make things clearer. (#6503)
* Refactor as_sub to make things clearer. - `as_sub` becomes `as_alternative` - `as_sub_limited` becomes `as_derivative` - `as_alternative` and `as_derivative` generate a mutually exclusive set of accounts. * Test fix * Add test * Fix test * Remove `as_alternative`. * Docs.
1 parent b6e48a8 commit fa65eff

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/tests.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,11 @@ fn filtering_works() {
201201
assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()));
202202
expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin)));
203203

204-
let sub_id = Utility::sub_account_id(1, 0);
205-
Balances::mutate_account(&sub_id, |a| a.free = 1000);
204+
let derivative_id = Utility::derivative_account_id(1, 0);
205+
Balances::mutate_account(&derivative_id, |a| a.free = 1000);
206206
let inner = Box::new(Call::Balances(BalancesCall::transfer(6, 1)));
207207

208-
let call = Box::new(Call::Utility(UtilityCall::as_sub(0, inner.clone())));
209-
assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()));
210-
expect_event(RawEvent::ProxyExecuted(Ok(())));
211-
assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()));
212-
expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin)));
213-
assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()));
214-
expect_event(RawEvent::ProxyExecuted(Ok(())));
215-
216-
let call = Box::new(Call::Utility(UtilityCall::as_limited_sub(0, inner.clone())));
208+
let call = Box::new(Call::Utility(UtilityCall::as_derivative(0, inner.clone())));
217209
assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()));
218210
expect_event(RawEvent::ProxyExecuted(Ok(())));
219211
assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()));

0 commit comments

Comments
 (0)