## Issue Addressed

NA

## Proposed Changes

- Bump version.
- Add some new ENR for Prater
    - Afri: https://github.com/eth2-clients/eth2-testnets/pull/42
    - Prysm: https://github.com/eth2-clients/eth2-testnets/pull/43
- Apply the fixes from #2181 to the no-eth1-sim to try fix CI issues. 

## Additional Info

NA
This commit is contained in:
Paul Hauner
2021-03-18 04:20:46 +00:00
parent aae8bbd130
commit b34a79dc0b
8 changed files with 50 additions and 47 deletions

View File

@@ -9,7 +9,7 @@ use rayon::prelude::*;
use std::cmp::max;
use std::net::{IpAddr, Ipv4Addr};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tokio::time::{sleep_until, Instant};
use tokio::time::sleep;
use types::{Epoch, EthSpec, MainnetEthSpec};
pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
@@ -68,7 +68,6 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
.duration_since(UNIX_EPOCH)
.map_err(|_| "should get system time")?
+ genesis_delay;
let genesis_instant = Instant::now() + genesis_delay;
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
@@ -86,7 +85,7 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
beacon_config.network.enr_address = Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));
let main_future = async {
let network = LocalNetwork::new(context, beacon_config.clone()).await?;
let network = LocalNetwork::new(context.clone(), beacon_config.clone()).await?;
/*
* One by one, add beacon nodes to the network.
*/
@@ -97,44 +96,39 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
/*
* Create a future that will add validator clients to the network. Each validator client is
* attached to a single corresponding beacon node.
* attached to a single corresponding beacon node. Spawn each validator in a new task.
*/
let add_validators_fut = async {
for (i, files) in validator_files.into_iter().enumerate() {
network
.add_validator_client(testing_validator_config(), i, files, i % 2 == 0)
.await?;
}
Ok::<(), String>(())
};
/*
* The processes that will run checks on the network as it runs.
*/
let checks_fut = async {
sleep_until(genesis_instant).await;
let (finalization, block_prod) = futures::join!(
// Check that the chain finalizes at the first given opportunity.
checks::verify_first_finalization(network.clone(), slot_duration),
// Check that a block is produced at every slot.
checks::verify_full_block_production_up_to(
network.clone(),
Epoch::new(4).start_slot(MainnetEthSpec::slots_per_epoch()),
slot_duration,
)
let executor = context.executor.clone();
for (i, files) in validator_files.into_iter().enumerate() {
let network_1 = network.clone();
executor.spawn(
async move {
println!("Adding validator client {}", i);
network_1
.add_validator_client(testing_validator_config(), i, files, i % 2 == 0)
.await
.expect("should add validator");
},
"vc",
);
finalization?;
block_prod?;
}
Ok::<(), String>(())
};
let duration_to_genesis = network.duration_to_genesis().await;
println!("Duration to genesis: {}", duration_to_genesis.as_secs());
sleep(duration_to_genesis).await;
let (add_validators, start_checks) = futures::join!(add_validators_fut, checks_fut);
add_validators?;
start_checks?;
let (finalization, block_prod) = futures::join!(
// Check that the chain finalizes at the first given opportunity.
checks::verify_first_finalization(network.clone(), slot_duration),
// Check that a block is produced at every slot.
checks::verify_full_block_production_up_to(
network.clone(),
Epoch::new(4).start_slot(MainnetEthSpec::slots_per_epoch()),
slot_duration,
)
);
finalization?;
block_prod?;
// The `final_future` either completes immediately or never completes, depending on the value
// of `continue_after_checks`.