Skip to content

Commit

Permalink
Merge pull request #2954 from dusk-network/neotamandua/reorder_exec_c…
Browse files Browse the repository at this point in the history
…ore_imports

execution-core: reorder imports to align with convention
  • Loading branch information
Neotamandua authored Nov 13, 2024
2 parents 11a572d + 00c92dc commit 3f3f1a4
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 77 deletions.
14 changes: 5 additions & 9 deletions execution-core/src/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ use bytecheck::CheckBytes;
use dusk_bytes::{DeserializableSlice, Serializable, Write};
use rkyv::{Archive, Deserialize, Serialize};

use crate::{
signatures::bls::{
PublicKey as BlsPublicKey, SecretKey as BlsSecretKey,
Signature as BlsSignature,
},
transfer::withdraw::Withdraw as TransferWithdraw,
ContractId,
use crate::signatures::bls::{
PublicKey as BlsPublicKey, SecretKey as BlsSecretKey,
Signature as BlsSignature,
};

use crate::{dusk, Dusk};
use crate::transfer::withdraw::Withdraw as TransferWithdraw;
use crate::{dusk, ContractId, Dusk};

/// ID of the genesis stake contract
pub const STAKE_CONTRACT: ContractId = crate::reserved(0x2);
Expand Down
10 changes: 4 additions & 6 deletions execution-core/src/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use alloc::string::String;
use alloc::vec::Vec;

use core::fmt::Debug;

use bytecheck::CheckBytes;
Expand All @@ -18,12 +17,11 @@ use poseidon_merkle::Opening;
use rand::{CryptoRng, RngCore};
use rkyv::{Archive, Deserialize, Serialize};

use crate::{
signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
},
BlsScalar, ContractId, Error,
use crate::signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
};
use crate::{BlsScalar, ContractId, Error};

use data::{ContractCall, ContractDeploy, TransactionData};
use moonlight::Transaction as MoonlightTransaction;
use phoenix::{
Expand Down
5 changes: 2 additions & 3 deletions execution-core/src/transfer/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ use alloc::vec::Vec;

use bytecheck::CheckBytes;
use dusk_bytes::{DeserializableSlice, Error as BytesError, Serializable};
use rkyv::{
ser::serializers::AllocSerializer, Archive, Deserialize, Serialize,
};
use rkyv::ser::serializers::AllocSerializer;
use rkyv::{Archive, Deserialize, Serialize};

use crate::{ContractId, Error, ARGBUF_LEN};

Expand Down
18 changes: 8 additions & 10 deletions execution-core/src/transfer/moonlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ use bytecheck::CheckBytes;
use dusk_bytes::{DeserializableSlice, Error as BytesError, Serializable};
use rkyv::{Archive, Deserialize, Serialize};

use crate::{
signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
Signature as AccountSignature,
},
transfer::data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
MAX_MEMO_SIZE,
},
BlsScalar, Error,
use crate::signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
Signature as AccountSignature,
};
use crate::transfer::data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
MAX_MEMO_SIZE,
};
use crate::{BlsScalar, Error};

/// A Moonlight account's information.
#[derive(Debug, Clone, PartialEq, Eq, Archive, Serialize, Deserialize)]
Expand Down
16 changes: 7 additions & 9 deletions execution-core/src/transfer/phoenix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ use ff::Field;
use rand::{CryptoRng, RngCore};
use rkyv::{Archive, Deserialize, Serialize};

use crate::{
signatures::schnorr::{
SecretKey as SchnorrSecretKey, Signature as SchnorrSignature,
},
transfer::data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
MAX_MEMO_SIZE,
},
BlsScalar, Error, JubJubAffine, JubJubScalar,
use crate::signatures::schnorr::{
SecretKey as SchnorrSecretKey, Signature as SchnorrSignature,
};
use crate::transfer::data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
MAX_MEMO_SIZE,
};
use crate::{BlsScalar, Error, JubJubAffine, JubJubScalar};

// phoenix types
pub use phoenix_circuits::{InputNoteInfo, OutputNoteInfo, TxCircuit};
Expand Down
18 changes: 8 additions & 10 deletions execution-core/src/transfer/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ use dusk_bytes::Serializable;
use rand::{CryptoRng, RngCore};
use rkyv::{Archive, Deserialize, Serialize};

use crate::{
signatures::{
bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
Signature as AccountSignature,
},
schnorr::{SecretKey as NoteSecretKey, Signature as NoteSignature},
},
transfer::phoenix::StealthAddress,
BlsScalar, ContractId,
use crate::signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
Signature as AccountSignature,
};
use crate::signatures::schnorr::{
SecretKey as NoteSecretKey, Signature as NoteSignature,
};
use crate::transfer::phoenix::StealthAddress;
use crate::{BlsScalar, ContractId};

/// Withdrawal information, proving the intent of a user to withdraw from a
/// contract.
Expand Down
27 changes: 11 additions & 16 deletions execution-core/tests/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use execution_core::{
signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
},
transfer::{
data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
},
phoenix::{
Note, NoteTreeItem, NotesTree, Prove,
PublicKey as PhoenixPublicKey, SecretKey as PhoenixSecretKey,
TxCircuitVec,
},
Transaction,
},
BlsScalar, Error, JubJubScalar,
use execution_core::signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
};
use execution_core::transfer::data::{
ContractBytecode, ContractCall, ContractDeploy, TransactionData,
};
use execution_core::transfer::phoenix::{
Note, NoteTreeItem, NotesTree, Prove, PublicKey as PhoenixPublicKey,
SecretKey as PhoenixSecretKey, TxCircuitVec,
};
use execution_core::transfer::Transaction;
use execution_core::{BlsScalar, Error, JubJubScalar};
use ff::Field;
use rand::rngs::StdRng;
use rand::{CryptoRng, Rng, RngCore, SeedableRng};
Expand Down
25 changes: 11 additions & 14 deletions execution-core/tests/transaction.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 execution_core::{
signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
},
transfer::{
data::{ContractCall, TransactionData, MAX_MEMO_SIZE},
phoenix::{
Note, NoteOpening, NoteTreeItem, NotesTree, Prove,
PublicKey as PhoenixPublicKey, SecretKey as PhoenixSecretKey,
TxCircuitVec,
},
Transaction,
},
Error, JubJubScalar,
use execution_core::signatures::bls::{
PublicKey as AccountPublicKey, SecretKey as AccountSecretKey,
};
use execution_core::transfer::data::{
ContractCall, TransactionData, MAX_MEMO_SIZE,
};
use execution_core::transfer::phoenix::{
Note, NoteOpening, NoteTreeItem, NotesTree, Prove,
PublicKey as PhoenixPublicKey, SecretKey as PhoenixSecretKey, TxCircuitVec,
};
use execution_core::transfer::Transaction;
use execution_core::{Error, JubJubScalar};
use ff::Field;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
Expand Down

0 comments on commit 3f3f1a4

Please sign in to comment.