mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-07 15:53:14 +00:00
fix: try edition 2024
This commit is contained in:
parent
ee91d7d79c
commit
7052bccfbc
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use rs_merkle::Hasher;
|
use rs_merkle::Hasher;
|
||||||
use sha2::{digest::FixedOutput, Digest, Sha256};
|
use sha2::{Digest, Sha256, digest::FixedOutput};
|
||||||
|
|
||||||
use super::TreeHashType;
|
use super::TreeHashType;
|
||||||
|
|
||||||
|
|||||||
@ -2,14 +2,14 @@ use std::{collections::HashMap, fmt, marker::PhantomData};
|
|||||||
|
|
||||||
use rs_merkle::{MerkleProof, MerkleTree};
|
use rs_merkle::{MerkleProof, MerkleTree};
|
||||||
use serde::{
|
use serde::{
|
||||||
|
Deserialize, Deserializer, Serialize,
|
||||||
de::{SeqAccess, Visitor},
|
de::{SeqAccess, Visitor},
|
||||||
ser::SerializeSeq,
|
ser::SerializeSeq,
|
||||||
Deserialize, Deserializer, Serialize,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{transaction::Transaction, utxo_commitment::UTXOCommitment};
|
use crate::{transaction::Transaction, utxo_commitment::UTXOCommitment};
|
||||||
|
|
||||||
use super::{hasher::OwnHasher, tree_leav_item::TreeLeavItem, TreeHashType};
|
use super::{TreeHashType, hasher::OwnHasher, tree_leav_item::TreeLeavItem};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct HashStorageMerkleTree<Leav: TreeLeavItem + Clone> {
|
pub struct HashStorageMerkleTree<Leav: TreeLeavItem + Clone> {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use serde_json::{to_value, Value};
|
use serde_json::{Value, to_value};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
@ -65,7 +65,7 @@ impl RpcError {
|
|||||||
return Self::server_error(Some(format!(
|
return Self::server_error(Some(format!(
|
||||||
"Failed to serialize invalid parameters error: {:?}",
|
"Failed to serialize invalid parameters error: {:?}",
|
||||||
err.to_string()
|
err.to_string()
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RpcError::new(-32_602, "Invalid params".to_owned(), Some(value))
|
RpcError::new(-32_602, "Invalid params".to_owned(), Some(value))
|
||||||
@ -178,7 +178,7 @@ impl From<ServerError> for RpcError {
|
|||||||
let error_data = match to_value(&e) {
|
let error_data = match to_value(&e) {
|
||||||
Ok(value) => value,
|
Ok(value) => value,
|
||||||
Err(_err) => {
|
Err(_err) => {
|
||||||
return RpcError::new_internal_error(None, "Failed to serialize ServerError")
|
return RpcError::new_internal_error(None, "Failed to serialize ServerError");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RpcError::new_internal_error(Some(error_data), e.to_string().as_str())
|
RpcError::new_internal_error(Some(error_data), e.to_string().as_str())
|
||||||
|
|||||||
@ -315,10 +315,10 @@ impl From<Message> for Vec<u8> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use serde_json::Value;
|
||||||
use serde_json::de::from_slice;
|
use serde_json::de::from_slice;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use serde_json::ser::to_vec;
|
use serde_json::ser::to_vec;
|
||||||
use serde_json::Value;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
use crate::parse_request;
|
use crate::parse_request;
|
||||||
|
|
||||||
use super::errors::RpcParseError;
|
use super::errors::RpcParseError;
|
||||||
use super::parser::parse_params;
|
|
||||||
use super::parser::RpcRequest;
|
use super::parser::RpcRequest;
|
||||||
|
use super::parser::parse_params;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
use k256::ecdsa::{
|
use k256::ecdsa::{
|
||||||
signature::{Signer, Verifier},
|
|
||||||
Signature, SigningKey, VerifyingKey,
|
Signature, SigningKey, VerifyingKey,
|
||||||
|
signature::{Signer, Verifier},
|
||||||
};
|
};
|
||||||
use log::info;
|
use log::info;
|
||||||
use secp256k1_zkp::{PedersenCommitment, Tweak};
|
use secp256k1_zkp::{PedersenCommitment, Tweak};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use sha2::{digest::FixedOutput, Digest};
|
use sha2::{Digest, digest::FixedOutput};
|
||||||
|
|
||||||
use crate::merkle_tree_public::TreeHashType;
|
use crate::merkle_tree_public::TreeHashType;
|
||||||
|
|
||||||
@ -297,9 +297,9 @@ impl AuthenticatedTransaction {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use k256::{ecdsa::signature::Signer, FieldBytes};
|
use k256::{FieldBytes, ecdsa::signature::Signer};
|
||||||
use secp256k1_zkp::{constants::SECRET_KEY_SIZE, Tweak};
|
use secp256k1_zkp::{Tweak, constants::SECRET_KEY_SIZE};
|
||||||
use sha2::{digest::FixedOutput, Digest};
|
use sha2::{Digest, digest::FixedOutput};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
merkle_tree_public::TreeHashType,
|
merkle_tree_public::TreeHashType,
|
||||||
@ -378,11 +378,13 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(authenticated_tx.transaction(), &transaction);
|
assert_eq!(authenticated_tx.transaction(), &transaction);
|
||||||
assert_eq!(hash, &transaction.body.hash());
|
assert_eq!(hash, &transaction.body.hash());
|
||||||
assert!(authenticated_tx
|
assert!(
|
||||||
|
authenticated_tx
|
||||||
.transaction()
|
.transaction()
|
||||||
.public_key
|
.public_key
|
||||||
.verify(&transaction.body.to_bytes(), &signature)
|
.verify(&transaction.body.to_bytes(), &signature)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "key_protocol"
|
name = "key_protocol"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use aes_gcm::{aead::Aead, AeadCore, Aes256Gcm, KeyInit};
|
use aes_gcm::{AeadCore, Aes256Gcm, KeyInit, aead::Aead};
|
||||||
use elliptic_curve::point::AffineCoordinates;
|
|
||||||
use elliptic_curve::PrimeField;
|
use elliptic_curve::PrimeField;
|
||||||
|
use elliptic_curve::point::AffineCoordinates;
|
||||||
use k256::{AffinePoint, FieldBytes, Scalar};
|
use k256::{AffinePoint, FieldBytes, Scalar};
|
||||||
use log::info;
|
use log::info;
|
||||||
use rand::{rngs::OsRng, RngCore};
|
use rand::{RngCore, rngs::OsRng};
|
||||||
|
|
||||||
use super::constants_types::{CipherText, Nonce};
|
use super::constants_types::{CipherText, Nonce};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use aes_gcm::{aead::Aead, Aes256Gcm, KeyInit};
|
use aes_gcm::{Aes256Gcm, KeyInit, aead::Aead};
|
||||||
use constants_types::{CipherText, Nonce};
|
use constants_types::{CipherText, Nonce};
|
||||||
use elliptic_curve::point::AffineCoordinates;
|
use elliptic_curve::point::AffineCoordinates;
|
||||||
use k256::AffinePoint;
|
use k256::AffinePoint;
|
||||||
@ -136,8 +136,8 @@ impl KeyChain {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use aes_gcm::{
|
use aes_gcm::{
|
||||||
aead::{Aead, KeyInit, OsRng},
|
|
||||||
Aes256Gcm,
|
Aes256Gcm,
|
||||||
|
aead::{Aead, KeyInit, OsRng},
|
||||||
};
|
};
|
||||||
use constants_types::{CipherText, Nonce};
|
use constants_types::{CipherText, Nonce};
|
||||||
use constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
use constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use common::merkle_tree_public::TreeHashType;
|
use common::merkle_tree_public::TreeHashType;
|
||||||
use elliptic_curve::PrimeField;
|
use elliptic_curve::PrimeField;
|
||||||
use k256::{AffinePoint, FieldBytes, Scalar};
|
use k256::{AffinePoint, FieldBytes, Scalar};
|
||||||
use rand::{rngs::OsRng, RngCore};
|
use rand::{RngCore, rngs::OsRng};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sha2::{digest::FixedOutput, Digest};
|
use sha2::{Digest, digest::FixedOutput};
|
||||||
|
|
||||||
use super::constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
use super::constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,9 @@ impl NSSAUserData {
|
|||||||
accounts_keys: HashMap<nssa::Address, nssa::PrivateKey>,
|
accounts_keys: HashMap<nssa::Address, nssa::PrivateKey>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
if !Self::valid_key_transaction_pairing_check(&accounts_keys) {
|
if !Self::valid_key_transaction_pairing_check(&accounts_keys) {
|
||||||
anyhow::bail!("Key transaction pairing check not satisfied, there is addresses, which is not derived from keys");
|
anyhow::bail!(
|
||||||
|
"Key transaction pairing check not satisfied, there is addresses, which is not derived from keys"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let key_holder = KeyChain::new_os_random_with_accounts(accounts_keys);
|
let key_holder = KeyChain::new_os_random_with_accounts(accounts_keys);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mempool"
|
name = "mempool"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "program-methods"
|
name = "program-methods"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
risc0-build = { version = "3.0.3" }
|
risc0-build = { version = "3.0.3" }
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "programs"
|
name = "programs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "test-program-methods"
|
name = "test-program-methods"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
risc0-build = { version = "3.0.3" }
|
risc0-build = { version = "3.0.3" }
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "programs"
|
name = "programs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sequencer_core"
|
name = "sequencer_core"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hex.workspace = true
|
hex.workspace = true
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use std::path::Path;
|
|||||||
use block_store::SequecerBlockStore;
|
use block_store::SequecerBlockStore;
|
||||||
use common::block::HashableBlockData;
|
use common::block::HashableBlockData;
|
||||||
use nssa::{self, Address};
|
use nssa::{self, Address};
|
||||||
use rand::{rngs::OsRng, RngCore};
|
use rand::{RngCore, rngs::OsRng};
|
||||||
|
|
||||||
use crate::config::AccountInitialData;
|
use crate::config::AccountInitialData;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sequencer_rpc"
|
name = "sequencer_rpc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -5,8 +5,8 @@ pub mod types;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use common::rpc_primitives::{
|
use common::rpc_primitives::{
|
||||||
errors::{RpcError, RpcErrorKind},
|
|
||||||
RpcPollingConfig,
|
RpcPollingConfig,
|
||||||
|
errors::{RpcError, RpcErrorKind},
|
||||||
};
|
};
|
||||||
use sequencer_core::SequencerCore;
|
use sequencer_core::SequencerCore;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|||||||
@ -2,13 +2,13 @@ use std::io;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use actix_cors::Cors;
|
use actix_cors::Cors;
|
||||||
use actix_web::{http, middleware, web, App, Error as HttpError, HttpResponse, HttpServer};
|
use actix_web::{App, Error as HttpError, HttpResponse, HttpServer, http, middleware, web};
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use log::info;
|
use log::info;
|
||||||
|
|
||||||
use common::rpc_primitives::message::Message;
|
|
||||||
use common::rpc_primitives::RpcConfig;
|
use common::rpc_primitives::RpcConfig;
|
||||||
|
use common::rpc_primitives::message::Message;
|
||||||
use sequencer_core::SequencerCore;
|
use sequencer_core::SequencerCore;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use actix_web::Error as HttpError;
|
use actix_web::Error as HttpError;
|
||||||
use base64::{engine::general_purpose, Engine};
|
use base64::{Engine, engine::general_purpose};
|
||||||
use nssa;
|
use nssa;
|
||||||
use sequencer_core::config::AccountInitialData;
|
use sequencer_core::config::AccountInitialData;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
@ -26,7 +26,7 @@ use common::rpc_primitives::requests::{
|
|||||||
SendTxResponse,
|
SendTxResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
use super::{JsonHandler, respond, types::err_rpc::RpcErr};
|
||||||
|
|
||||||
pub const HELLO: &str = "hello";
|
pub const HELLO: &str = "hello";
|
||||||
pub const SEND_TX: &str = "send_tx";
|
pub const SEND_TX: &str = "send_tx";
|
||||||
@ -276,13 +276,13 @@ impl JsonHandler {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{rpc_handler, JsonHandler};
|
use crate::{JsonHandler, rpc_handler};
|
||||||
use base64::{engine::general_purpose, Engine};
|
use base64::{Engine, engine::general_purpose};
|
||||||
use common::rpc_primitives::RpcPollingConfig;
|
use common::rpc_primitives::RpcPollingConfig;
|
||||||
|
|
||||||
use sequencer_core::{
|
use sequencer_core::{
|
||||||
config::{AccountInitialData, SequencerConfig},
|
|
||||||
SequencerCore,
|
SequencerCore,
|
||||||
|
config::{AccountInitialData, SequencerConfig},
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
@ -368,7 +368,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn call_rpc_handler_with_json(handler: JsonHandler, request_json: Value) -> Value {
|
async fn call_rpc_handler_with_json(handler: JsonHandler, request_json: Value) -> Value {
|
||||||
use actix_web::{test, web, App};
|
use actix_web::{App, test, web};
|
||||||
|
|
||||||
let app = test::init_service(
|
let app = test::init_service(
|
||||||
App::new()
|
App::new()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sequencer_runner"
|
name = "sequencer_runner"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use anyhow::Result;
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use common::rpc_primitives::RpcConfig;
|
use common::rpc_primitives::RpcConfig;
|
||||||
use log::info;
|
use log::info;
|
||||||
use sequencer_core::{config::SequencerConfig, SequencerCore};
|
use sequencer_core::{SequencerCore, config::SequencerConfig};
|
||||||
use sequencer_rpc::new_http_server;
|
use sequencer_rpc::new_http_server;
|
||||||
use tokio::{sync::Mutex, task::JoinHandle};
|
use tokio::{sync::Mutex, task::JoinHandle};
|
||||||
|
|
||||||
@ -71,8 +71,10 @@ pub async fn main_runner() -> Result<()> {
|
|||||||
if let Some(ref rust_log) = app_config.override_rust_log {
|
if let Some(ref rust_log) = app_config.override_rust_log {
|
||||||
info!("RUST_LOG env var set to {rust_log:?}");
|
info!("RUST_LOG env var set to {rust_log:?}");
|
||||||
|
|
||||||
|
unsafe {
|
||||||
std::env::set_var(RUST_LOG, rust_log);
|
std::env::set_var(RUST_LOG, rust_log);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//ToDo: Add restart on failures
|
//ToDo: Add restart on failures
|
||||||
let (_, _) = startup_sequencer(app_config).await?;
|
let (_, _) = startup_sequencer(app_config).await?;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "storage"
|
name = "storage"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use error::DbError;
|
|||||||
use rocksdb::{
|
use rocksdb::{
|
||||||
BoundColumnFamily, ColumnFamilyDescriptor, DBWithThreadMode, MultiThreaded, Options,
|
BoundColumnFamily, ColumnFamilyDescriptor, DBWithThreadMode, MultiThreaded, Options,
|
||||||
};
|
};
|
||||||
use sc_db_utils::{produce_blob_from_fit_vec, DataBlob, DataBlobChangeVariant};
|
use sc_db_utils::{DataBlob, DataBlobChangeVariant, produce_blob_from_fit_vec};
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod sc_db_utils;
|
pub mod sc_db_utils;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use serde::{de::Error, Deserialize, Serialize};
|
use serde::{Deserialize, Serialize, de::Error};
|
||||||
|
|
||||||
use crate::SC_DATA_BLOB_SIZE;
|
use crate::SC_DATA_BLOB_SIZE;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "wallet"
|
name = "wallet"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@ -5,8 +5,8 @@ use key_protocol::key_protocol_core::NSSAUserData;
|
|||||||
use nssa::Address;
|
use nssa::Address;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{PersistentAccountData, WalletConfig},
|
|
||||||
HOME_DIR_ENV_VAR,
|
HOME_DIR_ENV_VAR,
|
||||||
|
config::{PersistentAccountData, WalletConfig},
|
||||||
};
|
};
|
||||||
|
|
||||||
///Get home dir for wallet. Env var `NSSA_WALLET_HOME_DIR` must be set before execution to succeed.
|
///Get home dir for wallet. Env var `NSSA_WALLET_HOME_DIR` must be set before execution to succeed.
|
||||||
@ -69,12 +69,16 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_home_get_env_var() {
|
fn test_get_home_get_env_var() {
|
||||||
|
unsafe {
|
||||||
std::env::set_var(HOME_DIR_ENV_VAR, "/path/to/configs");
|
std::env::set_var(HOME_DIR_ENV_VAR, "/path/to/configs");
|
||||||
|
}
|
||||||
|
|
||||||
let home = get_home().unwrap();
|
let home = get_home().unwrap();
|
||||||
|
|
||||||
assert_eq!(PathBuf::from_str("/path/to/configs").unwrap(), home);
|
assert_eq!(PathBuf::from_str("/path/to/configs").unwrap(), home);
|
||||||
|
|
||||||
|
unsafe {
|
||||||
std::env::remove_var(HOME_DIR_ENV_VAR);
|
std::env::remove_var(HOME_DIR_ENV_VAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -2,8 +2,8 @@ use std::{fs::File, io::Write, path::PathBuf, str::FromStr, sync::Arc};
|
|||||||
|
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use common::{
|
use common::{
|
||||||
sequencer_client::{json::SendTxResponse, SequencerClient},
|
|
||||||
ExecutionFailureKind,
|
ExecutionFailureKind,
|
||||||
|
sequencer_client::{SequencerClient, json::SendTxResponse},
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use tokio::runtime::Builder;
|
use tokio::runtime::Builder;
|
||||||
use wallet::{execute_subcommand, Args};
|
use wallet::{Args, execute_subcommand};
|
||||||
|
|
||||||
pub const NUM_THREADS: usize = 2;
|
pub const NUM_THREADS: usize = 2;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user