fix session keys order

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2026-09-25 15:44:59 +03:00
parent 11eca462a4
commit ee23e6ba64
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
4 changed files with 19 additions and 19 deletions

View File

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

View File

@ -67,13 +67,13 @@ impl RotatePopup {
fn parse_session_keys(&self) -> (String, String, String, String, String) {
if !self.cached_keys.is_empty() && self.cached_keys.len() == 322 {
let gran_key = format!("0x{}", &self.cached_keys[2..66]);
let babe_key = format!("0x{}", &self.cached_keys[66..130]);
let babe_key = format!("0x{}", &self.cached_keys[2..66]);
let gran_key = format!("0x{}", &self.cached_keys[66..130]);
let audi_key = format!("0x{}", &self.cached_keys[130..194]);
let wevr_key = format!("0x{}", &self.cached_keys[194..258]);
let exds_key = format!("0x{}", &self.cached_keys[258..322]);
(gran_key, babe_key, audi_key, wevr_key, exds_key)
(babe_key, gran_key, audi_key, wevr_key, exds_key)
} else {
(
String::from("0x0000000000000000000000000000000000000000000000000000000000000000"),
@ -145,18 +145,18 @@ impl Component for RotatePopup {
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
if self.is_active {
let (border_style, border_type) = self.palette.create_popup_style();
let (gran_key, babe_key, audi_key, wevr_key, exds_key) = self.parse_session_keys();
let (babe_key, gran_key, audi_key, wevr_key, exds_key) = self.parse_session_keys();
let table = Table::new(
vec![
Row::new(vec![
Cell::from(Text::from("gran".to_string()).alignment(Alignment::Left)),
Cell::from(Text::from(gran_key).alignment(Alignment::Right)),
]),
Row::new(vec![
Cell::from(Text::from("babe".to_string()).alignment(Alignment::Left)),
Cell::from(Text::from(babe_key).alignment(Alignment::Right)),
]),
Row::new(vec![
Cell::from(Text::from("gran".to_string()).alignment(Alignment::Left)),
Cell::from(Text::from(gran_key).alignment(Alignment::Right)),
]),
Row::new(vec![
Cell::from(Text::from("audi".to_string()).alignment(Alignment::Left)),
Cell::from(Text::from(audi_key).alignment(Alignment::Right)),

View File

@ -238,21 +238,21 @@ pub async fn get_session_keys(
account_id: &[u8; 32],
) -> Result<()> {
let maybe_session_keys = super::raw_calls::session::next_keys(api, None, account_id).await?;
let (gran_key, babe_key, audi_key, wevr_key, exds_key) = match maybe_session_keys {
let (babe_key, gran_key, audi_key, wevr_key, exds_key) = match maybe_session_keys {
Some(session_keys) => {
let gran_key = format!("0x{}", hex::encode(session_keys.grandpa.0));
let babe_key = format!("0x{}", hex::encode(session_keys.babe.0));
let gran_key = format!("0x{}", hex::encode(session_keys.grandpa.0));
let audi_key = format!("0x{}", hex::encode(session_keys.authority_discovery.0));
let wevr_key = format!("0x{}", hex::encode(session_keys.weaver.0));
let exds_key = format!("0x{}", hex::encode(session_keys.exodus.0));
(gran_key, babe_key, audi_key, wevr_key, exds_key)
(babe_key, gran_key, audi_key, wevr_key, exds_key)
}
None => (String::new(), String::new(), String::new(), String::new(), String::new()),
};
check_author_has_key(rpc_client, action_tx, &gran_key, "gran").await?;
check_author_has_key(rpc_client, action_tx, &babe_key, "babe").await?;
check_author_has_key(rpc_client, action_tx, &gran_key, "gran").await?;
check_author_has_key(rpc_client, action_tx, &audi_key, "audi").await?;
check_author_has_key(rpc_client, action_tx, &wevr_key, "wevr").await?;
check_author_has_key(rpc_client, action_tx, &exds_key, "exds").await?;
@ -269,25 +269,25 @@ pub async fn get_queued_session_keys(
let account = super::raw_calls::convert_array_to_account_id(account_id);
let maybe_queued_keys = super::raw_calls::session::queued_keys(api, None).await?;
let (gran_key, babe_key, audi_key, wevr_key, exds_key) = match maybe_queued_keys {
let (babe_key, gran_key, audi_key, wevr_key, exds_key) = match maybe_queued_keys {
Some(session_keys) => match session_keys.iter().find(|tuple| tuple.0 == account) {
Some(keys) => {
let session_keys = &keys.1;
let gran_key = format!("0x{}", hex::encode(session_keys.grandpa.0));
let babe_key = format!("0x{}", hex::encode(session_keys.babe.0));
let gran_key = format!("0x{}", hex::encode(session_keys.grandpa.0));
let audi_key = format!("0x{}", hex::encode(session_keys.authority_discovery.0));
let wevr_key = format!("0x{}", hex::encode(session_keys.weaver.0));
let exds_key = format!("0x{}", hex::encode(session_keys.exodus.0));
(gran_key, babe_key, audi_key, wevr_key, exds_key)
(babe_key, gran_key, audi_key, wevr_key, exds_key)
}
None => (String::new(), String::new(), String::new(), String::new(), String::new()),
},
None => (String::new(), String::new(), String::new(), String::new(), String::new()),
};
check_author_has_key(rpc_client, action_tx, &gran_key, "q_gran").await?;
check_author_has_key(rpc_client, action_tx, &babe_key, "q_babe").await?;
check_author_has_key(rpc_client, action_tx, &gran_key, "q_gran").await?;
check_author_has_key(rpc_client, action_tx, &audi_key, "q_audi").await?;
check_author_has_key(rpc_client, action_tx, &wevr_key, "q_wevr").await?;
check_author_has_key(rpc_client, action_tx, &exds_key, "q_exds").await?;

View File

@ -115,7 +115,7 @@ pub async fn set_keys(
hashed_keys_str: &String,
maybe_nonce: Option<&mut u32>,
) -> Result<TxProgress<CasperConfig, OnlineClient<CasperConfig>>> {
let (gran_key, babe_key, audi_key, wevr_key, exds_key) = {
let (babe_key, gran_key, audi_key, wevr_key, exds_key) = {
let s = hashed_keys_str.trim_start_matches("0x");
(
hex::decode(&s[0..64])
@ -146,8 +146,8 @@ pub async fn set_keys(
)
};
let session_keys = runtime_types::casper_runtime::opaque::SessionKeys {
grandpa: runtime_types::sp_consensus_grandpa::app::Public(gran_key),
babe: runtime_types::sp_consensus_babe::app::Public(babe_key),
grandpa: runtime_types::sp_consensus_grandpa::app::Public(gran_key),
authority_discovery: runtime_types::sp_authority_discovery::app::Public(audi_key),
weaver: runtime_types::ghost_weaver::sr25519::app_sr25519::Public(wevr_key),
exodus: runtime_types::ghost_exodus::sr25519::app_sr25519::Public(exds_key),