Log block import source (#5738)

* the default target peers is 100

* add some comments

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into track-block-import-source

* add block import source

* revert

* update logging text

* fix tests

* lint

* use % instaed of to_string
This commit is contained in:
Eitan Seri-Levi
2024-05-15 12:17:06 +03:00
committed by GitHub
parent 6f45ad4534
commit 6636167503
12 changed files with 74 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ use derivative::Derivative;
use serde::{Deserialize, Serialize};
use ssz::{Decode, DecodeError};
use ssz_derive::{Decode, Encode};
use std::fmt;
use std::marker::PhantomData;
use superstruct::superstruct;
use test_random_derive::TestRandom;
@@ -836,6 +837,23 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> ForkVersionDeserialize
))
}
}
pub enum BlockImportSource {
Gossip,
Lookup,
RangeSync,
HttpApi,
}
impl fmt::Display for BlockImportSource {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
BlockImportSource::Gossip => write!(f, "gossip"),
BlockImportSource::Lookup => write!(f, "lookup"),
BlockImportSource::RangeSync => write!(f, "range_sync"),
BlockImportSource::HttpApi => write!(f, "http_api"),
}
}
}
#[cfg(test)]
mod tests {

View File

@@ -122,7 +122,7 @@ pub use crate::attester_slashing::AttesterSlashing;
pub use crate::beacon_block::{
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockCapella,
BeaconBlockDeneb, BeaconBlockElectra, BeaconBlockRef, BeaconBlockRefMut, BlindedBeaconBlock,
EmptyBlock,
BlockImportSource, EmptyBlock,
};
pub use crate::beacon_block_body::{
BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyBellatrix,