Skip to content

Commit

Permalink
refactor: Adjust fees configuration and refactor social related proxy…
Browse files Browse the repository at this point in the history
… types (#257)

* Increase base weight price

* Refactor social related proxy types

* Get rid of complete migrations

* Update spec_version to 41

* Remove redundant parts of code and put deprecation marks
  • Loading branch information
F3Joule authored Mar 20, 2024
1 parent 01fb722 commit da9c0b8
Showing 1 changed file with 25 additions and 30 deletions.
55 changes: 25 additions & 30 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_creator_staking::migration::MigrateToV1<Runtime>,
(),
>;

/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
Expand All @@ -138,8 +138,8 @@ pub struct WeightToFee;
impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Extrinsic base weight (smallest non-zero weight) is mapped to 10 MILLIUNIT
let p = 10 * MILLIUNIT;
// Extrinsic base weight (smallest non-zero weight) is mapped to 100 MILLIUNIT
let p = 100 * MILLIUNIT;
let q = Balance::from(ExtrinsicBaseWeight::get().ref_time());
smallvec![WeightToFeeCoefficient {
degree: 1,
Expand Down Expand Up @@ -178,7 +178,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("subsocial-parachain"),
impl_name: create_runtime_str!("subsocial-parachain"),
authoring_version: 1,
spec_version: 40,
spec_version: 41,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 8,
Expand Down Expand Up @@ -562,9 +562,15 @@ parameter_types! {
)]
pub enum ProxyType {
Any,
#[deprecated(note = "Will be removed in the next release")]
// TODO: remove as it's not used
DomainRegistrar,
SocialActions,
#[deprecated(note = "Will be removed in the next release")]
// TODO: remove or either replace as it's not used
Management,
#[deprecated(note = "Will be removed in the next release")]
// TODO: remove or either replace (if we have use-cases for it) as it's not used
SocialActionsProxy,
}

Expand All @@ -576,34 +582,23 @@ impl Default for ProxyType {

impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
let is_social_action = matches!(
c,
RuntimeCall::AccountFollows(..)
| RuntimeCall::Domains(..)
| RuntimeCall::PostFollows(..)
| RuntimeCall::Posts(..)
| RuntimeCall::Profiles(..)
| RuntimeCall::Reactions(..)
| RuntimeCall::Roles(..)
| RuntimeCall::SpaceFollows(..)
| RuntimeCall::Spaces(..)
);

match self {
ProxyType::Any => true,
ProxyType::DomainRegistrar => false,
ProxyType::SocialActions => matches!(
c,
RuntimeCall::Posts(..)
| RuntimeCall::Reactions(..)
| RuntimeCall::AccountFollows(..)
| RuntimeCall::SpaceFollows(..)
| RuntimeCall::Spaces(..)
| RuntimeCall::Profiles(..)
),
// TODO: Think on this proxy type. We probably need this to extend `SocialActions` or either replace it.
ProxyType::Management => matches!(
c,
RuntimeCall::Spaces(..)
| RuntimeCall::SpaceOwnership(..)
| RuntimeCall::Roles(..)
| RuntimeCall::Profiles(..)
| RuntimeCall::Domains(..)
),
ProxyType::SocialActionsProxy => {
matches!(
c,
RuntimeCall::Proxy(pallet_proxy::Call::proxy { call, .. })
if ProxyType::SocialActions.filter(call),
)
},
ProxyType::SocialActions => is_social_action,
_ => false,
}
}

Expand Down

0 comments on commit da9c0b8

Please sign in to comment.