Skip to content

Commit 957aca1

Browse files
authored
Merge branch 'main' into get-block
2 parents 46385ef + e15184d commit 957aca1

File tree

17 files changed

+45
-29
lines changed

17 files changed

+45
-29
lines changed

tower-fallback/tests/fallback.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Tests for tower-fallback
2+
13
use tower::{service_fn, Service, ServiceExt};
24
use tower_fallback::Fallback;
35

zebra-chain/src/chain_tip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'f> BestTipChanged<'f> {
139139
}
140140
}
141141

142-
impl<'f> Future for BestTipChanged<'f> {
142+
impl Future for BestTipChanged<'_> {
143143
type Output = Result<(), BoxError>;
144144

145145
fn poll(

zebra-chain/src/orchard/shielded_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,6 @@ impl ZcashDeserialize for Flags {
270270
// the reserved bits 2..7 of the flagsOrchard field MUST be zero."
271271
// https://zips.z.cash/protocol/protocol.pdf#txnencodingandconsensus
272272
Flags::from_bits(reader.read_u8()?)
273-
.ok_or_else(|| SerializationError::Parse("invalid reserved orchard flags"))
273+
.ok_or(SerializationError::Parse("invalid reserved orchard flags"))
274274
}
275275
}
+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
//! Serialization tests.
2+
13
mod preallocate;
24
mod prop;

zebra-chain/src/transaction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl Transaction {
231231
&'a self,
232232
branch_id: ConsensusBranchId,
233233
all_previous_outputs: &'a [transparent::Output],
234-
) -> sighash::SigHasher {
234+
) -> sighash::SigHasher<'a> {
235235
sighash::SigHasher::new(self, branch_id, all_previous_outputs)
236236
}
237237

zebra-chain/src/transaction/serialize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ impl ZcashDeserialize for Transaction {
889889
// Convert it to a NetworkUpgrade
890890
let network_upgrade =
891891
NetworkUpgrade::from_branch_id(limited_reader.read_u32::<LittleEndian>()?)
892-
.ok_or_else(|| {
892+
.ok_or({
893893
SerializationError::Parse(
894894
"expected a valid network upgrade from the consensus branch id",
895895
)

zebra-network/src/protocol/external/codec.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,9 @@ impl Codec {
508508
timestamp: Utc
509509
.timestamp_opt(reader.read_i64::<LittleEndian>()?, 0)
510510
.single()
511-
.ok_or_else(|| Error::Parse("version timestamp is out of range for DateTime"))?,
511+
.ok_or(Error::Parse(
512+
"version timestamp is out of range for DateTime",
513+
))?,
512514
address_recv: AddrInVersion::zcash_deserialize(&mut reader)?,
513515
address_from: AddrInVersion::zcash_deserialize(&mut reader)?,
514516
nonce: Nonce(reader.read_u64::<LittleEndian>()?),

zebra-scan/src/service.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ impl Service<Request> for ScanService {
9393
Request::Info => {
9494
let db = self.db.clone();
9595

96-
return async move {
96+
async move {
9797
Ok(Response::Info {
9898
min_sapling_birthday_height: db.network().sapling_activation_height(),
9999
})
100100
}
101-
.boxed();
101+
.boxed()
102102
}
103103

104104
Request::RegisterKeys(keys) => {
105105
let mut scan_task = self.scan_task.clone();
106106

107-
return async move {
107+
async move {
108108
let newly_registered_keys = scan_task.register_keys(keys)?.await?;
109109
if !newly_registered_keys.is_empty() {
110110
Ok(Response::RegisteredKeys(newly_registered_keys))
@@ -113,14 +113,14 @@ impl Service<Request> for ScanService {
113113
are valid Sapling extended full viewing keys".into())
114114
}
115115
}
116-
.boxed();
116+
.boxed()
117117
}
118118

119119
Request::DeleteKeys(keys) => {
120120
let mut db = self.db.clone();
121121
let mut scan_task = self.scan_task.clone();
122122

123-
return async move {
123+
async move {
124124
// Wait for a message to confirm that the scan task has removed the key up to `DELETE_KEY_TIMEOUT`
125125
let remove_keys_result = tokio::time::timeout(
126126
DELETE_KEY_TIMEOUT,
@@ -141,13 +141,13 @@ impl Service<Request> for ScanService {
141141

142142
Ok(Response::DeletedKeys)
143143
}
144-
.boxed();
144+
.boxed()
145145
}
146146

147147
Request::Results(keys) => {
148148
let db = self.db.clone();
149149

150-
return async move {
150+
async move {
151151
let mut final_result = BTreeMap::new();
152152
for key in keys {
153153
let db = db.clone();
@@ -168,26 +168,26 @@ impl Service<Request> for ScanService {
168168

169169
Ok(Response::Results(final_result))
170170
}
171-
.boxed();
171+
.boxed()
172172
}
173173

174174
Request::SubscribeResults(keys) => {
175175
let mut scan_task = self.scan_task.clone();
176176

177-
return async move {
177+
async move {
178178
let results_receiver = scan_task.subscribe(keys)?.await.map_err(|_| {
179179
"scan task dropped responder, check that keys are registered"
180180
})?;
181181

182182
Ok(Response::SubscribeResults(results_receiver))
183183
}
184-
.boxed();
184+
.boxed()
185185
}
186186

187187
Request::ClearResults(keys) => {
188188
let mut db = self.db.clone();
189189

190-
return async move {
190+
async move {
191191
// Clear results from db for the provided `keys`
192192
tokio::task::spawn_blocking(move || {
193193
db.delete_sapling_results(keys);
@@ -196,7 +196,7 @@ impl Service<Request> for ScanService {
196196

197197
Ok(Response::ClearedResults)
198198
}
199-
.boxed();
199+
.boxed()
200200
}
201201
}
202202
}

zebra-scan/src/storage/db/sapling.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ trait InsertSaplingHeight {
265265
fn insert_sapling_height(self, sapling_key: &SaplingScanningKey, height: Height) -> Self;
266266
}
267267

268-
impl<'cf> InsertSaplingHeight for WriteSaplingTxIdsBatch<'cf> {
268+
impl InsertSaplingHeight for WriteSaplingTxIdsBatch<'_> {
269269
/// Insert sapling height with no results.
270270
///
271271
/// If a result already exists for the coinbase transaction at that height,
@@ -283,7 +283,7 @@ trait DeleteSaplingKeys {
283283
fn delete_sapling_keys(self, sapling_key: Vec<SaplingScanningKey>) -> Self;
284284
}
285285

286-
impl<'cf> DeleteSaplingKeys for WriteSaplingTxIdsBatch<'cf> {
286+
impl DeleteSaplingKeys for WriteSaplingTxIdsBatch<'_> {
287287
/// Delete sapling keys and their results.
288288
fn delete_sapling_keys(mut self, sapling_keys: Vec<SaplingScanningKey>) -> Self {
289289
for key in &sapling_keys {

zebra-scan/tests/scan_task_commands.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! export ZEBRA_CACHED_STATE_DIR="/path/to/zebra/state"
77
//! cargo test scan_task_commands --features="shielded-scan" -- --ignored --nocapture
8-
#![allow(dead_code)]
8+
#![allow(dead_code, non_local_definitions)]
99

1010
use std::{fs, time::Duration};
1111

@@ -26,6 +26,7 @@ use zebra_scan::{
2626

2727
use zebra_state::{ChainTipChange, LatestChainTip};
2828

29+
/// Boxed state service.
2930
pub type BoxStateService =
3031
BoxService<zebra_state::Request, zebra_state::Response, zebra_state::BoxError>;
3132

@@ -162,6 +163,7 @@ pub(crate) async fn run() -> Result<()> {
162163
Ok(())
163164
}
164165

166+
/// Starts the state service with the provided cache directory.
165167
pub async fn start_state_service_with_cache_dir(
166168
network: &Network,
167169
cache_dir: impl Into<std::path::PathBuf>,

zebra-state/src/service/finalized_state/column_family.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ where
6363
batch: Batch,
6464
}
6565

66-
impl<'cf, Key, Value> Debug for TypedColumnFamily<'cf, Key, Value>
66+
impl<Key, Value> Debug for TypedColumnFamily<'_, Key, Value>
6767
where
6868
Key: IntoDisk + FromDisk + Debug,
6969
Value: IntoDisk + FromDisk,
@@ -80,7 +80,7 @@ where
8080
}
8181
}
8282

83-
impl<'cf, Key, Value> PartialEq for TypedColumnFamily<'cf, Key, Value>
83+
impl<Key, Value> PartialEq for TypedColumnFamily<'_, Key, Value>
8484
where
8585
Key: IntoDisk + FromDisk + Debug,
8686
Value: IntoDisk + FromDisk,
@@ -90,7 +90,7 @@ where
9090
}
9191
}
9292

93-
impl<'cf, Key, Value> Eq for TypedColumnFamily<'cf, Key, Value>
93+
impl<Key, Value> Eq for TypedColumnFamily<'_, Key, Value>
9494
where
9595
Key: IntoDisk + FromDisk + Debug,
9696
Value: IntoDisk + FromDisk,
@@ -243,7 +243,7 @@ where
243243
}
244244
}
245245

246-
impl<'cf, Key, Value> TypedColumnFamily<'cf, Key, Value>
246+
impl<Key, Value> TypedColumnFamily<'_, Key, Value>
247247
where
248248
Key: IntoDisk + FromDisk + Debug + Ord,
249249
Value: IntoDisk + FromDisk,
@@ -259,7 +259,7 @@ where
259259
}
260260
}
261261

262-
impl<'cf, Key, Value> TypedColumnFamily<'cf, Key, Value>
262+
impl<Key, Value> TypedColumnFamily<'_, Key, Value>
263263
where
264264
Key: IntoDisk + FromDisk + Debug + Hash + Eq,
265265
Value: IntoDisk + FromDisk,
@@ -275,7 +275,7 @@ where
275275
}
276276
}
277277

278-
impl<'cf, Key, Value, Batch> WriteTypedBatch<'cf, Key, Value, Batch>
278+
impl<Key, Value, Batch> WriteTypedBatch<'_, Key, Value, Batch>
279279
where
280280
Key: IntoDisk + FromDisk + Debug,
281281
Value: IntoDisk + FromDisk,
@@ -312,7 +312,7 @@ where
312312
}
313313

314314
// Writing a batch to the database requires an owned batch.
315-
impl<'cf, Key, Value> WriteTypedBatch<'cf, Key, Value, DiskWriteBatch>
315+
impl<Key, Value> WriteTypedBatch<'_, Key, Value, DiskWriteBatch>
316316
where
317317
Key: IntoDisk + FromDisk + Debug,
318318
Value: IntoDisk + FromDisk,

zebra-state/src/service/finalized_state/disk_format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub trait FromDisk: Sized {
6868

6969
// Generic serialization impls
7070

71-
impl<'a, T> IntoDisk for &'a T
71+
impl<T> IntoDisk for &T
7272
where
7373
T: IntoDisk,
7474
{

zebra-state/src/service/non_finalized_state/chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ impl Chain {
12721272
pub fn partial_transparent_indexes<'a>(
12731273
&'a self,
12741274
addresses: &'a HashSet<transparent::Address>,
1275-
) -> impl Iterator<Item = &TransparentTransfers> {
1275+
) -> impl Iterator<Item = &'a TransparentTransfers> {
12761276
addresses
12771277
.iter()
12781278
.flat_map(|address| self.partial_transparent_transfers.get(address))

zebrad/src/commands.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Zebrad Subcommands
22
3+
#![allow(non_local_definitions)]
4+
35
use std::path::PathBuf;
46

57
use abscissa_core::{config::Override, Command, Configurable, FrameworkError, Runnable};

zebrad/src/components/metrics.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! An HTTP endpoint for metrics collection.
22
3+
#![allow(non_local_definitions)]
4+
35
use std::net::SocketAddr;
46

57
use abscissa_core::{Component, FrameworkError};

zebrad/src/components/tokio.rs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! The rayon thread pool is used for:
88
//! - long-running CPU-bound tasks like cryptography, via [`rayon::spawn_fifo`].
99
10+
#![allow(non_local_definitions)]
11+
1012
use std::{future::Future, time::Duration};
1113

1214
use abscissa_core::{Component, FrameworkError, Shutdown};

zebrad/src/components/tracing/endpoint.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! An HTTP endpoint for dynamically setting tracing filters.
22
3+
#![allow(non_local_definitions)]
4+
35
use std::net::SocketAddr;
46

57
use abscissa_core::{Component, FrameworkError};

0 commit comments

Comments
 (0)