Add proposer preferences SSE event (#9308)

This is needed to connect to buildoor (Kurtosis package, acts as a trustless builder)


  


Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
Eitan Seri-Levi
2026-06-20 12:41:34 -07:00
committed by GitHub
parent 477c25db9f
commit 10568b139b
6 changed files with 145 additions and 3 deletions

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);
}
}