mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
fix: try edition 2024
This commit is contained in:
parent
ee91d7d79c
commit
7052bccfbc
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "common"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use rs_merkle::Hasher;
|
||||
use sha2::{digest::FixedOutput, Digest, Sha256};
|
||||
use sha2::{Digest, Sha256, digest::FixedOutput};
|
||||
|
||||
use super::TreeHashType;
|
||||
|
||||
|
||||
@ -2,14 +2,14 @@ use std::{collections::HashMap, fmt, marker::PhantomData};
|
||||
|
||||
use rs_merkle::{MerkleProof, MerkleTree};
|
||||
use serde::{
|
||||
Deserialize, Deserializer, Serialize,
|
||||
de::{SeqAccess, Visitor},
|
||||
ser::SerializeSeq,
|
||||
Deserialize, Deserializer, Serialize,
|
||||
};
|
||||
|
||||
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)]
|
||||
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;
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
@ -65,7 +65,7 @@ impl RpcError {
|
||||
return Self::server_error(Some(format!(
|
||||
"Failed to serialize invalid parameters error: {:?}",
|
||||
err.to_string()
|
||||
)))
|
||||
)));
|
||||
}
|
||||
};
|
||||
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) {
|
||||
Ok(value) => value,
|
||||
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())
|
||||
|
||||
@ -315,10 +315,10 @@ impl From<Message> for Vec<u8> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json::Value;
|
||||
use serde_json::de::from_slice;
|
||||
use serde_json::json;
|
||||
use serde_json::ser::to_vec;
|
||||
use serde_json::Value;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
use crate::parse_request;
|
||||
|
||||
use super::errors::RpcParseError;
|
||||
use super::parser::parse_params;
|
||||
use super::parser::RpcRequest;
|
||||
use super::parser::parse_params;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
use k256::ecdsa::{
|
||||
signature::{Signer, Verifier},
|
||||
Signature, SigningKey, VerifyingKey,
|
||||
signature::{Signer, Verifier},
|
||||
};
|
||||
use log::info;
|
||||
use secp256k1_zkp::{PedersenCommitment, Tweak};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use sha2::{digest::FixedOutput, Digest};
|
||||
use sha2::{Digest, digest::FixedOutput};
|
||||
|
||||
use crate::merkle_tree_public::TreeHashType;
|
||||
|
||||
@ -297,9 +297,9 @@ impl AuthenticatedTransaction {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use k256::{ecdsa::signature::Signer, FieldBytes};
|
||||
use secp256k1_zkp::{constants::SECRET_KEY_SIZE, Tweak};
|
||||
use sha2::{digest::FixedOutput, Digest};
|
||||
use k256::{FieldBytes, ecdsa::signature::Signer};
|
||||
use secp256k1_zkp::{Tweak, constants::SECRET_KEY_SIZE};
|
||||
use sha2::{Digest, digest::FixedOutput};
|
||||
|
||||
use crate::{
|
||||
merkle_tree_public::TreeHashType,
|
||||
@ -378,11 +378,13 @@ mod tests {
|
||||
|
||||
assert_eq!(authenticated_tx.transaction(), &transaction);
|
||||
assert_eq!(hash, &transaction.body.hash());
|
||||
assert!(authenticated_tx
|
||||
.transaction()
|
||||
.public_key
|
||||
.verify(&transaction.body.to_bytes(), &signature)
|
||||
.is_ok());
|
||||
assert!(
|
||||
authenticated_tx
|
||||
.transaction()
|
||||
.public_key
|
||||
.verify(&transaction.body.to_bytes(), &signature)
|
||||
.is_ok()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "key_protocol"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use aes_gcm::{aead::Aead, AeadCore, Aes256Gcm, KeyInit};
|
||||
use elliptic_curve::point::AffineCoordinates;
|
||||
use aes_gcm::{AeadCore, Aes256Gcm, KeyInit, aead::Aead};
|
||||
use elliptic_curve::PrimeField;
|
||||
use elliptic_curve::point::AffineCoordinates;
|
||||
use k256::{AffinePoint, FieldBytes, Scalar};
|
||||
use log::info;
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
|
||||
use super::constants_types::{CipherText, Nonce};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use aes_gcm::{aead::Aead, Aes256Gcm, KeyInit};
|
||||
use aes_gcm::{Aes256Gcm, KeyInit, aead::Aead};
|
||||
use constants_types::{CipherText, Nonce};
|
||||
use elliptic_curve::point::AffineCoordinates;
|
||||
use k256::AffinePoint;
|
||||
@ -136,8 +136,8 @@ impl KeyChain {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use aes_gcm::{
|
||||
aead::{Aead, KeyInit, OsRng},
|
||||
Aes256Gcm,
|
||||
aead::{Aead, KeyInit, OsRng},
|
||||
};
|
||||
use constants_types::{CipherText, Nonce};
|
||||
use constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use common::merkle_tree_public::TreeHashType;
|
||||
use elliptic_curve::PrimeField;
|
||||
use k256::{AffinePoint, FieldBytes, Scalar};
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{digest::FixedOutput, Digest};
|
||||
use sha2::{Digest, digest::FixedOutput};
|
||||
|
||||
use super::constants_types::{NULLIFIER_SECRET_CONST, VIEWING_SECRET_CONST};
|
||||
|
||||
|
||||
@ -36,7 +36,9 @@ impl NSSAUserData {
|
||||
accounts_keys: HashMap<nssa::Address, nssa::PrivateKey>,
|
||||
) -> Result<Self> {
|
||||
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);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "mempool"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "program-methods"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[build-dependencies]
|
||||
risc0-build = { version = "3.0.3" }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "programs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[workspace]
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "test-program-methods"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[build-dependencies]
|
||||
risc0-build = { version = "3.0.3" }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "programs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[workspace]
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "sequencer_core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
hex.workspace = true
|
||||
|
||||
@ -3,7 +3,7 @@ use std::path::Path;
|
||||
use block_store::SequecerBlockStore;
|
||||
use common::block::HashableBlockData;
|
||||
use nssa::{self, Address};
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
|
||||
use crate::config::AccountInitialData;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "sequencer_rpc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -5,8 +5,8 @@ pub mod types;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common::rpc_primitives::{
|
||||
errors::{RpcError, RpcErrorKind},
|
||||
RpcPollingConfig,
|
||||
errors::{RpcError, RpcErrorKind},
|
||||
};
|
||||
use sequencer_core::SequencerCore;
|
||||
use serde::Serialize;
|
||||
|
||||
@ -2,13 +2,13 @@ use std::io;
|
||||
use std::sync::Arc;
|
||||
|
||||
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::FutureExt;
|
||||
use log::info;
|
||||
|
||||
use common::rpc_primitives::message::Message;
|
||||
use common::rpc_primitives::RpcConfig;
|
||||
use common::rpc_primitives::message::Message;
|
||||
use sequencer_core::SequencerCore;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use actix_web::Error as HttpError;
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
use nssa;
|
||||
use sequencer_core::config::AccountInitialData;
|
||||
use serde_json::Value;
|
||||
@ -26,7 +26,7 @@ use common::rpc_primitives::requests::{
|
||||
SendTxResponse,
|
||||
};
|
||||
|
||||
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
||||
use super::{JsonHandler, respond, types::err_rpc::RpcErr};
|
||||
|
||||
pub const HELLO: &str = "hello";
|
||||
pub const SEND_TX: &str = "send_tx";
|
||||
@ -276,13 +276,13 @@ impl JsonHandler {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{rpc_handler, JsonHandler};
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use crate::{JsonHandler, rpc_handler};
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
use common::rpc_primitives::RpcPollingConfig;
|
||||
|
||||
use sequencer_core::{
|
||||
config::{AccountInitialData, SequencerConfig},
|
||||
SequencerCore,
|
||||
config::{AccountInitialData, SequencerConfig},
|
||||
};
|
||||
use serde_json::Value;
|
||||
use tempfile::tempdir;
|
||||
@ -368,7 +368,7 @@ mod tests {
|
||||
}
|
||||
|
||||
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(
|
||||
App::new()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "sequencer_runner"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -5,7 +5,7 @@ use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use common::rpc_primitives::RpcConfig;
|
||||
use log::info;
|
||||
use sequencer_core::{config::SequencerConfig, SequencerCore};
|
||||
use sequencer_core::{SequencerCore, config::SequencerConfig};
|
||||
use sequencer_rpc::new_http_server;
|
||||
use tokio::{sync::Mutex, task::JoinHandle};
|
||||
|
||||
@ -71,7 +71,9 @@ pub async fn main_runner() -> Result<()> {
|
||||
if let Some(ref rust_log) = app_config.override_rust_log {
|
||||
info!("RUST_LOG env var set to {rust_log:?}");
|
||||
|
||||
std::env::set_var(RUST_LOG, rust_log);
|
||||
unsafe {
|
||||
std::env::set_var(RUST_LOG, rust_log);
|
||||
}
|
||||
}
|
||||
|
||||
//ToDo: Add restart on failures
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "storage"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -5,7 +5,7 @@ use error::DbError;
|
||||
use rocksdb::{
|
||||
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 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;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "wallet"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
|
||||
@ -5,8 +5,8 @@ use key_protocol::key_protocol_core::NSSAUserData;
|
||||
use nssa::Address;
|
||||
|
||||
use crate::{
|
||||
config::{PersistentAccountData, WalletConfig},
|
||||
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.
|
||||
@ -69,12 +69,16 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_home_get_env_var() {
|
||||
std::env::set_var(HOME_DIR_ENV_VAR, "/path/to/configs");
|
||||
unsafe {
|
||||
std::env::set_var(HOME_DIR_ENV_VAR, "/path/to/configs");
|
||||
}
|
||||
|
||||
let home = get_home().unwrap();
|
||||
|
||||
assert_eq!(PathBuf::from_str("/path/to/configs").unwrap(), home);
|
||||
|
||||
std::env::remove_var(HOME_DIR_ENV_VAR);
|
||||
unsafe {
|
||||
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 common::{
|
||||
sequencer_client::{json::SendTxResponse, SequencerClient},
|
||||
ExecutionFailureKind,
|
||||
sequencer_client::{SequencerClient, json::SendTxResponse},
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use tokio::runtime::Builder;
|
||||
use wallet::{execute_subcommand, Args};
|
||||
use wallet::{Args, execute_subcommand};
|
||||
|
||||
pub const NUM_THREADS: usize = 2;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user