Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-head-block-number

This commit is contained in:
Eitan Seri-Levi
2026-06-23 22:56:33 +03:00
55 changed files with 2609 additions and 909 deletions

View File

@@ -174,6 +174,10 @@ pub struct ProtoNode {
}
impl ProtoNode {
pub fn is_gloas(&self) -> bool {
self.as_v29().is_ok()
}
/// Generic version of spec's `parent_payload_status` that works for pre-Gloas nodes by
/// considering their parents Empty.
pub fn get_parent_payload_status(&self) -> PayloadStatus {

View File

@@ -723,15 +723,14 @@ impl ProtoArrayForkChoice {
.into());
}
// Spec: `is_parent_strong`. Use payload-aware weight matching the
// payload path the head node is on from its parent.
let parent_payload_status = info.head_node.get_parent_payload_status();
let parent_weight = info.parent_node.attestation_score(parent_payload_status);
// Spec: `is_parent_strong`. Use `PayloadStatus::Pending` to avoid weight split
// between payload statuses. https://github.com/ethereum/consensus-specs/issues/5305
let parent_pending_weight = info.parent_node.attestation_score(PayloadStatus::Pending);
let re_org_parent_weight_threshold = info.re_org_parent_weight_threshold;
let parent_strong = parent_weight > re_org_parent_weight_threshold;
let parent_strong = parent_pending_weight > re_org_parent_weight_threshold;
if !parent_strong {
return Err(DoNotReOrg::ParentNotStrong {
parent_weight,
parent_weight: parent_pending_weight,
re_org_parent_weight_threshold,
}
.into());

View File

@@ -14,8 +14,10 @@ use tree_hash_derive::TreeHash;
pub struct ProposerPreferences {
pub dependent_root: Hash256,
pub proposal_slot: Slot,
#[serde(with = "serde_utils::quoted_u64")]
pub validator_index: u64,
pub fee_recipient: Address,
#[serde(with = "serde_utils::quoted_u64")]
pub target_gas_limit: u64,
}
@@ -45,4 +47,24 @@ mod tests {
use super::*;
ssz_and_tree_hash_tests!(ProposerPreferences);
/// `validator_index` and `target_gas_limit` must serialize as quoted JSON strings (Beacon API
/// convention) and round-trip back to their numeric values.
#[test]
fn quoted_u64_json_serde() {
let preferences = ProposerPreferences {
dependent_root: Hash256::ZERO,
proposal_slot: Slot::new(7),
validator_index: 42,
fee_recipient: Address::ZERO,
target_gas_limit: 30_000_000,
};
let value = serde_json::to_value(&preferences).unwrap();
assert_eq!(value["validator_index"], serde_json::json!("42"));
assert_eq!(value["target_gas_limit"], serde_json::json!("30000000"));
let decoded: ProposerPreferences = serde_json::from_value(value).unwrap();
assert_eq!(decoded, preferences);
}
}