git.delta.rocks / unique-network / refs/commits / 10b295e0706d

difftreelog

NFTPAR-149. Benchmark EnableContractSponsoring

str-mv2020-12-08parent: #2e29cff.patch.diff
in: master

5 files changed

modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -311,6 +311,11 @@
 
         }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
 
+        enable_contract_sponsoring {
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+
+        }: enable_contract_sponsoring(RawOrigin::Signed(caller.clone()), caller.clone(), true)
+
         set_offchain_schema {
             let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
             let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
modifiedpallets/nft/src/default_weights.rsdiffbeforeafterboth
before · pallets/nft/src/default_weights.rs
1use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};23impl crate::WeightInfo for () {4	fn create_collection() -> Weight {5		(70_000_000 as Weight)6			.saturating_add(DbWeight::get().reads(7 as Weight))7			.saturating_add(DbWeight::get().writes(5 as Weight))8	}9	fn destroy_collection() -> Weight {10		(90_000_000 as Weight)11			.saturating_add(DbWeight::get().reads(2 as Weight))12			.saturating_add(DbWeight::get().writes(5 as Weight))13	}14	fn add_to_white_list() -> Weight {15		(30_000_000 as Weight)16			.saturating_add(DbWeight::get().reads(3 as Weight))17			.saturating_add(DbWeight::get().writes(1 as Weight))18    }19    fn remove_from_white_list() -> Weight {20		(35_000_000 as Weight)21			.saturating_add(DbWeight::get().reads(3 as Weight))22			.saturating_add(DbWeight::get().writes(1 as Weight))23	}24	fn set_public_access_mode() -> Weight {25		(27_000_000 as Weight)26			.saturating_add(DbWeight::get().reads(1 as Weight))27			.saturating_add(DbWeight::get().writes(1 as Weight))28	}29	fn set_mint_permission() -> Weight {30		(27_000_000 as Weight)31			.saturating_add(DbWeight::get().reads(1 as Weight))32			.saturating_add(DbWeight::get().writes(1 as Weight))33	}34	fn change_collection_owner() -> Weight {35		(27_000_000 as Weight)36			.saturating_add(DbWeight::get().reads(1 as Weight))37			.saturating_add(DbWeight::get().writes(1 as Weight))38	}39	fn add_collection_admin() -> Weight {40        (32_000_000 as Weight)41            .saturating_add(DbWeight::get().reads(3 as Weight))42            .saturating_add(DbWeight::get().writes(1 as Weight))43	}44	fn remove_collection_admin() -> Weight {45		(50_000_000 as Weight)46            .saturating_add(DbWeight::get().reads(2 as Weight))47            .saturating_add(DbWeight::get().writes(1 as Weight))48    }49    fn set_collection_sponsor() -> Weight {50		(32_000_000 as Weight)51            .saturating_add(DbWeight::get().reads(2 as Weight))52            .saturating_add(DbWeight::get().writes(1 as Weight))53    }  54    fn confirm_sponsorship() -> Weight {55		(22_000_000 as Weight)56            .saturating_add(DbWeight::get().reads(1 as Weight))57            .saturating_add(DbWeight::get().writes(1 as Weight))58    }  59    fn remove_collection_sponsor() -> Weight {60		(24_000_000 as Weight)61            .saturating_add(DbWeight::get().reads(1 as Weight))62            .saturating_add(DbWeight::get().writes(1 as Weight))63    }  64    fn create_item(s: usize, ) -> Weight {65        (130_000_000 as Weight)66            .saturating_add((2135 as Weight).saturating_mul(s as Weight).saturating_mul(500 as Weight)) // 500 is temporary multiplier, fee for storage67            .saturating_add(DbWeight::get().reads(10 as Weight))68            .saturating_add(DbWeight::get().writes(8 as Weight))69    }  70    fn burn_item() -> Weight {71		(170_000_000 as Weight)72            .saturating_add(DbWeight::get().reads(9 as Weight))73            .saturating_add(DbWeight::get().writes(7 as Weight))74    }  75    fn transfer() -> Weight {76        (125_000_000 as Weight)77            .saturating_add(DbWeight::get().reads(7 as Weight))78            .saturating_add(DbWeight::get().writes(7 as Weight))79    }  80    fn approve() -> Weight {81        (45_000_000 as Weight)82            .saturating_add(DbWeight::get().reads(3 as Weight))83            .saturating_add(DbWeight::get().writes(1 as Weight))84    }85    fn transfer_from() -> Weight {86        (150_000_000 as Weight)87            .saturating_add(DbWeight::get().reads(9 as Weight))88            .saturating_add(DbWeight::get().writes(8 as Weight))89    }90    fn set_offchain_schema() -> Weight {91        (33_000_000 as Weight)92            .saturating_add(DbWeight::get().reads(2 as Weight))93            .saturating_add(DbWeight::get().writes(1 as Weight))94    }95    fn set_const_on_chain_schema() -> Weight {96        (11_100_000 as Weight)97            .saturating_add(DbWeight::get().reads(2 as Weight))98            .saturating_add(DbWeight::get().writes(1 as Weight))99    }100    fn set_variable_on_chain_schema() -> Weight {101        (11_100_000 as Weight)102            .saturating_add(DbWeight::get().reads(2 as Weight))103            .saturating_add(DbWeight::get().writes(1 as Weight))104    }105    fn set_variable_meta_data() -> Weight {106        (17_500_000 as Weight)107            .saturating_add(DbWeight::get().reads(2 as Weight))108            .saturating_add(DbWeight::get().writes(1 as Weight))109    }110    // fn set_chain_limits() -> Weight {111    //     (0 as Weight)112    //         .saturating_add(DbWeight::get().reads(1 as Weight))113    //         .saturating_add(DbWeight::get().writes(1 as Weight))114    // }115    // fn enable_contract_sponsoring() -> Weight {116    //     (0 as Weight)117    //         .saturating_add(DbWeight::get().reads(1 as Weight))118    //         .saturating_add(DbWeight::get().writes(1 as Weight))119    // }120    // fn set_contract_sponsoring_rate_limit() -> Weight {121    //     (0 as Weight)122    //         .saturating_add(DbWeight::get().reads(1 as Weight))123    //         .saturating_add(DbWeight::get().writes(1 as Weight))124    // }125}
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -200,7 +200,7 @@
     fn set_const_on_chain_schema() -> Weight;
     fn set_variable_on_chain_schema() -> Weight;
     fn set_variable_meta_data() -> Weight;
-    // fn enable_contract_sponsoring() -> Weight;
+    fn enable_contract_sponsoring() -> Weight;
 }
 
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
@@ -1307,7 +1307,7 @@
         /// * contract address
         /// * enable flag
         /// 
-        #[weight = 0]
+        #[weight = T::WeightInfo::enable_contract_sponsoring()]
         pub fn enable_contract_sponsoring(
             origin,
             contract_address: T::AccountId,
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -73,6 +73,7 @@
     'frame-system-benchmarking',
     'frame-system/runtime-benchmarks',
     'pallet-balances/runtime-benchmarks',
+    'pallet-collective/runtime-benchmarks',
     'pallet-timestamp/runtime-benchmarks',
     'pallet-nft/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
modifiedruntime/src/nft_weights.rsdiffbeforeafterboth
--- a/runtime/src/nft_weights.rs
+++ b/runtime/src/nft_weights.rs
@@ -113,11 +113,11 @@
     //         .saturating_add(DbWeight::get().reads(1 as Weight))
     //         .saturating_add(DbWeight::get().writes(1 as Weight))
     // }
-    // fn enable_contract_sponsoring() -> Weight {
-    //     (0 as Weight)
-    //         .saturating_add(DbWeight::get().reads(1 as Weight))
-    //         .saturating_add(DbWeight::get().writes(1 as Weight))
-    // }
+    fn enable_contract_sponsoring() -> Weight {
+        (13_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(1 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
     // fn set_contract_sponsoring_rate_limit() -> Weight {
     //     (0 as Weight)
     //         .saturating_add(DbWeight::get().reads(1 as Weight))