Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions runtime/asgard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ use xcm_support::Get;
/// Constant values used within the runtime.
pub mod constants;
use bifrost_flexible_fee::fee_dealer::{FeeDealer, FixedCurrencyFeeRate};
use bifrost_runtime_common::xcm_impl::{
BifrostAccountIdToMultiLocation, BifrostAssetMatcher, BifrostCurrencyIdConvert,
BifrostFilteredAssets, BifrostXcmTransactFilter,
use bifrost_runtime_common::{
xcm_impl::{
BifrostAccountIdToMultiLocation, BifrostAssetMatcher, BifrostCurrencyIdConvert,
BifrostFilteredAssets, BifrostXcmTransactFilter,
},
SlowAdjustingFeeUpdate,
};
use codec::{Decode, Encode};
use constants::{currency::*, time::*};
Expand Down Expand Up @@ -638,7 +641,7 @@ impl pallet_tips::Config for Runtime {
}

impl pallet_transaction_payment::Config for Runtime {
type FeeMultiplierUpdate = ();
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OnChargeTransaction = FlexibleFee;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
Expand Down
10 changes: 7 additions & 3 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ use static_assertions::const_assert;
/// Constant values used within the runtime.
pub mod constants;
use bifrost_flexible_fee::fee_dealer::{FeeDealer, FixedCurrencyFeeRate};
use bifrost_runtime_common::xcm_impl::{
BifrostAssetMatcher, BifrostCurrencyIdConvert, BifrostFilteredAssets, BifrostXcmTransactFilter,
use bifrost_runtime_common::{
xcm_impl::{
BifrostAccountIdToMultiLocation, BifrostAssetMatcher, BifrostCurrencyIdConvert,
BifrostFilteredAssets, BifrostXcmTransactFilter,
},
SlowAdjustingFeeUpdate,
};
use constants::{currency::*, time::*};
use cumulus_primitives_core::ParaId as CumulusParaId;
Expand Down Expand Up @@ -522,7 +526,7 @@ impl pallet_tips::Config for Runtime {
}

impl pallet_transaction_payment::Config for Runtime {
type FeeMultiplierUpdate = ();
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OnChargeTransaction = FlexibleFee;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
Expand Down
2 changes: 2 additions & 0 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ frame-support = { version = "3.0.0", default-features = false }
frame-system = { version = "3.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false }
max-encoded-len = { version = "3.0.0", default-features = false }
pallet-transaction-payment = { version = "3.0.0", default-features = false }

# Cumulus dependencies
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.8" }
Expand Down Expand Up @@ -100,4 +101,5 @@ std = [
"xcm-support/std",
"zenlink-protocol/std",
"zenlink-protocol-runtime-api/std",
"pallet-transaction-payment/std"
]
20 changes: 19 additions & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::sp_runtime::offchain::storage_lock::BlockNumberProvider;
use frame_support::{parameter_types, sp_runtime::offchain::storage_lock::BlockNumberProvider};
use node_primitives::BlockNumber;
use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use sp_runtime::{FixedPointNumber, Perquintill};

pub mod xcm_impl;

Expand All @@ -35,3 +37,19 @@ impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
.unwrap_or_default()
}
}

parameter_types! {
/// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less
/// than this will decrease the weight and more will increase.
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
/// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to
/// change the fees more rapidly.
pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(3, 100_000);
/// Minimum amount of the multiplier. This value cannot be too low. A test case should ensure
/// that combined with `AdjustmentVariable`, we can recover from the minimum.
/// See `multiplier_can_grow_from_zero`.
pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128);
}

pub type SlowAdjustingFeeUpdate<R> =
TargetedFeeAdjustment<R, TargetBlockFullness, AdjustmentVariable, MinimumMultiplier>;
11 changes: 7 additions & 4 deletions runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ use xcm_support::Get;
/// Constant values used within the runtime.
pub mod constants;
use bifrost_flexible_fee::fee_dealer::{FeeDealer, FixedCurrencyFeeRate};
use bifrost_runtime_common::xcm_impl::{
BifrostAccountIdToMultiLocation, BifrostAssetMatcher, BifrostCurrencyIdConvert,
BifrostFilteredAssets, BifrostXcmTransactFilter,
use bifrost_runtime_common::{
xcm_impl::{
BifrostAccountIdToMultiLocation, BifrostAssetMatcher, BifrostCurrencyIdConvert,
BifrostFilteredAssets, BifrostXcmTransactFilter,
},
SlowAdjustingFeeUpdate,
};
use codec::{Decode, Encode};
use constants::{currency::*, time::*};
Expand Down Expand Up @@ -640,7 +643,7 @@ impl pallet_tips::Config for Runtime {
}

impl pallet_transaction_payment::Config for Runtime {
type FeeMultiplierUpdate = ();
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OnChargeTransaction = FlexibleFee;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
Expand Down