-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: 📈 finish benchmarking the storage-providers
pallet's extrinsics
#344
base: main
Are you sure you want to change the base?
Conversation
storage-providers
palletstorage-providers
pallet's extrinsics
pallets/providers/src/utils.rs
Outdated
MainStorageProviders::<T>::remove(&provider_id); | ||
AccountIdToMainStorageProviderId::<T>::remove(msp.owner_account); | ||
// TODO: The buckets of this MSP should be moved to another one somehow, we can't leave the user without its data because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could emit an event with all buckets that were being stored by the deleted MSP so users can recover them with move bucket requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I added that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job!
runtime/src/configs/mod.rs
Outdated
@@ -498,6 +498,7 @@ impl pallet_storage_providers::Config for Runtime { | |||
type StorageDataUnit = StorageDataUnit; | |||
type StorageDataUnitAndBalanceConvert = StorageDataUnitAndBalanceConverter; | |||
type SpCount = u32; | |||
type BucketCount = u32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set this to be u128
to avoid any chances of overflowing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beast!!
This PR benchmarks the two remaining unbenchmarked extrinsics from the
storage-providers
pallet (top_up_deposit
anddelete_provider
). To do so, it:MainStorageProvider
type that holds the metadata of a MSP:amount_of_value_props
: the total amount of value propositions that this MSP has added to its repertoire. This is used to know how much weight is going to be needed to clean those value propositions from storage.amount_of_buckets
: the current amount of buckets that the MSP is storing. This is also used to know how much weight is going to be needed to delete or move those buckets.BucketCount
) to allow for flexibility when defining the maximum amount of buckets the user of the pallet deems a MSP can store.msp_sign_off
extrinsic. Previously it was not clearing up the storage occupied by the MSP's value propositions, now it correctly clears everything.delete_provider
extrinsic. Likemsp_sign_off
, it was not clearing up the storage used by the value propositions if the provider to delete was a MSP, but this time becausedrain_prefix
was used but the iterator was never iterated so no elements were deleted.MainStorageProviderIdsToBuckets
storage, since with this extrinsic a MSP can be deleted while still having buckets. Like it was mentioned, specific logic to delete or move these buckets should be implemented in another PR.top_up_deposit
anddelete_provider
.Fixes issue #24