lib: Clean up imports

This commit is contained in:
parazyd
2023-08-24 15:29:16 +02:00
parent 481066de2f
commit 2d0e3b0d89
48 changed files with 86 additions and 126 deletions

3
Cargo.lock generated
View File

@@ -1513,6 +1513,7 @@ dependencies = [
name = "darkfi-deployooor-contract"
version = "0.4.1"
dependencies = [
"async-trait",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.10",
@@ -1563,14 +1564,12 @@ dependencies = [
name = "darkfi-sdk"
version = "0.4.1"
dependencies = [
"async-trait",
"blake2b_simd",
"blake3",
"bridgetree",
"bs58",
"chacha20poly1305",
"darkfi-serial",
"futures-lite",
"halo2_gadgets",
"halo2_proofs",
"lazy_static",

View File

@@ -16,14 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
blockchain::Slot,
crypto::schnorr::Signature,
pasta::{group::ff::Field, pallas},
};
use darkfi_serial::{deserialize, serialize, SerialDecodable, SerialEncodable};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, deserialize, serialize, SerialDecodable, SerialEncodable};
use crate::{tx::Transaction, Error, Result};

View File

@@ -16,10 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::crypto::{MerkleNode, MerkleTree};
use darkfi_serial::{deserialize, serialize, SerialDecodable, SerialEncodable};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, deserialize, serialize, SerialDecodable, SerialEncodable};
use crate::{util::time::Timestamp, Error, Result};

View File

@@ -18,13 +18,11 @@
use std::fmt;
use async_trait::async_trait;
use darkfi_sdk::{
crypto::{MerkleNode, MerkleTree},
pasta::pallas,
};
use darkfi_serial::{serialize, SerialDecodable, SerialEncodable};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, serialize, SerialDecodable, SerialEncodable};
use super::{
constants::{BLOCK_MAGIC_BYTES, BLOCK_VERSION},

View File

@@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
crypto::{
pedersen::{pedersen_commitment_base, pedersen_commitment_u64},
@@ -26,11 +25,10 @@ use darkfi_sdk::{
},
pasta::{arithmetic::CurveAffine, group::Curve, pallas},
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use halo2_proofs::{arithmetic::Field, circuit::Value};
use log::info;
use rand::rngs::OsRng;
use smol::io::{AsyncRead, AsyncWrite};
use super::constants::EPOCH_LENGTH;
use crate::{

View File

@@ -16,14 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
crypto::{schnorr::Signature, Keypair, PublicKey},
pasta::pallas,
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use log::error;
use smol::io::{AsyncRead, AsyncWrite};
use crate::{
zk::proof::{Proof, VerifyingKey},

View File

@@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use crypto_api_chachapoly::ChachaPolyIetf;
use darkfi_sdk::{
crypto::{
@@ -26,9 +25,8 @@ use darkfi_sdk::{
},
pasta::pallas,
};
use darkfi_serial::{Decodable, Encodable, SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, Decodable, Encodable, SerialDecodable, SerialEncodable};
use rand::rngs::OsRng;
use smol::io::{AsyncRead, AsyncWrite};
use crate::Error;

View File

@@ -16,16 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
blockchain::{PidOutput, PreviousSlot, Slot},
crypto::MerkleTree,
pasta::{group::ff::PrimeField, pallas},
};
use darkfi_serial::{deserialize, serialize, SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, deserialize, serialize, SerialDecodable, SerialEncodable};
use log::info;
use rand::{thread_rng, Rng};
use smol::io::{AsyncRead, AsyncWrite};
use super::{
constants,

View File

@@ -16,18 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
crypto::MerkleNode,
pasta::{arithmetic::CurveAffine, group::Curve, pallas},
};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use crate::{
zk::{proof::VerifyingKey, Proof},
Error, Result,
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
#[derive(Debug, Clone, SerialDecodable, SerialEncodable)]
pub struct TransferStx {

View File

@@ -16,9 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use crate::consensus::{EncryptedTxRcpt, TransferStx};

View File

@@ -43,8 +43,10 @@ default = []
no-entrypoint = []
client = [
"darkfi",
"darkfi-serial/async",
"darkfi-money-contract/client",
"darkfi-money-contract/no-entrypoint",
"rand",
"chacha20poly1305",
"log",

View File

@@ -23,6 +23,9 @@ use darkfi_sdk::{
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
#[cfg(feature = "client")]
use darkfi_serial::async_trait;
/// Parameters for `Consensus::GenesisStake`
#[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
// ANCHOR: ConsensusGenesisStakeParams

View File

@@ -63,7 +63,7 @@ fn consensus_contract_genesis_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusGenesisStake,
&Holder::Alice,
&vec![genesis_stake_tx.clone(), genesis_stake_tx.clone()],
&[genesis_stake_tx.clone(), genesis_stake_tx.clone()],
current_slot,
1,
)
@@ -75,7 +75,7 @@ fn consensus_contract_genesis_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusGenesisStake,
&Holder::Alice,
&vec![genesis_stake_tx.clone()],
&[genesis_stake_tx.clone()],
current_slot + 1,
1,
)

View File

@@ -111,7 +111,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusStake,
&Holder::Alice,
&vec![stake_tx],
&[stake_tx],
current_slot,
1,
)
@@ -129,7 +129,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusProposal,
&Holder::Alice,
&vec![proposal_tx],
&[proposal_tx],
current_slot,
1,
)
@@ -144,7 +144,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusUnstakeRequest,
&Holder::Alice,
&vec![unstake_request_tx],
&[unstake_request_tx],
current_slot,
1,
)
@@ -166,7 +166,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusUnstakeRequest,
&Holder::Alice,
&vec![unstake_request_tx],
&[unstake_request_tx],
current_slot,
1,
)
@@ -187,7 +187,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusUnstake,
&Holder::Alice,
&vec![unstake_tx],
&[unstake_tx],
current_slot,
1,
)
@@ -217,7 +217,7 @@ fn consensus_contract_stake_unstake() -> Result<()> {
th.execute_erroneous_txs(
TxAction::ConsensusProposal,
&Holder::Alice,
&vec![proposal_tx],
&[proposal_tx],
current_slot,
1,
)

View File

@@ -42,8 +42,10 @@ default = []
no-entrypoint = []
client = [
"darkfi",
"darkfi-serial/async",
"darkfi-money-contract/client",
"darkfi-money-contract/no-entrypoint",
"rand",
"chacha20poly1305",
"log",

View File

@@ -25,7 +25,7 @@ use darkfi_sdk::{
},
pasta::pallas,
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use rand::rngs::OsRng;
use darkfi::{

View File

@@ -25,7 +25,7 @@ use darkfi_sdk::{
},
pasta::pallas,
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use log::debug;
use rand::rngs::OsRng;

View File

@@ -26,6 +26,9 @@ use darkfi_sdk::{
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
#[cfg(feature = "client")]
use darkfi_serial::async_trait;
/// A `DaoBulla` represented in the state
#[derive(Debug, Copy, Clone, Eq, PartialEq, SerialEncodable, SerialDecodable)]
pub struct DaoBulla(pallas::Base);

View File

@@ -13,6 +13,8 @@ darkfi-sdk = { path = "../../sdk" }
darkfi-serial = { path = "../../serial", features = ["derive", "crypto"] }
thiserror = "1.0.47"
async-trait = { version = "0.1.73", optional = true }
# We need to disable random using "custom" which makes the crate a noop
# so the wasm32-unknown-unknown target is enabled.
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -21,3 +23,7 @@ getrandom = { version = "0.2.8", features = ["custom"] }
[features]
default = []
no-entrypoint = []
client = [
"darkfi-sdk/async",
"darkfi-serial/async",
]

View File

@@ -16,6 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#[cfg(feature = "client")]
use darkfi_serial::async_trait;
use darkfi_sdk::crypto::{ContractId, PublicKey};
use darkfi_serial::{SerialDecodable, SerialEncodable};

View File

@@ -16,8 +16,8 @@ thiserror = "1.0.47"
# The following dependencies are used for the client API and
# probably shouldn't be in WASM
chacha20poly1305 = { version = "0.10.1", optional = true }
darkfi = { path = "../../../", features = ["zk", "rpc", "blockchain"], optional = true }
chacha20poly1305 = { version = "0.10.1", optional = true }
halo2_proofs = { version = "0.3.0", optional = true }
log = { version = "0.4.20", optional = true }
rand = { version = "0.8.5", optional = true }
@@ -40,6 +40,8 @@ default = []
no-entrypoint = []
client = [
"darkfi",
"darkfi-serial/async",
"rand",
"chacha20poly1305",
"log",

View File

@@ -31,7 +31,7 @@ use darkfi_sdk::{
crypto::{pasta_prelude::*, Nullifier, SecretKey, TokenId, DARK_TOKEN_ID},
pasta::pallas,
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use crate::model::Coin;

View File

@@ -26,6 +26,9 @@ use darkfi_sdk::{
};
use darkfi_serial::{SerialDecodable, SerialEncodable};
#[cfg(feature = "client")]
use darkfi_serial::async_trait;
/// A `Coin` represented in the Money state
#[derive(Debug, Clone, Copy, Eq, PartialEq, SerialEncodable, SerialDecodable)]
pub struct Coin(pallas::Base);

View File

@@ -72,7 +72,7 @@ fn genesis_mint() -> Result<()> {
th.execute_erroneous_txs(
TxAction::MoneyGenesisMint,
&Holder::Alice,
&vec![genesis_mint_tx.clone(), genesis_mint_tx.clone()],
&[genesis_mint_tx.clone(), genesis_mint_tx.clone()],
current_slot,
1,
)
@@ -84,7 +84,7 @@ fn genesis_mint() -> Result<()> {
th.execute_erroneous_txs(
TxAction::MoneyGenesisMint,
&Holder::Alice,
&vec![genesis_mint_tx.clone()],
&[genesis_mint_tx.clone()],
current_slot + 1,
1,
)

View File

@@ -12,7 +12,7 @@ darkfi-serial = {path = "../../../src/serial", features = ["derive", "crypto"]}
darkfi-dao-contract = {path = "../dao", features = ["client", "no-entrypoint"]}
darkfi-money-contract = {path = "../money", features = ["client", "no-entrypoint"]}
darkfi-consensus-contract = {path = "../consensus", features = ["client", "no-entrypoint"]}
darkfi-deployooor-contract = {path = "../deployooor", features = ["no-entrypoint"]}
darkfi-deployooor-contract = {path = "../deployooor", features = ["client", "no-entrypoint"]}
blake3 = "1.4.1"
bs58 = "0.5.0"

View File

@@ -18,15 +18,11 @@
use std::{cmp::Ordering, collections::HashMap, fmt::Debug, path::Path, sync::Arc};
use async_trait::async_trait;
use darkfi_serial::{
deserialize, serialize, Decodable, Encodable, SerialDecodable, SerialEncodable,
async_trait, deserialize, serialize, Decodable, Encodable, SerialDecodable, SerialEncodable,
};
use log::{error, info};
use smol::{
io::{AsyncRead, AsyncWrite},
lock::Mutex,
};
use smol::lock::Mutex;
use tinyjson::JsonValue;
use crate::{

View File

@@ -21,10 +21,7 @@ use std::{fmt::Debug, sync::Arc};
use async_trait::async_trait;
use darkfi_serial::{Decodable, Encodable, SerialDecodable, SerialEncodable};
use log::debug;
use smol::{
io::{AsyncRead, AsyncWrite},
lock::Mutex,
};
use smol::lock::Mutex;
use super::EventMsg;
use crate::{

View File

@@ -18,12 +18,11 @@
use std::sync::Arc;
use async_trait::async_trait;
use darkfi_serial::{serialize, SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, serialize, SerialDecodable, SerialEncodable};
use log::{debug, error, info};
use rand::{rngs::OsRng, Rng};
use smol::{
io::{self, AsyncRead, AsyncWrite, ReadHalf, WriteHalf},
io::{self, ReadHalf, WriteHalf},
lock::Mutex,
Executor,
};

View File

@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_serial::{
AsyncDecodable, AsyncEncodable, Decodable, Encodable, SerialDecodable, SerialEncodable, VarInt,
async_trait, AsyncDecodable, AsyncEncodable, Decodable, Encodable, SerialDecodable,
SerialEncodable, VarInt,
};
use log::trace;
use smol::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};

View File

@@ -13,15 +13,13 @@ doctest = false
[features]
default = []
async = ["async-trait", "futures-lite"]
async = ["darkfi-serial/async"]
[dependencies]
# Error handling
thiserror = "1.0.47"
# Serialization
async-trait = {version = "0.1.73", optional = true}
futures-lite = {version = "1.13.0", optional = true}
darkfi-serial = {version = "0.4.1", path = "../serial", features = ["derive", "crypto"]}
# Encoding

View File

@@ -16,11 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#[cfg(feature = "async-trait")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use pasta_curves::{group::ff::Field, pallas};

View File

@@ -17,10 +17,7 @@
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{serialize, SerialDecodable, SerialEncodable};
use lazy_static::lazy_static;
use pasta_curves::{group::ff::PrimeField, pallas};

View File

@@ -20,10 +20,7 @@
#![allow(non_snake_case)]
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use halo2_gadgets::ecc::chip::FixedPoint;
use pasta_curves::{

View File

@@ -19,10 +19,7 @@
use core::str::FromStr;
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use halo2_gadgets::ecc::chip::FixedPoint;
use pasta_curves::{

View File

@@ -19,11 +19,6 @@
use core::{fmt, str::FromStr};
use std::{io, iter};
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use bridgetree::{BridgeTree, Hashable, Level};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use halo2_gadgets::sinsemilla::primitives::HashDomain;
@@ -34,6 +29,9 @@ use pasta_curves::{
};
use subtle::{Choice, ConditionallySelectable};
#[cfg(feature = "async")]
use darkfi_serial::async_trait;
use crate::crypto::constants::{
sinsemilla::{i2lebsp_k, L_ORCHARD_MERKLE, MERKLE_CRH_PERSONALIZATION},
MERKLE_DEPTH,

View File

@@ -16,16 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use chacha20poly1305::{AeadInPlace, ChaCha20Poly1305, KeyInit};
use darkfi_serial::{Decodable, Encodable, SerialDecodable, SerialEncodable};
use pasta_curves::{group::ff::Field, pallas};
use rand_core::{CryptoRng, RngCore};
#[cfg(feature = "async")]
use darkfi_serial::async_trait;
use super::{diffie_hellman, poseidon_hash, util::mod_r_p, PublicKey, SecretKey};
use crate::error::ContractError;

View File

@@ -17,10 +17,7 @@
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use pasta_curves::{group::ff::PrimeField, pallas};

View File

@@ -17,10 +17,7 @@
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use halo2_gadgets::ecc::chip::FixedPoint;
use pasta_curves::{

View File

@@ -17,10 +17,7 @@
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use lazy_static::lazy_static;
use pasta_curves::{group::ff::PrimeField, pallas};

View File

@@ -17,10 +17,7 @@
*/
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use futures_lite::{AsyncRead, AsyncWrite};
use darkfi_serial::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use super::crypto::ContractId;

View File

@@ -157,7 +157,7 @@ pub fn async_enum_ser(input: &ItemEnum, cratename: Ident) -> syn::Result<TokenSt
Ok(quote! {
#[async_trait]
impl #impl_generics #cratename::AsyncEncodable for #enum_ident #ty_generics #where_clause {
async fn encode_async<S: AsyncWrite + Unpin + Send>(&self, s: &mut S) -> ::std::io::Result<usize> {
async fn encode_async<S: #cratename::AsyncWrite + Unpin + Send>(&self, s: &mut S) -> ::std::io::Result<usize> {
let variant_idx: u8 = match self {
#all_variants_idx_body
};
@@ -255,7 +255,7 @@ pub fn async_enum_de(input: &ItemEnum, cratename: Ident) -> syn::Result<TokenStr
Ok(quote! {
#[async_trait]
impl #impl_generics #cratename::AsyncDecodable for #name #ty_generics #where_clause {
async fn decode_async<D: AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
async fn decode_async<D: #cratename::AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
let variant_tag: u8 = #cratename::AsyncDecodable::decode_async(d).await?;
let mut return_value =
@@ -322,7 +322,7 @@ pub fn async_struct_ser(input: &ItemStruct, cratename: Ident) -> syn::Result<Tok
Ok(quote! {
#[async_trait]
impl #impl_generics #cratename::AsyncEncodable for #name #ty_generics #where_clause {
async fn encode_async<S: AsyncWrite + Unpin + Send>(&self, s: &mut S) -> ::std::io::Result<usize> {
async fn encode_async<S: #cratename::AsyncWrite + Unpin + Send>(&self, s: &mut S) -> ::std::io::Result<usize> {
let mut len = 0;
#body
Ok(len)
@@ -392,7 +392,7 @@ pub fn async_struct_de(input: &ItemStruct, cratename: Ident) -> syn::Result<Toke
Ok(quote! {
#[async_trait]
impl #impl_generics #cratename::AsyncDecodable for #name #ty_generics #where_clause {
async fn decode_async<D: AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
async fn decode_async<D: #cratename::AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
let mut return_value = #return_value;
return_value.#method_ident();
Ok(return_value)
@@ -403,7 +403,7 @@ pub fn async_struct_de(input: &ItemStruct, cratename: Ident) -> syn::Result<Toke
Ok(quote! {
#[async_trait]
impl #impl_generics #cratename::AsyncDecodable for #name #ty_generics #where_clause {
async fn decode_async<D: AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
async fn decode_async<D: #cratename::AsyncRead + Unpin + Send>(d: &mut D) -> ::std::io::Result<Self> {
Ok(#return_value)
}
}

View File

@@ -21,11 +21,11 @@ use std::{
io::{Error, ErrorKind, Result},
};
use async_trait::async_trait;
pub use async_trait::async_trait;
use futures_lite::{
io::Cursor, AsyncRead, AsyncReadExt as FutAsyncReadExt, AsyncWrite,
AsyncWriteExt as FutAsyncWriteExt,
io::Cursor, AsyncReadExt as FutAsyncReadExt, AsyncWriteExt as FutAsyncWriteExt,
};
pub use futures_lite::{AsyncRead, AsyncWrite};
use crate::{endian, VarInt};

View File

@@ -28,7 +28,8 @@ pub use darkfi_derive::{SerialDecodable, SerialEncodable};
mod async_lib;
#[cfg(feature = "async")]
pub use async_lib::{
deserialize_async, deserialize_async_partial, serialize_async, AsyncDecodable, AsyncEncodable,
async_trait, deserialize_async, deserialize_async_partial, serialize_async, AsyncDecodable,
AsyncEncodable, AsyncRead, AsyncWrite,
};
mod endian;

View File

@@ -18,7 +18,6 @@
use std::collections::HashMap;
use async_trait::async_trait;
use darkfi_sdk::{
crypto::{
schnorr::{SchnorrPublic, SchnorrSecret, Signature},
@@ -27,10 +26,9 @@ use darkfi_sdk::{
pasta::pallas,
tx::ContractCall,
};
use darkfi_serial::{serialize, Encodable, SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, serialize, Encodable, SerialDecodable, SerialEncodable};
use log::{debug, error};
use rand::{CryptoRng, RngCore};
use smol::io::{AsyncRead, AsyncWrite};
use crate::{
error::TxVerifyFailed,

View File

@@ -18,9 +18,7 @@
use std::{fmt, time::UNIX_EPOCH};
use async_trait::async_trait;
use darkfi_serial::{SerialDecodable, SerialEncodable};
use smol::io::{AsyncRead, AsyncWrite};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use crate::Result;

View File

@@ -16,16 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use async_trait::async_trait;
use darkfi_sdk::{
blockchain::{PidOutput, PreviousSlot, Slot},
crypto::{schnorr::SchnorrSecret, MerkleNode, MerkleTree, SecretKey},
pasta::{group::ff::PrimeField, pallas},
};
use darkfi_serial::{serialize, SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, serialize, SerialDecodable, SerialEncodable};
use log::{error, info, warn};
use rand::rngs::OsRng;
use smol::io::{AsyncRead, AsyncWrite};
use crate::{
blockchain::{

View File

@@ -17,9 +17,8 @@
*/
use std::{io, io::Cursor};
use async_trait::async_trait;
use darkfi_sdk::pasta::{pallas, vesta};
use darkfi_serial::{SerialDecodable, SerialEncodable};
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
use halo2_proofs::{
helpers::SerdeFormat,
plonk,
@@ -28,7 +27,6 @@ use halo2_proofs::{
transcript::{Blake2bRead, Blake2bWrite},
};
use rand::RngCore;
use smol::io::{AsyncRead, AsyncWrite};
#[derive(Clone, Debug)]
pub struct VerifyingKey {

View File

@@ -55,7 +55,7 @@ impl ErrorEmitter {
}
pub fn emit(&self, typ: &str, msg: &str) {
if let Ok(_) = std::env::var("ZKAS_SILENT") {
if std::env::var("ZKAS_SILENT").is_ok() {
return
}