chore(validator_client): Read genesis time and genesis validators root from eth2_network_config (#8638)

#5019


  If there is a known eth2_network_config, we read the genesis time and validators root from the config.


Co-Authored-By: Jimmy Chu <898091+jimmychu0807@users.noreply.github.com>
This commit is contained in:
Jimmy Chu
2026-01-14 14:25:07 +08:00
committed by GitHub
parent c91345782a
commit f584521e85
3 changed files with 36 additions and 5 deletions

View File

@@ -133,6 +133,16 @@ impl Eth2NetworkConfig {
self.genesis_state_source != GenesisStateSource::Unknown
}
/// The `genesis_time` of the genesis state.
pub fn genesis_time<E: EthSpec>(&self) -> Result<Option<u64>, String> {
if let GenesisStateSource::Url { genesis_time, .. } = self.genesis_state_source {
Ok(Some(genesis_time))
} else {
self.get_genesis_state_from_bytes::<E>()
.map(|state| Some(state.genesis_time()))
}
}
/// The `genesis_validators_root` of the genesis state.
pub fn genesis_validators_root<E: EthSpec>(&self) -> Result<Option<Hash256>, String> {
if let GenesisStateSource::Url {