1234567891011121314151617#[macro_export]18macro_rules! dispatch_unique_runtime {19 ($collection:ident.$method:ident($($name:ident),*)) => {{20 let collection = <Runtime as pallet_common::Config>::CollectionDispatch::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);21 let dispatch = collection.as_dyn();2223 Ok::<_, DispatchError>(dispatch.$method($($name),*))24 }};25}2627#[macro_export]28macro_rules! impl_common_runtime_apis {29 (30 $(31 #![custom_apis]3233 $($custom_apis:tt)+34 )?35 ) => {36 use sp_std::prelude::*;37 use sp_api::impl_runtime_apis;38 use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};39 use sp_runtime::{40 Permill,41 traits::Block as BlockT,42 transaction_validity::{TransactionSource, TransactionValidity},43 ApplyExtrinsicResult, DispatchError,44 };45 use fp_rpc::TransactionStatus;46 use pallet_transaction_payment::{47 FeeDetails, RuntimeDispatchInfo,48 };49 use pallet_evm::{50 Runner, account::CrossAccountId as _,51 Account as EVMAccount, FeeCalculator,52 };53 use up_data_structs::*;545556 impl_runtime_apis! {57 $($($custom_apis)+)?5859 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {60 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {61 dispatch_unique_runtime!(collection.account_tokens(account))62 }63 fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {64 dispatch_unique_runtime!(collection.collection_tokens())65 }66 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {67 dispatch_unique_runtime!(collection.token_exists(token))68 }6970 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {71 dispatch_unique_runtime!(collection.token_owner(token))72 }7374 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>, DispatchError> {75 dispatch_unique_runtime!(collection.token_owners(token))76 }7778 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {79 let budget = up_data_structs::budget::Value::new(10);8081 Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))82 }83 fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {84 Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))85 }86 fn collection_properties(87 collection: CollectionId,88 keys: Option<Vec<Vec<u8>>>89 ) -> Result<Vec<Property>, DispatchError> {90 let keys = keys.map(91 |keys| Common::bytes_keys_to_property_keys(keys)92 ).transpose()?;9394 Common::filter_collection_properties(collection, keys)95 }9697 fn token_properties(98 collection: CollectionId,99 token_id: TokenId,100 keys: Option<Vec<Vec<u8>>>101 ) -> Result<Vec<Property>, DispatchError> {102 let keys = keys.map(103 |keys| Common::bytes_keys_to_property_keys(keys)104 ).transpose()?;105106 dispatch_unique_runtime!(collection.token_properties(token_id, keys))107 }108109 fn property_permissions(110 collection: CollectionId,111 keys: Option<Vec<Vec<u8>>>112 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {113 let keys = keys.map(114 |keys| Common::bytes_keys_to_property_keys(keys)115 ).transpose()?;116117 Common::filter_property_permissions(collection, keys)118 }119120 fn token_data(121 collection: CollectionId,122 token_id: TokenId,123 keys: Option<Vec<Vec<u8>>>124 ) -> Result<TokenData<CrossAccountId>, DispatchError> {125 let token_data = TokenData {126 properties: Self::token_properties(collection, token_id, keys)?,127 owner: Self::token_owner(collection, token_id)?,128 pieces: Self::total_pieces(collection, token_id)?.unwrap_or(0),129 };130131 Ok(token_data)132 }133134 fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {135 dispatch_unique_runtime!(collection.total_supply())136 }137 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {138 dispatch_unique_runtime!(collection.account_balance(account))139 }140 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {141 dispatch_unique_runtime!(collection.balance(account, token))142 }143 fn allowance(144 collection: CollectionId,145 sender: CrossAccountId,146 spender: CrossAccountId,147 token: TokenId,148 ) -> Result<u128, DispatchError> {149 dispatch_unique_runtime!(collection.allowance(sender, spender, token))150 }151152 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {153 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))154 }155 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {156 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))157 }158 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {159 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))160 }161 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {162 dispatch_unique_runtime!(collection.last_token_id())163 }164 fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {165 Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))166 }167 fn collection_stats() -> Result<CollectionStats, DispatchError> {168 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())169 }170 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {171 Ok(<UniqueSponsorshipPredict<Runtime> as SponsorshipPredict<Runtime>>::predict(172 collection,173 account,174 token175 ))176 }177178 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {179 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))180 }181182 fn total_pieces(collection: CollectionId, token_id: TokenId) -> Result<Option<u128>, DispatchError> {183 dispatch_unique_runtime!(collection.total_pieces(token_id))184 }185 }186187 #[allow(unused_variables)]188 impl rmrk_rpc::RmrkApi<189 Block,190 AccountId,191 RmrkCollectionInfo<AccountId>,192 RmrkInstanceInfo<AccountId>,193 RmrkResourceInfo,194 RmrkPropertyInfo,195 RmrkBaseInfo<AccountId>,196 RmrkPartType,197 RmrkTheme198 > for Runtime {199 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {200 #[cfg(feature = "rmrk")]201 return pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>();202203 #[cfg(not(feature = "rmrk"))]204 return Ok(Default::default());205 }206207 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {208 #[cfg(feature = "rmrk")]209 return pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id);210211 #[cfg(not(feature = "rmrk"))]212 return Ok(Default::default())213 }214215 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {216 #[cfg(feature = "rmrk")]217 return pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id);218219 #[cfg(not(feature = "rmrk"))]220 return Ok(Default::default())221 }222223 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {224 #[cfg(feature = "rmrk")]225 return pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id);226227 #[cfg(not(feature = "rmrk"))]228 return Ok(Default::default())229 }230231 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {232 #[cfg(feature = "rmrk")]233 return pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id);234235 #[cfg(not(feature = "rmrk"))]236 return Ok(Default::default())237 }238239 fn collection_properties(240 collection_id: RmrkCollectionId,241 filter_keys: Option<Vec<RmrkPropertyKey>>242 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {243 #[cfg(feature = "rmrk")]244 return pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys);245246 #[cfg(not(feature = "rmrk"))]247 return Ok(Default::default())248 }249250 fn nft_properties(251 collection_id: RmrkCollectionId,252 nft_id: RmrkNftId,253 filter_keys: Option<Vec<RmrkPropertyKey>>254 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {255 #[cfg(feature = "rmrk")]256 return pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys);257258 #[cfg(not(feature = "rmrk"))]259 return Ok(Default::default())260 }261262 fn nft_resources(collection_id: RmrkCollectionId,nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {263 #[cfg(feature = "rmrk")]264 return pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id);265266 #[cfg(not(feature = "rmrk"))]267 return Ok(Default::default())268 }269270 fn nft_resource_priority(271 collection_id: RmrkCollectionId,272 nft_id: RmrkNftId,273 resource_id: RmrkResourceId274 ) -> Result<Option<u32>, DispatchError> {275 #[cfg(feature = "rmrk")]276 return pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id);277278 #[cfg(not(feature = "rmrk"))]279 return Ok(Default::default())280 }281282 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {283 #[cfg(feature = "rmrk")]284 return pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id);285286 #[cfg(not(feature = "rmrk"))]287 return Ok(Default::default())288 }289290 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {291 #[cfg(feature = "rmrk")]292 return pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id);293294 #[cfg(not(feature = "rmrk"))]295 return Ok(Default::default())296 }297298 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {299 #[cfg(feature = "rmrk")]300 return pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id);301302 #[cfg(not(feature = "rmrk"))]303 Ok(Default::default())304 }305306 fn theme(307 base_id: RmrkBaseId,308 theme_name: RmrkThemeName,309 filter_keys: Option<Vec<RmrkPropertyKey>>310 ) -> Result<Option<RmrkTheme>, DispatchError> {311 #[cfg(feature = "rmrk")]312 return pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys);313314 #[cfg(not(feature = "rmrk"))]315 return Ok(Default::default())316 }317 }318319 impl sp_api::Core<Block> for Runtime {320 fn version() -> RuntimeVersion {321 VERSION322 }323324 fn execute_block(block: Block) {325 Executive::execute_block(block)326 }327328 fn initialize_block(header: &<Block as BlockT>::Header) {329 Executive::initialize_block(header)330 }331 }332333 impl sp_api::Metadata<Block> for Runtime {334 fn metadata() -> OpaqueMetadata {335 OpaqueMetadata::new(Runtime::metadata().into())336 }337 }338339 impl sp_block_builder::BlockBuilder<Block> for Runtime {340 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {341 Executive::apply_extrinsic(extrinsic)342 }343344 fn finalize_block() -> <Block as BlockT>::Header {345 Executive::finalize_block()346 }347348 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {349 data.create_extrinsics()350 }351352 fn check_inherents(353 block: Block,354 data: sp_inherents::InherentData,355 ) -> sp_inherents::CheckInherentsResult {356 data.check_extrinsics(&block)357 }358359 360 361 362 }363364 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {365 fn validate_transaction(366 source: TransactionSource,367 tx: <Block as BlockT>::Extrinsic,368 hash: <Block as BlockT>::Hash,369 ) -> TransactionValidity {370 Executive::validate_transaction(source, tx, hash)371 }372 }373374 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {375 fn offchain_worker(header: &<Block as BlockT>::Header) {376 Executive::offchain_worker(header)377 }378 }379380 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {381 fn chain_id() -> u64 {382 <Runtime as pallet_evm::Config>::ChainId::get()383 }384385 fn account_basic(address: H160) -> EVMAccount {386 let (account, _) = EVM::account_basic(&address);387 account388 }389390 fn gas_price() -> U256 {391 let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();392 price393 }394395 fn account_code_at(address: H160) -> Vec<u8> {396 EVM::account_codes(address)397 }398399 fn author() -> H160 {400 <pallet_evm::Pallet<Runtime>>::find_author()401 }402403 fn storage_at(address: H160, index: U256) -> H256 {404 let mut tmp = [0u8; 32];405 index.to_big_endian(&mut tmp);406 EVM::account_storages(address, H256::from_slice(&tmp[..]))407 }408409 #[allow(clippy::redundant_closure)]410 fn call(411 from: H160,412 to: H160,413 data: Vec<u8>,414 value: U256,415 gas_limit: U256,416 max_fee_per_gas: Option<U256>,417 max_priority_fee_per_gas: Option<U256>,418 nonce: Option<U256>,419 estimate: bool,420 access_list: Option<Vec<(H160, Vec<H256>)>>,421 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {422 let config = if estimate {423 let mut config = <Runtime as pallet_evm::Config>::config().clone();424 config.estimate = true;425 Some(config)426 } else {427 None428 };429430 let is_transactional = false;431 <Runtime as pallet_evm::Config>::Runner::call(432 CrossAccountId::from_eth(from),433 to,434 data,435 value,436 gas_limit.low_u64(),437 max_fee_per_gas,438 max_priority_fee_per_gas,439 nonce,440 access_list.unwrap_or_default(),441 is_transactional,442 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),443 ).map_err(|err| err.error.into())444 }445446 #[allow(clippy::redundant_closure)]447 fn create(448 from: H160,449 data: Vec<u8>,450 value: U256,451 gas_limit: U256,452 max_fee_per_gas: Option<U256>,453 max_priority_fee_per_gas: Option<U256>,454 nonce: Option<U256>,455 estimate: bool,456 access_list: Option<Vec<(H160, Vec<H256>)>>,457 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {458 let config = if estimate {459 let mut config = <Runtime as pallet_evm::Config>::config().clone();460 config.estimate = true;461 Some(config)462 } else {463 None464 };465466 let is_transactional = false;467 <Runtime as pallet_evm::Config>::Runner::create(468 CrossAccountId::from_eth(from),469 data,470 value,471 gas_limit.low_u64(),472 max_fee_per_gas,473 max_priority_fee_per_gas,474 nonce,475 access_list.unwrap_or_default(),476 is_transactional,477 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),478 ).map_err(|err| err.error.into())479 }480481 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {482 Ethereum::current_transaction_statuses()483 }484485 fn current_block() -> Option<pallet_ethereum::Block> {486 Ethereum::current_block()487 }488489 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {490 Ethereum::current_receipts()491 }492493 fn current_all() -> (494 Option<pallet_ethereum::Block>,495 Option<Vec<pallet_ethereum::Receipt>>,496 Option<Vec<TransactionStatus>>497 ) {498 (499 Ethereum::current_block(),500 Ethereum::current_receipts(),501 Ethereum::current_transaction_statuses()502 )503 }504505 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {506 xts.into_iter().filter_map(|xt| match xt.0.function {507 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),508 _ => None509 }).collect()510 }511512 fn elasticity() -> Option<Permill> {513 None514 }515 }516517 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {518 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {519 UncheckedExtrinsic::new_unsigned(520 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),521 )522 }523 }524525 impl sp_session::SessionKeys<Block> for Runtime {526 fn decode_session_keys(527 encoded: Vec<u8>,528 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {529 SessionKeys::decode_into_raw_public_keys(&encoded)530 }531532 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {533 SessionKeys::generate(seed)534 }535 }536537 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {538 fn slot_duration() -> sp_consensus_aura::SlotDuration {539 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())540 }541542 fn authorities() -> Vec<AuraId> {543 Aura::authorities().to_vec()544 }545 }546547 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {548 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {549 ParachainSystem::collect_collation_info(header)550 }551 }552553 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {554 fn account_nonce(account: AccountId) -> Index {555 System::account_nonce(account)556 }557 }558559 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {560 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {561 TransactionPayment::query_info(uxt, len)562 }563 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {564 TransactionPayment::query_fee_details(uxt, len)565 }566 }567568 569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 #[cfg(feature = "runtime-benchmarks")]610 impl frame_benchmarking::Benchmark<Block> for Runtime {611 fn benchmark_metadata(extra: bool) -> (612 Vec<frame_benchmarking::BenchmarkList>,613 Vec<frame_support::traits::StorageInfo>,614 ) {615 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};616 use frame_support::traits::StorageInfoTrait;617618 let mut list = Vec::<BenchmarkList>::new();619620 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);621 list_benchmark!(list, extra, pallet_common, Common);622 list_benchmark!(list, extra, pallet_unique, Unique);623 list_benchmark!(list, extra, pallet_structure, Structure);624 list_benchmark!(list, extra, pallet_inflation, Inflation);625 list_benchmark!(list, extra, pallet_fungible, Fungible);626 list_benchmark!(list, extra, pallet_refungible, Refungible);627 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);628 list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);629630 #[cfg(not(feature = "unique-runtime"))]631 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);632633 #[cfg(not(feature = "unique-runtime"))]634 list_benchmark!(list, extra, pallet_proxy_rmrk_equip, RmrkEquip);635636 637638 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();639640 return (list, storage_info)641 }642643 fn dispatch_benchmark(644 config: frame_benchmarking::BenchmarkConfig645 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {646 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};647648 let allowlist: Vec<TrackedStorageKey> = vec![649 650 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),651652 653 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),654 655 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),656 657 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),658 659 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),660661 662 hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),663664 665 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),666 ];667668 let mut batches = Vec::<BenchmarkBatch>::new();669 let params = (&config, &allowlist);670671 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);672 add_benchmark!(params, batches, pallet_common, Common);673 add_benchmark!(params, batches, pallet_unique, Unique);674 add_benchmark!(params, batches, pallet_structure, Structure);675 add_benchmark!(params, batches, pallet_inflation, Inflation);676 add_benchmark!(params, batches, pallet_fungible, Fungible);677 add_benchmark!(params, batches, pallet_refungible, Refungible);678 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);679 add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);680681 #[cfg(not(feature = "unique-runtime"))]682 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);683684 #[cfg(not(feature = "unique-runtime"))]685 add_benchmark!(params, batches, pallet_proxy_rmrk_equip, RmrkEquip);686687 688689 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }690 Ok(batches)691 }692 }693694 #[cfg(feature = "try-runtime")]695 impl frame_try_runtime::TryRuntime<Block> for Runtime {696 fn on_runtime_upgrade() -> (Weight, Weight) {697 log::info!("try-runtime::on_runtime_upgrade unique-chain.");698 let weight = Executive::try_runtime_upgrade().unwrap();699 (weight, RuntimeBlockWeights::get().max_block)700 }701702 fn execute_block_no_check(block: Block) -> Weight {703 Executive::execute_block_no_check(block)704 }705 }706 }707 }708}