Skip to content

Commit 6f12ef8

Browse files
authored
Merge pull request #833 from sethdusek/rust1.87
Bump rust-toolchain to rust 1.87
2 parents dadd828 + 8142da2 commit 6f12ef8

File tree

17 files changed

+32
-31
lines changed

17 files changed

+32
-31
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ jobs:
238238

239239
- uses: actions-rs/toolchain@v1
240240
with:
241-
toolchain: nightly-2024-11-23
241+
toolchain: nightly-2025-03-28
242242
override: true
243243

244244
- name: install deps

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ tokio-stream = { version = "0.1.8", features = ["sync", "time"] }
8686
tokio-util = { version = "0.6.9", features = ["codec"] }
8787
bounded-integer = { version = "^0.5", features = ["types"] }
8888
url = "2.5.4"
89-
getrandom = { version = "0.2.7" }
89+
getrandom = { version = "0.2.16" }
9090
itertools = { version = "0.10.3", default-features = false }
9191
miette = { version = "5", features = ["fancy"] }
9292
hashbrown = { version = "0.14.3", features = ["serde"] }
9393
core2 = { version = "0.4.0", default-features = false, features = ["alloc"] }
9494
# dev-dependencies
95-
proptest = { version = "1.5.0", default-features = false, features = [
95+
proptest = { version = "=1.6.0", default-features = false, features = [
9696
"alloc",
9797
"std",
9898
] }

bindings/ergo-lib-c-core/src/constant.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ pub unsafe fn constant_to_ergo_box(
178178
let b = constant
179179
.0
180180
.clone()
181-
.try_extract_into::<ergo_lib::ergotree_ir::chain::ergo_box::ErgoBox>()
182-
.map(Into::into)?;
181+
.try_extract_into::<ergo_lib::ergotree_ir::chain::ergo_box::ErgoBox>()?;
183182
*ergo_box_out = Box::into_raw(Box::new(ErgoBox(b)));
184183
Ok(())
185184
}

bindings/ergo-lib-wasm/src/ast/js_conv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub enum ConvError {
4545
#[error("not supported: {0:?}")]
4646
NotSupported(JsValue),
4747
#[error("unexpected constant: {0:?}")]
48-
UnexpectedConst(Constant),
48+
UnexpectedConst(Box<Constant>),
4949
#[error("unexpected js value: {0:?}, expected {1}")]
5050
UnexpectedJs(JsValue, &'static str),
5151
#[error("IO error: {0}")]
@@ -172,7 +172,7 @@ pub(crate) fn constant_to_js(c: Constant) -> Result<JsValue, ConvError> {
172172
}
173173
arr.into()
174174
}
175-
_ => return Err(ConvError::UnexpectedConst(c)),
175+
_ => return Err(ConvError::UnexpectedConst(c.into())),
176176
},
177177
SType::STuple(ref item_tpes) => {
178178
let vec: Vec<JsValue> = match c.v {
@@ -181,15 +181,15 @@ pub(crate) fn constant_to_js(c: Constant) -> Result<JsValue, ConvError> {
181181
.zip(item_tpes.clone().items.into_iter())
182182
.map(|(v, tpe)| constant_to_js(Constant { tpe, v }))
183183
.collect::<Result<Vec<JsValue>, _>>()?,
184-
_ => return Err(ConvError::UnexpectedConst(c.clone())),
184+
_ => return Err(ConvError::UnexpectedConst(c.clone().into())),
185185
};
186186
let arr = Array::new();
187187
for item in vec {
188188
arr.push(&item);
189189
}
190190
arr.into()
191191
}
192-
_ => return Err(ConvError::UnexpectedConst(c.clone())),
192+
_ => return Err(ConvError::UnexpectedConst(c.clone().into())),
193193
})
194194
}
195195

