Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
566faae
add update_provider_via_governance extrinsic
saraswatpuneet Sep 2, 2025
c6a6446
provider update related ext
saraswatpuneet Sep 2, 2025
ff260b4
add extrinsics to update a given application
saraswatpuneet Sep 2, 2025
fa1dfcb
add provider/application update tests
saraswatpuneet Sep 3, 2025
e8d61b7
add benchmarks and tests
saraswatpuneet Sep 3, 2025
ce09338
Update weights
saraswatpuneet Sep 3, 2025
02208fe
update weights and add e2e tests
saraswatpuneet Sep 3, 2025
5f47790
lint e2e
saraswatpuneet Sep 3, 2025
3e53ac9
Merge branch 'feat/provider-context-development' into 2549_update_pro…
saraswatpuneet Sep 3, 2025
8fcd4d3
add a non sudo required create application function and block it in r…
saraswatpuneet Sep 4, 2025
fa789ef
cleanups
saraswatpuneet Sep 4, 2025
19dac9b
better assertions
saraswatpuneet Sep 4, 2025
232bf98
update benchmarks to run over a lenght of locales
saraswatpuneet Sep 4, 2025
013b982
Update weights
saraswatpuneet Sep 4, 2025
156ae37
make benchmakrs more grandular
saraswatpuneet Sep 4, 2025
9af87fb
temporary: to make benchmarks run with m,n
saraswatpuneet Sep 4, 2025
720a627
Update weights
saraswatpuneet Sep 4, 2025
a8e49d7
improve benchmarks
saraswatpuneet Sep 4, 2025
e7f01ed
Update weights
saraswatpuneet Sep 4, 2025
d7451c3
set correct weights on extrinsics
saraswatpuneet Sep 4, 2025
1dab27b
Update weights
saraswatpuneet Sep 4, 2025
1fa7330
fix lint
saraswatpuneet Sep 4, 2025
7e40764
block on filter
saraswatpuneet Sep 4, 2025
5680042
remove hidden in test
saraswatpuneet Sep 5, 2025
c6a4a74
update pallet readme with new apis and runtime api
saraswatpuneet Sep 5, 2025
6517305
set proper removabls of older cids from logo storage
saraswatpuneet Sep 5, 2025
a8643af
Update weights
saraswatpuneet Sep 5, 2025
b944fe8
better assertions
saraswatpuneet Sep 6, 2025
267f015
remove unused variable
saraswatpuneet Sep 6, 2025
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
Prev Previous commit
Next Next commit
set correct weights on extrinsics
  • Loading branch information
