mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
VC: accept unknown fields in chain spec (#2277)
## Issue Addressed Closes #2274 ## Proposed Changes * Modify the `YamlConfig` to collect unknown fields into an `extra_fields` map, instead of failing hard. * Log a debug message if there are extra fields returned to the VC from one of its BNs. This restores Lighthouse's compatibility with Teku beacon nodes (and therefore Infura)
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::http_metrics::metrics::{inc_counter_vec, ENDPOINT_ERRORS, ENDPOINT_RE
|
||||
use environment::RuntimeContext;
|
||||
use eth2::BeaconNodeHttpClient;
|
||||
use futures::future;
|
||||
use slog::{error, info, warn, Logger};
|
||||
use slog::{debug, error, info, warn, Logger};
|
||||
use slot_clock::SlotClock;
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
@@ -236,6 +236,14 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
|
||||
CandidateError::Incompatible
|
||||
})?;
|
||||
|
||||
if !yaml_config.extra_fields.is_empty() {
|
||||
debug!(
|
||||
log,
|
||||
"Beacon spec includes unknown fields";
|
||||
"fields" => ?yaml_config.extra_fields
|
||||
);
|
||||
}
|
||||
|
||||
if *spec == beacon_node_spec {
|
||||
Ok(())
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,7 @@ use slog::{debug, error, info, warn, Logger};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path, PathBuf};
|
||||
use types::{Graffiti, Keypair, PublicKey, PublicKeyBytes};
|
||||
|
||||
use crate::key_cache;
|
||||
@@ -101,20 +101,16 @@ impl InitializedValidator {
|
||||
}
|
||||
}
|
||||
|
||||
fn open_keystore(path: &PathBuf) -> Result<Keystore, Error> {
|
||||
fn open_keystore(path: &Path) -> Result<Keystore, Error> {
|
||||
let keystore_file = File::open(path).map_err(Error::UnableToOpenVotingKeystore)?;
|
||||
Keystore::from_json_reader(keystore_file).map_err(Error::UnableToParseVotingKeystore)
|
||||
}
|
||||
|
||||
fn get_lockfile_path(file_path: &PathBuf) -> Option<PathBuf> {
|
||||
fn get_lockfile_path(file_path: &Path) -> Option<PathBuf> {
|
||||
file_path
|
||||
.file_name()
|
||||
.and_then(|os_str| os_str.to_str())
|
||||
.map(|filename| {
|
||||
file_path
|
||||
.clone()
|
||||
.with_file_name(format!("{}.lock", filename))
|
||||
})
|
||||
.map(|filename| file_path.with_file_name(format!("{}.lock", filename)))
|
||||
}
|
||||
|
||||
impl InitializedValidator {
|
||||
@@ -238,7 +234,7 @@ impl InitializedValidator {
|
||||
/// Try to unlock `keystore` at `keystore_path` by prompting the user via `stdin`.
|
||||
fn unlock_keystore_via_stdin_password(
|
||||
keystore: &Keystore,
|
||||
keystore_path: &PathBuf,
|
||||
keystore_path: &Path,
|
||||
) -> Result<(ZeroizeString, Keypair), Error> {
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
|
||||
Reference in New Issue
Block a user