ergo-chain-generation/src/chain_generation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn prove_block(
142142
// Ergo test suite uses randomly generated value for ad_proofs_root.
143143
let mut rng = thread_rng();
144144
let how_many: usize = rng.gen_range(0..5000);
145-
let mut ad_proofs_bytes: Vec<u8> = std::iter::repeat(0_u8).take(how_many).collect();
145+
let mut ad_proofs_bytes: Vec<u8> = vec![0; how_many];
146146
for x in &mut ad_proofs_bytes {
147147
*x = rng.gen();
148148
}

ergo-chain-generation/src/fake_pow_scheme.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ mod tests {
8686
// Ergo test suite uses randomly generated value for ad_proofs_root.
8787
let mut rng = thread_rng();
8888
let how_many: usize = rng.gen_range(0..5000);
89-
let mut ad_proofs_bytes: Vec<u8> = std::iter::repeat(0_u8).take(how_many).collect();
89+
let mut ad_proofs_bytes: Vec<u8> = vec![0; how_many];
9090
for x in &mut ad_proofs_bytes {
9191
*x = rng.gen();
9292
}
@@ -147,7 +147,7 @@ mod tests {
147147
let x = DlogProverInput::random();
148148

149149
let (sk, _) = default_miner_secret();
150-
let nonce: Vec<u8> = std::iter::repeat(0_u8).take(8).collect();
150+
let nonce: Vec<u8> = vec![0; 8];
151151
let d = order_bigint() / (height + 1);
152152
let autolykos_solution = AutolykosSolution {
153153
miner_pk: sk.public_key().unwrap().public_key.into(),

ergo-chain-types/src/autolykos_pow_scheme.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ use crate::Header;
3434
///
3535
/// There are 2 cases to consider:
3636
/// - If `exponent >= 3` then `N` is represented by
37-
/// `(-1^sign) * mantissa * 256^(exponent-3)`
37+
/// `(-1^sign) * mantissa * 256^(exponent-3)`
3838
/// E.g. suppose the compact form is given in hex-format by `0x04123456`. Mantissa is `0x123456`
3939
/// and `exponent == 4`. So `N == 0x123456 * 265^1`. Now note that we need exactly 4 bytes to
4040
/// represent `N`; 3 bytes for the mantissa and 1 byte for the rest. In base-256:
41-
/// `N == B(0x12)B(0x34)B(0x56)0`
41+
/// `N == B(0x12)B(0x34)B(0x56)0`
4242
/// where `B(y)` denotes the base-256 representation of a hex-number `y` (note how each base-256
4343
/// digit is represented by a single-byte).
4444
/// - If `exponent < 3` then `N` is represented by the `exponent`-most-significant-bytes of the
@@ -507,8 +507,8 @@ mod tests {
507507
} else if a.is_zero() || b.is_zero() {
508508
return false;
509509
}
510-
let (exp_a, mantissa_a) = a.iter_u32_digits().enumerate().last().unwrap();
511-
let (exp_b, mantissa_b) = a.iter_u32_digits().enumerate().last().unwrap();
510+
let (exp_a, mantissa_a) = a.iter_u32_digits().enumerate().next_back().unwrap();
511+
let (exp_b, mantissa_b) = a.iter_u32_digits().enumerate().next_back().unwrap();
512512
mantissa_a == mantissa_b && exp_a == exp_b && a.sign() == b.sign()
513513
}
514514

ergo-lib/src/wallet/derivation_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl DerivationPath {
191191
/// Returns an empty path error if the path is empty (master node for example)
192192
pub fn next(&self) -> Result<DerivationPath, DerivationPathError> {
193193
#[allow(clippy::unwrap_used)]
194-
if self.0.len() > 0 {
194+
if !self.0.is_empty() {
195195
let mut new_path = self.0.to_vec();
196196
let last_idx = new_path.len() - 1;
197197
// The bounds have been checked, there is at least one element

ergo-merkle-tree/src/merkleproof.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ impl std::convert::TryFrom<u8> for NodeSide {
2929
}
3030

3131
/// A LevelNode used for MerkleProof verification, consists of a 32 byte hash and side it is on in tree
32-
3332
#[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))]
3433
#[cfg_attr(
3534
feature = "json",

ergo-merkle-tree/src/merkletree.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ impl MerkleTree {
196196
// prepend leaf nodes with empty nodes to build the full tree
197197
tree_nodes.splice(
198198
0..0,
199-
std::iter::repeat(MerkleNode::empty()).take(tree_nodes.len().next_power_of_two() - 1),
199+
std::iter::repeat_n(
200+
MerkleNode::empty(),
201+
tree_nodes.len().next_power_of_two() - 1,
202+
),
200203
);
201204
build_nodes(&mut tree_nodes);
202205
let nodes_len = tree_nodes.len();

0 commit comments

Comments
 (0)