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
--- 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
--- 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
before · runtime/Cargo.toml
1[package]2authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']3edition = '2018'4homepage = 'https://substrate.io'5license = 'Unlicense'6name = 'nft-runtime'7repository = 'https://github.com/usetech-llc/nft_parachain/'8version = '2.0.0'910[package.metadata.docs.rs]11targets = ['x86_64-unknown-linux-gnu']1213[build-dependencies]14wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' }1516# alias "parity-scale-code" to "codec"17[dependencies.codec]18default-features = false19features = ['derive']20package = 'parity-scale-codec'21version = '1.3.4'2223[dependencies]24hex-literal = { optional = true, version = '0.3.1' }25serde = { features = ['derive'], optional = true, version = '1.0.101' }2627# local dependencies28pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' }2930# Substrate dependencies31frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }32frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }33frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }34frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }35frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }36frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }37pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }38pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }39pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }40pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }41pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }42pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }43pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }44pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }45pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }46pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }47pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }48sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }49sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }50sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }51sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }52sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }53sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }54sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }55sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }56sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }57sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }58sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }5960pallet-membership = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }61pallet-collective = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }62pallet-democracy = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }63pallet-elections-phragmen = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }64pallet-treasury = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }65pallet-scheduler = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }6667[features]68default = ['std']69runtime-benchmarks = [70    'hex-literal',71    'frame-benchmarking',72    'frame-support/runtime-benchmarks',73    'frame-system-benchmarking',74    'frame-system/runtime-benchmarks',75    'pallet-balances/runtime-benchmarks',76    'pallet-timestamp/runtime-benchmarks',77    'pallet-nft/runtime-benchmarks',78    'sp-runtime/runtime-benchmarks',79]80std = [81    'codec/std',82    'serde',83    'frame-executive/std',84    'frame-support/std',85    'frame-system/std',86    'frame-system-rpc-runtime-api/std',87    'pallet-aura/std',88    'pallet-balances/std',89    'pallet-contracts/std',90    'pallet-contracts-primitives/std',91    'pallet-contracts-rpc-runtime-api/std',92    'pallet-grandpa/std',93    'pallet-randomness-collective-flip/std',94    'pallet-sudo/std',95    'pallet-timestamp/std',96    'pallet-transaction-payment/std',97    'pallet-transaction-payment-rpc-runtime-api/std',98    'pallet-nft/std',99    'sp-api/std',100    'sp-block-builder/std',101    'sp-consensus-aura/std',102    'sp-core/std',103    'sp-inherents/std',104    'sp-offchain/std',105    'sp-runtime/std',106    'sp-session/std',107    'sp-std/std',108    'sp-transaction-pool/std',109    'sp-version/std',110111    'pallet-collective/std',112    'pallet-democracy/std',113    'pallet-elections-phragmen/std', 114    'pallet-membership/std',115    'pallet-treasury/std',116    'pallet-scheduler/std',117]
after · runtime/Cargo.toml
1[package]2authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']3edition = '2018'4homepage = 'https://substrate.io'5license = 'Unlicense'6name = 'nft-runtime'7repository = 'https://github.com/usetech-llc/nft_parachain/'8version = '2.0.0'910[package.metadata.docs.rs]11targets = ['x86_64-unknown-linux-gnu']1213[build-dependencies]14wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' }1516# alias "parity-scale-code" to "codec"17[dependencies.codec]18default-features = false19features = ['derive']20package = 'parity-scale-codec'21version = '1.3.4'2223[dependencies]24hex-literal = { optional = true, version = '0.3.1' }25serde = { features = ['derive'], optional = true, version = '1.0.101' }2627# local dependencies28pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' }2930# Substrate dependencies31frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }32frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }33frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }34frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }35frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }36frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }37pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }38pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }39pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }40pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }41pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }42pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }43pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }44pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }45pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }46pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }47pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }48sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }49sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }50sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }51sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }52sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }53sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }54sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }55sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }56sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }57sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }58sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }5960pallet-membership = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }61pallet-collective = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }62pallet-democracy = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }63pallet-elections-phragmen = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }64pallet-treasury = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }65pallet-scheduler = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }6667[features]68default = ['std']69runtime-benchmarks = [70    'hex-literal',71    'frame-benchmarking',72    'frame-support/runtime-benchmarks',73    'frame-system-benchmarking',74    'frame-system/runtime-benchmarks',75    'pallet-balances/runtime-benchmarks',76    'pallet-collective/runtime-benchmarks',77    'pallet-timestamp/runtime-benchmarks',78    'pallet-nft/runtime-benchmarks',79    'sp-runtime/runtime-benchmarks',80]81std = [82    'codec/std',83    'serde',84    'frame-executive/std',85    'frame-support/std',86    'frame-system/std',87    'frame-system-rpc-runtime-api/std',88    'pallet-aura/std',89    'pallet-balances/std',90    'pallet-contracts/std',91    'pallet-contracts-primitives/std',92    'pallet-contracts-rpc-runtime-api/std',93    'pallet-grandpa/std',94    'pallet-randomness-collective-flip/std',95    'pallet-sudo/std',96    'pallet-timestamp/std',97    'pallet-transaction-payment/std',98    'pallet-transaction-payment-rpc-runtime-api/std',99    'pallet-nft/std',100    'sp-api/std',101    'sp-block-builder/std',102    'sp-consensus-aura/std',103    'sp-core/std',104    'sp-inherents/std',105    'sp-offchain/std',106    'sp-runtime/std',107    'sp-session/std',108    'sp-std/std',109    'sp-transaction-pool/std',110    'sp-version/std',111112    'pallet-collective/std',113    'pallet-democracy/std',114    'pallet-elections-phragmen/std', 115    'pallet-membership/std',116    'pallet-treasury/std',117    'pallet-scheduler/std',118]
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))