From d2ab8dd4d43228e497ee22c12026828235ccd77b Mon Sep 17 00:00:00 2001 From: Oleksandr Pravdyvyi Date: Tue, 19 Aug 2025 06:41:36 +0300 Subject: [PATCH] fix: comments fix --- nssa/src/address.rs | 15 --------------- sequencer_core/src/sequencer_store/mod.rs | 10 +--------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/nssa/src/address.rs b/nssa/src/address.rs index d54af10..93304d5 100644 --- a/nssa/src/address.rs +++ b/nssa/src/address.rs @@ -1,12 +1,9 @@ use std::{fmt::Display, str::FromStr}; -use anyhow::anyhow; use serde::{Deserialize, Serialize}; use crate::signature::PublicKey; -pub const LENGTH_MISMATCH_ERROR_MESSAGE: &str = "Slice length != 32 "; - #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct Address { value: [u8; 32], @@ -28,18 +25,6 @@ impl AsRef<[u8]> for Address { } } -impl TryFrom> for Address { - type Error = anyhow::Error; - - fn try_from(value: Vec) -> Result { - let addr_val: [u8; 32] = value - .try_into() - .map_err(|_| anyhow!(LENGTH_MISMATCH_ERROR_MESSAGE))?; - - Ok(Address::new(addr_val)) - } -} - impl From<&PublicKey> for Address { fn from(value: &PublicKey) -> Self { // TODO: Check specs diff --git a/sequencer_core/src/sequencer_store/mod.rs b/sequencer_core/src/sequencer_store/mod.rs index 3d9708d..4254ed7 100644 --- a/sequencer_core/src/sequencer_store/mod.rs +++ b/sequencer_core/src/sequencer_store/mod.rs @@ -23,15 +23,7 @@ impl SequecerChainStore { ) -> Self { let init_accs: Vec<(Address, u128)> = initial_accounts .iter() - .map(|acc_data| { - ( - hex::decode(acc_data.addr.clone()) - .unwrap() - .try_into() - .unwrap(), - acc_data.balance, - ) - }) + .map(|acc_data| (acc_data.addr.parse().unwrap(), acc_data.balance)) .collect(); let state = nssa::V01State::new_with_genesis_accounts(&init_accs);