mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Unify execution layer endpoints (#3214)
## Issue Addressed Resolves #3069 ## Proposed Changes Unify the `eth1-endpoints` and `execution-endpoints` flags in a backwards compatible way as described in https://github.com/sigp/lighthouse/issues/3069#issuecomment-1134219221 Users have 2 options: 1. Use multiple non auth execution endpoints for deposit processing pre-merge 2. Use a single jwt authenticated execution endpoint for both execution layer and deposit processing post merge Related https://github.com/sigp/lighthouse/issues/3118 To enable jwt authenticated deposit processing, this PR removes the calls to `net_version` as the `net` namespace is not exposed in the auth server in execution clients. Moving away from using `networkId` is a good step in my opinion as it doesn't provide us with any added guarantees over `chainId`. See https://github.com/ethereum/consensus-specs/issues/2163 and https://github.com/sigp/lighthouse/issues/2115 Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
@@ -16,17 +16,11 @@ pub struct GanacheInstance {
|
||||
pub port: u16,
|
||||
child: Child,
|
||||
pub web3: Web3<Http>,
|
||||
network_id: u64,
|
||||
chain_id: u64,
|
||||
}
|
||||
|
||||
impl GanacheInstance {
|
||||
fn new_from_child(
|
||||
mut child: Child,
|
||||
port: u16,
|
||||
network_id: u64,
|
||||
chain_id: u64,
|
||||
) -> Result<Self, String> {
|
||||
fn new_from_child(mut child: Child, port: u16, chain_id: u64) -> Result<Self, String> {
|
||||
let stdout = child
|
||||
.stdout
|
||||
.ok_or("Unable to get stdout for ganache child process")?;
|
||||
@@ -64,14 +58,13 @@ impl GanacheInstance {
|
||||
port,
|
||||
child,
|
||||
web3,
|
||||
network_id,
|
||||
chain_id,
|
||||
})
|
||||
}
|
||||
|
||||
/// Start a new `ganache` process, waiting until it indicates that it is ready to accept
|
||||
/// RPC connections.
|
||||
pub fn new(network_id: u64, chain_id: u64) -> Result<Self, String> {
|
||||
pub fn new(chain_id: u64) -> Result<Self, String> {
|
||||
let port = unused_tcp_port()?;
|
||||
let binary = match cfg!(windows) {
|
||||
true => "ganache.cmd",
|
||||
@@ -89,8 +82,6 @@ impl GanacheInstance {
|
||||
.arg(format!("{}", port))
|
||||
.arg("--mnemonic")
|
||||
.arg("\"vast thought differ pull jewel broom cook wrist tribe word before omit\"")
|
||||
.arg("--networkId")
|
||||
.arg(format!("{}", network_id))
|
||||
.arg("--chain.chainId")
|
||||
.arg(format!("{}", chain_id))
|
||||
.spawn()
|
||||
@@ -102,7 +93,7 @@ impl GanacheInstance {
|
||||
)
|
||||
})?;
|
||||
|
||||
Self::new_from_child(child, port, network_id, chain_id)
|
||||
Self::new_from_child(child, port, chain_id)
|
||||
}
|
||||
|
||||
pub fn fork(&self) -> Result<Self, String> {
|
||||
@@ -128,7 +119,7 @@ impl GanacheInstance {
|
||||
)
|
||||
})?;
|
||||
|
||||
Self::new_from_child(child, port, self.network_id, self.chain_id)
|
||||
Self::new_from_child(child, port, self.chain_id)
|
||||
}
|
||||
|
||||
/// Returns the endpoint that this instance is listening on.
|
||||
@@ -136,11 +127,6 @@ impl GanacheInstance {
|
||||
endpoint(self.port)
|
||||
}
|
||||
|
||||
/// Returns the network id of the ganache instance
|
||||
pub fn network_id(&self) -> u64 {
|
||||
self.network_id
|
||||
}
|
||||
|
||||
/// Returns the chain id of the ganache instance
|
||||
pub fn chain_id(&self) -> u64 {
|
||||
self.chain_id
|
||||
|
||||
@@ -30,8 +30,8 @@ pub struct GanacheEth1Instance {
|
||||
}
|
||||
|
||||
impl GanacheEth1Instance {
|
||||
pub async fn new(network_id: u64, chain_id: u64) -> Result<Self, String> {
|
||||
let ganache = GanacheInstance::new(network_id, chain_id)?;
|
||||
pub async fn new(chain_id: u64) -> Result<Self, String> {
|
||||
let ganache = GanacheInstance::new(chain_id)?;
|
||||
DepositContract::deploy(ganache.web3.clone(), 0, None)
|
||||
.await
|
||||
.map(|deposit_contract| Self {
|
||||
|
||||
Reference in New Issue
Block a user