Update Rust Edition to 2024 (#7766)

* #7749

Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
chonghe
2025-08-13 11:04:31 +08:00
committed by GitHub
parent bd6b8b6a65
commit 522bd9e9c6
468 changed files with 3594 additions and 3396 deletions

View File

@@ -1,10 +1,10 @@
use crate::{Error as DirError, ValidatorDir};
use bls::get_withdrawal_credentials;
use deposit_contract::{encode_eth1_tx_data, Error as DepositError};
use deposit_contract::{Error as DepositError, encode_eth1_tx_data};
use eth2_keystore::{Error as KeystoreError, Keystore, KeystoreBuilder, PlainText};
use filesystem::create_with_600_perms;
use rand::{distributions::Alphanumeric, Rng};
use std::fs::{create_dir_all, File};
use rand::{Rng, distr::Alphanumeric};
use std::fs::{File, create_dir_all};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use types::{ChainSpec, DepositData, Hash256, Keypair, Signature};
@@ -314,7 +314,7 @@ pub fn write_password_to_file<P: AsRef<Path>>(path: P, bytes: &[u8]) -> Result<(
/// Generates a random keystore with a random password.
fn random_keystore() -> Result<(Keystore, PlainText), Error> {
let keypair = Keypair::random();
let password: PlainText = rand::thread_rng()
let password: PlainText = rand::rng()
.sample_iter(&Alphanumeric)
.take(DEFAULT_PASSWORD_LEN)
.map(char::from)

View File

@@ -6,8 +6,8 @@
use crate::{Builder, BuilderError};
use eth2_keystore::{
DKLEN, Keystore, KeystoreBuilder, PlainText,
json_keystore::{Kdf, Scrypt},
Keystore, KeystoreBuilder, PlainText, DKLEN,
};
use std::path::PathBuf;
use types::test_utils::generate_deterministic_keypair;

View File

@@ -11,10 +11,10 @@ pub mod insecure_keys;
mod validator_dir;
pub use crate::validator_dir::{
unlock_keypair_from_password_path, Error, Eth1DepositData, ValidatorDir,
ETH1_DEPOSIT_TX_HASH_FILE,
ETH1_DEPOSIT_TX_HASH_FILE, Error, Eth1DepositData, ValidatorDir,
unlock_keypair_from_password_path,
};
pub use builder::{
keystore_password_path, Builder, Error as BuilderError, ETH1_DEPOSIT_DATA_FILE,
VOTING_KEYSTORE_FILE, WITHDRAWAL_KEYSTORE_FILE,
Builder, ETH1_DEPOSIT_DATA_FILE, Error as BuilderError, VOTING_KEYSTORE_FILE,
WITHDRAWAL_KEYSTORE_FILE, keystore_password_path,
};

View File

@@ -1,12 +1,12 @@
use crate::builder::{
keystore_password_path, ETH1_DEPOSIT_AMOUNT_FILE, ETH1_DEPOSIT_DATA_FILE, VOTING_KEYSTORE_FILE,
WITHDRAWAL_KEYSTORE_FILE,
ETH1_DEPOSIT_AMOUNT_FILE, ETH1_DEPOSIT_DATA_FILE, VOTING_KEYSTORE_FILE,
WITHDRAWAL_KEYSTORE_FILE, keystore_password_path,
};
use deposit_contract::decode_eth1_tx_data;
use derivative::Derivative;
use eth2_keystore::{Error as KeystoreError, Keystore, PlainText};
use lockfile::{Lockfile, LockfileError};
use std::fs::{read, write, File};
use std::fs::{File, read, write};
use std::io;
use std::path::{Path, PathBuf};
use tree_hash::TreeHash;