From 6f67f9b8f6e0a363a9c9d5646bbdaee38e9bc198 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 31 May 2024 15:59:05 -0600 Subject: [PATCH] swap routers back to default, print error on app store state deserialize --- .../packages/app_store/app_store/src/utils.rs | 21 ++++++++++--------- kinode/src/register.rs | 7 +++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/utils.rs b/kinode/packages/app_store/app_store/src/utils.rs index d42fffe8..608f8fad 100644 --- a/kinode/packages/app_store/app_store/src/utils.rs +++ b/kinode/packages/app_store/app_store/src/utils.rs @@ -56,17 +56,18 @@ impl OnchainMetadata { /// fetch state from disk or create a new one if that fails pub fn fetch_state(our: Address, provider: eth::Provider) -> State { if let Some(state_bytes) = get_state() { - if let Ok(state) = serde_json::from_slice::(&state_bytes) { - if state.contract_address == CONTRACT_ADDRESS { - return State::from_serialized(our, provider, state); - } else { - println!( - "state contract address mismatch! expected {}, got {}", - CONTRACT_ADDRESS, state.contract_address - ); + match serde_json::from_slice::(&state_bytes) { + Ok(state) => { + if state.contract_address == CONTRACT_ADDRESS { + return State::from_serialized(our, provider, state); + } else { + println!( + "state contract address mismatch! expected {}, got {}", + CONTRACT_ADDRESS, state.contract_address + ); + } } - } else { - println!("failed to deserialize saved state"); + Err(e) => println!("failed to deserialize saved state: {e}"), } } State::new(our, provider, CONTRACT_ADDRESS.to_string()).expect("state creation failed") diff --git a/kinode/src/register.rs b/kinode/src/register.rs index a3ac8acb..b83c20ab 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -73,10 +73,9 @@ pub async fn register( ("tcp".to_string(), tcp_port), ]), routers: vec![ - // "default-router-1.os".into(), - // "default-router-2.os".into(), - // "default-router-3.os".into(), - "default-router-7.os".into(), + "default-router-1.os".into(), + "default-router-2.os".into(), + "default-router-3.os".into(), ], }, });