Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Adjust fees configuration and refactor social related proxy types #257

Merged
merged 8 commits into from
Mar 20, 2024
Merged
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
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
Loading