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

BitVM2: bump rust nightly #551

Merged
merged 7 commits into from
Dec 19, 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 @@ impl TaskTracker {
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)
});
// 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/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
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 @@ -136,6 +136,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 139 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#L139

Added line #L139 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving forward we should use #[expect(dead_code)] instead. And then, we don't need to rely on FIXME:. The compiler will tell us if this can be removed.

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)]

Copy link
Contributor

@Rajil1213 Rajil1213 Dec 19, 2024

Choose a reason for hiding this comment

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

Could you add a comment as to why this one (is_none_or) is needed too? Should also replace allow with expect 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.

The problem is that this will conflict with main:

#![allow(stable_features)] // FIX: this is needed for sp1 toolchain.
#![feature(is_sorted, is_none_or)]

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay then. We can leave this as is for now.

//! 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 @@ -239,7 +239,7 @@
if !l1v
.last_finalized_checkpoint
.as_ref()
.map_or(true, |prev_chp| {
.is_none_or(|prev_chp| {

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

View check run for this annotation

Codecov / codecov/patch

crates/state/src/operation.rs#L242

Added line #L242 was not covered by tests
checkpt.batch_info.idx() == prev_chp.batch_info.idx() + 1
})
{
Expand Down
4 changes: 4 additions & 0 deletions crates/storage/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ 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)] // #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.

Same comment about replacing this with expect.

pub async fn get_len_async(&self) -> usize {
let cache = self.cache.lock().await;
cache.len()
}

/// Gets the number of elements in the cache.
// TODO replace this with an atomic we update after every op
#[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.

Here too.

pub fn get_len_blocking(&self) -> usize {
let cache = self.cache.blocking_lock();
cache.len()
Expand All @@ -110,13 +112,15 @@ impl<K: Clone + Eq + Hash, V: Clone> CacheTable<K, V> {
}

/// Inserts an entry into the table, dropping the previous value.
#[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.

And here...

pub async fn insert_async(&self, k: K, v: V) {
let slot = Arc::new(RwLock::new(SlotState::Ready(v)));
let mut cache = self.cache.lock().await;
cache.put(k, slot);
}

/// Inserts an entry into the table, dropping the previous value.
#[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.

One more.

pub fn insert_blocking(&self, k: K, v: V) {
let slot = Arc::new(RwLock::new(SlotState::Ready(v)));
let mut cache = self.cache.blocking_lock();
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.
Copy link
Contributor

Choose a reason for hiding this comment

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

two more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

three.

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

four

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

five...

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

six

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 `N` blocks from a given height
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 @@ -5,7 +5,7 @@ use strata_zkvm::{AggregationInput, ZKVMInputBuilder};
// 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
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/btc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::helpers::proof_generator::ProofGenerator;
pub struct BtcBlockProofGenerator;

impl BtcBlockProofGenerator {
#[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.

seven

pub fn new() -> Self {
Self
}
Expand Down
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct CheckpointProofGenerator {
}

impl CheckpointProofGenerator {
#[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.

eight

pub fn new(
l1_batch_proof_generator: L1BatchProofGenerator,
l2_batch_proof_generator: L2BatchProofGenerator,
Expand Down
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/cl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct ClProofGenerator {
}

impl ClProofGenerator {
#[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.

nine

pub fn new(el_proof_generator: ElProofGenerator) -> Self {
Self { el_proof_generator }
}
Expand Down
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::helpers::proof_generator::ProofGenerator;
pub struct ElProofGenerator;

impl ElProofGenerator {
#[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.

ten

pub fn new() -> Self {
Self
}
Expand Down
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/l1_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct L1BatchProofGenerator {
}

impl L1BatchProofGenerator {
#[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.

eleven

pub fn new(btc_proof_generator: BtcBlockProofGenerator) -> Self {
Self {
btc_proof_generator,
Expand Down
1 change: 1 addition & 0 deletions provers/sp1/tests/helpers/l2_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct L2BatchProofGenerator {
}

impl L2BatchProofGenerator {
#[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.

last one...

pub fn new(cl_proof_generator: ClProofGenerator) -> Self {
Self { cl_proof_generator }
}
Expand Down
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