Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STR-676: updates rust nightly #537

Merged
merged 8 commits into from
Dec 18, 2024
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
2 changes: 1 addition & 1 deletion bin/prover-client/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
let all_dependencies_completed = dependent_task.dependencies.iter().all(|dep_id| {
tasks
.get(dep_id)
.map_or(false, |t| t.status == ProvingTaskStatus::Completed)
.is_some_and(|t| t.status == ProvingTaskStatus::Completed)

Check warning on line 85 in bin/prover-client/src/task.rs

View check run for this annotation

Codecov / codecov/patch

bin/prover-client/src/task.rs#L85

Added line #L85 was not covered by tests
});
// Return the task ID and completion status of dependencies
(*id, all_dependencies_completed)
Expand Down
6 changes: 3 additions & 3 deletions bin/strata-cli/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum MaybeLink<'a, 'b> {
Object(OnchainObject<'a>),
}

impl<'a, 'b> PrettyPrint for MaybeLink<'a, 'b> {
impl PrettyPrint for MaybeLink<'_, '_> {
fn pretty(&self) -> String {
match self {
MaybeLink::Link(l) => l.pretty(),
Expand Down Expand Up @@ -160,7 +160,7 @@ pub struct Link<'a, 'b> {
explorer_ep: &'b str,
}

impl<'b, 'a> Display for Link<'a, 'b> {
impl Display for Link<'_, '_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.object {
OnchainObject::Transaction(ref txid) => match txid {
Expand All @@ -179,7 +179,7 @@ impl<'b, 'a> Display for Link<'a, 'b> {
}
}

impl<'a, 'b> PrettyPrint for Link<'a, 'b> {
impl PrettyPrint for Link<'_, '_> {
fn pretty(&self) -> String {
match self.object {
OnchainObject::Transaction(_) => format!("View transaction at {self}"),
Expand Down
6 changes: 3 additions & 3 deletions bin/strata-cli/src/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
.map(|(pubk, privk)| [pubk.to_string(), privk.to_string()])
.map(|[pubk, privk]| {
(
(pubk.as_bytes().len() as u32).to_le_bytes(),
(pubk.len() as u32).to_le_bytes(),

Check warning on line 52 in bin/strata-cli/src/recovery.rs

View check run for this annotation

Codecov / codecov/patch

bin/strata-cli/src/recovery.rs#L52

Added line #L52 was not covered by tests
pubk,
(privk.as_bytes().len() as u32).to_le_bytes(),
(privk.len() as u32).to_le_bytes(),

Check warning on line 54 in bin/strata-cli/src/recovery.rs

View check run for this annotation

Codecov / codecov/patch

bin/strata-cli/src/recovery.rs#L54

Added line #L54 was not covered by tests
privk,
)
});
Expand All @@ -78,7 +78,7 @@
let keymap_len = keymap_iter
.clone()
.map(|(pubk_len, pubk, privk_len, privk)| {
pubk_len.len() + pubk.as_bytes().len() + privk_len.len() + privk.as_bytes().len()
pubk_len.len() + pubk.len() + privk_len.len() + privk.len()

Check warning on line 81 in bin/strata-cli/src/recovery.rs

View check run for this annotation

Codecov / codecov/patch

bin/strata-cli/src/recovery.rs#L81

Added line #L81 was not covered by tests
})
.sum::<usize>();

Expand Down
8 changes: 8 additions & 0 deletions bin/strata-reth/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,21 @@ impl From<SequencerRpcError> for EthApiError {

/// A client to interact with a Sequencer
#[derive(Debug, Clone)]
#[allow(dead_code)] // FIXME: remove this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, my bad :( I removed it already in the upcoming PR (bumping reth to latest)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, once we have it up we can link the PRs by adding the number here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am inclined to put this PR before #542 since it depends on succinct labs bumping their cargo version.

What you think? You can rebase and remove the dead_code lints.

pub struct SequencerClient {
inner: Arc<SequencerClientInner>,
}

impl SequencerClient {
/// Creates a new [`SequencerClient`].
#[allow(dead_code)] // FIXME: remove this
pub fn new(sequencer_endpoint: impl Into<String>) -> Self {
let client = Client::builder().use_rustls_tls().build().unwrap();
Self::with_client(sequencer_endpoint, client)
}

/// Creates a new [`SequencerClient`].
#[allow(dead_code)] // FIXME: remove this
pub fn with_client(sequencer_endpoint: impl Into<String>, http_client: Client) -> Self {
let inner = SequencerClientInner {
sequencer_endpoint: sequencer_endpoint.into(),
Expand All @@ -55,23 +58,27 @@ impl SequencerClient {
}

/// Returns the network of the client
#[allow(dead_code)] // FIXME: remove this
pub fn endpoint(&self) -> &str {
&self.inner.sequencer_endpoint
}

/// Returns the client
#[allow(dead_code)] // FIXME: remove this
pub fn http_client(&self) -> &Client {
&self.inner.http_client
}

/// Returns the next id for the request
#[allow(dead_code)] // FIXME: remove this
fn next_request_id(&self) -> usize {
self.inner
.id
.fetch_add(1, std::sync::atomic::Ordering::SeqCst)
}

/// Forwards a transaction to the sequencer endpoint.
#[allow(dead_code)] // FIXME: remove this
pub async fn forward_raw_transaction(&self, tx: &[u8]) -> Result<(), SequencerRpcError> {
let body = serde_json::to_string(&serde_json::json!({
"jsonrpc": "2.0",
Expand Down Expand Up @@ -107,6 +114,7 @@ impl SequencerClient {
}

#[derive(Debug, Default)]
#[allow(dead_code)] // FIXME: remove this
struct SequencerClientInner {
/// The endpoint of the sequencer
sequencer_endpoint: String,
Expand Down
14 changes: 7 additions & 7 deletions crates/btcio/src/rpc/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ where
{
struct SatVisitor;

impl<'d> Visitor<'d> for SatVisitor {
impl Visitor<'_> for SatVisitor {
type Value = Amount;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand All @@ -418,7 +418,7 @@ where
{
struct SatVisitor;

impl<'d> Visitor<'d> for SatVisitor {
impl Visitor<'_> for SatVisitor {
type Value = SignedAmount;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down Expand Up @@ -456,7 +456,7 @@ where
{
struct TxidVisitor;

impl<'d> Visitor<'d> for TxidVisitor {
impl Visitor<'_> for TxidVisitor {
type Value = Txid;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand All @@ -482,7 +482,7 @@ where
{
struct TxVisitor;

impl<'d> Visitor<'d> for TxVisitor {
impl Visitor<'_> for TxVisitor {
type Value = Transaction;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down Expand Up @@ -512,7 +512,7 @@ where
D: Deserializer<'d>,
{
struct AddressVisitor;
impl<'d> Visitor<'d> for AddressVisitor {
impl Visitor<'_> for AddressVisitor {
type Value = Address<NetworkUnchecked>;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand All @@ -539,7 +539,7 @@ where
{
struct BlockHashVisitor;

impl<'d> Visitor<'d> for BlockHashVisitor {
impl Visitor<'_> for BlockHashVisitor {
type Value = BlockHash;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand All @@ -565,7 +565,7 @@ where
{
struct HeightVisitor;

impl<'d> Visitor<'d> for HeightVisitor {
impl Visitor<'_> for HeightVisitor {
type Value = Height;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/reth/exex/src/cache_db_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
self.provider
.block_hash(number)?
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(number))
.ok_or(ProviderError::BlockBodyIndicesNotFound(number))

Check warning on line 138 in crates/reth/exex/src/cache_db_provider.rs

View check run for this annotation

Codecov / codecov/patch

crates/reth/exex/src/cache_db_provider.rs#L138

Added line #L138 was not covered by tests
}
}
2 changes: 2 additions & 0 deletions crates/state/src/bridge_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ impl OperatorTable {
}

/// Sanity checks the operator table for sensibility.
#[allow(dead_code)] // FIXME: remove this
fn sanity_check(&self) {
if !self.operators.is_sorted_by_key(|e| e.idx) {
panic!("bridge_state: operators list not sorted");
Expand Down Expand Up @@ -205,6 +206,7 @@ impl DepositsTable {
}

/// Sanity checks the operator table for sensibility.
#[allow(dead_code)] // FIXME: remove this
fn sanity_check(&self) {
if !self.deposits.is_sorted_by_key(|e| e.deposit_idx) {
panic!("bridge_state: deposits list not sorted");
Expand Down
4 changes: 2 additions & 2 deletions crates/state/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(dead_code)] // TODO: remove once the bridge state `sanity_check` fn is used.
#![feature(is_sorted)] // TODO: switch to using crate
#![allow(stable_features)] // FIX: this is needed for sp1 toolchain.
#![feature(is_sorted, is_none_or)]

//! Rollup types relating to the consensus-layer state of the rollup.
//!
Expand Down
2 changes: 1 addition & 1 deletion crates/state/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
if !l1v
.last_finalized_checkpoint
.as_ref()
.map_or(true, |prev_chp| {
.is_none_or(|prev_chp| {

Check warning on line 239 in crates/state/src/operation.rs

View check run for this annotation

Codecov / codecov/patch

crates/state/src/operation.rs#L239

Added line #L239 was not covered by tests
checkpt.batch_info.idx() == prev_chp.batch_info.idx() + 1
})
{
Expand Down
2 changes: 2 additions & 0 deletions crates/storage/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl<K: Clone + Eq + Hash, V: Clone> CacheTable<K, V> {

/// Gets the number of elements in the cache.
// TODO replace this with an atomic we update after every op
#[allow(dead_code)]
pub fn get_len(&self) -> usize {
let cache = self.cache.lock();
cache.len()
Expand All @@ -98,6 +99,7 @@ impl<K: Clone + Eq + Hash, V: Clone> CacheTable<K, V> {
}

/// Inserts an entry into the table, dropping the previous value.
#[allow(dead_code)]
pub fn insert(&self, k: K, v: V) {
let slot = Arc::new(RwLock::new(SlotState::Ready(v)));
self.cache.lock().put(k, slot);
Expand Down
4 changes: 4 additions & 0 deletions crates/storage/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub use tracing::*;
pub type DbRecv<T> = tokio::sync::oneshot::Receiver<DbResult<T>>;

/// Shim to opaquely execute the operation without being aware of the underlying impl.
#[allow(dead_code)] // FIXME: remove this
pub struct OpShim<T, R> {
executor_fn: Arc<dyn Fn(T) -> DbResult<R> + Sync + Send + 'static>,
}
Expand All @@ -21,6 +22,7 @@ where
T: Sync + Send + 'static,
R: Sync + Send + 'static,
{
#[allow(dead_code)] // FIXME: remove this
pub fn wrap<F>(op: F) -> Self
where
F: Fn(T) -> DbResult<R> + Sync + Send + 'static,
Expand All @@ -31,6 +33,7 @@ where
}

/// Executes the operation on the provided thread pool and returns the result over.
#[allow(dead_code)] // FIXME: remove this
pub async fn exec_async(&self, pool: &threadpool::ThreadPool, arg: T) -> DbResult<R> {
let (resp_tx, resp_rx) = tokio::sync::oneshot::channel();

Expand All @@ -50,6 +53,7 @@ where
}

/// Executes the operation directly.
#[allow(dead_code)] // FIXME: remove this
pub fn exec_blocking(&self, arg: T) -> DbResult<R> {
(self.executor_fn)(arg)
}
Expand Down
1 change: 1 addition & 0 deletions crates/tasks/src/pending_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl PendingTasks {
}
}

#[allow(dead_code)] // FIXME: remove this
pub fn current(&self) -> usize {
self.counter.load(Ordering::SeqCst)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/test-utils/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl BtcChainSegment {
}

pub fn get_block(&self, height: u32) -> &Block {
return self.custom_blocks.get(&height).unwrap();
self.custom_blocks.get(&height).unwrap()
}

/// Retrieves the timestamps of a specified number of blocks from a given height in a
Expand Down
2 changes: 1 addition & 1 deletion crates/zkvm/adapters/native/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::env::NativeMachine;

pub struct NativeMachineInputBuilder(pub NativeMachine);

impl<'a> ZkVmInputBuilder<'a> for NativeMachineInputBuilder {
impl ZkVmInputBuilder<'_> for NativeMachineInputBuilder {
type Input = NativeMachine;

fn new() -> NativeMachineInputBuilder {
Expand Down
2 changes: 1 addition & 1 deletion crates/zkvm/adapters/sp1/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strata_zkvm::{AggregationInput, ZkVmError, ZkVmInputBuilder, ZkVmResult};
// A wrapper around SP1Stdin
pub struct SP1ProofInputBuilder(SP1Stdin);

impl<'a> ZkVmInputBuilder<'a> for SP1ProofInputBuilder {
impl ZkVmInputBuilder<'_> for SP1ProofInputBuilder {
type Input = SP1Stdin;
fn new() -> SP1ProofInputBuilder {
SP1ProofInputBuilder(SP1Stdin::new())
Expand Down
5 changes: 2 additions & 3 deletions provers/sp1/guest-btc-blockspace/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-07-27"
channel = "nightly-2024-12-12"
components = [
"cargo",
"clippy",
Expand Down
Loading