avoid crushes during the chill

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-11-18 02:19:45 +03:00
parent 7f246d9a4e
commit 2483648b13
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
4 changed files with 20 additions and 23 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye" name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"] authors = ["str3tch <stretch@ghostchain.io>"]
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
version = "0.3.77" version = "0.3.78"
edition = "2021" edition = "2021"
homepage = "https://git.ghostchain.io/ghostchain" homepage = "https://git.ghostchain.io/ghostchain"
repository = "https://git.ghostchain.io/ghostchain/ghost-eye" repository = "https://git.ghostchain.io/ghostchain/ghost-eye"

View File

@ -189,9 +189,7 @@ pub async fn get_last_updated(
.ok() .ok()
.map(|hex_string: String| { .map(|hex_string: String| {
let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string"); let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string");
u64::decode(&mut bytes.as_slice()) u64::decode(&mut bytes.as_slice()).ok().unwrap_or_default()
.ok()
.unwrap_or_default()
}) })
.unwrap_or_default(); .unwrap_or_default();
@ -219,9 +217,7 @@ pub async fn get_rate_limit_delay(
.ok() .ok()
.map(|hex_string: String| { .map(|hex_string: String| {
let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string"); let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string");
u64::decode(&mut bytes.as_slice()) u64::decode(&mut bytes.as_slice()).ok().unwrap_or(5_000u64)
.ok()
.unwrap_or(5_000u64)
}) })
.unwrap_or(5_000u64); .unwrap_or(5_000u64);

View File

@ -277,8 +277,8 @@ impl Network {
} }
TxStatus::InBestBlock(b) => self.action_tx.send(Action::EventLog( TxStatus::InBestBlock(b) => self.action_tx.send(Action::EventLog(
format!( format!(
"transaction {} included in the block header {}", "transaction {:?} included in the block header {}",
b.extrinsic_hash(), b,
b.block_hash() b.block_hash()
), ),
ActionLevel::Info, ActionLevel::Info,
@ -380,7 +380,11 @@ impl Network {
.await?; .await?;
legacy_rpc_calls::get_last_updated(&self.action_tx, &self.rpc_client, chain_id) legacy_rpc_calls::get_last_updated(&self.action_tx, &self.rpc_client, chain_id)
.await?; .await?;
legacy_rpc_calls::get_rate_limit_delay(&self.action_tx, &self.rpc_client, chain_id) legacy_rpc_calls::get_rate_limit_delay(
&self.action_tx,
&self.rpc_client,
chain_id,
)
.await?; .await?;
} }
Ok(()) Ok(())
@ -715,7 +719,7 @@ impl Network {
Action::ChillFrom(sender) => { Action::ChillFrom(sender) => {
let sender_str = hex::encode(sender); let sender_str = hex::encode(sender);
let maybe_nonce = self.senders.get_mut(&sender_str); let maybe_nonce = self.senders.get_mut(&sender_str);
if let Ok(tx_progress) = predefined_txs::chill( if let Ok(_) = predefined_txs::chill(
&self.action_tx, &self.action_tx,
&self.online_client_api, &self.online_client_api,
&sender, &sender,
@ -723,11 +727,11 @@ impl Network {
) )
.await .await
{ {
self.transactions_to_watch.push(TxToWatch { self.action_tx.send(Action::EventLog(
tx_progress, format!("the chill state will be applied at the start of new era."),
sender: sender_str, ActionLevel::Info,
target: ActionTarget::ValidatorLog, ActionTarget::ValidatorLog,
}); ))?
} }
Ok(()) Ok(())
} }
@ -851,11 +855,7 @@ impl Network {
.await .await
} }
Action::NullifyLastTimestamp(chain_id) => { Action::NullifyLastTimestamp(chain_id) => {
legacy_rpc_calls::set_last_timestamp( legacy_rpc_calls::set_last_timestamp(&self.action_tx, &self.rpc_client, chain_id)
&self.action_tx,
&self.rpc_client,
chain_id,
)
.await .await
} }
_ => Ok(()), _ => Ok(()),

View File

@ -0,0 +1 @@