mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
Match substrate's fmt (#1148)
* Alter gitlab. * Use substrate's rustfmt.toml * cargo +nightly fmt --all * Fix spellcheck. * cargo +nightly fmt --all * format. * Fix spellcheck and fmt * fmt? * Fix spellcheck Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::chain::Chain;
|
||||
use crate::client::Client;
|
||||
use crate::{chain::Chain, client::Client};
|
||||
|
||||
use async_std::sync::{Arc, RwLock};
|
||||
use async_trait::async_trait;
|
||||
@@ -83,7 +82,8 @@ where
|
||||
.await
|
||||
.map(|maybe_storage_value| {
|
||||
maybe_storage_value.or(self.maybe_default_value).map(|storage_value| {
|
||||
storage_value.into_inner().unique_saturated_into() as f64 / T::DIV.unique_saturated_into() as f64
|
||||
storage_value.into_inner().unique_saturated_into() as f64 /
|
||||
T::DIV.unique_saturated_into() as f64
|
||||
})
|
||||
})
|
||||
.map_err(drop);
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::chain::Chain;
|
||||
use crate::client::Client;
|
||||
use crate::error::Error;
|
||||
use crate::{chain::Chain, client::Client, error::Error};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use relay_utils::metrics::{metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, U64};
|
||||
use relay_utils::metrics::{
|
||||
metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, U64,
|
||||
};
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_storage::well_known_keys::CODE;
|
||||
@@ -40,10 +40,7 @@ pub struct StorageProofOverheadMetric<C: Chain> {
|
||||
|
||||
impl<C: Chain> Clone for StorageProofOverheadMetric<C> {
|
||||
fn clone(&self) -> Self {
|
||||
StorageProofOverheadMetric {
|
||||
client: self.client.clone(),
|
||||
metric: self.metric.clone(),
|
||||
}
|
||||
StorageProofOverheadMetric { client: self.client.clone(), metric: self.metric.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,15 +70,15 @@ impl<C: Chain> StorageProofOverheadMetric<C> {
|
||||
.await?;
|
||||
let storage_proof_size: usize = storage_proof.clone().iter_nodes().map(|n| n.len()).sum();
|
||||
|
||||
let storage_value_reader =
|
||||
bp_runtime::StorageProofChecker::<C::Hasher>::new(*best_header.state_root(), storage_proof)
|
||||
.map_err(Error::StorageProofError)?;
|
||||
let maybe_encoded_storage_value = storage_value_reader
|
||||
.read_value(CODE)
|
||||
.map_err(Error::StorageProofError)?;
|
||||
let encoded_storage_value_size = maybe_encoded_storage_value
|
||||
.ok_or(Error::MissingMandatoryCodeEntry)?
|
||||
.len();
|
||||
let storage_value_reader = bp_runtime::StorageProofChecker::<C::Hasher>::new(
|
||||
*best_header.state_root(),
|
||||
storage_proof,
|
||||
)
|
||||
.map_err(Error::StorageProofError)?;
|
||||
let maybe_encoded_storage_value =
|
||||
storage_value_reader.read_value(CODE).map_err(Error::StorageProofError)?;
|
||||
let encoded_storage_value_size =
|
||||
maybe_encoded_storage_value.ok_or(Error::MissingMandatoryCodeEntry)?.len();
|
||||
|
||||
Ok(storage_proof_size - encoded_storage_value_size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user