Skip to content

Commit

Permalink
fix invalid slots
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <abdullaheryz@protonmail.com>
  • Loading branch information
aeryz committed Sep 27, 2023
1 parent f961e2c commit 2560ee1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 3 additions & 8 deletions lib/unionlabs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())?;
Expand Down
3 changes: 2 additions & 1 deletion voyager/src/chain/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
Expand Down
9 changes: 7 additions & 2 deletions voyager/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand Down

0 comments on commit 2560ee1

Please sign in to comment.