Remove a max supply record on collection's destruction (#11593)

* Remove a max supply record on collection's destruction

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Jegor Sidorenko
2022-06-07 11:08:58 +01:00
committed by GitHub
parent a8c1d430ef
commit 7b712fa4ff
4 changed files with 117 additions and 88 deletions
+8
View File
@@ -684,5 +684,13 @@ fn max_supply_should_work() {
Uniques::mint(Origin::signed(user_id), collection_id, 2, user_id),
Error::<Test>::MaxSupplyReached
);
// validate we remove the CollectionMaxSupply record when we destroy the collection
assert_ok!(Uniques::destroy(
Origin::signed(user_id),
collection_id,
Collection::<Test>::get(collection_id).unwrap().destroy_witness()
));
assert!(!CollectionMaxSupply::<Test>::contains_key(collection_id));
});
}