Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes

This commit is contained in:
realbigsean
2024-06-17 15:08:36 -04:00
47 changed files with 258 additions and 144 deletions

View File

@@ -10,7 +10,6 @@ use crate::block_verification::{
use crate::kzg_utils::{validate_blob, validate_blobs};
use crate::{metrics, BeaconChainError};
use kzg::{Error as KzgError, Kzg, KzgCommitment};
use merkle_proof::MerkleTreeError;
use slog::debug;
use ssz_derive::{Decode, Encode};
use ssz_types::VariableList;
@@ -128,13 +127,6 @@ pub enum GossipBlobError<E: EthSpec> {
/// The blob sidecar is invalid and the peer is faulty.
KzgError(kzg::Error),
/// The kzg commitment inclusion proof failed.
///
/// ## Peer scoring
///
/// The blob sidecar is invalid
InclusionProof(MerkleTreeError),
/// The pubkey cache timed out.
///
/// ## Peer scoring
@@ -459,10 +451,7 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes>(
// Verify the inclusion proof in the sidecar
let _timer = metrics::start_timer(&metrics::BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION);
if !blob_sidecar
.verify_blob_sidecar_inclusion_proof()
.map_err(GossipBlobError::InclusionProof)?
{
if !blob_sidecar.verify_blob_sidecar_inclusion_proof() {
return Err(GossipBlobError::InvalidInclusionProof);
}
drop(_timer);

View File

@@ -1,5 +1,3 @@
extern crate slog;
mod compute_light_client_updates;
pub mod config;
mod metrics;

View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
mod block_cache;
mod deposit_cache;
mod inner;

View File

@@ -1,5 +1,7 @@
pub use lighthouse_metrics::*;
use lazy_static::lazy_static;
lazy_static! {
/*
* Eth1 blocks

View File

@@ -1985,39 +1985,10 @@ impl<E: EthSpec> ExecutionLayer<E> {
excess_blob_gas: deneb_block.excess_blob_gas,
})
}
ExecutionBlockWithTransactions::Electra(electra_block) => {
let withdrawals = VariableList::new(
electra_block
.withdrawals
.into_iter()
.map(Into::into)
.collect(),
)
.map_err(ApiError::DeserializeWithdrawals)?;
ExecutionPayload::Electra(ExecutionPayloadElectra {
parent_hash: electra_block.parent_hash,
fee_recipient: electra_block.fee_recipient,
state_root: electra_block.state_root,
receipts_root: electra_block.receipts_root,
logs_bloom: electra_block.logs_bloom,
prev_randao: electra_block.prev_randao,
block_number: electra_block.block_number,
gas_limit: electra_block.gas_limit,
gas_used: electra_block.gas_used,
timestamp: electra_block.timestamp,
extra_data: electra_block.extra_data,
base_fee_per_gas: electra_block.base_fee_per_gas,
block_hash: electra_block.block_hash,
transactions: convert_transactions(electra_block.transactions)?,
withdrawals,
blob_gas_used: electra_block.blob_gas_used,
excess_blob_gas: electra_block.excess_blob_gas,
// TODO(electra)
// deposit_receipts: electra_block.deposit_receipts,
// withdrawal_requests: electra_block.withdrawal_requests,
deposit_receipts: <_>::default(),
withdrawal_requests: <_>::default(),
})
ExecutionBlockWithTransactions::Electra(_) => {
return Err(ApiError::UnsupportedForkVariant(format!(
"legacy payload construction for {fork} is not implemented"
)));
}
};

View File

@@ -1,5 +1,3 @@
extern crate alloy_consensus;
extern crate alloy_rlp;
use alloy_consensus::TxEnvelope;
use alloy_rlp::Decodable;
use types::{EthSpec, ExecutionPayloadRef, Hash256, Unsigned, VersionedHash};

View File

@@ -2,9 +2,6 @@
/// all required libp2p functionality.
///
/// This crate builds and manages the libp2p services required by the beacon node.
#[macro_use]
extern crate lazy_static;
mod config;
pub mod service;

View File

@@ -1,5 +1,7 @@
pub use lighthouse_metrics::*;
use lazy_static::lazy_static;
lazy_static! {
pub static ref NAT_OPEN: Result<IntGaugeVec> = try_create_int_gauge_vec(
"nat_open",

View File

@@ -6,6 +6,7 @@
//!
//! The scoring algorithms are currently experimental.
use crate::service::gossipsub_scoring_parameters::GREYLIST_THRESHOLD as GOSSIPSUB_GREYLIST_THRESHOLD;
use lazy_static::lazy_static;
use serde::Serialize;
use std::time::Instant;
use strum::AsRefStr;

View File

@@ -3,6 +3,7 @@ use crate::rpc::codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCode
use futures::future::BoxFuture;
use futures::prelude::{AsyncRead, AsyncWrite};
use futures::{FutureExt, StreamExt};
use lazy_static::lazy_static;
use libp2p::core::{InboundUpgrade, UpgradeInfo};
use ssz::Encode;
use ssz_types::VariableList;

View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
/// This crate provides the network server for Lighthouse.
pub mod error;
#[allow(clippy::mutable_key_type)] // PeerId in hashmaps are no longer permitted by clippy

View File

@@ -5,6 +5,7 @@ use beacon_chain::{
sync_committee_verification::Error as SyncCommitteeError,
};
use fnv::FnvHashMap;
use lazy_static::lazy_static;
pub use lighthouse_metrics::*;
use lighthouse_network::{
peer_manager::peerdb::client::ClientKind, types::GossipKind, GossipTopic, Gossipsub,

View File

@@ -695,7 +695,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
| GossipBlobError::InvalidSubnet { .. }
| GossipBlobError::InvalidInclusionProof
| GossipBlobError::KzgError(_)
| GossipBlobError::InclusionProof(_)
| GossipBlobError::NotFinalizedDescendant { .. } => {
warn!(
self.log,

View File

@@ -120,7 +120,7 @@ impl<E: EthSpec> ActiveBlobsByRootRequest<E> {
if self.request.block_root != block_root {
return Err(LookupVerifyError::UnrequestedBlockRoot(block_root));
}
if !blob.verify_blob_sidecar_inclusion_proof().unwrap_or(false) {
if !blob.verify_blob_sidecar_inclusion_proof() {
return Err(LookupVerifyError::InvalidInclusionProof);
}
if !self.request.indices.contains(&blob.index) {

View File

@@ -1,5 +1,3 @@
extern crate clap;
mod cli;
mod config;

View File

@@ -7,9 +7,6 @@
//!
//! Provides a simple API for storing/retrieving all types that sometimes needs type-hints. See
//! tests for implementation examples.
#[macro_use]
extern crate lazy_static;
mod chunk_writer;
pub mod chunked_iter;
pub mod chunked_vector;

View File

@@ -1,6 +1,7 @@
pub use lighthouse_metrics::{set_gauge, try_create_int_gauge, *};
use directory::size_of_dir;
use lazy_static::lazy_static;
use std::path::Path;
lazy_static! {

View File

@@ -133,7 +133,6 @@ where
#[superstruct(only(Electra))]
pub earliest_consolidation_epoch: Epoch,
// TODO(electra) should these be optional?
#[superstruct(only(Electra))]
pub pending_balance_deposits: List<PendingBalanceDeposit, E::PendingBalanceDepositsLimit>,
#[superstruct(only(Electra))]