mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Fix execution layer redundancy (#5588)
* remove execution layer url redundancy * fix typo * fix tests * fix formatting
This commit is contained in:
@@ -355,14 +355,14 @@ struct Inner<E: EthSpec> {
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
/// Endpoint urls for EL nodes that are running the engine api.
|
||||
pub execution_endpoints: Vec<SensitiveUrl>,
|
||||
/// Endpoint url for EL nodes that are running the engine api.
|
||||
pub execution_endpoint: Option<SensitiveUrl>,
|
||||
/// Endpoint urls for services providing the builder api.
|
||||
pub builder_url: Option<SensitiveUrl>,
|
||||
/// User agent to send with requests to the builder API.
|
||||
pub builder_user_agent: Option<String>,
|
||||
/// JWT secrets for the above endpoints running the engine api.
|
||||
pub secret_files: Vec<PathBuf>,
|
||||
/// JWT secret for the above endpoint running the engine api.
|
||||
pub secret_file: Option<PathBuf>,
|
||||
/// The default fee recipient to use on the beacon node if none if provided from
|
||||
/// the validator client during block preparation.
|
||||
pub suggested_fee_recipient: Option<Address>,
|
||||
@@ -386,10 +386,10 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
/// Instantiate `Self` with an Execution engine specified in `Config`, using JSON-RPC via HTTP.
|
||||
pub fn from_config(config: Config, executor: TaskExecutor, log: Logger) -> Result<Self, Error> {
|
||||
let Config {
|
||||
execution_endpoints: urls,
|
||||
execution_endpoint: url,
|
||||
builder_url,
|
||||
builder_user_agent,
|
||||
secret_files,
|
||||
secret_file,
|
||||
suggested_fee_recipient,
|
||||
jwt_id,
|
||||
jwt_version,
|
||||
@@ -397,16 +397,10 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
execution_timeout_multiplier,
|
||||
} = config;
|
||||
|
||||
if urls.len() > 1 {
|
||||
warn!(log, "Only the first execution engine url will be used");
|
||||
}
|
||||
let execution_url = urls.into_iter().next().ok_or(Error::NoEngine)?;
|
||||
let execution_url = url.ok_or(Error::NoEngine)?;
|
||||
|
||||
// Use the default jwt secret path if not provided via cli.
|
||||
let secret_file = secret_files
|
||||
.into_iter()
|
||||
.next()
|
||||
.unwrap_or_else(|| default_datadir.join(DEFAULT_JWT_FILE));
|
||||
let secret_file = secret_file.unwrap_or_else(|| default_datadir.join(DEFAULT_JWT_FILE));
|
||||
|
||||
let jwt_key = if secret_file.exists() {
|
||||
// Read secret from file if it already exists
|
||||
|
||||
@@ -229,8 +229,8 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
|
||||
// This EL should not talk to a builder
|
||||
let config = Config {
|
||||
execution_endpoints: vec![mock_el_url],
|
||||
secret_files: vec![path],
|
||||
execution_endpoint: Some(mock_el_url),
|
||||
secret_file: Some(path),
|
||||
suggested_fee_recipient: None,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -67,8 +67,8 @@ impl<E: EthSpec> MockExecutionLayer<E> {
|
||||
std::fs::write(&path, hex::encode(DEFAULT_JWT_SECRET)).unwrap();
|
||||
|
||||
let config = Config {
|
||||
execution_endpoints: vec![url],
|
||||
secret_files: vec![path],
|
||||
execution_endpoint: Some(url),
|
||||
secret_file: Some(path),
|
||||
suggested_fee_recipient: Some(Address::repeat_byte(42)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user