Skip to content

Commit 3f9f609

Browse files
committed
Authorized transactions (user, preimage) should be for free - part 1
1 parent 014ef43 commit 3f9f609

File tree

6 files changed

+190
-164
lines changed

6 files changed

+190
-164
lines changed

Cargo.lock

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", rev =
102102
pallet-offences = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
103103
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
104104
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
105+
pallet-skip-feeless-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
105106
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
106107
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }
107108
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "23cac32cb789a6a6e3a071a3f5cd293737098b71", default-features = false }

pallets/transaction-storage/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ pub mod pallet {
334334
/// O(n*log(n)) of data size, as all data is pushed to an in-memory trie.
335335
#[pallet::call_index(0)]
336336
#[pallet::weight(T::WeightInfo::store(data.len() as u32))]
337+
#[pallet::feeless_if(|origin: &OriginFor<T>, data: &Vec<u8>| -> bool { /*TODO: add here correct validation */ true })]
337338
pub fn store(_origin: OriginFor<T>, data: Vec<u8>) -> DispatchResult {
338339
// In the case of a regular unsigned transaction, this should have been checked by
339340
// pre_dispatch. In the case of a regular signed transaction, this should have been

runtimes/bulletin-westend/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pallet-authorship = { workspace = true }
3232
pallet-balances = { workspace = true }
3333
pallet-message-queue = { workspace = true }
3434
pallet-session = { workspace = true }
35+
pallet-skip-feeless-payment = { workspace = true }
3536
pallet-sudo = { workspace = true }
3637
pallet-timestamp = { workspace = true }
3738
pallet-transaction-payment = { workspace = true }
@@ -114,6 +115,7 @@ std = [
114115
"pallet-collator-selection/std",
115116
"pallet-message-queue/std",
116117
"pallet-session/std",
118+
"pallet-skip-feeless-payment/std",
117119
"pallet-sudo/std",
118120
"pallet-timestamp/std",
119121
"pallet-transaction-payment-rpc-runtime-api/std",

runtimes/bulletin-westend/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim<
112112
frame_system::CheckEra<Runtime>,
113113
frame_system::CheckNonce<Runtime>,
114114
frame_system::CheckWeight<Runtime>,
115-
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
115+
pallet_skip_feeless_payment::SkipCheckIfFeeless<
116+
Runtime,
117+
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
118+
>,
116119
ValidateSigned,
117120
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
118121
),
@@ -531,11 +534,8 @@ impl pallet_collator_selection::Config for Runtime {
531534
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
532535
}
533536

534-
parameter_types! {
535-
/// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
536-
pub const DepositBase: Balance = deposit(1, 88);
537-
/// Additional storage item size of 32 bytes.
538-
pub const DepositFactor: Balance = deposit(0, 32);
537+
impl pallet_skip_feeless_payment::Config for Runtime {
538+
type RuntimeEvent = RuntimeEvent;
539539
}
540540

541541
impl pallet_sudo::Config for Runtime {
@@ -558,6 +558,7 @@ construct_runtime!(
558558
// Monetary stuff.
559559
Balances: pallet_balances = 10,
560560
TransactionPayment: pallet_transaction_payment = 11,
561+
SkipFeelessPayment: pallet_skip_feeless_payment = 12,
561562

562563
// Storage
563564
TransactionStorage: pallet_transaction_storage = 40,

0 commit comments

Comments
 (0)