Merge remote-tracking branch 'origin/unstable' into tree-states

This commit is contained in:
Michael Sproul
2023-10-19 12:07:35 +11:00
189 changed files with 1475 additions and 951 deletions

View File

@@ -13,7 +13,6 @@ eth2_keystore = { workspace = true }
filesystem = { workspace = true }
zeroize = { workspace = true }
serde = { workspace = true }
serde_derive = "1.0.116"
serde_yaml = { workspace = true }
slog = { workspace = true }
types = { workspace = true }

View File

@@ -8,7 +8,7 @@ use eth2_wallet::{
};
use filesystem::{create_with_600_perms, Error as FsError};
use rand::{distributions::Alphanumeric, Rng};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use std::fs::{self, File};
use std::io;
use std::io::prelude::*;

View File

@@ -9,7 +9,7 @@ use crate::{
use directory::ensure_dir_exists;
use eth2_keystore::Keystore;
use regex::Regex;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use slog::{error, Logger};
use std::collections::HashSet;
use std::fs::{self, File};

View File

@@ -7,7 +7,7 @@ use mediatype::{names, MediaType, MediaTypeList};
use serde::{Deserialize, Deserializer, Serialize};
use serde_json::Value;
use ssz::{Decode, DecodeError};
use ssz_derive::Encode;
use ssz_derive::{Decode, Encode};
use std::convert::TryFrom;
use std::fmt::{self, Display};
use std::str::{from_utf8, FromStr};
@@ -888,6 +888,28 @@ pub struct SseBlock {
pub execution_optimistic: bool,
}
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
pub struct SseBlobSidecar {
pub block_root: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
pub index: u64,
pub slot: Slot,
pub kzg_commitment: KzgCommitment,
pub versioned_hash: VersionedHash,
}
impl SseBlobSidecar {
pub fn from_blob_sidecar<E: EthSpec>(blob_sidecar: &BlobSidecar<E>) -> SseBlobSidecar {
SseBlobSidecar {
block_root: blob_sidecar.block_root,
index: blob_sidecar.index,
slot: blob_sidecar.slot,
kzg_commitment: blob_sidecar.kzg_commitment,
versioned_hash: blob_sidecar.kzg_commitment.calculate_versioned_hash(),
}
}
}
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
pub struct SseFinalizedCheckpoint {
pub block: Hash256,
@@ -1019,6 +1041,7 @@ impl ForkVersionDeserialize for SseExtendedPayloadAttributes {
pub enum EventKind<T: EthSpec> {
Attestation(Box<Attestation<T>>),
Block(SseBlock),
BlobSidecar(SseBlobSidecar),
FinalizedCheckpoint(SseFinalizedCheckpoint),
Head(SseHead),
VoluntaryExit(SignedVoluntaryExit),
@@ -1035,6 +1058,7 @@ impl<T: EthSpec> EventKind<T> {
match self {
EventKind::Head(_) => "head",
EventKind::Block(_) => "block",
EventKind::BlobSidecar(_) => "blob_sidecar",
EventKind::Attestation(_) => "attestation",
EventKind::VoluntaryExit(_) => "voluntary_exit",
EventKind::FinalizedCheckpoint(_) => "finalized_checkpoint",
@@ -1072,6 +1096,9 @@ impl<T: EthSpec> EventKind<T> {
"block" => Ok(EventKind::Block(serde_json::from_str(data).map_err(
|e| ServerError::InvalidServerSentEvent(format!("Block: {:?}", e)),
)?)),
"blob_sidecar" => Ok(EventKind::BlobSidecar(serde_json::from_str(data).map_err(
|e| ServerError::InvalidServerSentEvent(format!("Blob Sidecar: {:?}", e)),
)?)),
"chain_reorg" => Ok(EventKind::ChainReorg(serde_json::from_str(data).map_err(
|e| ServerError::InvalidServerSentEvent(format!("Chain Reorg: {:?}", e)),
)?)),
@@ -1124,6 +1151,7 @@ pub struct EventQuery {
pub enum EventTopic {
Head,
Block,
BlobSidecar,
Attestation,
VoluntaryExit,
FinalizedCheckpoint,
@@ -1142,6 +1170,7 @@ impl FromStr for EventTopic {
match s {
"head" => Ok(EventTopic::Head),
"block" => Ok(EventTopic::Block),
"blob_sidecar" => Ok(EventTopic::BlobSidecar),
"attestation" => Ok(EventTopic::Attestation),
"voluntary_exit" => Ok(EventTopic::VoluntaryExit),
"finalized_checkpoint" => Ok(EventTopic::FinalizedCheckpoint),
@@ -1161,6 +1190,7 @@ impl fmt::Display for EventTopic {
match self {
EventTopic::Head => write!(f, "head"),
EventTopic::Block => write!(f, "block"),
EventTopic::BlobSidecar => write!(f, "blob_sidecar"),
EventTopic::Attestation => write!(f, "attestation"),
EventTopic::VoluntaryExit => write!(f, "voluntary_exit"),
EventTopic::FinalizedCheckpoint => write!(f, "finalized_checkpoint"),
@@ -1983,7 +2013,7 @@ pub struct ExecutionPayloadAndBlobs<E: EthSpec> {
pub blobs_bundle: BlobsBundle<E>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Encode)]
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Encode, Decode)]
#[serde(bound = "E: EthSpec")]
pub struct BlobsBundle<E: EthSpec> {
pub commitments: KzgCommitments<E>,

View File

@@ -13,7 +13,6 @@ ethereum_hashing = { workspace = true }
hex = { workspace = true }
serde_yaml = { workspace = true }
serde = { workspace = true }
serde_derive = "1.0.116"
bls = { workspace = true }
[dev-dependencies]

View File

@@ -22,7 +22,7 @@ extern crate lazy_static;
use bls::{Keypair, PublicKey, SecretKey};
use ethereum_hashing::hash;
use num_bigint::BigUint;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use std::fs::File;
use std::path::PathBuf;

View File

@@ -12,7 +12,6 @@ task_executor = { workspace = true }
tokio = { workspace = true }
eth2 = { workspace = true }
serde_json = { workspace = true }
serde_derive = "1.0.116"
serde = { workspace = true }
lighthouse_version = { workspace = true }
lighthouse_metrics = { workspace = true }

View File

@@ -1,7 +1,7 @@
use std::time::{SystemTime, UNIX_EPOCH};
use eth2::lighthouse::{ProcessHealth, SystemHealth};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
pub const VERSION: u64 = 1;
pub const CLIENT_NAME: &str = "lighthouse";

View File

@@ -8,6 +8,5 @@ lighthouse_network = { workspace = true }
types = { workspace = true }
sysinfo = { workspace = true }
serde = { workspace = true }
serde_derive = "1.0.116"
serde_json = { workspace = true }
parking_lot = { workspace = true }