Skip to content

Commit

Permalink
test: fix tests to run standalone in wallet (#4526)
Browse files Browse the repository at this point in the history
Allow tests to be run individually, i.e. `cargo test -p tari_wallet` in the wallet.

The main reason this didn't work was that the wallet excluded the `base_node` feature from `tari_core`. I've added it as a dev-dependency, but not sure if it breaks the libwallet build
  • Loading branch information
stringhandler authored Oct 20, 2022
1 parent 67bec16 commit 8289493
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ members = [
"applications/tari_miner",

]
#

# Add here until we move to edition=2021
resolver = "2"


# Shutdown when panicking so we can see the error, specifically for the wallet
[profile.release]
Expand Down
1 change: 1 addition & 0 deletions base_layer/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ mod domain_hashing {
"com.tari.tari_project.base_layer.core.kernel_mmr",
1
);

pub type KernelMmrHasherBlake256 = DomainSeparatedHasher<Blake256, KernelMmrHashDomain>;
pub type KernelMmr = MerkleMountainRange<KernelMmrHasherBlake256, Vec<Hash>>;
pub type PrunedKernelMmr = MerkleMountainRange<KernelMmrHasherBlake256, PrunedHashSet>;
Expand Down
7 changes: 2 additions & 5 deletions base_layer/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.38.7"
edition = "2018"

[dependencies]
tari_core = {path = "../../base_layer/core", version = "^0.38", default-features = false, features = ["transactions", "mempool_proto", "base_node_proto"]}
tari_common = { path = "../../common" }
tari_common_types = { version = "^0.38", path = "../../base_layer/common_types" }
tari_comms = { version = "^0.38", path = "../../comms/core" }
Expand Down Expand Up @@ -56,16 +57,12 @@ prost = "0.9"
itertools = "0.10.3"
chacha20poly1305 = "0.9.1"

[dependencies.tari_core]
path = "../../base_layer/core"
version = "^0.38"
default-features = false
features = ["transactions", "mempool_proto", "base_node_proto", ]

[dev-dependencies]
tari_p2p = { version = "^0.38", path = "../p2p", features = ["test-mocks"] }
tari_comms_dht = { version = "^0.38", path = "../../comms/dht", features = ["test-mocks"] }
tari_test_utils = { version = "^0.38", path = "../../infrastructure/test_utils" }
tari_core = {path = "../../base_layer/core", version = "^0.38", default-features = false, features = ["transactions", "mempool_proto", "base_node_proto", "base_node"]}
env_logger = "0.7.1"
prost = "0.9.0"

Expand Down
7 changes: 4 additions & 3 deletions scripts/generate-coinsplits.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ $i=1
Do {
$i

$splits = get-random -max 10 -min 1
$tariAmount = get-random -max 50000 -min 10000
& cargo run --release --bin tari_console_wallet -- -b . --network esmeralda --password mike --command-mode-auto-exit coin-split $tariAmount $splits
$splits = get-random -max 5 -min 1
$tariAmount = get-random -max 1000 -min 200
#& cargo run --release --bin tari_console_wallet -- -b . --password mike --command-mode-auto-exit -p "wallet.base_node.base_node_rpc_pool_size=1" -p "wallet.command_send_wait_timeout=0" coin-split $tariAmount $splits
& ../../target/release/tari_console_wallet -b . --password mike --command-mode-auto-exit -p "wallet.base_node.base_node_rpc_pool_size=1" -p "wallet.command_send_wait_timeout=0" coin-split $tariAmount $splits


$i++
Expand Down

0 comments on commit 8289493

Please sign in to comment.