diff --git a/rusk/benches/block_ingestion.rs b/rusk/benches/block_ingestion.rs
index eb70cabf57..84962d803c 100644
--- a/rusk/benches/block_ingestion.rs
+++ b/rusk/benches/block_ingestion.rs
@@ -17,7 +17,8 @@ use criterion::{
criterion_group, criterion_main, BenchmarkGroup, BenchmarkId, Criterion,
};
use execution_core::{
- transfer::Transaction as ProtocolTransaction, BlsPublicKey, BlsSecretKey,
+ signatures::bls::{PublicKey as BlsPublicKey, SecretKey as BlsSecretKey},
+ transfer::Transaction as ProtocolTransaction,
};
use node_data::ledger::Transaction;
use rand::prelude::StdRng;
diff --git a/rusk/src/lib/chain/rusk.rs b/rusk/src/lib/chain/rusk.rs
index 4aee486fd2..32cfcc2de3 100644
--- a/rusk/src/lib/chain/rusk.rs
+++ b/rusk/src/lib/chain/rusk.rs
@@ -21,12 +21,15 @@ use dusk_consensus::config::{
RATIFICATION_COMMITTEE_CREDITS, VALIDATION_COMMITTEE_CREDITS,
};
use dusk_consensus::operations::{CallParams, VerificationOutput, Voter};
-use execution_core::transfer::ContractDeploy;
use execution_core::{
- stake::StakeData,
- transfer::{AccountData, Transaction as ProtocolTransaction},
- BlsPublicKey, BlsScalar, ContractBytecode, ContractError, Dusk, Event,
- STAKE_CONTRACT, TRANSFER_CONTRACT,
+ signatures::bls::PublicKey as BlsPublicKey,
+ stake::{StakeData, STAKE_CONTRACT},
+ transfer::{
+ contract_exec::{ContractBytecode, ContractDeploy},
+ moonlight::AccountData,
+ Transaction as ProtocolTransaction, TRANSFER_CONTRACT,
+ },
+ BlsScalar, ContractError, Dusk, Event,
};
use node_data::ledger::{Slash, SpentTransaction, Transaction};
use rusk_abi::{CallReceipt, PiecrustError, Session, VM};
diff --git a/rusk/src/lib/chain/vm.rs b/rusk/src/lib/chain/vm.rs
index 9714ca0cdf..d0f8e8139a 100644
--- a/rusk/src/lib/chain/vm.rs
+++ b/rusk/src/lib/chain/vm.rs
@@ -13,8 +13,8 @@ use dusk_consensus::operations::{CallParams, VerificationOutput, Voter};
use dusk_consensus::user::provisioners::Provisioners;
use dusk_consensus::user::stake::Stake;
use execution_core::{
- stake::StakeData, transfer::Transaction as ProtocolTransaction,
- BlsPublicKey,
+ signatures::bls::PublicKey as BlsPublicKey, stake::StakeData,
+ transfer::Transaction as ProtocolTransaction,
};
use node::vm::VMExecution;
use node_data::ledger::{Block, Slash, SpentTransaction, Transaction};
diff --git a/rusk/src/lib/error.rs b/rusk/src/lib/error.rs
index 653fed10ab..57777deda0 100644
--- a/rusk/src/lib/error.rs
+++ b/rusk/src/lib/error.rs
@@ -7,7 +7,10 @@
use std::{fmt, io};
use dusk_bytes::Serializable;
-use execution_core::{BlsPublicKey, BlsScalar, Dusk, PhoenixError};
+use execution_core::{
+ signatures::bls::PublicKey as BlsPublicKey,
+ transfer::phoenix::Error as PhoenixError, BlsScalar, Dusk,
+};
use rusk_abi::PiecrustError;
#[derive(Debug)]
diff --git a/rusk/src/lib/gen_id.rs b/rusk/src/lib/gen_id.rs
index bb7f2d6389..82c52fa445 100644
--- a/rusk/src/lib/gen_id.rs
+++ b/rusk/src/lib/gen_id.rs
@@ -4,8 +4,8 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.
-use crate::hash::Hasher;
-use rusk_abi::ContractId;
+use blake2b_simd::Params;
+use execution_core::{ContractId, CONTRACT_ID_BYTES};
/// Generate a [`ContractId`] address from:
/// - slice of bytes,
@@ -16,11 +16,15 @@ pub fn gen_contract_id(
nonce: u64,
owner: impl AsRef<[u8]>,
) -> ContractId {
- let mut hasher = Hasher::new();
+ let mut hasher = Params::new().hash_length(CONTRACT_ID_BYTES).to_state();
hasher.update(bytes.as_ref());
- hasher.update(nonce.to_le_bytes());
+ hasher.update(&nonce.to_le_bytes()[..]);
hasher.update(owner.as_ref());
- let hash_bytes = hasher.finalize();
+ let hash_bytes: [u8; CONTRACT_ID_BYTES] = hasher
+ .finalize()
+ .as_bytes()
+ .try_into()
+ .expect("the hash result is exactly `CONTRACT_ID_BYTES` long");
ContractId::from_bytes(hash_bytes)
}
@@ -47,7 +51,7 @@ mod tests {
assert_eq!(
hex::encode(contract_id.as_bytes()),
- "a138d3b9c87235dac6f62d1d30b75cffbb94601d9cbe5bd540b3e1e5842c8a7d"
+ "2da8b6277789a88c7215789e227ef4dd97486db252e554805c7b874a17e07785"
);
}
}
diff --git a/rusk/src/lib/hash.rs b/rusk/src/lib/hash.rs
deleted file mode 100644
index 523baf6e9b..0000000000
--- a/rusk/src/lib/hash.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//
-// Copyright (c) DUSK NETWORK. All rights reserved.
-
-use blake2b_simd::{Params, State};
-
-/// Hashes scalars and arbitrary slices of bytes using Blake2b, returning an
-/// array of 32 bytes.
-///
-/// This hash cannot be proven inside a circuit, if that is desired, use
-/// `poseidon_hash` instead.
-pub struct Hasher {
- state: State,
-}
-
-impl Default for Hasher {
- fn default() -> Self {
- Hasher {
- state: Params::new().hash_length(64).to_state(),
- }
- }
-}
-
-impl Hasher {
- /// Create new hasher instance.
- pub fn new() -> Self {
- Self::default()
- }
-
- /// Process data, updating the internal state.
- pub fn update(&mut self, data: impl AsRef<[u8]>) {
- self.state.update(data.as_ref());
- }
-
- /// Retrieve result and consume hasher instance.
- pub fn finalize(self) -> [u8; 32] {
- let hash = self.state.finalize();
- let mut a = [0u8; 32];
- a.clone_from_slice(&hash.as_array()[..32]);
- a
- }
-}
diff --git a/rusk/src/lib/http/chain/graphql.rs b/rusk/src/lib/http/chain/graphql.rs
index 735ece0655..ed664150de 100644
--- a/rusk/src/lib/http/chain/graphql.rs
+++ b/rusk/src/lib/http/chain/graphql.rs
@@ -13,7 +13,7 @@ use data::*;
use tx::*;
use async_graphql::{Context, FieldError, FieldResult, Object};
-use execution_core::{ContractId, TRANSFER_CONTRACT};
+use execution_core::{transfer::TRANSFER_CONTRACT, ContractId};
use node::database::rocksdb::Backend;
use node::database::{Ledger, DB};
diff --git a/rusk/src/lib/lib.rs b/rusk/src/lib/lib.rs
index a9cdd23505..3cce7b8230 100644
--- a/rusk/src/lib/lib.rs
+++ b/rusk/src/lib/lib.rs
@@ -10,7 +10,6 @@
pub mod chain;
mod error;
pub mod gen_id;
-mod hash;
pub mod http;
pub mod verifier;
mod version;
diff --git a/rusk/src/lib/test_utils.rs b/rusk/src/lib/test_utils.rs
index b5c343dc41..5427b50dfd 100644
--- a/rusk/src/lib/test_utils.rs
+++ b/rusk/src/lib/test_utils.rs
@@ -16,11 +16,14 @@ use futures::Stream;
use tokio::spawn;
use tracing::{error, info};
-use execution_core::stake::StakeData;
-use execution_core::transfer::{TreeLeaf, TRANSFER_TREE_DEPTH};
use execution_core::{
- BlsPublicKey, BlsScalar, ContractId, Note, ViewKey, STAKE_CONTRACT,
- TRANSFER_CONTRACT,
+ signatures::bls::PublicKey as BlsPublicKey,
+ stake::{StakeData, STAKE_CONTRACT},
+ transfer::{
+ phoenix::{Note, TreeLeaf, ViewKey, NOTES_TREE_DEPTH},
+ TRANSFER_CONTRACT,
+ },
+ BlsScalar, ContractId,
};
use parking_lot::RwLockWriteGuard;
use poseidon_merkle::Opening as PoseidonOpening;
@@ -62,7 +65,7 @@ impl Rusk {
pub fn tree_opening(
&self,
pos: u64,
- ) -> Result