fix: comments fix

This commit is contained in:
Oleksandr Pravdyvyi 2025-08-19 06:41:36 +03:00
parent 1cdf058938
commit d2ab8dd4d4
No known key found for this signature in database
GPG Key ID: 9F8955C63C443871
2 changed files with 1 additions and 24 deletions

View File

@ -1,12 +1,9 @@
use std::{fmt::Display, str::FromStr}; use std::{fmt::Display, str::FromStr};
use anyhow::anyhow;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::signature::PublicKey; use crate::signature::PublicKey;
pub const LENGTH_MISMATCH_ERROR_MESSAGE: &str = "Slice length != 32 ";
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Address { pub struct Address {
value: [u8; 32], value: [u8; 32],
@ -28,18 +25,6 @@ impl AsRef<[u8]> for Address {
} }
} }
impl TryFrom<Vec<u8>> for Address {
type Error = anyhow::Error;
fn try_from(value: Vec<u8>) -> Result<Self, Self::Error> {
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 { impl From<&PublicKey> for Address {
fn from(value: &PublicKey) -> Self { fn from(value: &PublicKey) -> Self {
// TODO: Check specs // TODO: Check specs

View File

@ -23,15 +23,7 @@ impl SequecerChainStore {
) -> Self { ) -> Self {
let init_accs: Vec<(Address, u128)> = initial_accounts let init_accs: Vec<(Address, u128)> = initial_accounts
.iter() .iter()
.map(|acc_data| { .map(|acc_data| (acc_data.addr.parse().unwrap(), acc_data.balance))
(
hex::decode(acc_data.addr.clone())
.unwrap()
.try_into()
.unwrap(),
acc_data.balance,
)
})
.collect(); .collect();
let state = nssa::V01State::new_with_genesis_accounts(&init_accs); let state = nssa::V01State::new_with_genesis_accounts(&init_accs);