-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Asset Pallet: Support repeated destroys to safely destroy large assets #12310
Changes from 19 commits
6a9d9d1
7db1fd5
cbe14b2
001eaef
1beae07
c9ce171
3067e38
7c4f610
aca497f
634345a
93d886d
2d3b650
5a612d1
b961255
91e3c18
60f954a
ce00b5b
5492b6d
bc20a6c
6ceb592
2edac52
aa2aecf
10fdd90
139d2e9
597f532
a09e762
70930ac
dc4a243
05d778d
62d4f13
e9e108b
5df4a62
544ac52
9206acf
29c7745
2986f29
6ac84a1
1f2930f
791aa7f
450a698
3daef79
ea34cf5
84cbb47
082a10c
e84d5ae
78cde15
c6470fb
85e50b9
c97e850
df27e0b
ca9fa2e
9609f13
26d27cc
72ec8f8
ee30cf8
87a7877
773212e
a4be57f
111da0e
9c06bb8
4eef069
486814f
c185cb0
91095af
9ef3c2b
6165576
7811b62
cd3e28d
aee596e
30814df
9b653a5
57fe747
7ba1ef5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,22 +179,6 @@ impl<T: Config<I>, I: 'static> fungibles::Create<T::AccountId> for Pallet<T, I> | |
| } | ||
| } | ||
|
|
||
| impl<T: Config<I>, I: 'static> fungibles::Destroy<T::AccountId> for Pallet<T, I> { | ||
| type DestroyWitness = DestroyWitness; | ||
|
|
||
| fn get_destroy_witness(asset: &T::AssetId) -> Option<Self::DestroyWitness> { | ||
| Asset::<T, I>::get(asset).map(|asset_details| asset_details.destroy_witness()) | ||
| } | ||
|
|
||
| fn destroy( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removal of that method would be a breaking change for the existing integrations, for those who use our pallet and for other similar assets pallets like orml. What could we do about this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's true. Though my understanding from @joepetrowski is that this particular functionality isn't really used in the wild yet.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we could keep that destroy method for compatibility, but change the implementation and allow to call it if there are less than T::RemoveItemsLimit items to remove? In that case, this method would consist of the items amount check and will simply call
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that makes sense. Though it's always to be a bit annoying maintaining 2 ways of doing the same thing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I weighed it in with @joepetrowski and since it seems no one is using the destroy extrinsic yet, it should be fine to break it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @joepetrowski @tonyalaribe What if we simply put |
||
| id: T::AssetId, | ||
| witness: Self::DestroyWitness, | ||
| maybe_check_owner: Option<T::AccountId>, | ||
| ) -> Result<Self::DestroyWitness, DispatchError> { | ||
| Self::do_destroy(id, witness, maybe_check_owner) | ||
| } | ||
| } | ||
|
|
||
| impl<T: Config<I>, I: 'static> fungibles::metadata::Inspect<<T as SystemConfig>::AccountId> | ||
| for Pallet<T, I> | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.