Skip to content

Commit

Permalink
Merge pull request #3390 from dusk-network/remove-test-wallet
Browse files Browse the repository at this point in the history
workspace: remove `test-wallet` crate
  • Loading branch information
herr-seppia authored Jan 20, 2025
2 parents 4ed14f5 + 9cf1af1 commit 26a9bda
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 51 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ members = [
"node",
"rusk-wallet",

# Test utils
"test-wallet",
]
resolver = "2"

Expand Down
3 changes: 2 additions & 1 deletion rusk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ rusk-recovery = { workspace = true, optional = true }
futures = { workspace = true, optional = true }

[dev-dependencies]
test-wallet = { version = "0.1.0", path = "../test-wallet" }
wallet-core = { workspace = true }
zeroize = { workspace = true, features = ["derive"] }
rusk-recovery = { workspace = true, features = ["state"] }
ff = { workspace = true }
rusk-prover = { workspace = true, features = ["no_random", "debug"] }
Expand Down
1 change: 1 addition & 0 deletions rusk/benches/block_ingestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

#![feature(lazy_cell)]
extern crate alloc;

#[path = "../tests/common/mod.rs"]
mod common;
Expand Down
4 changes: 4 additions & 0 deletions rusk/tests/common/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

pub mod test_wallet;

use std::collections::HashMap;
use std::fmt::Debug;
use std::sync::{Arc, RwLock};
Expand All @@ -25,6 +27,8 @@ use rusk::{Error, Result, Rusk};
use test_wallet::{self as wallet, Store};
use tracing::info;

pub use test_wallet::Wallet;

#[derive(Debug, Clone)]
pub struct TestStore;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use wallet_core::keys::{
derive_bls_sk, derive_phoenix_pk, derive_phoenix_sk,
};

pub use imp::*;
pub use imp::Wallet;

/// Stores the cryptographic material necessary to derive cryptographic keys.
pub trait Store {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use alloc::string::FromUtf8Error;
use alloc::vec::Vec;
use core::convert::Infallible;
use std::string::FromUtf8Error;

use dusk_bytes::Error as BytesError;
use dusk_core::signatures::bls::{
Expand All @@ -30,6 +29,7 @@ use rkyv::ser::serializers::{
use rkyv::validation::validators::CheckDeserializeError;
use rusk_prover::LocalProver;
use wallet_core::keys::{derive_bls_sk, derive_phoenix_sk};
// use wallet_core::prelude::*;
use wallet_core::transaction::{
moonlight, moonlight_deployment, moonlight_stake, moonlight_stake_reward,
moonlight_to_phoenix, moonlight_unstake, phoenix as phoenix_transaction,
Expand All @@ -39,7 +39,7 @@ use wallet_core::transaction::{
use wallet_core::{phoenix_balance, BalanceInfo};
use zeroize::Zeroize;

use crate::{StateClient, Store};
use super::{StateClient, Store};

const MAX_INPUT_NOTES: usize = 4;

Expand Down
4 changes: 2 additions & 2 deletions rusk/tests/rusk-state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async fn generate_phoenix_txs() -> Result<(), Box<dyn std::error::Error>> {
Arc::new(std::sync::RwLock::new(std::collections::HashMap::new()));

let wallet =
test_wallet::Wallet::new(TestStore, TestStateClient { rusk, cache });
crate::wallet::Wallet::new(TestStore, TestStateClient { rusk, cache });

const N_ADDRESSES: usize = 100;

Expand Down Expand Up @@ -253,7 +253,7 @@ async fn generate_moonlight_txs() -> Result<(), Box<dyn std::error::Error>> {
Arc::new(std::sync::RwLock::new(std::collections::HashMap::new()));

let wallet =
test_wallet::Wallet::new(TestStore, TestStateClient { rusk, cache });
crate::wallet::Wallet::new(TestStore, TestStateClient { rusk, cache });

const N_ADDRESSES: usize = 100;

Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/contract_deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use rand::rngs::StdRng;
use rusk::{Result, Rusk, DUSK_CONSENSUS_KEY};
use rusk_recovery_tools::state;
use tempfile::tempdir;
use test_wallet::{self as wallet, Wallet};
use tokio::sync::broadcast;
use tracing::info;

Expand All @@ -29,7 +28,9 @@ use crate::common::state::{generator_procedure, ExecuteResult};
use crate::common::state::{
DEFAULT_GAS_PER_DEPLOY_BYTE, DEFAULT_MIN_GAS_LIMIT,
};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore, Wallet,
};

const BLOCK_HEIGHT: u64 = 1;
const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/contract_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use std::collections::HashMap;
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::state::{generator_procedure2, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};
use crate::common::*;

const BLOCK_HEIGHT: u64 = 1;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ use rand::prelude::*;
use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use tempfile::tempdir;
use test_wallet::{self as wallet};

use crate::common::logger;
use crate::common::state::{generator_procedure, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};

const BLOCK_GAS_LIMIT: u64 = 100_000_000_000;

Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/gas_behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ use rand::prelude::*;
use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::logger;
use crate::common::state::{generator_procedure, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};

const BLOCK_HEIGHT: u64 = 1;
const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/moonlight_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use std::collections::HashMap;
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::state::{generator_procedure, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};
use crate::common::*;

const BLOCK_HEIGHT: u64 = 1;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/multi_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ use rand::prelude::*;
use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::logger;
use crate::common::state::{generator_procedure, new_state, ExecuteResult};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};

const BLOCK_HEIGHT: u64 = 1;
// This is purposefully chosen to be low to trigger the discarding of a
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/owner_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use dusk_vm::{gen_contract_id, CallReceipt, ContractData, Session, VM};
use rusk::{Error, Result, Rusk};
use rusk_recovery_tools::state;
use tempfile::tempdir;
use test_wallet::{self as wallet, Wallet};
use tokio::sync::broadcast;
use tracing::info;

Expand All @@ -33,7 +32,9 @@ use crate::common::state::DEFAULT_MIN_DEPLOY_POINTS;
use crate::common::state::{
DEFAULT_GAS_PER_DEPLOY_BYTE, DEFAULT_MIN_GAS_LIMIT,
};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, test_wallet::Wallet, TestStateClient, TestStore,
};

const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000;
const POINT_LIMIT: u64 = 0x10000000;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/phoenix_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use std::collections::HashMap;
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::state::{generator_procedure, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};
use crate::common::*;

const BLOCK_HEIGHT: u64 = 1;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ use rand::prelude::*;
use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::logger;
use crate::common::state::{generator_procedure, new_state};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};

const BLOCK_GAS_LIMIT: u64 = 100_000_000_000;
const INITIAL_BALANCE: u64 = 10_000_000_000;
Expand Down
5 changes: 3 additions & 2 deletions rusk/tests/services/unspendable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ use rand::prelude::*;
use rand::rngs::StdRng;
use rusk::{Result, Rusk};
use tempfile::tempdir;
use test_wallet::{self as wallet};
use tracing::info;

use crate::common::logger;
use crate::common::state::{generator_procedure, new_state, ExecuteResult};
use crate::common::wallet::{TestStateClient, TestStore};
use crate::common::wallet::{
test_wallet as wallet, TestStateClient, TestStore,
};

const BLOCK_HEIGHT: u64 = 1;
const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000;
Expand Down
2 changes: 2 additions & 0 deletions rusk/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
#![feature(lazy_cell)]
mod common;
mod services;

extern crate alloc;
22 changes: 0 additions & 22 deletions test-wallet/Cargo.toml

This file was deleted.

0 comments on commit 26a9bda

Please sign in to comment.