Skip to content
Snippets Groups Projects
Unverified Commit 874fb2a7 authored by bgallois's avatar bgallois
Browse files

formatting

parent b9bda4f6
No related branches found
No related tags found
1 merge request!312Upgrade polkadot v1.17.0
Pipeline #39704 passed
......@@ -14,9 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
// This file is not formatted automatically due to the nested macro definition.
// It can be formatted by commenting out the last line, the first five lines,
// and then running `rustfmt` on `runtime/common/src/apis.rs`.
#[macro_export]
macro_rules! runtime_apis {
{$($custom:tt)*} => {
($($custom:tt)*) => {
impl_runtime_apis! {
$($custom)*
......@@ -73,10 +76,7 @@ macro_rules! runtime_apis {
) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?;
Babe::submit_unsigned_equivocation_report(
equivocation_proof,
key_owner_proof,
)
Babe::submit_unsigned_equivocation_report(equivocation_proof, key_owner_proof)
}
}
......@@ -98,9 +98,11 @@ macro_rules! runtime_apis {
fn metadata() -> OpaqueMetadata {
OpaqueMetadata::new(Runtime::metadata().into())
}
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
Runtime::metadata_at_version(version)
}
fn metadata_versions() -> Vec<u32> {
Runtime::metadata_versions()
}
......@@ -115,9 +117,7 @@ macro_rules! runtime_apis {
Executive::finalize_block()
}
fn inherent_extrinsics(
data: sp_inherents::InherentData,
) -> Vec<<Block as BlockT>::Extrinsic> {
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
data.create_extrinsics()
}
......@@ -136,8 +136,7 @@ macro_rules! runtime_apis {
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
// Filtered calls should not enter the tx pool.
if !<Runtime as frame_system::Config>::BaseCallFilter::contains(&tx.function)
{
if !<Runtime as frame_system::Config>::BaseCallFilter::contains(&tx.function) {
return sp_runtime::transaction_validity::InvalidTransaction::Call.into();
}
Executive::validate_transaction(source, tx, block_hash)
......@@ -151,9 +150,7 @@ macro_rules! runtime_apis {
}
impl sp_session::SessionKeys<Block> for Runtime {
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
fn decode_session_keys(encoded: Vec<u8>) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
}
......@@ -198,8 +195,7 @@ macro_rules! runtime_apis {
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
for Runtime {
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
......@@ -213,9 +209,11 @@ macro_rules! runtime_apis {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
......@@ -247,44 +245,44 @@ macro_rules! runtime_apis {
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Weight {
Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
Executive::try_execute_block(block, state_root_check, signature_check, select)
.expect("execute-block failed")
}
}
#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (
fn benchmark_metadata(
extra: bool,
) -> (
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
use frame_benchmarking::{list_benchmark, BenchmarkList, Benchmarking};
use frame_support::traits::StorageInfoTrait;
use pallet_session_benchmarking::Pallet as SessionBench;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use frame_benchmarking::baseline::Pallet as Baseline;
use frame_system_benchmarking::{
extensions::Pallet as SystemExtensionsBench, Pallet as SystemBench,
};
use pallet_session_benchmarking::Pallet as SessionBench;
let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);
let storage_info = AllPalletsWithSystem::storage_info();
return (list, storage_info)
return (list, storage_info);
}
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<
Vec<frame_benchmarking::BenchmarkBatch>,
scale_info::prelude::string::String,
> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch};
use frame_support::traits::TrackedStorageKey;
use frame_support::traits::WhitelistedStorageKeys;
config: frame_benchmarking::BenchmarkConfig,
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, scale_info::prelude::string::String> {
use frame_benchmarking::{baseline::Pallet as Baseline, BenchmarkBatch, Benchmarking};
use frame_support::traits::{TrackedStorageKey, WhitelistedStorageKeys};
use frame_system_benchmarking::{
extensions::Pallet as SystemExtensionsBench, Pallet as SystemBench,
};
use pallet_session_benchmarking::Pallet as SessionBench;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use frame_benchmarking::baseline::Pallet as Baseline;
impl pallet_session_benchmarking::Config for Runtime {}
impl frame_system_benchmarking::Config for Runtime {}
......@@ -310,10 +308,10 @@ let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storag
let params = (&config, &whitelist);
add_benchmarks!(params, batches);
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
}
if batches.is_empty() {
return Err("Benchmark not found for this pallet.".into());
}
Ok(batches)
}
};
}
}};}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment