From 28ed45667882b6522d22d2ac1db4c6f9f18c946a Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Mon, 23 May 2022 17:40:50 +0000 Subject: [PATCH] fix: nft weights --- --- a/pallets/nonfungible/src/weights.rs +++ b/pallets/nonfungible/src/weights.rs @@ -36,15 +36,13 @@ fn create_multiple_items(b: u32, ) -> Weight; fn create_multiple_items_ex(b: u32, ) -> Weight; fn burn_item() -> Weight; - fn set_collection_properties(amount: u32) -> Weight; - fn delete_collection_properties(amount: u32) -> Weight; - fn set_token_properties(amount: u32) -> Weight; - fn delete_token_properties(amount: u32) -> Weight; - fn set_property_permissions(amount: u32) -> Weight; fn transfer() -> Weight; fn approve() -> Weight; fn transfer_from() -> Weight; fn burn_from() -> Weight; + fn set_property_permissions(b: u32) -> Weight; + fn set_token_properties(b: u32) -> Weight; + fn delete_token_properties(b: u32) -> Weight; } /// Weights for pallet_nonfungible using the Substrate node and recommended hardware. @@ -93,31 +91,6 @@ (24_554_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - - fn set_collection_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn delete_collection_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn set_token_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn delete_token_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn set_property_permissions(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) } // Storage: Nonfungible TokenData (r:1 w:1) @@ -151,6 +124,9 @@ // Storage: Nonfungible AccountBalance (r:1 w:1) // Storage: Nonfungible Owned (r:0 w:1) fn burn_from() -> Weight { + (27_580_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } // Storage: Common CollectionPropertyPermissions (r:1 w:1) fn set_property_permissions(b: u32, ) -> Weight { @@ -227,33 +203,8 @@ (24_554_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } - - fn set_collection_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn delete_collection_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn set_token_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - - fn delete_token_properties(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) } - fn set_property_permissions(amount: u32) -> Weight { - // TODO calculate appropriate weight - (50_000_000 as Weight).saturating_mul(amount as Weight) - } - // Storage: Nonfungible TokenData (r:1 w:1) // Storage: Nonfungible AccountBalance (r:2 w:2) // Storage: Nonfungible Allowance (r:1 w:0) @@ -285,6 +236,9 @@ // Storage: Nonfungible AccountBalance (r:1 w:1) // Storage: Nonfungible Owned (r:0 w:1) fn burn_from() -> Weight { + (27_580_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } // Storage: Common CollectionPropertyPermissions (r:1 w:1) fn set_property_permissions(b: u32, ) -> Weight { -- gitstuff