mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-03 17:40:34 +00:00
November 2023 - Rust Nightly Update (#413)
* Update nightly * Replace .get(0) with .first() * allow new clippy lint --------- Co-authored-by: GitHub Actions <> Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
parent
ae449535ff
commit
a2089c61fb
11 changed files with 15 additions and 13 deletions
2
.github/nightly-version
vendored
2
.github/nightly-version
vendored
|
@ -1 +1 @@
|
||||||
nightly-2023-10-01
|
nightly-2023-11-01
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub struct Block {
|
||||||
|
|
||||||
impl Block {
|
impl Block {
|
||||||
pub fn number(&self) -> usize {
|
pub fn number(&self) -> usize {
|
||||||
match self.miner_tx.prefix.inputs.get(0) {
|
match self.miner_tx.prefix.inputs.first() {
|
||||||
Some(Input::Gen(number)) => (*number).try_into().unwrap(),
|
Some(Input::Gen(number)) => (*number).try_into().unwrap(),
|
||||||
_ => panic!("invalid block, miner TX didn't have a Input::Gen"),
|
_ => panic!("invalid block, miner TX didn't have a Input::Gen"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,7 @@ impl RctSignatures {
|
||||||
self
|
self
|
||||||
.base
|
.base
|
||||||
.encrypted_amounts
|
.encrypted_amounts
|
||||||
.get(0)
|
.first()
|
||||||
.expect("MLSAG with Bulletproofs didn't have any outputs"),
|
.expect("MLSAG with Bulletproofs didn't have any outputs"),
|
||||||
EncryptedAmount::Original { .. }
|
EncryptedAmount::Original { .. }
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -247,7 +247,7 @@ impl<R: RpcConnection> Rpc<R> {
|
||||||
|
|
||||||
// https://github.com/monero-project/monero/issues/8311
|
// https://github.com/monero-project/monero/issues/8311
|
||||||
if res.as_hex.is_empty() {
|
if res.as_hex.is_empty() {
|
||||||
match tx.prefix.inputs.get(0) {
|
match tx.prefix.inputs.first() {
|
||||||
Some(Input::Gen { .. }) => (),
|
Some(Input::Gen { .. }) => (),
|
||||||
_ => Err(RpcError::PrunedTransaction)?,
|
_ => Err(RpcError::PrunedTransaction)?,
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ impl<R: RpcConnection> Rpc<R> {
|
||||||
match self.get_block(self.get_block_hash(number).await?).await {
|
match self.get_block(self.get_block_hash(number).await?).await {
|
||||||
Ok(block) => {
|
Ok(block) => {
|
||||||
// Make sure this is actually the block for this number
|
// Make sure this is actually the block for this number
|
||||||
match block.miner_tx.prefix.inputs.get(0) {
|
match block.miner_tx.prefix.inputs.first() {
|
||||||
Some(Input::Gen(actual)) => {
|
Some(Input::Gen(actual)) => {
|
||||||
if usize::try_from(*actual).unwrap() == number {
|
if usize::try_from(*actual).unwrap() == number {
|
||||||
Ok(block)
|
Ok(block)
|
||||||
|
@ -467,7 +467,7 @@ impl<R: RpcConnection> Rpc<R> {
|
||||||
}
|
}
|
||||||
b"status" => {
|
b"status" => {
|
||||||
if bytes_res
|
if bytes_res
|
||||||
.get(0)
|
.first()
|
||||||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "status wasn't a string"))?
|
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "status wasn't a string"))?
|
||||||
.as_slice() !=
|
.as_slice() !=
|
||||||
b"OK"
|
b"OK"
|
||||||
|
|
|
@ -493,8 +493,9 @@ impl Scanner {
|
||||||
.iter()
|
.iter()
|
||||||
// Filter to v2 miner TX outputs/RCT outputs since we're tracking the RCT output index
|
// Filter to v2 miner TX outputs/RCT outputs since we're tracking the RCT output index
|
||||||
.filter(|output| {
|
.filter(|output| {
|
||||||
((tx.prefix.version == 2) && matches!(tx.prefix.inputs.get(0), Some(Input::Gen(..)))) ||
|
let is_v2_miner_tx =
|
||||||
output.amount.is_none()
|
(tx.prefix.version == 2) && matches!(tx.prefix.inputs.first(), Some(Input::Gen(..)));
|
||||||
|
is_v2_miner_tx || output.amount.is_none()
|
||||||
})
|
})
|
||||||
.count(),
|
.count(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -392,7 +392,7 @@ impl ReadWrite for Transaction {
|
||||||
// is impossible since we'll only read up to u16::MAX items.
|
// is impossible since we'll only read up to u16::MAX items.
|
||||||
writer.write_all(&u16::try_from(shares.len()).unwrap().to_le_bytes())?;
|
writer.write_all(&u16::try_from(shares.len()).unwrap().to_le_bytes())?;
|
||||||
|
|
||||||
let share_len = shares.get(0).map(|share| share.len()).unwrap_or(0);
|
let share_len = shares.first().map(|share| share.len()).unwrap_or(0);
|
||||||
// For BLS12-381 G2, this would be:
|
// For BLS12-381 G2, this would be:
|
||||||
// - A 32-byte share
|
// - A 32-byte share
|
||||||
// - A 96-byte ephemeral key
|
// - A 96-byte ephemeral key
|
||||||
|
|
|
@ -33,5 +33,5 @@ pub(crate) fn merkle(hash_args: &[[u8; 32]]) -> [u8; 32] {
|
||||||
hashes = interim;
|
hashes = interim;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashes.get(0).copied().map(Into::into).unwrap_or(zero)
|
hashes.first().copied().map(Into::into).unwrap_or(zero)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
slice
|
slice
|
||||||
.get(0)
|
.first()
|
||||||
.filter(|(_, value)| !bool::from(multiexp_vartime(value).is_identity()))
|
.filter(|(_, value)| !bool::from(multiexp_vartime(value).is_identity()))
|
||||||
.map(|(id, _)| *id)
|
.map(|(id, _)| *id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ impl<D: Db, N: Network> MultisigManager<D, N> {
|
||||||
(
|
(
|
||||||
MultisigManager {
|
MultisigManager {
|
||||||
scanner,
|
scanner,
|
||||||
existing: current_keys.get(0).cloned().map(|(activation_block, key)| MultisigViewer {
|
existing: current_keys.first().cloned().map(|(activation_block, key)| MultisigViewer {
|
||||||
activation_block,
|
activation_block,
|
||||||
key,
|
key,
|
||||||
scheduler: schedulers.remove(0),
|
scheduler: schedulers.remove(0),
|
||||||
|
|
|
@ -470,7 +470,7 @@ impl Network for Monero {
|
||||||
let mut outputs = Vec::with_capacity(txs.len());
|
let mut outputs = Vec::with_capacity(txs.len());
|
||||||
for mut tx_outputs in txs.drain(..) {
|
for mut tx_outputs in txs.drain(..) {
|
||||||
for output in tx_outputs.drain(..) {
|
for output in tx_outputs.drain(..) {
|
||||||
let mut data = output.arbitrary_data().get(0).cloned().unwrap_or(vec![]);
|
let mut data = output.arbitrary_data().first().cloned().unwrap_or(vec![]);
|
||||||
|
|
||||||
// The Output serialization code above uses u16 to represent length
|
// The Output serialization code above uses u16 to represent length
|
||||||
data.truncate(u16::MAX.into());
|
data.truncate(u16::MAX.into());
|
||||||
|
|
|
@ -13,6 +13,7 @@ mod batch;
|
||||||
pub use batch::batch;
|
pub use batch::batch;
|
||||||
|
|
||||||
mod sign;
|
mod sign;
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub use sign::sign;
|
pub use sign::sign;
|
||||||
|
|
||||||
pub(crate) const COORDINATORS: usize = 4;
|
pub(crate) const COORDINATORS: usize = 4;
|
||||||
|
|
Loading…
Reference in a new issue