Merge branch 'main' into Pravdyvy/key-protocol-update-public-part

This commit is contained in:
Oleksandr Pravdyvyi 2025-08-20 17:53:09 +03:00
commit 612a67f5ed
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 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<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 {
fn from(value: &PublicKey) -> Self {
// TODO: Check specs

View File

@ -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);