mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Native support for Gnosis Beacon Chain network (#2931)
## Proposed Changes Add a new hardcoded spec for the Gnosis Beacon Chain. Ideally, official Lighthouse executables will be able to connect to the gnosis beacon chain from now on, using `--network gnosis` CLI option.
This commit is contained in:
@@ -16,6 +16,8 @@ modern = ["bls/supranational-force-adx"]
|
||||
milagro = ["bls/milagro"]
|
||||
# Support minimal spec (used for testing only).
|
||||
spec-minimal = []
|
||||
# Support Gnosis spec and Gnosis Beacon Chain.
|
||||
gnosis = []
|
||||
|
||||
[dependencies]
|
||||
beacon_node = { "path" = "../beacon_node" }
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use task_executor::{ShutdownReason, TaskExecutor};
|
||||
use tokio::runtime::{Builder as RuntimeBuilder, Runtime};
|
||||
use types::{EthSpec, MainnetEthSpec, MinimalEthSpec};
|
||||
use types::{EthSpec, GnosisEthSpec, MainnetEthSpec, MinimalEthSpec};
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use {
|
||||
@@ -87,6 +87,19 @@ impl EnvironmentBuilder<MainnetEthSpec> {
|
||||
}
|
||||
}
|
||||
|
||||
impl EnvironmentBuilder<GnosisEthSpec> {
|
||||
/// Creates a new builder using the `gnosis` eth2 specification.
|
||||
pub fn gnosis() -> Self {
|
||||
Self {
|
||||
runtime: None,
|
||||
log: None,
|
||||
eth_spec_instance: GnosisEthSpec,
|
||||
eth2_config: Eth2Config::gnosis(),
|
||||
eth2_network_config: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EnvironmentBuilder<E> {
|
||||
/// Specifies that a multi-threaded tokio runtime should be used. Ideal for production uses.
|
||||
///
|
||||
|
||||
@@ -52,11 +52,12 @@ fn main() {
|
||||
"{}\n\
|
||||
BLS library: {}\n\
|
||||
SHA256 hardware acceleration: {}\n\
|
||||
Specs: mainnet (true), minimal ({})",
|
||||
Specs: mainnet (true), minimal ({}), gnosis ({})",
|
||||
VERSION.replace("Lighthouse/", ""),
|
||||
bls_library_name(),
|
||||
have_sha_extensions(),
|
||||
cfg!(feature = "spec-minimal"),
|
||||
cfg!(feature = "gnosis"),
|
||||
).as_str()
|
||||
)
|
||||
.arg(
|
||||
@@ -302,9 +303,11 @@ fn main() {
|
||||
|
||||
match eth_spec_id {
|
||||
EthSpecId::Mainnet => run(EnvironmentBuilder::mainnet(), &matches, eth2_network_config),
|
||||
#[cfg(feature = "gnosis")]
|
||||
EthSpecId::Gnosis => run(EnvironmentBuilder::gnosis(), &matches, eth2_network_config),
|
||||
#[cfg(feature = "spec-minimal")]
|
||||
EthSpecId::Minimal => run(EnvironmentBuilder::minimal(), &matches, eth2_network_config),
|
||||
#[cfg(not(feature = "spec-minimal"))]
|
||||
#[cfg(not(all(feature = "spec-minimal", feature = "gnosis")))]
|
||||
other => {
|
||||
eprintln!(
|
||||
"Eth spec `{}` is not supported by this build of Lighthouse",
|
||||
|
||||
Reference in New Issue
Block a user