Skip to content

Commit a6c96bb

Browse files
committed
- fmt, clippy, test
1 parent 01113d4 commit a6c96bb

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

runtime/src/transaction_payment_wrapper.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ where
193193
}
194194

195195
fn is_coldkey_fee_payer_eligible(call: &RuntimeCallOf<T>) -> bool {
196-
match call.is_sub_type() {
197-
Some(pallet_subtensor::Call::set_weights { .. }) => true,
198-
_ => false,
199-
}
196+
matches!(
197+
call.is_sub_type(),
198+
Some(pallet_subtensor::Call::set_weights { .. })
199+
)
200200
}
201201
}
202202

@@ -206,7 +206,7 @@ where
206206
RuntimeCallOf<T>: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>
207207
+ IsSubType<pallet_proxy::Call<T>>
208208
+ IsSubType<pallet_utility::Call<T>>
209-
+ IsSubType<pallet_subtensor::Call<T>>,
209+
+ IsSubType<pallet_subtensor::Call<T>>,
210210
RuntimeOriginOf<T>: AsSystemOriginSigner<AccountIdOf<T>>
211211
+ Clone
212212
+ From<frame_system::RawOrigin<AccountIdOf<T>>>,

ts-tests/suites/dev/subtensor/transaction-payment-wrapper/00-transaction-payment-wrapper.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describeSuite({
1717

1818
it({
1919
id: "T01",
20-
title: "Check set_weights",
20+
title: "Fees for set_weights charged by coldkey instead of origin(hotkey)",
2121
test: async () => {
2222
const coldkey = generateKeyringPair("sr25519");
2323
const hotkey = generateKeyringPair("sr25519");
@@ -28,8 +28,10 @@ describeSuite({
2828
const initialBalance = tao(1e10);
2929

3030
log("Set Up");
31+
const existentialDeposit = await api.consts.balances.existentialDeposit.toBigInt();
32+
// Hotkey should "exist", even if coldkey is paying for tx
33+
await devForceSetBalance(api, context, hotkey.address, existentialDeposit);
3134
await devForceSetBalance(api, context, coldkey.address, initialBalance);
32-
await devForceSetBalance(api, context, hotkey.address, initialBalance);
3335
await devTryAssociateHotkey(api, context, coldkey, hotkey.address);
3436

3537
const coldkeyBalanceBefore = (await api.query.system.account(coldkey.address)).data.free.toBigInt();
@@ -48,7 +50,7 @@ describeSuite({
4850
const txFee = feeEvent[0].event.data.actualFee.toBigInt();
4951
expect(txFee).toBeGreaterThan(0n);
5052
expect(coldkeyBalanceAfter).toEqual(coldkeyBalanceBefore - txFee);
51-
expect(hotkeyBalance).toEqual(initialBalance);
53+
expect(hotkeyBalance).toEqual(existentialDeposit);
5254
},
5355
});
5456
},

0 commit comments

Comments
 (0)