Skip to content

Commit

Permalink
Merge pull request #3119 from dusk-network/neotamandua/reorder_rusk-x…
Browse files Browse the repository at this point in the history
…xx_imports

Reorder rusk-xxx imports
  • Loading branch information
Neotamandua authored Dec 5, 2024
2 parents 52362e0 + 955ded3 commit 2560a5d
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 108 deletions.
17 changes: 6 additions & 11 deletions rusk-abi/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@
use alloc::vec::Vec;

use dusk_bytes::Serializable;
use execution_core::{
signatures::{
bls::{
MultisigSignature, PublicKey as BlsPublicKey,
Signature as BlsSignature,
},
schnorr::{
PublicKey as SchnorrPublicKey, Signature as SchnorrSignature,
},
},
BlsScalar, ContractId,
use execution_core::signatures::bls::{
MultisigSignature, PublicKey as BlsPublicKey, Signature as BlsSignature,
};
use execution_core::signatures::schnorr::{
PublicKey as SchnorrPublicKey, Signature as SchnorrSignature,
};
use execution_core::{BlsScalar, ContractId};
use piecrust_uplink::{host_query, meta_data};

use crate::{Metadata, Query};
Expand Down
30 changes: 13 additions & 17 deletions rusk-abi/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ use std::path::{Path, PathBuf};

use dusk_bytes::DeserializableSlice;
use dusk_poseidon::{Domain, Hash as PoseidonHash};
use execution_core::{
groth16::{
bn254::{Bn254, G1Projective},
serialize::CanonicalDeserialize,
Groth16, PreparedVerifyingKey, Proof as Groth16Proof,
},
plonk::{Proof as PlonkProof, Verifier},
signatures::{
bls::{
MultisigPublicKey, MultisigSignature, PublicKey as BlsPublicKey,
Signature as BlsSignature,
},
schnorr::{
PublicKey as SchnorrPublicKey, Signature as SchnorrSignature,
},
},
BlsScalar,
use execution_core::groth16::bn254::{Bn254, G1Projective};
use execution_core::groth16::serialize::CanonicalDeserialize;
use execution_core::groth16::{
Groth16, PreparedVerifyingKey, Proof as Groth16Proof,
};
use execution_core::plonk::{Proof as PlonkProof, Verifier};
use execution_core::signatures::bls::{
MultisigPublicKey, MultisigSignature, PublicKey as BlsPublicKey,
Signature as BlsSignature,
};
use execution_core::signatures::schnorr::{
PublicKey as SchnorrPublicKey, Signature as SchnorrSignature,
};
use execution_core::BlsScalar;
use piecrust::{Error as PiecrustError, Session, SessionData, VM};
use rkyv::ser::serializers::AllocSerializer;
use rkyv::{Archive, Deserialize, Serialize};
Expand Down
47 changes: 20 additions & 27 deletions rusk-abi/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,29 @@

use std::sync::OnceLock;

use rand::rngs::OsRng;

use dusk_bytes::{ParseHexStr, Serializable};
use execution_core::{
groth16::{
bn254::{Bn254, Fr as Bn254Fr},
relations::{
lc,
r1cs::{
ConstraintSynthesizer, ConstraintSystemRef,
Field as Groth16Field, SynthesisError, Variable,
},
},
serialize::{CanonicalSerialize, Compress},
verifier::prepare_verifying_key,
Groth16,
},
plonk::{
Circuit, Compiler, Composer, Constraint, Error as PlonkError,
PublicParameters,
},
signatures::{
bls::{PublicKey as BlsPublicKey, SecretKey as BlsSecretKey},
schnorr::{
PublicKey as SchnorrPublicKey, SecretKey as SchnorrSecretKey,
},
},
BlsScalar, ContractId,
use execution_core::groth16::bn254::{Bn254, Fr as Bn254Fr};
use execution_core::groth16::relations::lc;
use execution_core::groth16::relations::r1cs::{
ConstraintSynthesizer, ConstraintSystemRef, Field as Groth16Field,
SynthesisError, Variable,
};
use execution_core::groth16::serialize::{CanonicalSerialize, Compress};
use execution_core::groth16::verifier::prepare_verifying_key;
use execution_core::groth16::Groth16;
use execution_core::plonk::{
Circuit, Compiler, Composer, Constraint, Error as PlonkError,
PublicParameters,
};
use execution_core::signatures::bls::{
PublicKey as BlsPublicKey, SecretKey as BlsSecretKey,
};
use execution_core::signatures::schnorr::{
PublicKey as SchnorrPublicKey, SecretKey as SchnorrSecretKey,
};
use execution_core::{BlsScalar, ContractId};
use ff::Field;
use rand::rngs::OsRng;
use rusk_abi::{ContractData, Session, VM};

const POINT_LIMIT: u64 = 0x4000000;
Expand Down
10 changes: 5 additions & 5 deletions rusk-profile/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use blake3::Hasher;
use serde::{Deserialize, Serialize};
use tracing::info;
use version_check::Version;

use std::fs::{self, read, File};
use std::io::prelude::*;
use std::io::{self, ErrorKind};
use std::path::PathBuf;

use blake3::Hasher;
use serde::{Deserialize, Serialize};
use tracing::info;
use version_check::Version;

use crate::{
extension, file_name, file_stem, get_rusk_circuits_dir, get_rusk_keys_dir,
Theme,
Expand Down
9 changes: 4 additions & 5 deletions rusk-profile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
#![deny(unused_crate_dependencies)]
#![deny(unused_extern_crates)]

use std::fs::{self, read, remove_file, write};
use std::path::{Path, PathBuf};
use std::{env, io};

use dirs::home_dir;
use sha2::{Digest, Sha256};
use tracing::{info, warn};

use std::env;
use std::fs::{self, read, remove_file, write};
use std::io;
use std::path::{Path, PathBuf};

mod theme;
pub use theme::Theme;

Expand Down
9 changes: 4 additions & 5 deletions rusk-prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ use alloc::vec::Vec;

use dusk_bytes::Serializable;
use dusk_plonk::prelude::Prover as PlonkProver;
use once_cell::sync::Lazy;

use execution_core::{
transfer::phoenix::{Prove, TxCircuit, TxCircuitVec, NOTES_TREE_DEPTH},
Error,
use execution_core::transfer::phoenix::{
Prove, TxCircuit, TxCircuitVec, NOTES_TREE_DEPTH,
};
use execution_core::Error;
use once_cell::sync::Lazy;

static TX_CIRCUIT_1_2_PROVER: Lazy<PlonkProver> =
Lazy::new(|| fetch_prover("TxCircuitOneTwo"));
Expand Down
15 changes: 6 additions & 9 deletions rusk-recovery/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use crate::Theme;
use std::sync::{mpsc, Mutex};
use std::{io, thread};

use dusk_plonk::prelude::{Compiler, PublicParameters};
use execution_core::transfer::phoenix::TRANSCRIPT_LABEL;
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::{
io,
sync::{mpsc, Mutex},
thread,
};

use rusk_profile::Circuit as CircuitProfile;

use lazy_static::lazy_static;
use tracing::{info, warn};

use crate::Theme;

mod circuits;

lazy_static! {
Expand Down
3 changes: 1 addition & 2 deletions rusk-recovery/src/keys/circuits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
use std::io::{self, ErrorKind};

use cargo_toml::{Dependency, Manifest};
use tracing::info;

use dusk_plonk::prelude::Circuit;
use execution_core::transfer::phoenix::{TxCircuit, NOTES_TREE_DEPTH};
use tracing::info;

type TxCircuitOneTwo = TxCircuit<NOTES_TREE_DEPTH, 1>;
type TxCircuitTwoTwo = TxCircuit<NOTES_TREE_DEPTH, 2>;
Expand Down
24 changes: 11 additions & 13 deletions rusk-recovery/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,29 @@ use std::fs;
use std::path::Path;

use dusk_bytes::DeserializableSlice;
use execution_core::signatures::bls::PublicKey as AccountPublicKey;
use execution_core::stake::{StakeAmount, StakeData, STAKE_CONTRACT};
use execution_core::transfer::phoenix::{Note, PublicKey, Sender};
use execution_core::transfer::TRANSFER_CONTRACT;
use execution_core::{ContractId, JubJubScalar};
use ff::Field;
use once_cell::sync::Lazy;
use rand::rngs::StdRng;
use rand::SeedableRng;
use rusk_abi::{ContractData, Session, VM};

use tracing::info;
use url::Url;

use execution_core::{
signatures::bls::PublicKey as AccountPublicKey,
stake::{StakeAmount, StakeData, STAKE_CONTRACT},
transfer::{
phoenix::{Note, PublicKey, Sender},
TRANSFER_CONTRACT,
},
ContractId, JubJubScalar,
};
use rusk_abi::{ContractData, Session, VM};

use crate::Theme;
pub use snapshot::{GenesisStake, PhoenixBalance, Snapshot};

mod http;
mod zip;

mod snapshot;
pub use snapshot::{GenesisStake, PhoenixBalance, Snapshot};

pub mod tar;
mod zip;

pub const DEFAULT_SNAPSHOT: &str =
include_str!("../config/testnet_remote.toml");
Expand Down
3 changes: 2 additions & 1 deletion rusk-recovery/src/state/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use http_req::request;
use std::error::Error;

use http_req::request;

const MAX_REDIRECT: usize = 3;

pub(super) fn download<T>(uri: T) -> Result<Vec<u8>, Box<dyn Error>>
Expand Down
14 changes: 6 additions & 8 deletions rusk-recovery/src/state/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
use std::fmt::Debug;

use dusk_bytes::Serializable;
use execution_core::{
signatures::bls::PublicKey as AccountPublicKey,
transfer::phoenix::PublicKey as PhoenixPublicKey, Dusk,
};
use execution_core::signatures::bls::PublicKey as AccountPublicKey;
use execution_core::transfer::phoenix::PublicKey as PhoenixPublicKey;
use execution_core::Dusk;
use serde_derive::{Deserialize, Serialize};

mod stake;
mod wrapper;

use crate::state;

mod stake;
pub use stake::GenesisStake;
mod wrapper;
use wrapper::Wrapper;

#[derive(Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -105,7 +104,6 @@ mod tests {
use std::error::Error;

use super::*;

use crate::state;

pub(crate) fn testnet_from_file() -> Result<Snapshot, Box<dyn Error>> {
Expand Down
7 changes: 3 additions & 4 deletions rusk-recovery/src/state/snapshot/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_bytes::Serializable;
use execution_core::signatures::bls::PublicKey as BlsPublicKey;
use execution_core::stake::StakeKeys;
use execution_core::Dusk;
use serde_derive::{Deserialize, Serialize};

use execution_core::{
signatures::bls::PublicKey as BlsPublicKey, stake::StakeKeys, Dusk,
};

use super::wrapper::Wrapper;

#[derive(Serialize, Deserialize, PartialEq, Eq)]
Expand Down
3 changes: 2 additions & 1 deletion rusk-recovery/src/state/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use flate2::{read, write, Compression};
use std::error::Error;
use std::fs::File;
use std::path::Path;

use flate2::{read, write, Compression};
use tar::Archive;

use super::zip;
Expand Down

0 comments on commit 2560a5d

Please sign in to comment.