Split the VC into crates making it more modular (#6453)

* Starting to modularize the VC

* Revert changes to eth2

* More progress

* More progress

* Compiles

* Merge latest unstable and make it compile

* Fix some lints

* Tests compile

* Merge latest unstable

* Remove unnecessary deps

* Merge latest unstable

* Correct release tests

* Merge latest unstable

* Merge remote-tracking branch 'origin/unstable' into modularize-vc

* Merge branch 'unstable' into modularize-vc

* Revert unnecessary cargo lock changes

* Update validator_client/beacon_node_fallback/Cargo.toml

* Update validator_client/http_metrics/Cargo.toml

* Update validator_client/http_metrics/src/lib.rs

* Update validator_client/initialized_validators/Cargo.toml

* Update validator_client/signing_method/Cargo.toml

* Update validator_client/validator_metrics/Cargo.toml

* Update validator_client/validator_services/Cargo.toml

* Update validator_client/validator_store/Cargo.toml

* Update validator_client/validator_store/src/lib.rs

* Merge remote-tracking branch 'origin/unstable' into modularize-vc

* Fix format string

* Rename doppelganger trait

* Don't drop the tempdir

* Cargo fmt
This commit is contained in:
Age Manning
2024-11-08 12:01:46 +11:00
committed by GitHub
parent ae160ebf07
commit 8e95024945
59 changed files with 1021 additions and 554 deletions

View File

@@ -11,6 +11,7 @@ types = { workspace = true }
tempfile = { workspace = true }
eth2 = { workspace = true }
validator_client = { workspace = true }
beacon_node_fallback = { workspace = true }
validator_dir = { workspace = true, features = ["insecure_keys"] }
sensitive_url = { workspace = true }
execution_layer = { workspace = true }

View File

@@ -16,12 +16,13 @@ use validator_client::ProductionValidatorClient;
use validator_dir::insecure_keys::build_deterministic_validator_dirs;
pub use beacon_node::{ClientConfig, ClientGenesis, ProductionClient};
pub use beacon_node_fallback::ApiTopic;
pub use environment;
pub use eth2;
pub use execution_layer::test_utils::{
Config as MockServerConfig, MockExecutionConfig, MockServer,
};
pub use validator_client::{ApiTopic, Config as ValidatorConfig};
pub use validator_client::Config as ValidatorConfig;
/// The global timeout for HTTP requests to the beacon node.
const HTTP_TIMEOUT: Duration = Duration::from_secs(8);

View File

@@ -175,7 +175,8 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
executor.spawn(
async move {
let mut validator_config = testing_validator_config();
validator_config.fee_recipient = Some(SUGGESTED_FEE_RECIPIENT.into());
validator_config.validator_store.fee_recipient =
Some(SUGGESTED_FEE_RECIPIENT.into());
println!("Adding validator client {}", i);
// Enable broadcast on every 4th node.

View File

@@ -178,7 +178,8 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
executor.spawn(
async move {
let mut validator_config = testing_validator_config();
validator_config.fee_recipient = Some(SUGGESTED_FEE_RECIPIENT.into());
validator_config.validator_store.fee_recipient =
Some(SUGGESTED_FEE_RECIPIENT.into());
println!("Adding validator client {}", i);
network_1
.add_validator_client_with_fallbacks(

View File

@@ -15,7 +15,6 @@ tempfile = { workspace = true }
tokio = { workspace = true }
reqwest = { workspace = true }
url = { workspace = true }
validator_client = { workspace = true }
slot_clock = { workspace = true }
futures = { workspace = true }
task_executor = { workspace = true }
@@ -28,3 +27,6 @@ serde_json = { workspace = true }
zip = { workspace = true }
parking_lot = { workspace = true }
logging = { workspace = true }
initialized_validators = { workspace = true }
slashing_protection = { workspace = true }
validator_store = { workspace = true }

View File

@@ -22,10 +22,14 @@ mod tests {
};
use eth2_keystore::KeystoreBuilder;
use eth2_network_config::Eth2NetworkConfig;
use initialized_validators::{
load_pem_certificate, load_pkcs12_identity, InitializedValidators,
};
use logging::test_logger;
use parking_lot::Mutex;
use reqwest::Client;
use serde::Serialize;
use slashing_protection::{SlashingDatabase, SLASHING_PROTECTION_FILENAME};
use slot_clock::{SlotClock, TestingSlotClock};
use std::env;
use std::fmt::Debug;
@@ -41,13 +45,7 @@ mod tests {
use tokio::time::sleep;
use types::{attestation::AttestationBase, *};
use url::Url;
use validator_client::{
initialized_validators::{
load_pem_certificate, load_pkcs12_identity, InitializedValidators,
},
validator_store::{Error as ValidatorStoreError, ValidatorStore},
SlashingDatabase, SLASHING_PROTECTION_FILENAME,
};
use validator_store::{Error as ValidatorStoreError, ValidatorStore};
/// If the we are unable to reach the Web3Signer HTTP API within this time out then we will
/// assume it failed to start.
@@ -322,7 +320,7 @@ mod tests {
let log = test_logger();
let validator_dir = TempDir::new().unwrap();
let config = validator_client::Config::default();
let config = initialized_validators::Config::default();
let validator_definitions = ValidatorDefinitions::from(validator_definitions);
let initialized_validators = InitializedValidators::from_definitions(
validator_definitions,
@@ -354,7 +352,7 @@ mod tests {
let slot_clock =
TestingSlotClock::new(Slot::new(0), Duration::from_secs(0), Duration::from_secs(1));
let config = validator_client::Config {
let config = validator_store::Config {
enable_web3signer_slashing_protection: slashing_protection_config.local,
..Default::default()
};