-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Assets Pallet: reintroduce fungibles::Destroy trait #12690
Conversation
…ly-destroy-large-assets
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
…has begun the process; Add live check for other extrinsics
Co-authored-by: Muharem Ismailov <[email protected]>
Co-authored-by: Muharem Ismailov <[email protected]>
/// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
/// | ||
/// Each call Emits the `Event::DestroyedAccounts` event. | ||
fn destroy_accounts(id: Self::AssetId, max_items: u32) -> Result<u32, DispatchError>; |
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.
left wondering what the u32 returned is. Is it the amount left or destroyed? Be good to be explicit about what it's returning.
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.
That's true. I'll add it to the comment.
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.
Looks good aside from already mentioned typo.
fn get_destroy_witness(id: &Self::AssetId) -> Option<Self::DestroyWitness>; | ||
|
||
/// Destroy an existing fungible asset. | ||
/// Start the destruction an existing fungible asset. | ||
/// * `id`: The `AssetId` to be destroyed. | ||
/// * `witness`: Any witness data that needs to be provided to complete the operation |
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.
no witness arg anymore
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.
Thanks for spotting this. I've taken it out.
@@ -281,9 +275,41 @@ pub trait Destroy<AccountId>: Inspect<AccountId> { | |||
/// | |||
/// If successful, this function will return the actual witness data from the destroyed asset. |
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.
this part of the doc also needs to be updated
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.
Yeah. Thanks again. Also taken it out now.
/// asset is in a `Destroying` state | ||
/// | ||
/// Due to weight restrictions, this function may need to be called multiple | ||
/// times to fully destroy all accounts. It will destroy `RemoveItemsLimit` accounts at a |
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.
there is no RemoveItemsLimit
in this context
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.
Yeah, I've updated the docs. The max_items value does the job in this case. Thanks for spotting it.
/// time. | ||
/// | ||
/// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
/// |
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.
doc for max_items is missing
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.
Yeah, i've added that now. Thanks
/// | ||
/// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
/// | ||
/// Each call Emits the `Event::DestroyedAccounts` event. |
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 don't know about the event in this context
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.
True. I wasn't sure how to word it. But i've removed the reference.
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.
please update the docs, the docs from the implementation is not relevant for the trait
witness: Self::DestroyWitness, | ||
maybe_check_owner: Option<AccountId>, | ||
) -> Result<Self::DestroyWitness, DispatchError>; | ||
/// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. |
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.
minor note, the formatting is different, with what you have above, I think the rust docs can be used as a reference https://doc.rust-lang.org/rust-by-example/meta/doc.html
I also might be important because polkadot js displays the docs in UI, but not sure what it exactly expects
bot rebase |
Error: Command 'Command { std: "git" "merge" "origin/master" "--no-ff" "--no-edit", kill_on_drop: false }' failed with status Some(1); output: no output |
bot rebase |
Branch is already up-to-date |
This PR is an offshoot of #12310 , to maintain a way for users of the asset pallet still remove fungible assets.
It's a separate PR to allow it be reviewed easily without bloating #12310 further. But they should be both merged in together.