Update to spec v1.0.0-rc.0 and BLSv4 (#1765)

## Issue Addressed

Closes #1504 
Closes #1505
Replaces #1703
Closes #1707

## Proposed Changes

* Update BLST and Milagro to versions compatible with BLSv4 spec
* Update Lighthouse to spec v1.0.0-rc.0, and update EF test vectors
* Use the v1.0.0 constants for `MainnetEthSpec`.
* Rename `InteropEthSpec` -> `V012LegacyEthSpec`
    * Change all constants to suit the mainnet `v0.12.3` specification (i.e., Medalla).
* Deprecate the `--spec` flag for the `lighthouse` binary
    * This value is now obtained from the `config_name` field of the `YamlConfig`.
        * Built in testnet YAML files have been updated.
    * Ignore the `--spec` value, if supplied, log a warning that it will be deprecated
    * `lcli` still has the spec flag, that's fine because it's dev tooling.
* Remove the `E: EthSpec` from `YamlConfig`
    * This means we need to deser the genesis `BeaconState` on-demand, but this is fine.
* Swap the old "minimal", "mainnet" strings over to the new `EthSpecId` enum.
* Always require a `CONFIG_NAME` field in `YamlConfig` (it used to have a default).

## Additional Info

Lots of breaking changes, do not merge! ~~We will likely need a Lighthouse v0.4.0 branch, and possibly a long-term v0.3.0 branch to keep Medalla alive~~.

Co-authored-by: Kirk Baird <baird.k@outlook.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
Michael Sproul
2020-10-28 22:19:38 +00:00
parent ad846ad280
commit 36bd4d87f0
55 changed files with 596 additions and 661 deletions

View File

@@ -24,7 +24,7 @@ use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use task_executor::TaskExecutor;
use tokio::runtime::{Builder as RuntimeBuilder, Runtime};
use types::{EthSpec, InteropEthSpec, MainnetEthSpec, MinimalEthSpec};
use types::{EthSpec, MainnetEthSpec, MinimalEthSpec, V012LegacyEthSpec};
pub const ETH2_CONFIG_FILENAME: &str = "eth2-spec.toml";
const LOG_CHANNEL_SIZE: usize = 2048;
@@ -37,7 +37,7 @@ pub struct EnvironmentBuilder<E: EthSpec> {
log: Option<Logger>,
eth_spec_instance: E,
eth2_config: Eth2Config,
testnet: Option<Eth2TestnetConfig<E>>,
testnet: Option<Eth2TestnetConfig>,
}
impl EnvironmentBuilder<MinimalEthSpec> {
@@ -66,14 +66,14 @@ impl EnvironmentBuilder<MainnetEthSpec> {
}
}
impl EnvironmentBuilder<InteropEthSpec> {
/// Creates a new builder using the `interop` eth2 specification.
pub fn interop() -> Self {
impl EnvironmentBuilder<V012LegacyEthSpec> {
/// Creates a new builder using the v0.12.x eth2 specification.
pub fn v012_legacy() -> Self {
Self {
runtime: None,
log: None,
eth_spec_instance: InteropEthSpec,
eth2_config: Eth2Config::interop(),
eth_spec_instance: V012LegacyEthSpec,
eth2_config: Eth2Config::v012_legacy(),
testnet: None,
}
}
@@ -238,7 +238,7 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
/// Adds a testnet configuration to the environment.
pub fn eth2_testnet_config(
mut self,
eth2_testnet_config: Eth2TestnetConfig<E>,
eth2_testnet_config: Eth2TestnetConfig,
) -> Result<Self, String> {
// Create a new chain spec from the default configuration.
self.eth2_config.spec = eth2_testnet_config
@@ -249,7 +249,7 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
.ok_or_else(|| {
format!(
"The loaded config is not compatible with the {} spec",
&self.eth2_config.spec_constants
&self.eth2_config.eth_spec_id
)
})?;
@@ -261,7 +261,7 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
/// Optionally adds a testnet configuration to the environment.
pub fn optional_eth2_testnet_config(
self,
optional_config: Option<Eth2TestnetConfig<E>>,
optional_config: Option<Eth2TestnetConfig>,
) -> Result<Self, String> {
if let Some(config) = optional_config {
self.eth2_testnet_config(config)
@@ -339,7 +339,7 @@ pub struct Environment<E: EthSpec> {
log: Logger,
eth_spec_instance: E,
pub eth2_config: Eth2Config,
pub testnet: Option<Eth2TestnetConfig<E>>,
pub testnet: Option<Eth2TestnetConfig>,
}
impl<E: EthSpec> Environment<E> {

View File

@@ -3,17 +3,17 @@
use environment::EnvironmentBuilder;
use eth2_testnet_config::Eth2TestnetConfig;
use std::path::PathBuf;
use types::{MainnetEthSpec, YamlConfig};
use types::{V012LegacyEthSpec, YamlConfig};
fn builder() -> EnvironmentBuilder<MainnetEthSpec> {
EnvironmentBuilder::mainnet()
fn builder() -> EnvironmentBuilder<V012LegacyEthSpec> {
EnvironmentBuilder::v012_legacy()
.single_thread_tokio_runtime()
.expect("should set runtime")
.null_logger()
.expect("should set logger")
}
fn eth2_testnet_config() -> Option<Eth2TestnetConfig<MainnetEthSpec>> {
fn eth2_testnet_config() -> Option<Eth2TestnetConfig> {
Eth2TestnetConfig::hard_coded_default().expect("should decode hard_coded params")
}