Merge branch 'unstable' into vc-fallback

This commit is contained in:
Mac L
2024-04-26 12:46:25 +10:00
261 changed files with 10567 additions and 6425 deletions

View File

@@ -1023,7 +1023,7 @@ impl ForkVersionDeserialize for SsePayloadAttributes {
fork_name: ForkName,
) -> Result<Self, D::Error> {
match fork_name {
ForkName::Merge => serde_json::from_value(value)
ForkName::Bellatrix => serde_json::from_value(value)
.map(Self::V1)
.map_err(serde::de::Error::custom),
ForkName::Capella => serde_json::from_value(value)
@@ -1598,7 +1598,7 @@ impl<E: EthSpec> FullBlockContents<E> {
fork_name: ForkName,
) -> Result<Self, ssz::DecodeError> {
match fork_name {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {
BeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name)
.map(|block| FullBlockContents::Block(block))
}
@@ -1658,7 +1658,7 @@ impl<E: EthSpec> ForkVersionDeserialize for FullBlockContents<E> {
fork_name: ForkName,
) -> Result<Self, D::Error> {
match fork_name {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {
Ok(FullBlockContents::Block(
BeaconBlock::deserialize_by_fork::<'de, D>(value, fork_name)?,
))
@@ -1758,7 +1758,7 @@ impl<E: EthSpec> PublishBlockRequest<E> {
/// SSZ decode with fork variant determined by `fork_name`.
pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result<Self, ssz::DecodeError> {
match fork_name {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {
SignedBeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name)
.map(|block| PublishBlockRequest::Block(Arc::new(block)))
}
@@ -1844,7 +1844,7 @@ impl<E: EthSpec> TryFrom<Arc<SignedBeaconBlock<E>>> for PublishBlockRequest<E> {
match *block {
SignedBeaconBlock::Base(_)
| SignedBeaconBlock::Altair(_)
| SignedBeaconBlock::Merge(_)
| SignedBeaconBlock::Bellatrix(_)
| SignedBeaconBlock::Capella(_) => Ok(PublishBlockRequest::Block(block)),
SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => Err(
"post-Deneb block contents cannot be fully constructed from just the signed block",
@@ -1953,7 +1953,7 @@ impl<E: EthSpec> ForkVersionDeserialize for FullPayloadContents<E> {
fork_name: ForkName,
) -> Result<Self, D::Error> {
match fork_name {
ForkName::Merge | ForkName::Capella => serde_json::from_value(value)
ForkName::Bellatrix | ForkName::Capella => serde_json::from_value(value)
.map(Self::Payload)
.map_err(serde::de::Error::custom),
ForkName::Deneb | ForkName::Electra => serde_json::from_value(value)

View File

@@ -33,7 +33,7 @@ GENESIS_DELAY: 6000
# Altair
ALTAIR_FORK_VERSION: 0x01000064
ALTAIR_FORK_EPOCH: 512
# Merge
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000064
BELLATRIX_FORK_EPOCH: 385536
# Capella

View File

@@ -22,7 +22,7 @@ GENESIS_DELAY: 300
# Altair
ALTAIR_FORK_VERSION: 0x02017000
ALTAIR_FORK_EPOCH: 0
# Merge
# Bellatrix
BELLATRIX_FORK_VERSION: 0x03017000
BELLATRIX_FORK_EPOCH: 0
TERMINAL_TOTAL_DIFFICULTY: 0

View File

@@ -21,7 +21,7 @@ GENESIS_DELAY: 86400
ALTAIR_FORK_VERSION: 0x90000070
ALTAIR_FORK_EPOCH: 50
# Merge
# Bellatrix
BELLATRIX_FORK_VERSION: 0x90000071
BELLATRIX_FORK_EPOCH: 100
TERMINAL_TOTAL_DIFFICULTY: 17000000000000000

View File

@@ -21,6 +21,24 @@ pub const VERSION: &str = git_version!(
fallback = "Lighthouse/v5.1.3"
);
/// Returns the first eight characters of the latest commit hash for this build.
///
/// No indication is given if the tree is dirty. This is part of the standard
/// for reporting the client version to the execution engine.
pub const COMMIT_PREFIX: &str = git_version!(
args = [
"--always",
"--abbrev=8",
// NOTE: using --match instead of --exclude for compatibility with old Git
"--match=thiswillnevermatchlol"
],
prefix = "",
suffix = "",
cargo_prefix = "",
cargo_suffix = "",
fallback = "00000000"
);
/// Returns `VERSION`, but with platform information appended to the end.
///
/// ## Example

View File

@@ -11,7 +11,7 @@ pub use crate::manual_slot_clock::ManualSlotClock as TestingSlotClock;
pub use crate::manual_slot_clock::ManualSlotClock;
pub use crate::system_time_slot_clock::SystemTimeSlotClock;
pub use metrics::scrape_for_metrics;
use types::consts::merge::INTERVALS_PER_SLOT;
use types::consts::bellatrix::INTERVALS_PER_SLOT;
pub use types::Slot;
/// A clock that reports the current slot.

View File

@@ -1,5 +1,6 @@
use super::SlotClock;
use parking_lot::RwLock;
use std::ops::Add;
use std::sync::Arc;
use std::time::Duration;
use types::Slot;
@@ -41,6 +42,11 @@ impl ManualSlotClock {
*self.current_time.write() = duration;
}
pub fn advance_time(&self, duration: Duration) {
let current_time = *self.current_time.read();
*self.current_time.write() = current_time.add(duration);
}
pub fn advance_slot(&self) {
self.set_slot(self.now().unwrap().as_u64() + 1)
}

View File

@@ -12,3 +12,4 @@ futures = { workspace = true }
lazy_static = { workspace = true }
lighthouse_metrics = { workspace = true }
sloggers = { workspace = true }
logging = { workspace = true }

View File

@@ -1,4 +1,5 @@
use crate::TaskExecutor;
use logging::test_logger;
use slog::Logger;
use sloggers::{null::NullLoggerBuilder, Build};
use std::sync::Arc;
@@ -26,7 +27,7 @@ impl Default for TestRuntime {
fn default() -> Self {
let (runtime_shutdown, exit) = async_channel::bounded(1);
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
let log = null_logger().unwrap();
let log = test_logger();
let (runtime, handle) = if let Ok(handle) = runtime::Handle::try_current() {
(None, handle)