Skip to content

Commit 2004df1

Browse files
Fix NoCurrency
1 parent e564d8e commit 2004df1

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

pallets/common/src/lib.rs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ use codec::{Decode, Encode};
1919
use polkadot_sdk_frame::{
2020
deps::frame_support,
2121
prelude::{
22-
fungible::{Dust, Inspect, InspectHold, Mutate, MutateHold, Unbalanced, UnbalancedHold},
22+
fungible::{
23+
hold::DoneSlash, Balanced, BalancedHold, Dust, Inspect, InspectHold, Mutate,
24+
MutateHold, Unbalanced, UnbalancedHold,
25+
},
2326
DepositConsequence, DispatchError, DispatchResult, Fortitude, Preservation, Provenance,
2427
WithdrawConsequence, Zero,
2528
},
@@ -40,10 +43,31 @@ pub struct NoCurrency<AccountId, HoldReason = ()>(
4043
core::marker::PhantomData<(AccountId, HoldReason)>,
4144
);
4245

46+
impl<AccountId, HoldReason> Balanced<AccountId> for NoCurrency<AccountId, HoldReason>
47+
where
48+
HoldReason: Encode + Decode + TypeInfo + 'static,
49+
{
50+
type OnDropDebt = ();
51+
type OnDropCredit = ();
52+
}
53+
54+
impl<AccountId, HoldReason> BalancedHold<AccountId> for NoCurrency<AccountId, HoldReason> where
55+
HoldReason: Encode + Decode + TypeInfo + 'static
56+
{
57+
}
58+
59+
impl<AccountId, HoldReason, Balance> DoneSlash<HoldReason, AccountId, Balance>
60+
for NoCurrency<AccountId, HoldReason>
61+
where
62+
Balance: Sized,
63+
HoldReason: Encode + Decode + TypeInfo + 'static,
64+
{
65+
}
66+
4367
impl<AccountId, HoldReason: Encode + Decode + TypeInfo + 'static> Inspect<AccountId>
4468
for NoCurrency<AccountId, HoldReason>
4569
{
46-
type Balance = u128;
70+
type Balance = u64;
4771

4872
fn total_issuance() -> Self::Balance {
4973
Zero::zero()

pallets/transaction-storage/src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
//! Test environment for transaction-storage pallet.
1919
2020
use crate::{
21-
self as pallet_transaction_storage, TransactionStorageProof,
22-
DEFAULT_MAX_BLOCK_TRANSACTIONS, DEFAULT_MAX_TRANSACTION_SIZE,
21+
self as pallet_transaction_storage, TransactionStorageProof, DEFAULT_MAX_BLOCK_TRANSACTIONS,
22+
DEFAULT_MAX_TRANSACTION_SIZE,
2323
};
2424
use pallets_common::NoCurrency;
2525
use polkadot_sdk_frame::{prelude::*, runtime::prelude::*, testing_prelude::*};
@@ -54,7 +54,7 @@ parameter_types! {
5454
impl pallet_transaction_storage::Config for Test {
5555
type RuntimeEvent = RuntimeEvent;
5656
type RuntimeCall = RuntimeCall;
57-
type Currency = NoCurrency<RuntimeHoldReason>;
57+
type Currency = NoCurrency<Self::AccountId, RuntimeHoldReason>;
5858
type RuntimeHoldReason = RuntimeHoldReason;
5959
type WeightInfo = ();
6060
type MaxBlockTransactions = ConstU32<{ DEFAULT_MAX_BLOCK_TRANSACTIONS }>;

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl pallet_sudo::Config for Runtime {
346346
impl pallet_transaction_storage::Config for Runtime {
347347
type RuntimeEvent = RuntimeEvent;
348348
type RuntimeCall = RuntimeCall;
349-
type Currency = NoCurrency<RuntimeHoldReason>;
349+
type Currency = NoCurrency<Self::AccountId, RuntimeHoldReason>;
350350
type RuntimeHoldReason = RuntimeHoldReason;
351351
type WeightInfo = pallet_transaction_storage::weights::SubstrateWeight<Runtime>;
352352
type MaxBlockTransactions = ConstU32<512>;

runtimes/bulletin-polkadot/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl pallet_timestamp::Config for Runtime {
344344
impl pallet_transaction_storage::Config for Runtime {
345345
type RuntimeEvent = RuntimeEvent;
346346
type RuntimeCall = RuntimeCall;
347-
type Currency = NoCurrency<RuntimeHoldReason>;
347+
type Currency = NoCurrency<Self::AccountId, RuntimeHoldReason>;
348348
type RuntimeHoldReason = RuntimeHoldReason;
349349
type WeightInfo = weights::pallet_transaction_storage::WeightInfo<Runtime>;
350350
type MaxBlockTransactions = ConstU32<512>;

runtimes/bulletin-westend/src/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ parameter_types! {
4444
impl pallet_transaction_storage::Config for Runtime {
4545
type RuntimeEvent = RuntimeEvent;
4646
type RuntimeCall = RuntimeCall;
47-
type Currency = NoCurrency<RuntimeHoldReason>;
47+
type Currency = NoCurrency<Self::AccountId, RuntimeHoldReason>;
4848
type RuntimeHoldReason = RuntimeHoldReason;
4949
type WeightInfo = crate::weights::pallet_transaction_storage::WeightInfo<Runtime>;
5050
type MaxBlockTransactions = crate::ConstU32<512>;

0 commit comments

Comments
 (0)