Skip to content
Commit 679d2dcd authored by Anthony Alaribe's avatar Anthony Alaribe Committed by GitHub
Browse files

Asset Pallet: Support repeated destroys to safely destroy large assets (#12310)



* Support repeated destroys to safely destroy large assets

* require freezing accounts before destroying

* support only deleting asset as final stage when there's no assets left

* pre: introduce the RemoveKeyLimit config parameter

* debug_ensure empty account in the right if block

* update to having separate max values for accounts and approvals

* add tests and use RemoveKeyLimit constant

* add useful comments to the extrinsics, and calculate returned weight

* add benchmarking for start_destroy and finish destroy

* push failing benchmark logic

* add benchmark tests for new functions

* update weights via local benchmarks

* remove extra weight file

* Update frame/assets/src/lib.rs

Co-authored-by: default avatarjoe petrowski <[email protected]>

* Update frame/assets/src/types.rs

Co-authored-by: default avatarjoe petrowski <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: default avatarjoe petrowski <[email protected]>

* effect some changes from codereview

* use NotFrozen error

* remove origin checks, as anyone can complete destruction after owner has begun the process; Add live check for other extrinsics

* fix comments about Origin behaviour

* add AssetStatus docs

* modularize logic to allow calling logic in on_idle and on_initialize hooks

* introduce simple migration for assets details

* reintroduce logging in the migrations

* move deposit_Event out of the mutate block

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarMuharem Ismailov <[email protected]>

* Update frame/assets/src/migration.rs

Co-authored-by: default avatarMuharem Ismailov <[email protected]>

* move AssetNotLive checkout out of the mutate blocks

* rename RemoveKeysLimit to RemoveItemsLimit

* update docs

* fix event name in benchmark

* fix cargo fmt.

* fix lint in benchmarking

* Empty commit to trigger CI

* Update frame/assets/src/lib.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* effect change suggested during code review

* move limit to a single location

* Update frame/assets/src/functions.rs

Co-authored-by: default avatarjoe petrowski <[email protected]>

* rename events

* fix weight typo, using rocksdb instead of T::DbWeight. Pending generating weights

* switch to using dead_account.len()

* rename event in the benchmarks

* empty to retrigger CI

* trigger CI to check cumulus dependency

* trigger CI for dependent cumulus

* Update frame/assets/src/migration.rs

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* move is-frozen to the assetStatus enum (#12547)

* add pre and post migration hooks

* update do_transfer logic to add new assert for more correct error messages

* trigger CI

* switch checking AssetStatus from checking Destroying state to checking live state

* fix error type in tests from Frozen to AssetNotLive

* trigger CI

* change ensure check for fn reducible_balance()

* change the error type to Error:<T,I>::IncorrectStatus to be clearer

* Trigger CI

Co-authored-by: default avatarjoe petrowski <[email protected]>
Co-authored-by: parity-processbot <>
Co-authored-by: default avatarMuharem Ismailov <[email protected]>
Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
parent 8fef631a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment