Skip to content

Commit dd3cc79

Browse files
committed
chore: bump rust toolchain version to 1.78.0
1 parent 8ad19d0 commit dd3cc79

File tree

18 files changed

+30
-261
lines changed

18 files changed

+30
-261
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.77.0"
2+
channel = "1.78.0"
33
components = ["clippy", "llvm-tools-preview", "rustfmt"]

src/beacon/signatures/public_key_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl PublicKeyOnG2 {
99
}
1010

1111
pub fn verify(&self, message: impl AsRef<[u8]>, signature: &SignatureOnG1) -> bool {
12-
verify_messages_unchained(self, &[message.as_ref()], &[&signature])
12+
verify_messages_unchained(self, &[message.as_ref()], &[signature])
1313
}
1414

1515
pub fn verify_batch(&self, messages: &[&[u8]], signatures: &[&SignatureOnG1]) -> bool {

src/blocks/chain4u.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ impl<T> Chain4U<T> {
167167
inner: Default::default(),
168168
}
169169
}
170-
pub fn get<Q: ?Sized>(&self, ident: &Q) -> Option<RawBlockHeader>
170+
pub fn get<Q>(&self, ident: &Q) -> Option<RawBlockHeader>
171171
where
172172
String: Borrow<Q>,
173-
Q: Hash + Eq,
173+
Q: Hash + Eq + ?Sized,
174174
{
175175
self.inner.lock().ident2header.get(ident).cloned()
176176
}
@@ -395,15 +395,11 @@ impl<N, E, Ix> KeyedDiGraph<N, E, Ix> {
395395
{
396396
petgraph::algo::is_cyclic_directed(&self.graph)
397397
}
398-
fn neighbors_directed<Q: ?Sized>(
399-
&self,
400-
node: &Q,
401-
dir: petgraph::Direction,
402-
) -> impl Iterator<Item = &N>
398+
fn neighbors_directed<Q>(&self, node: &Q, dir: petgraph::Direction) -> impl Iterator<Item = &N>
403399
where
404400
Ix: petgraph::graph::IndexType,
405401
N: Borrow<Q> + Hash + Eq,
406-
Q: Hash + Eq,
402+
Q: Hash + Eq + ?Sized,
407403
{
408404
self.node2ix
409405
.get_by_left(node)

src/chain/weight.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
// Copyright 2019-2024 ChainSafe Systems
22
// SPDX-License-Identifier: Apache-2.0, MIT
33

4-
use crate::blocks::Tipset;
5-
use fvm_ipld_blockstore::Blockstore;
6-
use num::BigInt;
7-
use std::sync::Arc;
8-
9-
pub type Weight = BigInt;
10-
11-
/// The `Scale` trait abstracts away the logic of assigning a weight to a chain,
12-
/// which can be consensus specific. For example it can depend on the stake and
13-
/// power of validators, or it can be as simple as the height of the blocks in
14-
/// a `Nakamoto` style consensus.
15-
pub trait Scale {
16-
/// Calculate the weight of a tipset.
17-
fn weight<DB>(db: &Arc<DB>, ts: &Tipset) -> Result<Weight, anyhow::Error>
18-
where
19-
DB: Blockstore;
20-
}
4+
pub type Weight = num::BigInt;

src/chain_sync/consensus.rs

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,8 @@
11
// Copyright 2019-2024 ChainSafe Systems
22
// SPDX-License-Identifier: Apache-2.0, MIT
33

4-
use std::{
5-
borrow::Cow,
6-
fmt::{Debug, Display},
7-
sync::Arc,
8-
};
9-
10-
use crate::blocks::{Block, Tipset};
11-
use crate::chain::Scale;
12-
use crate::message::SignedMessage;
13-
use crate::message_pool::MessagePool;
14-
use crate::state_manager::StateManager;
15-
use async_trait::async_trait;
164
use futures::{stream::FuturesUnordered, StreamExt};
17-
use fvm_ipld_blockstore::Blockstore;
185
use nunny::Vec as NonEmpty;
19-
use tokio::task::JoinSet;
20-
21-
/// The `Consensus` trait encapsulates consensus specific rules of validation
22-
/// and block creation. Behind the scenes they can farm out the total ordering
23-
/// of transactions to an arbitrary consensus engine, but in the end they
24-
/// package the transactions into Filecoin compatible blocks.
25-
///
26-
/// Not all fields will be made use of, however, so the validation of these
27-
/// blocks at least partially have to be trusted to the `Consensus` component.
28-
///
29-
/// Common rules for message ordering will be followed, and can be validated
30-
/// outside by the host system during chain synchronization.
31-
#[async_trait]
32-
pub trait Consensus: Scale + Debug + Send + Sync + Unpin + 'static {
33-
type Error: Debug + Display + Send + Sync;
34-
35-
/// Perform block validation asynchronously and return all encountered
36-
/// errors if failed.
37-
///
38-
/// Being asynchronous gives the method a chance to construct a pipeline of
39-
/// validations, i.e. do some common ones before branching out.
40-
async fn validate_block<DB>(
41-
&self,
42-
state_manager: Arc<StateManager<DB>>,
43-
block: Arc<Block>,
44-
) -> Result<(), NonEmpty<Self::Error>>
45-
where
46-
DB: Blockstore + Sync + Send + 'static;
47-
}
486

497
/// Helper function to collect errors from async validations.
508
pub async fn collect_errs<E>(
@@ -63,93 +21,3 @@ pub async fn collect_errs<E>(
6321
Err(_) => Ok(()),
6422
}
6523
}
66-
67-
/// The `Proposer` trait expresses the ability to "mine", or in more general,
68-
/// to propose blocks to the network according to the rules of the consensus
69-
/// protocol.
70-
///
71-
/// It is separate from the `Consensus` trait because it is only expected to
72-
/// be called once, then left to run in the background and try to publish
73-
/// blocks to the network which may or may not be adopted.
74-
///
75-
/// It exists mostly as a way for us to describe what kind of dependencies
76-
/// mining processes are expected to take.
77-
#[async_trait]
78-
pub trait Proposer {
79-
/// Start proposing blocks in the background and never return, unless
80-
/// something went horribly wrong. Broadly, they should select messages
81-
/// from the `mempool`, come up with a total ordering for them, then create
82-
/// blocks and publish them to the network.
83-
///
84-
/// To establish total ordering, the proposer might have to communicate
85-
/// with other peers using custom P2P messages, however that is its own
86-
/// concern, the dependencies to implement a suitable network later must
87-
/// come from somewhere else, because they are not common across all
88-
/// consensus variants.
89-
///
90-
/// The method returns a vector of handles so that it can start unspecified
91-
/// number of background tasks, which can all be canceled by the main thread
92-
/// if the application needs to exit. The method is async so that it can
93-
/// use async operations to initialize itself, during which it might
94-
/// encounter some errors.
95-
async fn spawn<DB, MP>(
96-
self,
97-
// NOTE: We will need access to the `ChainStore` as well, or, ideally
98-
// a wrapper over it that only allows us to do what we need to, but
99-
// for example not reset the Genesis. But since the `StateManager`
100-
// already exposes the `ChainStore` as is, and this is how it's
101-
// accessed during validation for example, I think we can defer
102-
// these for later refactoring and just use the same pattern.
103-
state_manager: Arc<StateManager<DB>>,
104-
mpool: Arc<MP>,
105-
services: &mut JoinSet<anyhow::Result<()>>,
106-
) -> anyhow::Result<()>
107-
where
108-
DB: Blockstore + Sync + Send + 'static,
109-
MP: MessagePoolApi + Sync + Send + 'static;
110-
}
111-
112-
/// The `MessagePoolApi` is the window of consensus to the contents of the
113-
/// `MessagePool`.
114-
///
115-
/// It exists to narrow down the possible operations that a consensus engine can
116-
/// do with the `MessagePool` to only those that it should reasonably exercise,
117-
/// which are mostly read-only queries to get transactions which can be expected
118-
/// to be put in the next block, based on their account nonce values and the
119-
/// current state.
120-
///
121-
/// The `MessagePool` is still expected to monitor the chain growth and remove
122-
/// messages which were included in blocks on its own.
123-
pub trait MessagePoolApi {
124-
/// Select the set of suitable signed messages based on a tipset we are
125-
/// about to build the next block on.
126-
///
127-
/// The result is a `Cow` in case the source can avoid cloning messages and
128-
/// just return a reference. They will be sent to the data store for
129-
/// storage, but a reference is enough for that.
130-
fn select_signed<DB>(
131-
&self,
132-
state_manager: &StateManager<DB>,
133-
base: &Tipset,
134-
) -> anyhow::Result<Vec<Cow<SignedMessage>>>
135-
where
136-
DB: Blockstore;
137-
}
138-
139-
impl<P> MessagePoolApi for MessagePool<P>
140-
where
141-
P: crate::message_pool::Provider + Send + Sync + 'static,
142-
{
143-
fn select_signed<DB>(
144-
&self,
145-
_: &StateManager<DB>,
146-
base: &Tipset,
147-
) -> anyhow::Result<Vec<Cow<SignedMessage>>>
148-
where
149-
DB: Blockstore,
150-
{
151-
self.select_messages_for_block(base)
152-
.map_err(|e| e.into())
153-
.map(|v| v.into_iter().map(Cow::Owned).collect())
154-
}
155-
}

src/cli/humantoken.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ mod parse {
219219
}
220220

221221
/// Take a float from the front of `input`
222-
fn bigdecimal<'a, E: ParseError<&'a str>>(input: &'a str) -> IResult<&str, BigDecimal, E>
222+
fn bigdecimal<'a, E>(input: &'a str) -> IResult<&str, BigDecimal, E>
223223
where
224-
E: FromExternalError<&'a str, ParseBigDecimalError>,
224+
E: ParseError<&'a str> + FromExternalError<&'a str, ParseBigDecimalError>,
225225
{
226226
map_res(recognize_float, str::parse)(input)
227227
}

src/cli/subcommands/mpool_cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn compute_stats(
134134
let actor_sequence = *actor_sequences.get(&address).expect("get must succeed");
135135

136136
let mut curr_sequence = actor_sequence;
137-
while bucket.get(&curr_sequence).is_some() {
137+
while bucket.contains_key(&curr_sequence) {
138138
curr_sequence += 1;
139139
}
140140

src/cli_shared/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl CliOpts {
194194
}
195195

196196
if let Some(addresses) = &self.p2p_listen_address {
197-
cfg.network.listening_multiaddrs = addresses.clone();
197+
cfg.network.listening_multiaddrs.clone_from(addresses);
198198
}
199199

200200
if self.import_snapshot.is_some() && self.import_chain.is_some() {

src/db/car/forest.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ pub const DEFAULT_FOREST_CAR_FRAME_SIZE: usize = 8000_usize.next_power_of_two();
8383
pub const DEFAULT_FOREST_CAR_COMPRESSION_LEVEL: u16 = zstd::DEFAULT_COMPRESSION_LEVEL as _;
8484
const ZSTD_SKIP_FRAME_LEN: u64 = 8;
8585

86-
pub trait ReaderGen<V>: Fn() -> io::Result<V> + Send + Sync + 'static {}
87-
impl<ReaderT, X: Fn() -> io::Result<ReaderT> + Send + Sync + 'static> ReaderGen<ReaderT> for X {}
88-
8986
pub struct ForestCar<ReaderT> {
9087
// Multiple `ForestCar` structures may share the same cache. The cache key is used to identify
9188
// the origin of a cached z-frame.

0 commit comments

Comments
 (0)