Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
gilescope committed Jun 21, 2021
1 parent 0afaf2c commit ddd464c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions frame/example-offchain-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use frame_support::traits::Get;
use sp_core::crypto::KeyTypeId;
use sp_runtime::{
RuntimeDebug,
offchain::{http, Duration, storage::{MutateStorageError, StorageRetrivalError, StorageValueRef}},
offchain::{http, Duration, storage::{MutateStorageError, StorageRetrievalError, StorageValueRef}},
traits::Zero,
transaction_validity::{InvalidTransaction, ValidTransaction, TransactionValidity},
};
Expand Down Expand Up @@ -366,7 +366,7 @@ impl<T: Config> Pallet<T> {
// low-level method of local storage API, which means that only one worker
// will be able to "acquire a lock" and send a transaction if multiple workers
// happen to be executed concurrently.
let res = val.mutate(|last_send: Result<Option<T::BlockNumber>, StorageRetrivalError>| {
let res = val.mutate(|last_send: Result<Option<T::BlockNumber>, StorageRetrievalError>| {
match last_send {
// If we already have a value in storage and the block number is recent enough
// we avoid sending another transaction at this time.
Expand Down
4 changes: 2 additions & 2 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ use sp_core::offchain::OpaqueNetworkState;
use sp_std::prelude::*;
use sp_std::convert::TryInto;
use sp_runtime::{
offchain::storage::{MutateStorageError, StorageRetrivalError, StorageValueRef},
offchain::storage::{MutateStorageError, StorageRetrievalError, StorageValueRef},
traits::{AtLeast32BitUnsigned, Convert, Saturating, TrailingZeroInput},
Perbill, Permill, PerThing, RuntimeDebug, SaturatedConversion,
};
Expand Down Expand Up @@ -720,7 +720,7 @@ impl<T: Config> Pallet<T> {
};
let storage = StorageValueRef::persistent(&key);
let res = storage.mutate(
|status: Result<Option<HeartbeatStatus<T::BlockNumber>>, StorageRetrivalError>| {
|status: Result<Option<HeartbeatStatus<T::BlockNumber>>, StorageRetrievalError>| {
// Check if there is already a lock for that particular block.
// This means that the heartbeat has already been sent, and we are just waiting
// for it to be included. However if it doesn't get included for INCLUDE_THRESHOLD
Expand Down
4 changes: 2 additions & 2 deletions frame/session/src/historical/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! the off-chain indexing API.
use sp_runtime::{
offchain::storage::{MutateStorageError, StorageRetrivalError, StorageValueRef},
offchain::storage::{MutateStorageError, StorageRetrievalError, StorageValueRef},
KeyTypeId
};
use sp_session::MembershipProof;
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn prove_session_membership<T: Config, D: AsRef<[u8]>>(
pub fn prune_older_than<T: Config>(first_to_keep: SessionIndex) {
let derived_key = shared::LAST_PRUNE.to_vec();
let entry = StorageValueRef::persistent(derived_key.as_ref());
match entry.mutate(|current: Result<Option<SessionIndex>, StorageRetrivalError>| -> Result<_, ()> {
match entry.mutate(|current: Result<Option<SessionIndex>, StorageRetrievalError>| -> Result<_, ()> {
match current {
Ok(Some(current)) if current < first_to_keep => Ok(first_to_keep),
// do not move the cursor, if the new one would be behind ours
Expand Down
10 changes: 5 additions & 5 deletions primitives/runtime/src/offchain/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ impl<'a> StorageValueRef<'a> {
///
/// Returns the value if stored.
/// Returns an error if the value could not be decoded.
pub fn get<T: codec::Decode>(&self) -> Result<Option<T>, StorageRetrivalError> {
pub fn get<T: codec::Decode>(&self) -> Result<Option<T>, StorageRetrievalError> {
sp_io::offchain::local_storage_get(self.kind, self.key)
.map(|val| T::decode(&mut &*val)
.map_err(|_| StorageRetrivalError::Undecodable))
.map_err(|_| StorageRetrievalError::Undecodable))
.transpose()
}

Expand All @@ -100,13 +100,13 @@ impl<'a> StorageValueRef<'a> {
/// 3. `Err(MutateStorageError::ValueFunctionFailed(_))` in case `mutate_val` returns an error.
pub fn mutate<T, E, F>(&self, mutate_val: F) -> Result<T, MutateStorageError<T,E>> where
T: codec::Codec,
F: FnOnce(Result<Option<T>, StorageRetrivalError>) -> Result<T, E>
F: FnOnce(Result<Option<T>, StorageRetrievalError>) -> Result<T, E>
{
let value = sp_io::offchain::local_storage_get(self.kind, self.key);
let decoded = value.as_deref()
.map(|mut bytes| {
T::decode(&mut bytes)
.map_err(|_| StorageRetrivalError::Undecodable)
.map_err(|_| StorageRetrievalError::Undecodable)
}).transpose();

let val = mutate_val(decoded).map_err(|err| MutateStorageError::ValueFunctionFailed(err))?;
Expand Down Expand Up @@ -150,7 +150,7 @@ mod tests {
val.set(&15_u32);

assert_eq!(val.get::<u32>(), Ok(Some(15_u32)));
assert_eq!(val.get::<Vec<u8>>(), Err(StorageRetrivalError::Undecodable));
assert_eq!(val.get::<Vec<u8>>(), Err(StorageRetrievalError::Undecodable));
assert_eq!(
state.read().persistent_storage.get(b"testval"),
Some(vec![15_u8, 0, 0, 0])
Expand Down
6 changes: 3 additions & 3 deletions primitives/runtime/src/offchain/storage_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
//! }
//! ```
use crate::offchain::storage::{StorageRetrivalError, MutateStorageError, StorageValueRef};
use crate::offchain::storage::{StorageRetrievalError, MutateStorageError, StorageValueRef};
use crate::traits::AtLeast32BitUnsigned;
use codec::{Codec, Decode, Encode};
use sp_core::offchain::{Duration, Timestamp};
Expand Down Expand Up @@ -280,7 +280,7 @@ impl<'a, L: Lockable> StorageLock<'a, L> {
/// Extend active lock's deadline
fn extend_active_lock(&mut self) -> Result<<L as Lockable>::Deadline, ()> {
let res = self.value_ref.mutate(
|s: Result<Option<L::Deadline>, StorageRetrivalError>| -> Result<<L as Lockable>::Deadline, ()> {
|s: Result<Option<L::Deadline>, StorageRetrievalError>| -> Result<<L as Lockable>::Deadline, ()> {
match s {
// lock is present and is still active, extend the lock.
Ok(Some(deadline)) if !<L as Lockable>::has_expired(&deadline) =>
Expand All @@ -302,7 +302,7 @@ impl<'a, L: Lockable> StorageLock<'a, L> {
new_deadline: L::Deadline,
) -> Result<(), <L as Lockable>::Deadline> {
let res = self.value_ref.mutate(
|s: Result<Option<L::Deadline>, StorageRetrivalError>|
|s: Result<Option<L::Deadline>, StorageRetrievalError>|
-> Result<<L as Lockable>::Deadline, <L as Lockable>::Deadline> {
match s {
// no lock set, we can safely acquire it
Expand Down

0 comments on commit ddd464c

Please sign in to comment.