-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Runtime] Enable feeless, walletless transactions on selected accounts (
#428) * wip(kreivo-runtime): configuration(-ish) of the pallets without `WebAuthn`. * change(kreivo-runtime): add suport for webauthn in pallet-pass * change(kreivo-runtime): feeless transactions to selected accounts * fix(kreivo-runtime): expose `ExistentialDeposit` type * fix(kreivo-runtime): a better way (that works) to conditionally enable Sudo on paseo * change(kreivo-runtime): move specific parameters belonging to system support to its corresponding module * fix(kreivo-runtime): remove sudo (we won't need it after a couple of changes we can easily do in Paseo) * change(kreivo-runtime): re-export parameter sent to monetary stuff module * fix(kreivo-runtime): remove numeric prefix from module names in `configuration` * fix(justfile): `node` -> `chain-spec-generator` * chore: bump version * change(chain-spec-generator): update metadata properties of kreivo de paseo
- Loading branch information
Showing
10 changed files
with
789 additions
and
425 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//! Configure FRAME pallets to include in runtime. | ||
|
||
use super::*; | ||
|
||
pub mod monetary_stuff; | ||
pub mod system_support; | ||
|
||
pub use monetary_stuff::{ | ||
ExistentialDeposit, KreivoAssetsCall, KreivoAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, | ||
TransactionByteFee, | ||
}; | ||
pub use system_support::RuntimeBlockWeights; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
use super::*; | ||
|
||
use fc_traits_gas_tank::NonFungibleGasBurner; | ||
|
||
use pallet_asset_tx_payment::FungiblesAdapter; | ||
use pallet_assets::BalanceToAssetBalance; | ||
use pallet_transaction_payment::FungibleAdapter; | ||
use runtime_common::impls::AssetsToBlockAuthor; | ||
|
||
// #[runtime::pallet_index(10)] | ||
// pub type Balances | ||
parameter_types! { | ||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; | ||
} | ||
|
||
impl pallet_balances::Config for Runtime { | ||
type MaxLocks = ConstU32<50>; | ||
/// The type for recording an account's balance. | ||
type Balance = Balance; | ||
/// The ubiquitous event type. | ||
type RuntimeEvent = RuntimeEvent; | ||
type DustRemoval = (); | ||
type ExistentialDeposit = ExistentialDeposit; | ||
type AccountStore = System; | ||
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>; | ||
type MaxReserves = ConstU32<50>; | ||
type ReserveIdentifier = [u8; 8]; | ||
type RuntimeHoldReason = RuntimeHoldReason; | ||
type FreezeIdentifier = RuntimeFreezeReason; | ||
type MaxFreezes = ConstU32<256>; | ||
type RuntimeFreezeReason = RuntimeFreezeReason; | ||
} | ||
|
||
// #[runtime::pallet_index(11)] | ||
// pub type TransactionPayment | ||
parameter_types! { | ||
/// Relay Chain `TransactionByteFee` / 10 | ||
pub const TransactionByteFee: Balance = 10 * MILLICENTS; | ||
} | ||
|
||
impl pallet_transaction_payment::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type OnChargeTransaction = FungibleAdapter<Balances, ResolveTo<TreasuryAccount, Balances>>; | ||
type WeightToFee = WeightToFee; | ||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>; | ||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; | ||
type OperationalFeeMultiplier = ConstU8<5>; | ||
} | ||
|
||
// #[runtime::pallet_index(12)] | ||
// pub type AssetsFreezer | ||
impl pallet_assets_freezer::Config<KreivoAssetsInstance> for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type RuntimeFreezeReason = RuntimeFreezeReason; | ||
} | ||
|
||
// #[runtime::pallet_index(13)] | ||
// pub type Assets | ||
parameter_types! { | ||
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 UNITS deposit to create asset | ||
pub const AssetAccountDeposit: Balance = deposit(1, 16); | ||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT; | ||
pub const AssetsStringLimit: u32 = 50; | ||
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1) | ||
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271 | ||
pub const MetadataDepositBase: Balance = deposit(1, 68); | ||
pub const MetadataDepositPerByte: Balance = deposit(0, 1); | ||
} | ||
|
||
/// We allow root to execute privileged asset operations. | ||
pub type AssetsForceOrigin = EnsureRoot<AccountId>; | ||
pub type KreivoAssetsInstance = pallet_assets::Instance1; | ||
pub type KreivoAssetsCall = pallet_assets::Call<Runtime, KreivoAssetsInstance>; | ||
|
||
impl pallet_assets::Config<KreivoAssetsInstance> for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type Balance = Balance; | ||
type AssetId = FungibleAssetLocation; | ||
type AssetIdParameter = FungibleAssetLocation; | ||
type Currency = Balances; | ||
/// Only root can create assets and force state changes. | ||
type CreateOrigin = AsEnsureOriginWithArg<NeverEnsureOrigin<AccountId>>; | ||
type ForceOrigin = AssetsForceOrigin; | ||
type AssetDeposit = AssetDeposit; | ||
type MetadataDepositBase = MetadataDepositBase; | ||
type MetadataDepositPerByte = MetadataDepositPerByte; | ||
type ApprovalDeposit = ApprovalDeposit; | ||
type StringLimit = AssetsStringLimit; | ||
type Freezer = AssetsFreezer; | ||
type Extra = (); | ||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>; | ||
type CallbackHandle = (); | ||
type AssetAccountDeposit = AssetAccountDeposit; | ||
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>; | ||
type MaxHolds = frame_support::traits::ConstU32<50>; | ||
type RuntimeHoldReason = RuntimeHoldReason; | ||
#[cfg(feature = "runtime-benchmarks")] | ||
type BenchmarkHelper = (); | ||
} | ||
|
||
// #[runtime::pallet_index(14)] | ||
// pub type AssetsTxPayment | ||
impl pallet_asset_tx_payment::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type Fungibles = Assets; | ||
type OnChargeAssetTransaction = FungiblesAdapter< | ||
BalanceToAssetBalance<Balances, Runtime, ConvertInto, KreivoAssetsInstance>, | ||
AssetsToBlockAuthor<Runtime, KreivoAssetsInstance>, | ||
>; | ||
} | ||
|
||
// #[runtime::pallet_index(15)] | ||
// pub type Vesting | ||
parameter_types! { | ||
pub const MinVestedTransfer: Balance = 100 * CENTS; | ||
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = | ||
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); | ||
} | ||
|
||
impl pallet_vesting::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type Currency = Balances; | ||
type BlockNumberToBalance = ConvertInto; | ||
type MinVestedTransfer = MinVestedTransfer; | ||
type WeightInfo = pallet_vesting::weights::SubstrateWeight<Runtime>; | ||
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; | ||
type BlockNumberProvider = System; | ||
const MAX_VESTING_SCHEDULES: u32 = 28; | ||
} | ||
|
||
// #[runtime::pallet_index(16)] | ||
// pub type SkipFeeless | ||
impl pallet_skip_feeless_payment::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
} | ||
|
||
// #[runtime::pallet_index(17)] | ||
// pub type GasTxPayment | ||
impl pallet_gas_transaction_payment::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type GasBurner = NonFungibleGasBurner<Runtime, CommunityMemberships, pallet_nfts::ItemConfig>; | ||
} |
Oops, something went wrong.