mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
use crate::EthersTransaction;
|
||||
use crate::engine_api::{
|
||||
ExecutionBlock, PayloadAttributes, PayloadId, PayloadStatusV1, PayloadStatusV1Status,
|
||||
json_structures::{
|
||||
JsonForkchoiceUpdatedV1Response, JsonPayloadStatusV1, JsonPayloadStatusV1Status,
|
||||
},
|
||||
ExecutionBlock, PayloadAttributes, PayloadId, PayloadStatusV1, PayloadStatusV1Status,
|
||||
};
|
||||
use crate::engines::ForkchoiceState;
|
||||
use crate::EthersTransaction;
|
||||
use eth2::types::BlobsBundle;
|
||||
use kzg::{Kzg, KzgCommitment, KzgProof};
|
||||
use parking_lot::Mutex;
|
||||
use rand::{rngs::StdRng, Rng, SeedableRng};
|
||||
use rand::{Rng, SeedableRng, rngs::StdRng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz::Decode;
|
||||
use ssz_types::VariableList;
|
||||
@@ -178,7 +178,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
spec: Arc<ChainSpec>,
|
||||
kzg: Option<Arc<Kzg>>,
|
||||
) -> Self {
|
||||
let mut gen = Self {
|
||||
let mut generator = Self {
|
||||
head_block: <_>::default(),
|
||||
finalized_block_hash: <_>::default(),
|
||||
blocks: <_>::default(),
|
||||
@@ -200,9 +200,9 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
spec,
|
||||
};
|
||||
|
||||
gen.insert_pow_block(0).unwrap();
|
||||
generator.insert_pow_block(0).unwrap();
|
||||
|
||||
gen
|
||||
generator
|
||||
}
|
||||
|
||||
pub fn latest_block(&self) -> Option<Block<E>> {
|
||||
@@ -509,10 +509,10 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
// This is meant to cover starting post-merge transition at genesis. Useful for
|
||||
// testing Capella forks and later.
|
||||
let head_block_hash = forkchoice_state.head_block_hash;
|
||||
if let Some(genesis_pow_block) = self.block_by_number(0) {
|
||||
if genesis_pow_block.block_hash() == head_block_hash {
|
||||
self.terminal_block_hash = head_block_hash;
|
||||
}
|
||||
if let Some(genesis_pow_block) = self.block_by_number(0)
|
||||
&& genesis_pow_block.block_hash() == head_block_hash
|
||||
{
|
||||
self.terminal_block_hash = head_block_hash;
|
||||
}
|
||||
|
||||
if let Some(payload) = self.pending_payloads.remove(&head_block_hash) {
|
||||
@@ -711,7 +711,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
// TODO(EIP-7892): see FIXME below
|
||||
// FIXME: this will break with BPO forks. This function needs to calculate the epoch based on block timestamp..
|
||||
let max_blobs = self.spec.max_blobs_per_block_within_fork(fork_name) as usize;
|
||||
let num_blobs = rng.gen_range(self.min_blobs_count..=max_blobs);
|
||||
let num_blobs = rng.random_range(self.min_blobs_count..=max_blobs);
|
||||
let (bundle, transactions) = generate_blobs(num_blobs, fork_name)?;
|
||||
for tx in Vec::from(transactions) {
|
||||
execution_payload
|
||||
@@ -753,8 +753,8 @@ pub fn load_test_blobs_bundle_v1<E: EthSpec>() -> Result<(KzgCommitment, KzgProo
|
||||
))
|
||||
}
|
||||
|
||||
pub fn load_test_blobs_bundle_v2<E: EthSpec>(
|
||||
) -> Result<(KzgCommitment, KzgProofs<E>, Blob<E>), String> {
|
||||
pub fn load_test_blobs_bundle_v2<E: EthSpec>()
|
||||
-> Result<(KzgCommitment, KzgProofs<E>, Blob<E>), String> {
|
||||
let BlobsBundle::<E> {
|
||||
commitments,
|
||||
proofs,
|
||||
@@ -937,7 +937,7 @@ pub fn generate_pow_block(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use kzg::{trusted_setup::get_trusted_setup, Bytes48, CellRef, KzgBlobRef, TrustedSetup};
|
||||
use kzg::{Bytes48, CellRef, KzgBlobRef, TrustedSetup, trusted_setup::get_trusted_setup};
|
||||
use types::{MainnetEthSpec, MinimalEthSpec};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::Context;
|
||||
use crate::engine_api::{http::*, *};
|
||||
use crate::json_structures::*;
|
||||
use crate::test_utils::{DEFAULT_CLIENT_VERSION, DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI};
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use serde::{Deserialize, de::DeserializeOwned};
|
||||
use serde_json::Value as JsonValue;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ use eth2::types::{
|
||||
ProposerData, StateId, ValidatorId,
|
||||
};
|
||||
use eth2::{
|
||||
BeaconNodeHttpClient, Timeouts, CONSENSUS_VERSION_HEADER, CONTENT_TYPE_HEADER,
|
||||
SSZ_CONTENT_TYPE_HEADER,
|
||||
BeaconNodeHttpClient, CONSENSUS_VERSION_HEADER, CONTENT_TYPE_HEADER, SSZ_CONTENT_TYPE_HEADER,
|
||||
Timeouts,
|
||||
};
|
||||
use fork_choice::ForkchoiceUpdateParameters;
|
||||
use parking_lot::RwLock;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
test_utils::{
|
||||
MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, DEFAULT_TERMINAL_DIFFICULTY,
|
||||
DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, DEFAULT_TERMINAL_DIFFICULTY, MockServer,
|
||||
},
|
||||
*,
|
||||
};
|
||||
@@ -168,10 +168,11 @@ impl<E: EthSpec> MockExecutionLayer<E> {
|
||||
assert_eq!(payload.prev_randao(), prev_randao);
|
||||
|
||||
// Ensure the payload cache is empty.
|
||||
assert!(self
|
||||
.el
|
||||
.get_payload_by_root(&payload.tree_hash_root())
|
||||
.is_none());
|
||||
assert!(
|
||||
self.el
|
||||
.get_payload_by_root(&payload.tree_hash_root())
|
||||
.is_none()
|
||||
);
|
||||
let builder_params = BuilderParams {
|
||||
pubkey: PublicKeyBytes::empty(),
|
||||
slot,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::engine_api::auth::JwtKey;
|
||||
use crate::engine_api::{
|
||||
auth::Auth, http::JSONRPC_VERSION, ExecutionBlock, PayloadStatusV1, PayloadStatusV1Status,
|
||||
ExecutionBlock, PayloadStatusV1, PayloadStatusV1Status, auth::Auth, http::JSONRPC_VERSION,
|
||||
};
|
||||
use crate::json_structures::JsonClientVersionV1;
|
||||
use bytes::Bytes;
|
||||
@@ -23,16 +23,16 @@ use std::sync::{Arc, LazyLock};
|
||||
use tokio::{runtime, sync::oneshot};
|
||||
use tracing::info;
|
||||
use types::{ChainSpec, EthSpec, ExecutionBlockHash, Uint256};
|
||||
use warp::{http::StatusCode, Filter, Rejection};
|
||||
use warp::{Filter, Rejection, http::StatusCode};
|
||||
|
||||
use crate::EngineCapabilities;
|
||||
pub use execution_block_generator::DEFAULT_GAS_LIMIT;
|
||||
pub use execution_block_generator::{
|
||||
generate_blobs, generate_genesis_block, generate_genesis_header, generate_pow_block,
|
||||
mock_el_extra_data, static_valid_tx, Block, ExecutionBlockGenerator,
|
||||
Block, ExecutionBlockGenerator, generate_blobs, generate_genesis_block,
|
||||
generate_genesis_header, generate_pow_block, mock_el_extra_data, static_valid_tx,
|
||||
};
|
||||
pub use hook::Hook;
|
||||
pub use mock_builder::{mock_builder_extra_data, MockBuilder, Operation};
|
||||
pub use mock_builder::{MockBuilder, Operation, mock_builder_extra_data};
|
||||
pub use mock_execution_layer::MockExecutionLayer;
|
||||
|
||||
pub const DEFAULT_TERMINAL_DIFFICULTY: u64 = 6400;
|
||||
|
||||
Reference in New Issue
Block a user