Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
test-64bits:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand All @@ -39,7 +39,7 @@ jobs:
test-32bits:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- run: apt-get update && apt install -y libc6-dev-i386
- uses: actions/checkout@v4
Expand All @@ -50,7 +50,7 @@ jobs:
wasm-node-check:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- run: rustup target add wasm32-unknown-unknown
Expand All @@ -67,7 +67,7 @@ jobs:
check-features:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
check-no-std:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- run: rustup target add thumbv7m-none-eabi
Expand All @@ -113,7 +113,7 @@ jobs:
check-rustdoc-links:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand All @@ -122,7 +122,7 @@ jobs:
fmt:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
# Checks `rustfmt` formatting
- uses: actions/checkout@v4
Expand All @@ -136,7 +136,7 @@ jobs:
clippy:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
# Since build artifacts are specific to a nightly version, we pin the specific nightly
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
wasm-node-versions-match:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- run: apt-get update && apt install -y jq
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
build-js-doc:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -83,7 +83,7 @@ jobs:
build-rust-doc:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -104,7 +104,7 @@ jobs:
build-tests-coverage:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- run: apt update && apt install -y jq
- run: rustup component add llvm-tools-preview
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
npm-publish:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- run: rustup target add wasm32-unknown-unknown
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
crates-io-publish:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
- run: cargo publish --dry-run --locked
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/periodic-cargo-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
cargo-update:
runs-on: ubuntu-latest
container:
image: rust:1.88
image: rust:1.89
steps:
- uses: actions/checkout@v4
# Note: `cargo update --workspace` doesn't seem to have any effect.
Expand Down
4 changes: 0 additions & 4 deletions full-node/src/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ pub struct Config {
pub slot_duration_author_ratio: u16,
}

/// Identifier for a blocks request to be performed.
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct BlocksRequestId(usize);

