mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
clippy
This commit is contained in:
parent
fcb90f6f11
commit
00773d7457
@ -1,5 +1,3 @@
|
||||
use common::transaction::SignaturePublicKey;
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
|
||||
// TODO: Consider wrapping `AccountAddress` in a struct.
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ impl AccountPublicMask {
|
||||
impl Account {
|
||||
pub fn new() -> Self {
|
||||
let key_holder = AddressKeyHolder::new_os_random();
|
||||
let public_key = nssa::PublicKey::new(&key_holder.get_pub_account_signing_key());
|
||||
let public_key = nssa::PublicKey::new(key_holder.get_pub_account_signing_key());
|
||||
let address = nssa::Address::from_public_key(&public_key);
|
||||
let balance = 0;
|
||||
let utxos = HashMap::new();
|
||||
@ -132,7 +132,7 @@ impl Account {
|
||||
|
||||
pub fn new_with_balance(balance: u64) -> Self {
|
||||
let key_holder = AddressKeyHolder::new_os_random();
|
||||
let public_key = nssa::PublicKey::new(&key_holder.get_pub_account_signing_key());
|
||||
let public_key = nssa::PublicKey::new(key_holder.get_pub_account_signing_key());
|
||||
let address = nssa::Address::from_public_key(&public_key);
|
||||
let utxos = HashMap::new();
|
||||
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
use aes_gcm::{aead::Aead, Aes256Gcm, KeyInit};
|
||||
use constants_types::{CipherText, Nonce};
|
||||
use elliptic_curve::point::AffineCoordinates;
|
||||
use k256::{ecdsa::SigningKey, AffinePoint, FieldBytes};
|
||||
use k256::AffinePoint;
|
||||
use log::info;
|
||||
use rand::{rngs::OsRng, Rng, RngCore};
|
||||
use rand::{rngs::OsRng, Rng};
|
||||
use secret_holders::{SeedHolder, TopSecretKeyHolder, UTXOSecretKeyHolder};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::account_core::PublicKey;
|
||||
pub type PublicAccountSigningKey = [u8; 32];
|
||||
use nssa::{self, PrivateKey};
|
||||
use nssa::{self};
|
||||
|
||||
pub mod constants_types;
|
||||
pub mod ephemeral_key_holder;
|
||||
@ -118,7 +118,7 @@ mod tests {
|
||||
use elliptic_curve::point::AffineCoordinates;
|
||||
use k256::{AffinePoint, ProjectivePoint, Scalar};
|
||||
|
||||
use crate::{account_core::address, key_management::ephemeral_key_holder::EphemeralKeyHolder};
|
||||
use crate::key_management::ephemeral_key_holder::EphemeralKeyHolder;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use rs_merkle::Hasher;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{merkle_tree_public::hasher::OwnHasher, transaction::Transaction};
|
||||
use crate::merkle_tree_public::hasher::OwnHasher;
|
||||
use nssa;
|
||||
|
||||
pub type BlockHash = [u8; 32];
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use crate::block::Block;
|
||||
use crate::parse_request;
|
||||
use crate::transaction::Transaction;
|
||||
|
||||
use super::errors::RpcParseError;
|
||||
use super::parser::parse_params;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::transaction::Transaction;
|
||||
|
||||
//Requests
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ use reqwest::Client;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::sequencer_client::json::AccountInitialData;
|
||||
use crate::transaction::Transaction;
|
||||
use crate::{SequencerClientError, SequencerRpcError};
|
||||
|
||||
pub mod json;
|
||||
|
||||
@ -1,12 +1,6 @@
|
||||
use k256::ecdsa::SigningKey;
|
||||
use nssa;
|
||||
use secp256k1_zkp::Tweak;
|
||||
|
||||
use crate::{
|
||||
block::{Block, HashableBlockData},
|
||||
execution_input::PublicNativeTokenSend,
|
||||
transaction::{SignaturePrivateKey, Transaction, TransactionBody, TxKind},
|
||||
};
|
||||
use crate::block::{Block, HashableBlockData};
|
||||
|
||||
//Dummy producers
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::account::{Account, AccountWithMetadata};
|
||||
|
||||
|
||||
@ -28,11 +28,11 @@ impl PublicKey {
|
||||
}
|
||||
|
||||
impl Signature {
|
||||
pub(crate) fn new(key: &PrivateKey, message: &[u8]) -> Self {
|
||||
pub(crate) fn new(_key: &PrivateKey, message: &[u8]) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
pub(crate) fn is_valid_for(&self, message: &Message, public_key: &PublicKey) -> bool {
|
||||
pub(crate) fn is_valid_for(&self, _message: &Message, _public_key: &PublicKey) -> bool {
|
||||
// TODO: implement
|
||||
true
|
||||
}
|
||||
|
||||
@ -19,9 +19,11 @@ impl V01State {
|
||||
.to_owned()
|
||||
.into_iter()
|
||||
.map(|(address_value, balance)| {
|
||||
let mut account = Account::default();
|
||||
account.balance = balance;
|
||||
account.program_owner = AUTHENTICATED_TRANSFER_PROGRAM.id;
|
||||
let account = Account {
|
||||
balance: balance,
|
||||
program_owner: AUTHENTICATED_TRANSFER_PROGRAM.id,
|
||||
..Account::default()
|
||||
};
|
||||
let address = Address::new(address_value);
|
||||
(address, account)
|
||||
})
|
||||
@ -188,7 +190,6 @@ mod tests {
|
||||
let from_key = PrivateKey(99);
|
||||
let to = Address::new(initial_data[0].0);
|
||||
let balance_to_move = 8;
|
||||
let to_previous_balance = state.get_account_by_address(&to).balance;
|
||||
let tx =
|
||||
transfer_transaction_for_tests(from.clone(), from_key, 0, to.clone(), balance_to_move);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use accounts::account_core::address::{self, AccountAddress};
|
||||
use anyhow::Result;
|
||||
use common::{
|
||||
block::HashableBlockData,
|
||||
execution_input::PublicNativeTokenSend,
|
||||
merkle_tree_public::TreeHashType,
|
||||
nullifier::UTXONullifier,
|
||||
transaction::{AuthenticatedTransaction, Transaction, TransactionBody, TxKind},
|
||||
utxo_commitment::UTXOCommitment,
|
||||
};
|
||||
use config::SequencerConfig;
|
||||
use mempool::MemPool;
|
||||
@ -86,7 +81,7 @@ impl SequencerCore {
|
||||
|
||||
let authenticated_tx = self.transaction_pre_check(transaction)?;
|
||||
|
||||
self.mempool.push_item(authenticated_tx.into());
|
||||
self.mempool.push_item(authenticated_tx);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -144,7 +139,7 @@ mod tests {
|
||||
use crate::config::AccountInitialData;
|
||||
|
||||
use super::*;
|
||||
use nssa::Program;
|
||||
|
||||
|
||||
fn setup_sequencer_config_variable_initial_accounts(
|
||||
initial_accounts: Vec<AccountInitialData>,
|
||||
@ -310,8 +305,6 @@ mod tests {
|
||||
|
||||
let initial_accounts = vec![initial_acc1, initial_acc2];
|
||||
|
||||
let intial_accounts_len = initial_accounts.len();
|
||||
|
||||
let config = setup_sequencer_config_variable_initial_accounts(initial_accounts);
|
||||
let sequencer = SequencerCore::start_from_config(config.clone());
|
||||
|
||||
@ -507,7 +500,7 @@ mod tests {
|
||||
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(TransactionMalformationErrorKind::MempoolFullForRound { .. })
|
||||
Err(TransactionMalformationErrorKind::MempoolFullForRound)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use std::{collections::HashMap, path::Path};
|
||||
|
||||
use anyhow::Result;
|
||||
use common::{block::Block, merkle_tree_public::TreeHashType, transaction::Transaction};
|
||||
use common::{block::Block, merkle_tree_public::TreeHashType};
|
||||
use storage::RocksDBIO;
|
||||
|
||||
pub struct SequecerBlockStore {
|
||||
@ -76,7 +76,7 @@ fn block_to_transactions_map(block: &Block) -> HashMap<TreeHashType, u64> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use nssa::Program;
|
||||
|
||||
use tempfile::tempdir;
|
||||
//
|
||||
// fn create_dummy_block_with_transaction(block_id: u64) -> (Block, nssa::PublicTransaction) {
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
use std::{collections::HashSet, path::Path};
|
||||
use std::path::Path;
|
||||
|
||||
use accounts::account_core::address::AccountAddress;
|
||||
use block_store::SequecerBlockStore;
|
||||
use common::{
|
||||
block::HashableBlockData,
|
||||
merkle_tree_public::merkle_tree::{PublicTransactionMerkleTree, UTXOCommitmentsMerkleTree},
|
||||
nullifier::UTXONullifier,
|
||||
};
|
||||
use common::block::HashableBlockData;
|
||||
use nssa;
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
|
||||
|
||||
@ -18,8 +18,7 @@ use common::{
|
||||
|
||||
use common::rpc_primitives::requests::{
|
||||
GetBlockDataRequest, GetBlockDataResponse, GetGenesisIdRequest, GetGenesisIdResponse,
|
||||
GetLastBlockRequest, GetLastBlockResponse, HelloRequest, HelloResponse, RegisterAccountRequest,
|
||||
RegisterAccountResponse, SendTxRequest, SendTxResponse,
|
||||
GetLastBlockRequest, GetLastBlockResponse, HelloRequest, HelloResponse, SendTxRequest, SendTxResponse,
|
||||
};
|
||||
|
||||
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
||||
@ -203,11 +202,8 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{rpc_handler, JsonHandler};
|
||||
use common::{
|
||||
rpc_primitives::RpcPollingConfig,
|
||||
transaction::{SignaturePrivateKey, Transaction, TransactionBody},
|
||||
};
|
||||
use nssa::Program;
|
||||
use common::rpc_primitives::RpcPollingConfig;
|
||||
|
||||
use sequencer_core::{
|
||||
config::{AccountInitialData, SequencerConfig},
|
||||
SequencerCore,
|
||||
|
||||
@ -1,23 +1,18 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use common::{
|
||||
execution_input::PublicNativeTokenSend,
|
||||
sequencer_client::{json::SendTxResponse, SequencerClient},
|
||||
transaction::Transaction,
|
||||
ExecutionFailureKind,
|
||||
};
|
||||
|
||||
use accounts::account_core::{address::AccountAddress, Account};
|
||||
use anyhow::Result;
|
||||
use chain_storage::NodeChainStore;
|
||||
use common::transaction::TransactionBody;
|
||||
use config::NodeConfig;
|
||||
use log::info;
|
||||
use sc_core::proofs_circuits::pedersen_commitment_vec;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use nssa;
|
||||
|
||||
use crate::helperfunctions::{fetch_config, produce_account_addr_from_hex};
|
||||
|
||||
@ -101,7 +96,7 @@ impl NodeCore {
|
||||
|
||||
let signing_key = account.key_holder.get_pub_account_signing_key();
|
||||
let witness_set =
|
||||
nssa::public_transaction::WitnessSet::for_message(&message, &[&signing_key]);
|
||||
nssa::public_transaction::WitnessSet::for_message(&message, &[signing_key]);
|
||||
|
||||
let tx = nssa::PublicTransaction::new(message, witness_set);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user