Skip to content

Commit

Permalink
fix: post-rebase fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-zil committed Dec 12, 2024
1 parent bc6f312 commit 4e50e21
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions z2/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use zilliqa::{
block_request_limit_default, consensus_timeout_default, empty_block_timeout_default,
eth_chain_id_default, failed_request_sleep_duration_default, local_address_default,
max_blocks_in_flight_default, minimum_time_left_for_empty_block_default,
scilla_address_default, scilla_ext_libs_path_default, scilla_stdlib_dir_default,
state_rpc_limit_default, total_native_token_supply_default, Amount, ApiServer,
ConsensusConfig, GenesisDeposit,
remote_api_url_default, scilla_address_default, scilla_ext_libs_path_default,
scilla_stdlib_dir_default, state_rpc_limit_default, total_native_token_supply_default,
Amount, ApiServer, ConsensusConfig, GenesisDeposit,
},
transaction::EvmGas,
};
Expand Down
2 changes: 1 addition & 1 deletion zilliqa/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub fn state_cache_size_default() -> usize {
}

pub fn remote_api_url_default() -> Url {
Url::parse(&format!("http://localhost:{}", json_rpc_port_default())).unwrap()
Url::parse("http://localhost:4201").unwrap()
}

pub fn eth_chain_id_default() -> u64 {
Expand Down
16 changes: 9 additions & 7 deletions zilliqa/src/node_launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

use anyhow::{anyhow, Result};
use http::{header, Method};
use jsonrpsee::{core::client::ClientT, RpcModule};
use jsonrpsee::core::client::ClientT;
use libp2p::{futures::StreamExt, PeerId};
use node::Node;
use opentelemetry::KeyValue;
Expand Down Expand Up @@ -182,9 +182,9 @@ impl NodeLauncher {

async fn handle_watchdog(&mut self) -> Result<()> {
// If watchdog is disabled, then do nothing.
// if systemd::daemon::watchdog_enabled(false).unwrap_or_default() == 0 {
// return Ok(());
// }
if systemd::daemon::watchdog_enabled(false).unwrap_or_default() == 0 {
return Ok(());
}

// 1. Collect quick sample
let self_highest = self
Expand All @@ -195,6 +195,8 @@ impl NodeLauncher {
.get_highest_canonical_block_number()?
.ok_or_else(|| anyhow!("can't find highest block num in database!"))?;

tracing::debug!("WDT check {self_highest}");

// 1.5 Debounce
if self.watchdog.value == self_highest {
self.watchdog.count += 1;
Expand Down Expand Up @@ -222,14 +224,14 @@ impl NodeLauncher {
"0x0".to_string()
});

let other_highest = result
let remote_highest = result
.strip_prefix("0x")
.map(|s| u64::from_str_radix(s, 16).unwrap_or_default())
.unwrap_or_default();

// 4. If self < others for > threshold, then we're stuck
if self_highest < other_highest {
tracing::warn!(?self_highest, ?other_highest, "WDT node stuck at");
if self_highest < remote_highest {
tracing::warn!(?self_highest, ?remote_highest, "WDT node stuck at");
return Ok(());
} else {
tracing::warn!(
Expand Down
10 changes: 6 additions & 4 deletions zilliqa/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ use zilliqa::{
allowed_timestamp_skew_default, block_request_batch_size_default,
block_request_limit_default, eth_chain_id_default, failed_request_sleep_duration_default,
max_blocks_in_flight_default, minimum_time_left_for_empty_block_default,
scilla_address_default, scilla_ext_libs_path_default, scilla_stdlib_dir_default,
state_cache_size_default, state_rpc_limit_default, total_native_token_supply_default,
Amount, ApiServer, Checkpoint, ConsensusConfig, GenesisDeposit, NodeConfig,
remote_api_url_default, scilla_address_default, scilla_ext_libs_path_default,
scilla_stdlib_dir_default, state_cache_size_default, state_rpc_limit_default,
total_native_token_supply_default, Amount, ApiServer, Checkpoint, ConsensusConfig,
GenesisDeposit, NodeConfig,
},
crypto::{SecretKey, TransactionPublicKey},
db,
Expand Down Expand Up @@ -180,7 +181,8 @@ fn node(
Arc::new(AtomicUsize::new(0)),
)?;
let node = Arc::new(Mutex::new(node));
let rpc_module: RpcModule<Arc<Mutex<Node>>> = zilliqa::api::rpc_module(node.clone());
let rpc_module: RpcModule<Arc<Mutex<Node>>> =
api::rpc_module(node.clone(), &api::all_enabled());

Ok((
TestNode {
Expand Down
2 changes: 1 addition & 1 deletion zilliqa/tests/it/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use zilliqa::{
allowed_timestamp_skew_default, block_request_batch_size_default,
block_request_limit_default, consensus_timeout_default, eth_chain_id_default,
failed_request_sleep_duration_default, max_blocks_in_flight_default,
minimum_time_left_for_empty_block_default, scilla_address_default,
minimum_time_left_for_empty_block_default, remote_api_url_default, scilla_address_default,
scilla_ext_libs_path_default, scilla_stdlib_dir_default, state_cache_size_default,
state_rpc_limit_default, total_native_token_supply_default, ApiServer, Checkpoint,
ConsensusConfig, NodeConfig,
Expand Down

0 comments on commit 4e50e21

Please sign in to comment.