Merge remote-tracking branch 'origin/unstable' into faster-block-production

This commit is contained in:
Michael Sproul
2022-08-11 16:50:44 +10:00
61 changed files with 1295 additions and 520 deletions

View File

@@ -132,8 +132,7 @@ pub fn test_spec<E: EthSpec>() -> ChainSpec {
FORK_NAME_ENV_VAR, e
)
});
let fork = ForkName::from_str(fork_name.as_str())
.unwrap_or_else(|()| panic!("unknown FORK_NAME: {}", fork_name));
let fork = ForkName::from_str(fork_name.as_str()).unwrap();
fork.make_genesis_spec(E::default_spec())
} else {
E::default_spec()
@@ -157,6 +156,7 @@ pub struct Builder<T: BeaconChainTypes> {
execution_layer: Option<ExecutionLayer<T::EthSpec>>,
mock_execution_layer: Option<MockExecutionLayer<T::EthSpec>>,
mock_builder: Option<TestingBuilder<T::EthSpec>>,
testing_slot_clock: Option<TestingSlotClock>,
runtime: TestRuntime,
log: Logger,
}
@@ -289,6 +289,7 @@ where
execution_layer: None,
mock_execution_layer: None,
mock_builder: None,
testing_slot_clock: None,
runtime,
log,
}
@@ -435,6 +436,11 @@ where
self
}
pub fn testing_slot_clock(mut self, slot_clock: TestingSlotClock) -> Self {
self.testing_slot_clock = Some(slot_clock);
self
}
pub fn build(self) -> BeaconChainHarness<BaseHarnessType<E, Hot, Cold>> {
let (shutdown_tx, shutdown_receiver) = futures::channel::mpsc::channel(1);
@@ -475,7 +481,9 @@ where
};
// Initialize the slot clock only if it hasn't already been initialized.
builder = if builder.get_slot_clock().is_none() {
builder = if let Some(testing_slot_clock) = self.testing_slot_clock {
builder.slot_clock(testing_slot_clock)
} else if builder.get_slot_clock().is_none() {
builder
.testing_slot_clock(Duration::from_secs(seconds_per_slot))
.expect("should configure testing slot clock")