Skip to content

Commit 295b507

Browse files
authored
chore: format code and fix typos (#138)
1 parent 3752aab commit 295b507

File tree

14 files changed

+22
-22
lines changed

14 files changed

+22
-22
lines changed

substrate-archive-backend/src/frontend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ where
6565
}
6666

6767
impl SpawnNamed for TaskExecutor {
68-
fn spawn(&self, _: &'static str, fut: std::pin::Pin<Box<dyn Future<Output = ()> + Send + 'static>>) {
68+
fn spawn_blocking(&self, _: &'static str, fut: std::pin::Pin<Box<dyn Future<Output = ()> + Send + 'static>>) {
6969
let _ = self.pool.spawn(fut);
7070
}
7171

72-
fn spawn_blocking(&self, _: &'static str, fut: std::pin::Pin<Box<dyn Future<Output = ()> + Send + 'static>>) {
72+
fn spawn(&self, _: &'static str, fut: std::pin::Pin<Box<dyn Future<Output = ()> + Send + 'static>>) {
7373
let _ = self.pool.spawn(fut);
7474
}
7575
}

substrate-archive-backend/src/frontend/client.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ where
142142
type StateBackend = TrieState<Block, D>;
143143

144144
fn call_api_at<
145-
'a,
146145
R: Encode + Decode + PartialEq,
147146
NC: FnOnce() -> std::result::Result<R, String> + UnwindSafe,
148147
C: CoreApi<Block, Error = sp_blockchain::Error>,
149148
>(
150149
&self,
151-
params: CallApiAtParams<'a, Block, C, NC, TrieState<Block, D>>,
150+
params: CallApiAtParams<Block, C, NC, TrieState<Block, D>>,
152151
) -> sp_blockchain::Result<NativeOrEncoded<R>> {
153152
let core_api = params.core_api;
154153
let at = params.at;

substrate-archive-backend/src/read_only_backend.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ where
9898
}
9999
}
100100

101+
/// Get keyed storage value hash or None if there is nothing associated.
101102
pub fn storage_hash(&self, hash: Block::Hash, key: &[u8]) -> Option<Block::Hash> {
102103
match self.state_at(hash) {
103104
Some(state) => state.storage_hash(key).unwrap_or_else(|_| panic!("No storage found for {:?}", hash)),

substrate-archive-backend/src/read_only_backend/main_backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ type ChainResult<T> = Result<T, BlockchainError>;
3535

3636
impl<Block: BlockT, D: ReadOnlyDB + 'static> Backend<Block> for ReadOnlyBackend<Block, D> {
3737
type BlockImportOperation = RealBlockImportOperation<D>;
38-
type OffchainStorage = OffchainStorageBackend;
3938
type Blockchain = Self;
4039
type State = super::state_backend::TrieState<Block, D>;
40+
type OffchainStorage = OffchainStorageBackend;
4141

4242
fn begin_operation(&self) -> ChainResult<Self::BlockImportOperation> {
4343
log::warn!("Block import operations are not supported for Read Only Backend");

substrate-archive-backend/src/read_only_backend/state_backend.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ impl<B: BlockT, D: ReadOnlyDB> StateBackend<HashFor<B>> for TrieState<B, D> {
118118
self.state.next_child_storage_key(child_info, key)
119119
}
120120

121+
fn for_keys_in_child_storage<F: FnMut(&[u8])>(&self, child_info: &ChildInfo, f: F) {
122+
self.state.for_keys_in_child_storage(child_info, f)
123+
}
124+
121125
fn for_keys_with_prefix<F: FnMut(&[u8])>(&self, prefix: &[u8], f: F) {
122126
self.state.for_keys_with_prefix(prefix, f)
123127
}
@@ -126,10 +130,6 @@ impl<B: BlockT, D: ReadOnlyDB> StateBackend<HashFor<B>> for TrieState<B, D> {
126130
self.state.for_key_values_with_prefix(prefix, f)
127131
}
128132

129-
fn for_keys_in_child_storage<F: FnMut(&[u8])>(&self, child_info: &ChildInfo, f: F) {
130-
self.state.for_keys_in_child_storage(child_info, f)
131-
}
132-
133133
fn for_child_keys_with_prefix<F: FnMut(&[u8])>(&self, child_info: &ChildInfo, prefix: &[u8], f: F) {
134134
self.state.for_child_keys_with_prefix(child_info, prefix, f)
135135
}

substrate-archive-backend/src/runtime_version_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<B: BlockT, D: ReadOnlyDB + 'static> RuntimeVersionCache<B, D> {
132132
.collect())
133133
}
134134

135-
/// This can be thought of as similiar to a recursive Binary Search
135+
/// This can be thought of as similar to a recursive Binary Search
136136
fn find_pivot(&self, blocks: &[SignedBlock<B>], versions: &mut Vec<VersionRange<B>>) -> Result<()> {
137137
if blocks.is_empty() {
138138
return Ok(());

substrate-archive-common/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub enum Error {
4646
BgJobGet(#[from] coil::FetchError),
4747
#[error("could not build threadpool")]
4848
ThreadPool(#[from] rayon::ThreadPoolBuildError),
49-
/// Error occured while serializing/deserializing data
49+
/// Error occurred while serializing/deserializing data
5050
#[error("Error while decoding job data {0}")]
5151
De(#[from] rmp_serde::decode::Error),
5252
#[error(

substrate-archive/src/actors/actor_pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<A: Actor + Send + Clone> ActorPool<A> {
7575
/// and is not taken out. WeakAddresses can be used to
7676
/// communicate directly with a single actor.
7777
///
78-
/// This has the possiblity of interrupting the pooled actors
78+
/// This has the possibility of interrupting the pooled actors
7979
/// if many tasks are sent to the one actor.
8080
///
8181
/// # None

substrate-archive/src/actors/workers/blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343
rt_cache: RuntimeVersionCache<B, D>,
4444
/// the last maximum block number from which we are sure every block before then is indexed
4545
last_max: u32,
46-
/// the maximimum amount of blocks to index at once
46+
/// the maximum amount of blocks to index at once
4747
max_block_load: u32,
4848
}
4949

substrate-archive/src/archive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn parse_urls(chain_data_path: Option<String>, pg_url: Option<String>) -> (Strin
152152
}
153153

154154
/// Create rocksdb secondary directory if it doesn't exist yet.
155-
/// If the ChainPpec is not specified, a temporary directory is used.
155+
/// If the ChainSpec is not specified, a temporary directory is used.
156156
/// Return path to that directory
157157
///
158158
/// # Panics
@@ -220,7 +220,7 @@ where
220220
let last_finalized_block = backend.last_finalized()?;
221221
let rt = client.runtime_version_at(&BlockId::Hash(last_finalized_block))?;
222222
log::info!(
223-
"Running archive for chain `{}` 🔗, implemention `{}`. Latest known runtime version: {}. Latest finalized block {} 🛡️",
223+
"Running archive for chain `{}` 🔗, implementation `{}`. Latest known runtime version: {}. Latest finalized block {} 🛡️",
224224
rt.spec_name,
225225
rt.impl_name,
226226
rt.spec_version,

0 commit comments

Comments
 (0)