mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
fix: comments fix
This commit is contained in:
parent
1cdf058938
commit
d2ab8dd4d4
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user