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

This commit is contained in:
Michael Sproul
2022-03-01 16:03:41 +11:00
209 changed files with 6107 additions and 1362 deletions

View File

@@ -2,7 +2,7 @@
name = "account_utils"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "clap_utils"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -31,7 +31,7 @@ pub fn get_eth2_network_config(cli_args: &ArgMatches) -> Result<Eth2NetworkConfi
if let Some(string) = parse_optional::<String>(cli_args, "terminal-total-difficulty-override")?
{
let stripped = string.replace(",", "");
let stripped = string.replace(',', "");
let terminal_total_difficulty = Uint256::from_dec_str(&stripped).map_err(|e| {
format!(
"Could not parse --terminal-total-difficulty-override as decimal value: {:?}",

View File

@@ -2,7 +2,7 @@
name = "compare_fields"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
[dev-dependencies]
compare_fields_derive = { path = "../compare_fields_derive" }

View File

@@ -2,7 +2,7 @@
name = "compare_fields_derive"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
[lib]
proc-macro = true

View File

@@ -8,7 +8,7 @@ use syn::{parse_macro_input, DeriveInput};
fn is_slice(field: &syn::Field) -> bool {
field.attrs.iter().any(|attr| {
attr.path.is_ident("compare_fields")
&& attr.tokens.to_string().replace(" ", "") == "(as_slice)"
&& attr.tokens.to_string().replace(' ', "") == "(as_slice)"
})
}

View File

@@ -2,7 +2,7 @@
name = "deposit_contract"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
build = "build.rs"

View File

@@ -2,7 +2,7 @@
name = "directory"
version = "0.1.0"
authors = ["pawan <pawandhananjay@gmail.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "eth2"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,6 +1,7 @@
//! This module contains endpoints that are non-standard and only available on Lighthouse servers.
mod attestation_performance;
mod block_packing_efficiency;
mod block_rewards;
use crate::{
@@ -18,6 +19,9 @@ use store::{AnchorInfo, Split};
pub use attestation_performance::{
AttestationPerformance, AttestationPerformanceQuery, AttestationPerformanceStatistics,
};
pub use block_packing_efficiency::{
BlockPackingEfficiency, BlockPackingEfficiencyQuery, ProposerInfo, UniqueAttestation,
};
pub use block_rewards::{AttestationRewards, BlockReward, BlockRewardMeta, BlockRewardsQuery};
pub use lighthouse_network::{types::SyncState, PeerInfo};

View File

@@ -0,0 +1,34 @@
use serde::{Deserialize, Serialize};
use types::{Epoch, Hash256, Slot};
type CommitteePosition = usize;
type Committee = u64;
type ValidatorIndex = u64;
#[derive(Debug, Default, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)]
pub struct UniqueAttestation {
pub slot: Slot,
pub committee_index: Committee,
pub committee_position: CommitteePosition,
}
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
pub struct ProposerInfo {
pub validator_index: ValidatorIndex,
pub graffiti: String,
}
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
pub struct BlockPackingEfficiency {
pub slot: Slot,
pub block_hash: Hash256,
pub proposer_info: ProposerInfo,
pub available_attestations: usize,
pub included_attestations: usize,
pub prior_skip_slots: u64,
}
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
pub struct BlockPackingEfficiencyQuery {
pub start_epoch: Epoch,
pub end_epoch: Epoch,
}

View File

@@ -2,7 +2,7 @@
name = "eth2_config"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
[dependencies]
types = { path = "../../consensus/types" }

View File

@@ -2,7 +2,7 @@
name = "eth2_interop_keypairs"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "eth2_network_config"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
build = "build.rs"

View File

@@ -1,6 +1,7 @@
# Gnosis Beacon Chain config
# Extends the gnosis preset
CONFIG_NAME: 'gnosis'
PRESET_BASE: 'gnosis'
# Transition

View File

@@ -1,6 +1,7 @@
# Mainnet config
# Extends the mainnet preset
CONFIG_NAME: 'mainnet'
PRESET_BASE: 'mainnet'
# Transition

View File

@@ -1,6 +1,7 @@
# Prater config
# Extends the mainnet preset
CONFIG_NAME: 'prater'
PRESET_BASE: 'mainnet'
# Transition

View File

@@ -275,6 +275,7 @@ mod tests {
"{:?}",
net.name
);
assert_eq!(config.config.config_name, Some(net.name.to_string()));
}
}

View File

@@ -2,7 +2,7 @@
name = "eth2_wallet_manager"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "fallback"
version = "0.1.0"
authors = ["blacktemplar <blacktemplar@a1.net>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "filesystem"
version = "0.1.0"
authors = ["Mark Mackey <mark@sigmaprime.io>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "hashset_delay"
version = "0.2.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dependencies]
futures = "0.3.7"

View File

@@ -2,7 +2,7 @@
name = "lighthouse_metrics"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "lighthouse_version"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "lockfile"
version = "0.1.0"
authors = ["Michael Sproul <michael@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dependencies]
fs2 = "0.4.3"

View File

@@ -2,7 +2,7 @@
name = "logging"
version = "0.2.0"
authors = ["blacktemplar <blacktemplar@a1.net>"]
edition = "2018"
edition = "2021"
[features]
test_logger = [] # Print log output to stderr when running tests instead of dropping it

View File

@@ -3,13 +3,11 @@ use std::process::Command;
use std::process::Output;
fn run_cmd(cmd_line: &str) -> Result<Output, std::io::Error> {
let output;
if cfg!(target_os = "windows") {
output = Command::new(r#"cmd"#).args(["/C", cmd_line]).output();
Command::new(r#"cmd"#).args(["/C", cmd_line]).output()
} else {
output = Command::new(r#"sh"#).args(["-c", cmd_line]).output();
Command::new(r#"sh"#).args(["-c", cmd_line]).output()
}
output
}
#[test]

View File

@@ -2,7 +2,7 @@
name = "lru_cache"
version = "0.1.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dependencies]
fnv = "1.0.7"

View File

@@ -2,7 +2,7 @@
name = "malloc_utils"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "monitoring_api"
version = "0.1.0"
authors = ["pawan <pawandhananjay@gmail.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "sensitive_url"
version = "0.1.0"
authors = ["Mac L <mjladson@pm.me>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "slot_clock"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
[dependencies]
types = { path = "../../consensus/types" }

View File

@@ -2,7 +2,7 @@
name = "target_check"
version = "0.1.0"
authors = ["Michael Sproul <michael@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dependencies]
static_assertions = "1.1.0"

View File

@@ -2,7 +2,7 @@
name = "task_executor"
version = "0.1.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dependencies]
tokio = { version = "1.14.0", features = ["rt"] }

View File

@@ -7,7 +7,7 @@ use std::sync::Weak;
use tokio::runtime::Runtime;
/// Provides a reason when Lighthouse is shut down.
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ShutdownReason {
/// The node shut down successfully.
Success(&'static str),

View File

@@ -2,7 +2,7 @@
name = "test_random_derive"
version = "0.2.0"
authors = ["thojest <thojest@gmail.com>"]
edition = "2018"
edition = "2021"
description = "Procedural derive macros for implementation of TestRandom trait"
[lib]

View File

@@ -10,7 +10,7 @@ use syn::{parse_macro_input, DeriveInput};
/// The field attribute is: `#[test_random(default)]`
fn should_use_default(field: &syn::Field) -> bool {
field.attrs.iter().any(|attr| {
attr.path.is_ident("test_random") && attr.tokens.to_string().replace(" ", "") == "(default)"
attr.path.is_ident("test_random") && attr.tokens.to_string().replace(' ', "") == "(default)"
})
}

View File

@@ -0,0 +1,8 @@
[package]
name = "unused_port"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@@ -0,0 +1,55 @@
use std::net::{TcpListener, UdpSocket};
#[derive(Copy, Clone)]
pub enum Transport {
Tcp,
Udp,
}
/// A convenience function for `unused_port(Transport::Tcp)`.
pub fn unused_tcp_port() -> Result<u16, String> {
unused_port(Transport::Tcp)
}
/// A convenience function for `unused_port(Transport::Tcp)`.
pub fn unused_udp_port() -> Result<u16, String> {
unused_port(Transport::Udp)
}
/// A bit of hack to find an unused port.
///
/// Does not guarantee that the given port is unused after the function exits, just that it was
/// unused before the function started (i.e., it does not reserve a port).
///
/// ## Notes
///
/// It is possible that users are unable to bind to the ports returned by this function as the OS
/// has a buffer period where it doesn't allow binding to the same port even after the socket is
/// closed. We might have to use SO_REUSEADDR socket option from `std::net2` crate in that case.
pub fn unused_port(transport: Transport) -> Result<u16, String> {
let local_addr = match transport {
Transport::Tcp => {
let listener = TcpListener::bind("127.0.0.1:0").map_err(|e| {
format!("Failed to create TCP listener to find unused port: {:?}", e)
})?;
listener.local_addr().map_err(|e| {
format!(
"Failed to read TCP listener local_addr to find unused port: {:?}",
e
)
})?
}
Transport::Udp => {
let socket = UdpSocket::bind("127.0.0.1:0")
.map_err(|e| format!("Failed to create UDP socket to find unused port: {:?}", e))?;
socket.local_addr().map_err(|e| {
format!(
"Failed to read UDP socket local_addr to find unused port: {:?}",
e
)
})?
}
};
Ok(local_addr.port())
}

View File

@@ -2,7 +2,7 @@
name = "validator_dir"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
[features]
insecure_keys = []

View File

@@ -2,7 +2,7 @@
name = "warp_utils"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html