git.delta.rocks / unique-network / refs/commits / 7be352da9c23

difftreelog

Merge pull request #27 from usetech-llc/feature/nftpar-149

usetech-llc2020-12-08parents: #db9f499 #10b295e.patch.diff
in: master
NFTPAR-149. Benchmark EnableContractSponsoring

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
--- a/pallets/nft/src/default_weights.rs
+++ b/pallets/nft/src/default_weights.rs
@@ -112,11 +112,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))
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
200 fn set_const_on_chain_schema() -> Weight;200 fn set_const_on_chain_schema() -> Weight;
201 fn set_variable_on_chain_schema() -> Weight;201 fn set_variable_on_chain_schema() -> Weight;
202 fn set_variable_meta_data() -> Weight;202 fn set_variable_meta_data() -> Weight;
203 // fn enable_contract_sponsoring() -> Weight;203 fn enable_contract_sponsoring() -> Weight;
204}204}
205205
206#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]206#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
1307 /// * contract address1307 /// * contract address
1308 /// * enable flag1308 /// * enable flag
1309 /// 1309 ///
1310 #[weight = 0]1310 #[weight = T::WeightInfo::enable_contract_sponsoring()]
1311 pub fn enable_contract_sponsoring(1311 pub fn enable_contract_sponsoring(
1312 origin,1312 origin,
1313 contract_address: T::AccountId,1313 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))