saraswatpuneet committed Sep 4, 2025
commit d7451c3444da01721177e3d3dac85ff1909b6096
34 changes: 11 additions & 23 deletions pallets/msa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ pub mod pallet {
/// * [`Error::ExceedsMaxProviderNameSize`] - Too long of a provider name
/// * [`Error::DuplicateProviderRegistryEntry`] - a ProviderRegistryEntry associated with the given MSA id already exists.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::create_provider_v2(0u32))]
#[pallet::weight(T::WeightInfo::create_provider_v2(0u32, 0u32))]
pub fn create_provider(origin: OriginFor<T>, provider_name: Vec<u8>) -> DispatchResult {
let bounded_name: BoundedVec<u8, T::MaxProviderNameSize> =
provider_name.try_into().map_err(|_| Error::<T>::ExceedsMaxProviderNameSize)?;
Expand Down Expand Up @@ -1003,7 +1003,7 @@ pub mod pallet {
/// - [`NoKeyExists`](Error::NoKeyExists) - If there is not MSA for `origin`.
/// - [`Error::ExceedsMaxProviderNameSize`] - Too long of a provider name
#[pallet::call_index(11)]
#[pallet::weight(T::WeightInfo::propose_to_be_provider_v2(0u32))]
#[pallet::weight(T::WeightInfo::propose_to_be_provider_v2())]
pub fn propose_to_be_provider(
origin: OriginFor<T>,
provider_name: Vec<u8>,
Expand All @@ -1026,7 +1026,7 @@ pub mod pallet {
/// * [`Error::ExceedsMaxProviderNameSize`] - Too long of a provider name
/// * [`Error::DuplicateProviderRegistryEntry`] - a ProviderRegistryEntry associated with the given MSA id already exists.
#[pallet::call_index(12)]
#[pallet::weight(T::WeightInfo::create_provider_via_governance_v2(0u32,))]
#[pallet::weight(T::WeightInfo::create_provider_via_governance_v2(0u32, 0u32))]
pub fn create_provider_via_governance(
origin: OriginFor<T>,
provider_key: T::AccountId,
Expand Down Expand Up @@ -1325,8 +1325,8 @@ pub mod pallet {
/// * [`Error::DuplicateProviderRegistryEntry`] - a ProviderRegistryEntry associated with the given MSA id already exists.
#[pallet::call_index(19)]
#[pallet::weight(T::WeightInfo::create_provider_v2(
payload.localized_names.len() as u32
+payload.localized_logo_250_100_png_cids.len() as u32,
payload.localized_names.len() as u32,
payload.localized_logo_250_100_png_cids.len() as u32,
))]
pub fn create_provider_v2(
origin: OriginFor<T>,
Expand All @@ -1352,10 +1352,7 @@ pub mod pallet {
/// # Errors
/// - [`NoKeyExists`](Error::NoKeyExists) - If there is not MSA for `origin`.
#[pallet::call_index(20)]
#[pallet::weight(T::WeightInfo::propose_to_be_provider_v2(
payload.localized_names.len() as u32
+payload.localized_logo_250_100_png_cids.len() as u32,
))]
#[pallet::weight(T::WeightInfo::propose_to_be_provider_v2())]
pub fn propose_to_be_provider_v2(
origin: OriginFor<T>,
payload: ProviderRegistryEntry<
Expand Down Expand Up @@ -1393,8 +1390,8 @@ pub mod pallet {
/// * [`Error::InvalidBCP47LanguageCode`] - If the provided BCP 47 language code is invalid.
#[pallet::call_index(21)]
#[pallet::weight(T::WeightInfo::create_provider_via_governance_v2(
payload.localized_names.len() as u32
+payload.localized_logo_250_100_png_cids.len() as u32,
payload.localized_names.len() as u32,
payload.localized_logo_250_100_png_cids.len() as u32,
))]
pub fn create_provider_via_governance_v2(
origin: OriginFor<T>,
Expand Down Expand Up @@ -1424,10 +1421,7 @@ pub mod pallet {
/// * [`Error::InvalidCid`] - If the provided CID is invalid.
/// * [`Error::InvalidBCP47LanguageCode`] - If the provided BCP 47 language code is invalid.
#[pallet::call_index(22)]
#[pallet::weight(T::WeightInfo::propose_to_add_application(
payload.localized_names.len() as u32,
payload.localized_logo_250_100_png_cids.len() as u32,
))]
#[pallet::weight(T::WeightInfo::propose_to_add_application())]
pub fn propose_to_add_application(
origin: OriginFor<T>,
payload: ApplicationContext<
Expand Down Expand Up @@ -1579,10 +1573,7 @@ pub mod pallet {
/// * [`Error::InvalidCid`] - If the provided CID is invalid.
/// * [`Error::InvalidBCP47LanguageCode`] - If the provided BCP 47 language code is invalid.
#[pallet::call_index(26)]
#[pallet::weight(T::WeightInfo::propose_to_update_provider(
payload.localized_names.len() as u32
+payload.localized_logo_250_100_png_cids.len() as u32,
))]
#[pallet::weight(T::WeightInfo::propose_to_update_provider())]
pub fn propose_to_update_provider(
origin: OriginFor<T>,
payload: ProviderRegistryEntry<
Expand Down Expand Up @@ -1669,10 +1660,7 @@ pub mod pallet {
/// * [`Error::InvalidBCP47LanguageCode`] - If the provided BCP 47 language code is invalid.
/// * [`Error::ApplicationNotFound`] - If the application is not registered.
#[pallet::call_index(28)]
#[pallet::weight(T::WeightInfo::propose_to_update_application(
payload.localized_names.len() as u32,
payload.localized_logo_250_100_png_cids.len() as u32
))]
#[pallet::weight(T::WeightInfo::propose_to_update_application())]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does this also need the same benchmark changes?

Copy link
Collaborator Author

@saraswatpuneet saraswatpuneet Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal does not really change the state but create a proposal and that's it so it's not useful to add or not hence all proposal_* related ones have no parameters

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we use the max payload that can sent to it to compute the best worst estimate

pub fn propose_to_update_application(
origin: OriginFor<T>,
application_index: ApplicationIndex,
Expand Down
Loading