From 2560ee12fe215d87be67e2243ba5a01e57956a99 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 27 Sep 2023 12:01:34 +0300 Subject: [PATCH] fix invalid slots Signed-off-by: aeryz --- lib/unionlabs/src/lib.rs | 11 +++-------- voyager/src/chain/evm.rs | 3 ++- voyager/src/queue.rs | 9 +++++++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/unionlabs/src/lib.rs b/lib/unionlabs/src/lib.rs index fd11146941..e6be5c4f59 100644 --- a/lib/unionlabs/src/lib.rs +++ b/lib/unionlabs/src/lib.rs @@ -695,14 +695,9 @@ impl TryFrom<&[u8]> for WasmClientType { }) .and_then(|exports| { exports.into_iter().find_map(|export| { - export.ok().and_then(|export| { - if let Some(type_name) = export.name.strip_prefix("WASM_CLIENT_TYPE_") - { - Some(type_name) - } else { - None - } - }) + export + .ok() + .and_then(|export| export.name.strip_prefix("WASM_CLIENT_TYPE_")) }) }) .ok_or(())?; diff --git a/voyager/src/chain/evm.rs b/voyager/src/chain/evm.rs index cec20d87c7..1b2bf6139c 100644 --- a/voyager/src/chain/evm.rs +++ b/voyager/src/chain/evm.rs @@ -1472,7 +1472,8 @@ where chain_id: req.counterparty_chain_id.clone(), msg: ChainMsgType::WaitForTimestamp( (genesis.genesis_time - + (bootstrap.header.beacon.slot * C::SECONDS_PER_SLOT::U64)) + + (header.data.consensus_update.signature_slot + * C::SECONDS_PER_SLOT::U64)) .try_into() .unwrap(), ), diff --git a/voyager/src/queue.rs b/voyager/src/queue.rs index 3657c58642..2e314ecf86 100644 --- a/voyager/src/queue.rs +++ b/voyager/src/queue.rs @@ -102,7 +102,7 @@ impl Voyager { pub async fn new(config: Config) -> Self { let mut union = HashMap::new(); let mut evm_minimal = HashMap::new(); - let evm_mainnet = HashMap::new(); + let mut evm_mainnet = HashMap::new(); for (chain_name, chain_config) in config.chain { let chain = AnyChain::try_from_config(chain_config).await; @@ -114,7 +114,12 @@ impl Voyager { tracing::info!("registered chain {chain_name} (chain id {chain_id})"); } - AnyChain::EvmMainnet(_) => todo!(), + AnyChain::EvmMainnet(c) => { + let chain_id = c.chain_id; + assert!(evm_mainnet.insert(c.chain_id, c).is_none()); + + tracing::info!("registered chain {chain_name} (chain id {chain_id})"); + } AnyChain::EvmMinimal(c) => { let chain_id = c.chain_id; assert!(evm_minimal.insert(c.chain_id, c).is_none());