Skip to content

Commit 9fba8ab

Browse files
authored
Merge pull request #1894 from o1-labs/io/rust-1.92.0
Rust 1.92
2 parents 2a511d9 + 011b25d commit 9fba8ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+118
-153
lines changed

.github/config/versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# - website/docs/developers/getting-started.mdx
1111

1212
rust:
13-
stable: "1.84"
13+
stable: "1.92"
1414
beta: "beta"
1515
nightly: "nightly"
1616

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
- Remove ocaml-interop dependency, fix
3232
[#1235](https://github.com/o1-labs/mina-rust/issues/1235)
3333
([#1646](https://github.com/o1-labs/mina-rust/pull/1646))
34+
- *Build** Update Rust to 1.92 [#1894](https://github.com/o1-labs/mina-rust/issues/1894)
3435

3536
### Removed
3637

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,17 @@ format-md: ## Format all markdown and MDX files to wrap at 80 characters
246246

247247
.PHONY: lint
248248
lint: ## Run linter (clippy)
249-
cargo clippy --all-targets -- -D warnings --allow clippy::mutable_key_type
249+
cargo clippy --all-targets -- -D warnings \
250+
--allow clippy::large_enum_variant \
251+
--allow clippy::result-large-err \
252+
--allow unused
250253

251254
.PHONY: lint-beta
252255
lint-beta: ## Run linter (clippy) using beta Rust
253-
cargo +beta clippy --all-targets -- -D warnings --allow clippy::mutable_key_type
256+
cargo +beta clippy --all-targets -- -D warnings \
257+
--allow clippy::large_enum_variant \
258+
--allow clippy::result-large-err \
259+
--allow unused
254260

255261
.PHONY: lint-bash
256262
lint-bash: ## Check all shell scripts using shellcheck

ledger/src/account/account.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ impl VerificationKey {
555555
max_proofs_verified: {
556556
let n: u64 = rng.gen();
557557

558-
if n % 3 == 0 {
558+
if n.is_multiple_of(3) {
559559
ProofVerified::N2
560-
} else if n % 2 == 0 {
560+
} else if n.is_multiple_of(2) {
561561
ProofVerified::N1
562562
} else {
563563
ProofVerified::N0
@@ -568,9 +568,9 @@ impl VerificationKey {
568568
actual_wrap_domain_size: {
569569
let n: u64 = rng.gen();
570570

571-
if n % 3 == 0 {
571+
if n.is_multiple_of(3) {
572572
ProofVerified::N2
573-
} else if n % 2 == 0 {
573+
} else if n.is_multiple_of(2) {
574574
ProofVerified::N1
575575
} else {
576576
ProofVerified::N0
@@ -1648,13 +1648,13 @@ impl Account {
16481648

16491649
let gen_perm = |rng: &mut ThreadRng| {
16501650
let n: u64 = rng.gen();
1651-
if n % 5 == 0 {
1651+
if n.is_multiple_of(5) {
16521652
AuthRequired::Either
1653-
} else if n % 4 == 0 {
1653+
} else if n.is_multiple_of(4) {
16541654
AuthRequired::Impossible
1655-
} else if n % 3 == 0 {
1655+
} else if n.is_multiple_of(3) {
16561656
AuthRequired::None
1657-
} else if n % 2 == 0 {
1657+
} else if n.is_multiple_of(2) {
16581658
AuthRequired::Proof
16591659
} else {
16601660
AuthRequired::Signature

ledger/src/account/common.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ impl Default for TokenPermissions {
246246
// <https://github.com/MinaProtocol/mina/blob/develop/src/lib/mina_base/permissions.mli#L10>
247247
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, strum_macros::Display)]
248248
#[serde(rename_all = "lowercase")]
249+
#[derive(Default)]
249250
pub enum AuthRequired {
251+
#[default]
250252
None,
251253
Either,
252254
Proof,
@@ -255,12 +257,6 @@ pub enum AuthRequired {
255257
Both, // Legacy only
256258
}
257259

258-
impl Default for AuthRequired {
259-
fn default() -> Self {
260-
Self::None
261-
}
262-
}
263-
264260
impl From<ControlTag> for AuthRequired {
265261
/// <https://github.com/MinaProtocol/mina/blob/3753a8593cc1577bcf4da16620daf9946d88e8e5/src/lib/mina_base/permissions.ml#L68>
266262
fn from(value: ControlTag) -> Self {

ledger/src/address/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod raw;
22

33
const fn compute_nbytes(nbits: usize) -> usize {
4-
if nbits % 8 == 0 {
4+
if nbits.is_multiple_of(8) {
55
nbits / 8
66
} else {
77
(nbits / 8) + 1

ledger/src/address/raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<const NBYTES: usize> Address<NBYTES> {
391391
.for_each(|(index, byte)| {
392392
let byte = *byte as u64;
393393

394-
if index == 0 && self.length % 8 != 0 {
394+
if index == 0 && !self.length.is_multiple_of(8) {
395395
let nunused = self.length % 8;
396396
account_index |= byte >> (8 - nunused);
397397
shift += nunused;

ledger/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
#![allow(clippy::len_without_is_empty)]
9898
#![allow(clippy::result_unit_err)]
9999
// #![forbid(clippy::needless_pass_by_ref_mut)]
100+
#![allow(
101+
clippy::mutable_key_type,
102+
reason = "Deep within ValidCommandWithHash (used by TransactionPool) is a MutableFp that should probably be just Fp. Deserialize will not trigger UB. Remove this allow when fixed"
103+
)]
100104

101105
// Unused, we don't want to print on stdout
102106
// /// Print logs on stdout with the prefix `[ledger]`

ledger/src/ondisk/database.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl Database {
256256
/// # Returns
257257
///
258258
/// * `Result<Self>` - Returns an instance of the database if successful, otherwise
259-
/// returns an error.
259+
/// returns an error.
260260
///
261261
/// # Errors
262262
///
@@ -431,7 +431,7 @@ impl Database {
431431
/// # Returns
432432
///
433433
/// * `Result<Option<Box<[u8]>>>` - Returns an optional values if the key exists;
434-
/// otherwise, None. Returns an error if something goes wrong.
434+
/// otherwise, None. Returns an error if something goes wrong.
435435
pub fn get(&mut self, key: &[u8]) -> std::io::Result<Option<Value>> {
436436
// Note: `&mut self` is required for `File::seek`
437437

@@ -537,7 +537,7 @@ impl Database {
537537
/// # Returns
538538
///
539539
/// * `Result<Vec<Option<Box<[u8]>>>>` - Returns a vector of optional values
540-
/// corresponding to each key; if a key is not found, returns None.
540+
/// corresponding to each key; if a key is not found, returns None.
541541
pub fn get_batch<K>(&mut self, keys: K) -> std::io::Result<Vec<Option<Value>>>
542542
where
543543
K: IntoIterator<Item = Key>,

ledger/src/proofs/circuit_blobs.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,9 @@ pub fn fetch_blocking(filename: &impl AsRef<Path>) -> std::io::Result<Vec<u8>> {
137137
}
138138

139139
fn to_io_err(err: impl std::fmt::Display) -> std::io::Error {
140-
std::io::Error::new(
141-
std::io::ErrorKind::Other,
142-
format!(
143-
"failed to find circuit-blobs locally and to fetch the from github! error: {err}"
144-
),
145-
)
140+
std::io::Error::other(format!(
141+
"failed to find circuit-blobs locally and to fetch the from github! error: {err}"
142+
))
146143
}
147144

148145
let home_base_dir = home_base_dir();

0 commit comments

Comments
 (0)