/// Summary of the state of the [`ConsensusService`].
#[derive(Debug, Clone)]
pub struct SyncState {
Expand Down
2 changes: 1 addition & 1 deletion full-node/src/json_rpc_service/chain_head_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub async fn spawn_chain_head_subscription_task(config: Config) -> String {
return_value
}

fn convert_runtime_spec(runtime: &executor::CoreVersion) -> methods::MaybeRuntimeSpec {
fn convert_runtime_spec(runtime: &'_ executor::CoreVersion) -> methods::MaybeRuntimeSpec<'_> {
let runtime = runtime.decode();
methods::MaybeRuntimeSpec::Valid {
spec: methods::RuntimeSpec {
Expand Down
2 changes: 1 addition & 1 deletion full-node/src/json_rpc_service/requests_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ pub fn spawn_requests_handler(config: Config) {
}));
}

fn convert_runtime_version(runtime_spec: &executor::CoreVersion) -> methods::RuntimeVersion {
fn convert_runtime_version(runtime_spec: &'_ executor::CoreVersion) -> methods::RuntimeVersion<'_> {
let runtime_spec = runtime_spec.decode();
methods::RuntimeVersion {
spec_name: runtime_spec.spec_name.into(),
Expand Down
8 changes: 4 additions & 4 deletions lib/src/chain/blocks_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<T> NonFinalizedTree<T> {

/// Returns the header of all known non-finalized blocks in the chain without any specific
/// order.
pub fn iter_unordered(&self) -> impl Iterator<Item = header::HeaderRef> {
pub fn iter_unordered(&'_ self) -> impl Iterator<Item = header::HeaderRef<'_>> {
self.blocks
.iter_unordered()
.map(move |(_, b)| header::decode(&b.header, self.block_number_bytes).unwrap())
Expand All @@ -256,7 +256,7 @@ impl<T> NonFinalizedTree<T> {
///
/// The returned items are guaranteed to be in an order in which the parents are found before
/// their children.
pub fn iter_ancestry_order(&self) -> impl Iterator<Item = header::HeaderRef> {
pub fn iter_ancestry_order(&'_ self) -> impl Iterator<Item = header::HeaderRef<'_>> {
self.blocks
.iter_ancestry_order()
.map(move |(_, b)| header::decode(&b.header, self.block_number_bytes).unwrap())
Expand All @@ -281,7 +281,7 @@ impl<T> NonFinalizedTree<T> {

/// Builds a [`chain_information::ChainInformationRef`] struct that might later be used to
/// build a new [`NonFinalizedTree`].
pub fn as_chain_information(&self) -> chain_information::ValidChainInformationRef {
pub fn as_chain_information(&'_ self) -> chain_information::ValidChainInformationRef<'_> {
let attempt = chain_information::ChainInformationRef {
finalized_block_header: header::decode(
&self.finalized_block_header,
Expand Down Expand Up @@ -376,7 +376,7 @@ impl<T> NonFinalizedTree<T> {
}

/// Returns consensus information about the current best block of the chain.
pub fn best_block_consensus(&self) -> chain_information::ChainInformationConsensusRef {
pub fn best_block_consensus(&'_ self) -> chain_information::ChainInformationConsensusRef<'_> {
match (
&self.finalized_consensus,
self.blocks_by_best_score
Expand Down
16 changes: 8 additions & 8 deletions lib/src/chain/blocks_tree/finality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ impl<T> NonFinalizedTree<T> {
/// verification is nonetheless deterministic.
// TODO: expand the documentation about how blocks with authorities changes have to be finalized before any further block can be finalized
pub fn verify_justification(
&mut self,
&'_ mut self,
consensus_engine_id: [u8; 4],
scale_encoded_justification: &[u8],
randomness_seed: [u8; 32],
) -> Result<FinalityApply<T>, JustificationVerifyError> {
) -> Result<FinalityApply<'_, T>, JustificationVerifyError> {
match (&self.finality, &consensus_engine_id) {
(Finality::Grandpa { .. }, b"FRNK") => {
// Turn justification into a strongly-typed struct.
Expand Down Expand Up @@ -121,10 +121,10 @@ impl<T> NonFinalizedTree<T> {
/// A randomness seed must be provided and will be used during the verification. Note that the
/// verification is nonetheless deterministic.
pub fn verify_grandpa_commit_message(
&mut self,
&'_ mut self,
scale_encoded_commit: &[u8],
randomness_seed: [u8; 32],
) -> Result<FinalityApply<T>, CommitVerifyError> {
) -> Result<FinalityApply<'_, T>, CommitVerifyError> {
// The code below would panic if the chain doesn't use Grandpa.
if !matches!(self.finality, Finality::Grandpa { .. }) {
return Err(CommitVerifyError::NotGrandpa);
Expand Down Expand Up @@ -202,9 +202,9 @@ impl<T> NonFinalizedTree<T> {
/// If necessary, the current best block will be updated to be a descendant of the
/// newly-finalized block.
pub fn set_finalized_block(
&mut self,
&'_ mut self,
block_hash: &[u8; 32],
) -> Result<SetFinalizedBlockIter<T>, SetFinalizedError> {
) -> Result<SetFinalizedBlockIter<'_, T>, SetFinalizedError> {
let block_index = match self.blocks_by_hash.get(block_hash) {
Some(idx) => *idx,
None => return Err(SetFinalizedError::UnknownBlock),
Expand Down Expand Up @@ -311,9 +311,9 @@ impl<T> NonFinalizedTree<T> {
/// Panics if `block_index_to_finalize` isn't a valid node in the tree.
///
fn set_finalized_block_inner(
&mut self,
&'_ mut self,
block_index_to_finalize: fork_tree::NodeIndex,
) -> SetFinalizedBlockIter<T> {
) -> SetFinalizedBlockIter<'_, T> {
let new_finalized_block = self.blocks.get_mut(block_index_to_finalize).unwrap();

// Update `self.finality`.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/chain/chain_information.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl From<ValidChainInformation> for ChainInformation {

impl ValidChainInformation {
/// Gives access to the information.
pub fn as_ref(&self) -> ChainInformationRef {
pub fn as_ref(&'_ self) -> ChainInformationRef<'_> {
From::from(&self.inner)
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/chain/fork_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<T> ForkTree<T> {
///
/// Panics if the [`NodeIndex`] is invalid.
///
pub fn prune_ancestors(&mut self, node_index: NodeIndex) -> PruneAncestorsIter<T> {
pub fn prune_ancestors(&'_ mut self, node_index: NodeIndex) -> PruneAncestorsIter<'_, T> {
self.prune_ancestors_inner(node_index, false)
}

Expand All @@ -274,15 +274,15 @@ impl<T> ForkTree<T> {
///
/// Panics if the [`NodeIndex`] is invalid.
///
pub fn prune_uncles(&mut self, node_index: NodeIndex) -> PruneAncestorsIter<T> {
pub fn prune_uncles(&'_ mut self, node_index: NodeIndex) -> PruneAncestorsIter<'_, T> {
self.prune_ancestors_inner(node_index, true)
}

fn prune_ancestors_inner(
&mut self,
&'_ mut self,
node_index: NodeIndex,
uncles_only: bool,
) -> PruneAncestorsIter<T> {
) -> PruneAncestorsIter<'_, T> {
let iter = self.first_root.unwrap();

// `first_root` is updated ahead of the removal of the nodes. The update strategy is as
Expand Down
4 changes: 2 additions & 2 deletions lib/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl ChainSpec {
///
/// Bootnode addresses that have failed to be parsed are returned as well in the form of
/// a [`Bootnode::UnrecognizedFormat`].
pub fn boot_nodes(&self) -> impl ExactSizeIterator<Item = Bootnode> {
pub fn boot_nodes(&'_ self) -> impl ExactSizeIterator<Item = Bootnode<'_>> {
// Note that we intentionally don't expose types found in the `libp2p` module in order to
// not tie the code that parses chain specifications to the libp2p code.
self.client_spec.boot_nodes.iter().map(|unparsed| {
Expand Down Expand Up @@ -311,7 +311,7 @@ impl ChainSpec {
}

/// Gives access to what is known about the storage of the genesis block of the chain.
pub fn genesis_storage(&self) -> GenesisStorage {
pub fn genesis_storage(&'_ self) -> GenesisStorage<'_> {
match &self.client_spec.genesis {
structs::Genesis::Raw(raw) => GenesisStorage::Items(GenesisStorageItems { raw }),
structs::Genesis::StateRootHash(hash) => GenesisStorage::TrieRootHash(&hash.0),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/executor/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3554,7 +3554,7 @@ enum LogEmitInner {

impl LogEmit {
/// Returns the data that the runtime would like to print.
pub fn info(&self) -> LogEmitInfo {
pub fn info(&'_ self) -> LogEmitInfo<'_> {
match self.log_entry {
LogEmitInner::Num(n) => LogEmitInfo::Num(n),
LogEmitInner::Utf8 { str_ptr, str_size } => LogEmitInfo::Utf8(LogEmitInfoStr {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/executor/host/runtime_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ pub struct EmbeddedRuntimeVersionApis<'a> {
///
/// This function does not attempt to decode the content of the custom sections.
pub fn find_encoded_embedded_runtime_version_apis(
binary_wasm_module: &[u8],
) -> Result<EmbeddedRuntimeVersionApis, FindEncodedEmbeddedRuntimeVersionApisError> {
binary_wasm_module: &'_ [u8],
) -> Result<EmbeddedRuntimeVersionApis<'_>, FindEncodedEmbeddedRuntimeVersionApisError> {
let mut parser =
nom::combinator::all_consuming(nom::combinator::complete(nom::sequence::preceded(
(
Expand Down Expand Up @@ -194,7 +194,7 @@ impl CoreVersion {
Ok(CoreVersion(input))
}

pub fn decode(&self) -> CoreVersionRef {
pub fn decode(&'_ self) -> CoreVersionRef<'_> {
decode(&self.0).unwrap()
}
}
Expand Down Expand Up @@ -438,7 +438,7 @@ pub struct CoreVersionApi {
pub version: u32,
}

fn decode(scale_encoded: &[u8]) -> Result<CoreVersionRef, ()> {
fn decode(scale_encoded: &'_ [u8]) -> Result<CoreVersionRef<'_>, ()> {
// See https://spec.polkadot.network/#defn-rt-core-version
let result: nom::IResult<_, _> = nom::Parser::parse(
&mut nom::combinator::all_consuming(nom::combinator::complete(nom::combinator::map(
Expand Down Expand Up @@ -542,7 +542,7 @@ struct WasmSection<'a> {
}

/// Parses a Wasm section. If it is a custom section, returns its name and content.
fn wasm_section(bytes: &[u8]) -> nom::IResult<&[u8], Option<WasmSection>> {
fn wasm_section(bytes: &'_ [u8]) -> nom::IResult<&'_ [u8], Option<WasmSection<'_>>> {
nom::Parser::parse(
&mut nom::branch::alt((
nom::combinator::map(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/executor/host/zstd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ pub(super) const ZSTD_PREFIX: [u8; 8] = [82, 188, 83, 118, 70, 219, 142, 5];
///
/// The output data shall not be larger than `max_allowed`, to avoid potential zip bombs.
pub(super) fn zstd_decode_if_necessary(
data: &[u8],
data: &'_ [u8],
max_allowed: usize,
) -> Result<Cow<[u8]>, Error> {
) -> Result<Cow<'_, [u8]>, Error> {
if data.starts_with(&ZSTD_PREFIX) {
Ok(Cow::Owned(zstd_decode(
&data[ZSTD_PREFIX.len()..],
Expand Down
6 changes: 3 additions & 3 deletions lib/src/executor/runtime_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ impl StorageChanges {
/// Returns `Some` if and only if [`Config::calculate_trie_changes`] was `true` or if the
/// [`StorageChanges`] was created using [`StorageChanges::empty`].
pub fn trie_changes_iter_ordered(
&self,
) -> Option<impl Iterator<Item = (Option<&[u8]>, &[Nibble], TrieChange)>> {
&'_ self,
) -> Option<impl Iterator<Item = (Option<&'_ [u8]>, &'_ [Nibble], TrieChange<'_>)>> {
if !self.calculate_trie_changes {
return None;
}
Expand Down Expand Up @@ -1268,7 +1268,7 @@ pub struct LogEmit {

impl LogEmit {
/// Returns the data that the runtime would like to print.
pub fn info(&self) -> LogEmitInfo {
pub fn info(&'_ self) -> LogEmitInfo<'_> {
match &self.inner.vm {
host::HostVm::LogEmit(req) => req.info(),
// We only create a `LogEmit` if the inner state is `LogEmit`.
Expand Down
Loading
Loading