From 68f67b8f1b1df935b4b73ec1a545b4867c8479c1 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Fri, 29 Aug 2025 15:51:48 +0400 Subject: [PATCH 1/4] chore!: upgrade to minotari 5.0.0 --- Cargo.lock | 402 ++++++++++-------- Cargo.toml | 49 ++- README.md | 6 +- applications/tari_swarm_daemon/Cargo.toml | 2 +- .../src/layer_one_transactions/submitter.rs | 13 +- .../src/process_manager/manager.rs | 2 +- .../processes/minotari_wallet.rs | 10 +- applications/tari_validator_node/Cargo.toml | 2 +- .../src/json_rpc/handlers.rs | 2 +- applications/tari_validator_node/src/lib.rs | 3 +- applications/tari_walletd/Cargo.toml | 4 +- applications/tari_walletd/src/cli.rs | 3 +- applications/tari_walletd/src/config.rs | 2 + applications/tari_walletd/src/lib.rs | 11 +- applications/tari_walletd/src/main.rs | 13 +- .../src/services/recovery_service.rs | 4 +- applications/tari_watcher/Cargo.toml | 2 +- applications/tari_watcher/src/minotari.rs | 20 +- clients/base_node_client/Cargo.toml | 3 +- clients/base_node_client/src/grpc.rs | 18 +- clients/base_node_client/src/traits.rs | 8 +- clients/base_node_client/src/types.rs | 2 +- crates/epoch_manager/Cargo.toml | 2 + .../src/epoch_event_oracle/event.rs | 34 ++ crates/epoch_oracles/Cargo.toml | 8 +- crates/epoch_oracles/src/base_layer/mod.rs | 65 +-- crates/wallet/sdk/Cargo.toml | 3 +- .../sdk/src/apis/confidential_outputs.rs | 4 +- crates/wallet/sdk/src/apis/key_manager.rs | 49 +-- crates/wallet/sdk/src/lib.rs | 6 +- crates/wallet/sdk/src/models/key.rs | 4 +- crates/wallet/sdk/src/sdk.rs | 17 +- cucumber-output-junit.xml | 1 + integration_tests/Cargo.toml | 7 +- integration_tests/src/lib.rs | 95 ++--- integration_tests/src/miner.rs | 15 +- integration_tests/src/validator_node.rs | 9 +- integration_tests/src/wallet.rs | 67 ++- integration_tests/src/wallet_daemon.rs | 17 +- .../tests/features/claim_burn.feature | 23 +- .../tests/features/wallet_daemon.feature | 3 - integration_tests/tests/steps/miner.rs | 6 +- integration_tests/tests/steps/network.rs | 13 +- .../tests/steps/validator_node.rs | 10 +- integration_tests/tests/steps/wallet.rs | 17 +- .../tests/steps/wallet_daemon.rs | 4 +- 46 files changed, 553 insertions(+), 507 deletions(-) create mode 100644 cucumber-output-junit.xml diff --git a/Cargo.lock b/Cargo.lock index 9942134076..3116a12ac1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4153,6 +4153,32 @@ name = "hickory-proto" version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.9.1", + "ring 0.17.14", + "socket2", + "thiserror 2.0.12", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-proto" +version = "0.26.0-alpha.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62d7684f766b0f96344be88c023f9b6650039aea09d526b4974cce302eb61b1" dependencies = [ "async-trait", "bytes 1.10.1", @@ -4169,7 +4195,6 @@ dependencies = [ "ring 0.17.14", "rustls 0.23.28", "rustls-platform-verifier", - "socket2", "thiserror 2.0.12", "tinyvec", "tokio", @@ -4186,7 +4211,28 @@ checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a" dependencies = [ "cfg-if", "futures-util", - "hickory-proto", + "hickory-proto 0.25.2", + "ipconfig", + "moka", + "once_cell", + "parking_lot", + "rand 0.9.1", + "resolv-conf", + "smallvec 1.15.1", + "thiserror 2.0.12", + "tokio", + "tracing", +] + +[[package]] +name = "hickory-resolver" +version = "0.26.0-alpha.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbab5e26a7f82341145ba1fbd1f1858d0490624fcc46270db2d3c4a101f763f4" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto 0.26.0-alpha.1", "ipconfig", "moka", "once_cell", @@ -4973,7 +5019,6 @@ dependencies = [ "tari_common_types", "tari_comms", "tari_comms_dht", - "tari_core", "tari_crypto", "tari_engine", "tari_engine_types", @@ -4989,6 +5034,8 @@ dependencies = [ "tari_template_builtin", "tari_template_lib", "tari_transaction", + "tari_transaction_components", + "tari_transaction_key_manager", "tari_transaction_manifest", "tari_validator_node", "tari_validator_node_cli", @@ -5607,7 +5654,7 @@ source = "git+https://github.com/tari-project/rust-libp2p.git?rev=debc01257dd979 dependencies = [ "async-trait", "futures 0.3.31", - "hickory-resolver", + "hickory-resolver 0.25.2", "libp2p-core", "libp2p-identity", "parking_lot", @@ -5689,7 +5736,7 @@ version = "0.48.0" source = "git+https://github.com/tari-project/rust-libp2p.git?rev=debc01257dd979418d7793f2dc91d25471de5c38#debc01257dd979418d7793f2dc91d25471de5c38" dependencies = [ "futures 0.3.31", - "hickory-proto", + "hickory-proto 0.25.2", "if-watch", "libp2p-core", "libp2p-identity", @@ -6495,16 +6542,14 @@ dependencies = [ [[package]] name = "minotari_app_grpc" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "argon2 0.4.1", "base64 0.13.1", "borsh", - "chrono", "log", "prost 0.13.5", - "prost-types 0.13.5", "rand 0.8.5", "rcgen 0.12.1", "subtle", @@ -6514,8 +6559,10 @@ dependencies = [ "tari_crypto", "tari_features", "tari_max_size", + "tari_node_components", "tari_script", "tari_sidechain", + "tari_transaction_components", "tari_utilities", "thiserror 1.0.69", "tokio", @@ -6526,8 +6573,8 @@ dependencies = [ [[package]] name = "minotari_app_utilities" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "clap 3.2.25", "dialoguer 0.10.4", @@ -6548,8 +6595,8 @@ dependencies = [ [[package]] name = "minotari_console_wallet" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "blake2", "chrono", @@ -6582,23 +6629,21 @@ dependencies = [ "tari_common_types", "tari_comms", "tari_comms_dht", - "tari_contacts", "tari_core", "tari_crypto", "tari_features", "tari_hashing", - "tari_key_manager", "tari_libtor", "tari_max_size", "tari_p2p", "tari_script", "tari_shutdown", + "tari_transaction_components", "tari_utilities", "thiserror 1.0.69", "tokio", "tonic 0.13.1", "tui", - "unicode-segmentation", "unicode-width 0.1.14", "url", "zxcvbn", @@ -6606,16 +6651,16 @@ dependencies = [ [[package]] name = "minotari_ledger_wallet_common" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "bs58 0.5.1", ] [[package]] name = "minotari_ledger_wallet_comms" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "borsh", "dialoguer 0.11.0", @@ -6636,8 +6681,8 @@ dependencies = [ [[package]] name = "minotari_node" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "async-trait", @@ -6672,14 +6717,17 @@ dependencies = [ "tari_core", "tari_features", "tari_libtor", + "tari_node_components", "tari_p2p", "tari_service_framework", "tari_shutdown", "tari_storage", + "tari_transaction_components", "tari_utilities", "thiserror 1.0.69", "tokio", "tonic 0.13.1", + "tower-http 0.6.6", "url", "utoipa", "utoipa-swagger-ui", @@ -6687,16 +6735,16 @@ dependencies = [ [[package]] name = "minotari_node_grpc_client" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "minotari_app_grpc", ] [[package]] name = "minotari_node_wallet_client" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "async-trait", @@ -6704,8 +6752,8 @@ dependencies = [ "reqwest 0.12.22", "serde", "serde_json", - "tari_core", "tari_shutdown", + "tari_transaction_components", "tari_utilities", "tokio", "url", @@ -6713,8 +6761,8 @@ dependencies = [ [[package]] name = "minotari_wallet" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "argon2 0.4.1", @@ -6747,16 +6795,15 @@ dependencies = [ "tari_common_types", "tari_comms", "tari_comms_dht", - "tari_contacts", - "tari_core", "tari_crypto", - "tari_key_manager", "tari_max_size", "tari_p2p", "tari_script", "tari_service_framework", "tari_shutdown", "tari_sidechain", + "tari_transaction_components", + "tari_transaction_key_manager", "tari_utilities", "tempfile", "thiserror 1.0.69", @@ -6769,7 +6816,7 @@ dependencies = [ [[package]] name = "minotari_wallet_grpc_client" version = "0.1.0" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "minotari_app_grpc", "tari_common", @@ -10526,9 +10573,10 @@ dependencies = [ "minotari_node_grpc_client", "serde", "tari_common_types", - "tari_core", + "tari_node_components", "tari_ootle_common_types", "tari_template_lib", + "tari_transaction_components", "tari_utilities", "thiserror 1.0.69", "tonic 0.13.1", @@ -10570,8 +10618,8 @@ dependencies = [ [[package]] name = "tari_common" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "cargo_toml", @@ -10596,8 +10644,8 @@ dependencies = [ [[package]] name = "tari_common_sqlite" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "diesel", "diesel_migrations", @@ -10613,24 +10661,31 @@ dependencies = [ [[package]] name = "tari_common_types" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ + "argon2 0.4.1", "base64 0.21.7", "bitflags 2.9.2", "blake2", "borsh", "bs58 0.5.1", + "chacha20 0.7.3", "chacha20poly1305", + "crc32fast", "digest", + "getrandom 0.2.16", + "js-sys", "minotari_ledger_wallet_common", "newtype-ops", "once_cell", "primitive-types", "rand 0.8.5", "serde", + "serde_json", "strum 0.22.0", "strum_macros 0.22.0", + "subtle", "tari_common", "tari_crypto", "tari_hashing", @@ -10638,12 +10693,13 @@ dependencies = [ "tari_utilities", "thiserror 1.0.69", "utoipa", + "zeroize", ] [[package]] name = "tari_comms" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "async-trait", @@ -10688,8 +10744,8 @@ dependencies = [ [[package]] name = "tari_comms_dht" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "bitflags 2.9.2", @@ -10701,6 +10757,7 @@ dependencies = [ "diesel_migrations", "digest", "futures 0.3.31", + "futures-util", "log", "pin-project 0.4.30", "prost 0.13.5", @@ -10721,8 +10778,8 @@ dependencies = [ [[package]] name = "tari_comms_rpc_macros" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "proc-macro2", "quote", @@ -10769,73 +10826,29 @@ dependencies = [ "ts-rs", ] -[[package]] -name = "tari_contacts" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" -dependencies = [ - "chrono", - "diesel", - "diesel_migrations", - "futures 0.3.31", - "log", - "num-derive 0.4.2", - "num-traits", - "prost 0.13.5", - "rand 0.8.5", - "serde", - "serde_json", - "tari_common", - "tari_common_sqlite", - "tari_common_types", - "tari_comms", - "tari_comms_dht", - "tari_crypto", - "tari_max_size", - "tari_p2p", - "tari_service_framework", - "tari_shutdown", - "tari_utilities", - "thiserror 1.0.69", - "tokio", - "tower 0.4.13", - "uuid 1.17.0", -] - [[package]] name = "tari_core" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "async-trait", "bincode 1.3.3", - "bitflags 2.9.2", "blake2", "borsh", - "bytes 0.5.6", "chacha20poly1305", "chrono", - "decimal-rs", - "derivative", - "diesel", - "diesel_migrations", "digest", "dirs-next 1.0.2", "fs2", "futures 0.3.31", "hex", - "hickory-proto", + "hickory-proto 0.26.0-alpha.1", "integer-encoding", "jmt", "lmdb-zero", "log", - "minotari_ledger_wallet_comms", "monero", - "newtype-ops", - "num-derive 0.4.2", - "num-format", - "num-traits", "once_cell", "primitive-types", "prost 0.13.5", @@ -10843,11 +10856,9 @@ dependencies = [ "randomx-rs", "serde", "serde_json", - "serde_repr", "serde_valid", "sha2", "sha3", - "strum 0.22.0", "strum_macros 0.22.0", "tari-tiny-keccak", "tari_common", @@ -10859,9 +10870,9 @@ dependencies = [ "tari_crypto", "tari_features", "tari_hashing", - "tari_key_manager", "tari_max_size", "tari_mmr", + "tari_node_components", "tari_p2p", "tari_script", "tari_service_framework", @@ -10869,13 +10880,13 @@ dependencies = [ "tari_sidechain", "tari_storage", "tari_test_utils", + "tari_transaction_components", + "tari_transaction_key_manager", "tari_utilities", "thiserror 1.0.69", "tokio", "tracing", "url", - "utoipa", - "zeroize", ] [[package]] @@ -10963,6 +10974,7 @@ version = "0.11.2" dependencies = [ "anyhow", "log", + "minotari_app_grpc", "serde", "tari_common_types", "tari_crypto", @@ -10984,16 +10996,17 @@ version = "0.11.2" dependencies = [ "anyhow", "log", + "minotari_app_grpc", "serde", "tari_base_node_client", "tari_common_types", - "tari_core", "tari_engine_types", "tari_epoch_manager", "tari_ootle_common_types", "tari_ootle_storage", "tari_ootle_storage_sqlite", "tari_template_lib", + "tari_transaction_components", "tari_utilities", "thiserror 1.0.69", "tokio", @@ -11002,13 +11015,13 @@ dependencies = [ [[package]] name = "tari_features" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" [[package]] name = "tari_hashing" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "blake2", "borsh", @@ -11109,8 +11122,8 @@ dependencies = [ [[package]] name = "tari_jellyfish" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "borsh", "digest", @@ -11121,43 +11134,10 @@ dependencies = [ "thiserror 2.0.12", ] -[[package]] -name = "tari_key_manager" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" -dependencies = [ - "argon2 0.4.1", - "async-trait", - "blake2", - "chacha20 0.7.3", - "chacha20poly1305", - "chrono", - "crc32fast", - "derivative", - "diesel", - "diesel_migrations", - "digest", - "futures 0.3.31", - "log", - "rand 0.8.5", - "serde", - "strum 0.22.0", - "strum_macros 0.22.0", - "subtle", - "tari_common_sqlite", - "tari_common_types", - "tari_crypto", - "tari_service_framework", - "tari_utilities", - "thiserror 1.0.69", - "tokio", - "zeroize", -] - [[package]] name = "tari_libtor" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "derivative", "libtor", @@ -11170,8 +11150,8 @@ dependencies = [ [[package]] name = "tari_max_size" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "borsh", "serde", @@ -11181,8 +11161,8 @@ dependencies = [ [[package]] name = "tari_metrics" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "once_cell", "prometheus", @@ -11191,8 +11171,8 @@ dependencies = [ [[package]] name = "tari_mmr" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "borsh", "digest", @@ -11220,6 +11200,25 @@ dependencies = [ "tokio", ] +[[package]] +name = "tari_node_components" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +dependencies = [ + "blake2", + "borsh", + "chrono", + "digest", + "js-sys", + "log", + "serde", + "tari_common_types", + "tari_crypto", + "tari_transaction_components", + "tari_utilities", + "thiserror 1.0.69", +] + [[package]] name = "tari_ootle_app_utilities" version = "0.11.2" @@ -11413,7 +11412,6 @@ dependencies = [ "tari_consensus_types", "tari_crypto", "tari_engine_types", - "tari_key_manager", "tari_ootle_common_types", "tari_ootle_wallet_crypto", "tari_ootle_wallet_storage_sqlite", @@ -11421,6 +11419,8 @@ dependencies = [ "tari_template_builtin", "tari_template_lib", "tari_transaction", + "tari_transaction_components", + "tari_transaction_key_manager", "tempfile", "thiserror 1.0.69", "time", @@ -11480,10 +11480,10 @@ dependencies = [ "serde_json", "tari_bor", "tari_common", + "tari_common_types", "tari_crypto", "tari_engine_types", "tari_indexer_client", - "tari_key_manager", "tari_ootle_app_utilities", "tari_ootle_common_types", "tari_ootle_wallet_crypto", @@ -11494,6 +11494,8 @@ dependencies = [ "tari_template_builtin", "tari_template_lib", "tari_transaction", + "tari_transaction_components", + "tari_transaction_key_manager", "tari_transaction_manifest", "tari_utilities", "tari_wallet_daemon_client", @@ -11510,13 +11512,13 @@ dependencies = [ [[package]] name = "tari_p2p" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "futures 0.3.31", - "hickory-proto", - "hickory-resolver", + "hickory-proto 0.26.0-alpha.1", + "hickory-resolver 0.26.0-alpha.1", "log", "pgp", "prost 0.13.5", @@ -11607,8 +11609,8 @@ dependencies = [ [[package]] name = "tari_script" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "blake2", "borsh", @@ -11625,8 +11627,8 @@ dependencies = [ [[package]] name = "tari_service_framework" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "anyhow", "async-trait", @@ -11640,16 +11642,16 @@ dependencies = [ [[package]] name = "tari_shutdown" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "futures 0.3.31", ] [[package]] name = "tari_sidechain" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "borsh", "hex", @@ -11731,8 +11733,8 @@ dependencies = [ [[package]] name = "tari_storage" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "bincode 1.3.3", "lmdb-zero", @@ -11777,7 +11779,6 @@ dependencies = [ "serde_json", "slug", "tari_common_types", - "tari_core", "tari_crypto", "tari_engine", "tari_engine_types", @@ -11787,6 +11788,7 @@ dependencies = [ "tari_shutdown", "tari_sidechain", "tari_template_lib_types", + "tari_transaction_components", "tari_validator_node_client", "tari_wallet_daemon_client", "thiserror 1.0.69", @@ -11914,8 +11916,8 @@ dependencies = [ [[package]] name = "tari_test_utils" -version = "4.9.0-pre.1" -source = "git+https://github.com/tari-project/tari.git?tag=v4.9.0-pre.1#22bd4b9f851fa224fe4898c4601a71c326816f1b" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" dependencies = [ "futures 0.3.31", "rand 0.8.5", @@ -11943,6 +11945,71 @@ dependencies = [ "ts-rs", ] +[[package]] +name = "tari_transaction_components" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.9.2", + "blake2", + "borsh", + "bytes 0.5.6", + "chacha20poly1305", + "chrono", + "decimal-rs", + "derivative", + "digest", + "integer-encoding", + "log", + "minotari_ledger_wallet_comms", + "newtype-ops", + "num-derive 0.4.2", + "num-format", + "num-traits", + "primitive-types", + "rand 0.8.5", + "serde", + "serde_repr", + "serde_valid", + "strum 0.22.0", + "strum_macros 0.22.0", + "tari_common", + "tari_common_types", + "tari_crypto", + "tari_hashing", + "tari_max_size", + "tari_script", + "tari_service_framework", + "tari_sidechain", + "tari_utilities", + "thiserror 1.0.69", + "tokio", + "utoipa", + "zeroize", +] + +[[package]] +name = "tari_transaction_key_manager" +version = "5.0.0-pre.8" +source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +dependencies = [ + "async-trait", + "chacha20poly1305", + "chrono", + "diesel", + "diesel_migrations", + "log", + "rand 0.8.5", + "tari_common_sqlite", + "tari_common_types", + "tari_transaction_components", + "tari_utilities", + "tokio", + "zeroize", +] + [[package]] name = "tari_transaction_manifest" version = "0.11.2" @@ -12008,7 +12075,6 @@ dependencies = [ "tari_common_types", "tari_consensus", "tari_consensus_types", - "tari_core", "tari_crypto", "tari_engine", "tari_engine_types", @@ -12030,6 +12096,7 @@ dependencies = [ "tari_template_lib", "tari_template_manager", "tari_transaction", + "tari_transaction_components", "tari_validator_node_client", "tari_validator_node_rpc", "thiserror 1.0.69", @@ -12145,12 +12212,12 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "tari_core", "tari_crypto", "tari_ootle_common_types", "tari_shutdown", "tari_sidechain", "tari_template_lib_types", + "tari_transaction_components", "tokio", "toml 0.8.23", "tonic 0.13.1", @@ -12709,6 +12776,7 @@ dependencies = [ "futures-util", "http 1.3.1", "http-body 1.0.1", + "http-body-util", "iri-string", "pin-project-lite", "tower 0.5.2", diff --git a/Cargo.toml b/Cargo.toml index dbecd87a38..3de4106a23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,27 +123,28 @@ tari_wallet_daemon_client = { path = "clients/wallet_daemon_client" } transaction_generator = { path = "utilities/transaction_generator" } # external minotari/tari dependencies -minotari_app_grpc = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_app_utilities = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_console_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_node = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_common = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_common_sqlite = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_hashing = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_sidechain = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_jellyfish = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } +minotari_app_grpc = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_app_utilities = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_console_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_node = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_common = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_common_sqlite = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_hashing = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_sidechain = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_jellyfish = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } # avoid including default features so each crate can choose which ones to import -tari_core = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1", default-features = false } -tari_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_metrics = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_mmr = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_p2p = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } +tari_transaction_components = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_node_components = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_transaction_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_metrics = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_mmr = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_p2p = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } tari_crypto = "0.22.0" tari_utilities = "0.8.0" @@ -269,8 +270,9 @@ overflow-checks = true #tari_common_types = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_comms = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_comms_rpc_macros = { git = "https://github.com/account/tari.git", branch = "my-branch" } -#tari_core = { git = "https://github.com/account/tari.git", branch = "my-branch" } -#tari_key_manager = { git = "https://github.com/account/tari.git", branch = "my-branch" } +#tari_transaction_components = { git = "https://github.com/account/tari.git", branch = "my-branch" } +#tari_node_components = { git = "https://github.com/account/tari.git", branch = "my-branch" } +#tari_transaction_key_manager = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_mmr = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_p2p = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_shutdown = { git = "https://github.com/account/tari.git", branch = "my-branch" } @@ -297,8 +299,9 @@ overflow-checks = true #tari_common_sqlite = { path = "../tari/common_sqlite" } #tari_comms = { path = "../tari/comms/core" } #tari_comms_rpc_macros = { path = "../tari/comms/rpc_macros" } -#tari_core = { path = "../tari/base_layer/core" } -#tari_key_manager = { path = "../tari/base_layer/key_manager" } +#tari_transaction_components = { path = "../tari/base_layer/tari_transaction_components" } +#tari_node_components = { path = "../tari/base_layer/tari_node_components" } +#tari_transaction_key_manager = { path = "../tari/base_layer/key_manager" } #tari_mmr = { path = "../tari/base_layer/mmr" } #tari_p2p = { path = "../tari/base_layer/p2p" } #tari_shutdown = { path = "../tari/infrastructure/shutdown" } diff --git a/README.md b/README.md index 1b188bd9ba..5827bfcf03 100644 --- a/README.md +++ b/README.md @@ -88,12 +88,12 @@ So: | tari | ootle -`cd` into `tari` and change the branch `v4.9.0-pre.1`: +`cd` into `tari` and change the branch `v5.0.0-pre.8`: ```shell cd tari -git fetch origin tag v4.9.0-pre.1 -git checkout v4.9.0-pre.1 +git fetch origin tag v5.0.0-pre.8 +git checkout v5.0.0-pre.8 ``` Once done, change directory to the `ootle` and run the following from the ootle folder: diff --git a/applications/tari_swarm_daemon/Cargo.toml b/applications/tari_swarm_daemon/Cargo.toml index 74915e1d44..e71faa93d2 100644 --- a/applications/tari_swarm_daemon/Cargo.toml +++ b/applications/tari_swarm_daemon/Cargo.toml @@ -9,7 +9,7 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_core = { workspace = true } # Used for VN registration signature +tari_transaction_components = { workspace = true } # Used for VN registration signature tari_common_types = { workspace = true } tari_ootle_common_types = { workspace = true } tari_crypto = { workspace = true } diff --git a/applications/tari_swarm_daemon/src/layer_one_transactions/submitter.rs b/applications/tari_swarm_daemon/src/layer_one_transactions/submitter.rs index d9dc320d1d..4c46689a11 100644 --- a/applications/tari_swarm_daemon/src/layer_one_transactions/submitter.rs +++ b/applications/tari_swarm_daemon/src/layer_one_transactions/submitter.rs @@ -1,11 +1,10 @@ // Copyright 2025 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use anyhow::bail; +use anyhow::{anyhow, bail}; use log::info; use minotari_node_grpc_client::grpc; use minotari_wallet_grpc_client::WalletGrpcClient; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::tari_utilities::ByteArray; use tari_ootle_common_types::layer_one_transaction::{ LayerOnePayloadType, @@ -14,6 +13,7 @@ use tari_ootle_common_types::layer_one_transaction::{ ValidatorRegistrationParams, }; use tari_sidechain::EvictionProof; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; pub struct LayerOneTransactionSubmitter { client: WalletGrpcClient, @@ -66,10 +66,11 @@ impl LayerOneTransactionSubmitter { validator_node_claim_public_key: registration.claim_public_key.as_bytes().to_vec(), max_epoch: registration.max_epoch.as_u64(), fee_per_gram: 10, - payment_id: PaymentId::Open { - user_data: format!("VN registration: {}", registration.public_key).into_bytes(), - tx_type: TxType::ValidatorNodeRegistration, - } + payment_id: MemoField::new_open( + format!("VN registration: {}", registration.public_key).into_bytes(), + TxType::ValidatorNodeRegistration, + ) + .map_err(|e| anyhow!("Failed to create payment ID: {}", e))? .to_bytes(), sidechain_deployment_key: registration .sidechain_public_key diff --git a/applications/tari_swarm_daemon/src/process_manager/manager.rs b/applications/tari_swarm_daemon/src/process_manager/manager.rs index 9c50a30d43..336fe0271a 100644 --- a/applications/tari_swarm_daemon/src/process_manager/manager.rs +++ b/applications/tari_swarm_daemon/src/process_manager/manager.rs @@ -15,13 +15,13 @@ use futures::future::Either; use log::{debug, info}; use minotari_wallet_grpc_client::grpc; use tari_common_types::types::FixedHash; -use tari_core::consensus::NetworkConsensus; use tari_engine::wasm::WasmModule; use tari_engine_types::calculate_template_binary_hash; use tari_ootle_app_utilities::configuration::convert_network_to_l1_network; use tari_ootle_common_types::Network; use tari_shutdown::ShutdownSignal; use tari_template_lib_types::TemplateAddress; +use tari_transaction_components::consensus::NetworkConsensus; use tari_validator_node_client::types::{AddPeerRequest, GetTemplatesRequest}; use tari_wallet_daemon_client::types::ExtClaimBurnProof; use tokio::{sync::mpsc, time, time::sleep}; diff --git a/applications/tari_swarm_daemon/src/process_manager/processes/minotari_wallet.rs b/applications/tari_swarm_daemon/src/process_manager/processes/minotari_wallet.rs index 11f82f086f..1f01b4481b 100644 --- a/applications/tari_swarm_daemon/src/process_manager/processes/minotari_wallet.rs +++ b/applications/tari_swarm_daemon/src/process_manager/processes/minotari_wallet.rs @@ -5,7 +5,6 @@ use anyhow::anyhow; use minotari_node_grpc_client::grpc; use minotari_wallet_grpc_client::WalletGrpcClient; use serde::Serialize; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::tari_utilities::ByteArray; use tari_template_lib_types::crypto::{ CommitmentSignatureBytes, @@ -13,6 +12,7 @@ use tari_template_lib_types::crypto::{ RistrettoPublicKeyBytes, Scalar32Bytes, }; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tari_wallet_daemon_client::types::ClaimBurnProof; use crate::process_manager::Instance; @@ -54,11 +54,9 @@ impl MinoTariWalletProcess { let request = grpc::CreateBurnTransactionRequest { amount, fee_per_gram: 1, - payment_id: PaymentId::Open { - user_data: "Burn funds in swarm".as_bytes().to_vec(), - tx_type: TxType::Burn, - } - .to_bytes(), + payment_id: MemoField::new_open("Burn funds in swarm".as_bytes().to_vec(), TxType::Burn) + .map_err(|e| anyhow!("Failed to create MemoField: {e}"))? + .to_bytes(), claim_public_key: claim_public_key.to_vec(), sidechain_deployment_key: vec![], }; diff --git a/applications/tari_validator_node/Cargo.toml b/applications/tari_validator_node/Cargo.toml index 7b07133b5d..1a244157e1 100644 --- a/applications/tari_validator_node/Cargo.toml +++ b/applications/tari_validator_node/Cargo.toml @@ -18,7 +18,7 @@ web_ui = [] minotari_app_utilities = { workspace = true } tari_common = { workspace = true } tari_common_types = { workspace = true } -tari_core = { workspace = true, default-features = false, features = ["transactions"] } +tari_transaction_components = { workspace = true } tari_crypto = { workspace = true } tari_epoch_oracles = { workspace = true, features = ["base_layer"] } tari_validator_node_rpc = { workspace = true } diff --git a/applications/tari_validator_node/src/json_rpc/handlers.rs b/applications/tari_validator_node/src/json_rpc/handlers.rs index 8301f52722..ee6b1a8b8b 100644 --- a/applications/tari_validator_node/src/json_rpc/handlers.rs +++ b/applications/tari_validator_node/src/json_rpc/handlers.rs @@ -32,7 +32,6 @@ use serde_json::{self as json, json}; use tari_base_node_client::types::BaseLayerValidatorNode; use tari_common_types::types::CompressedPublicKey; use tari_consensus_types::{Decision, LeafBlock}; -use tari_core::transactions::transaction_components::ValidatorNodeSignature; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tari_engine_types::{FromByteType, ToByteType}; use tari_epoch_manager::{service::EpochManagerHandle, traits::LayerOneTransactionSubmitter, EpochManagerReader}; @@ -64,6 +63,7 @@ use tari_ootle_storage::{ use tari_ootle_storage_sqlite::global::SqliteGlobalDbAdapter; use tari_template_lib::prelude::{RistrettoPublicKeyBytes, Scalar32Bytes, SchnorrSignatureBytes}; use tari_template_manager::interface::TemplateManagerHandle; +use tari_transaction_components::transaction_components::ValidatorNodeSignature; use tari_validator_node_client::types::{ self, AddPeerRequest, diff --git a/applications/tari_validator_node/src/lib.rs b/applications/tari_validator_node/src/lib.rs index f722af623d..0684e4a68c 100644 --- a/applications/tari_validator_node/src/lib.rs +++ b/applications/tari_validator_node/src/lib.rs @@ -54,6 +54,7 @@ use tari_ootle_common_types::{PeerAddress, SubstateAddress}; use tari_ootle_storage::global::{DbFactory, GlobalDb}; use tari_ootle_storage_sqlite::{global::SqliteGlobalDbAdapter, SqliteDbFactory}; use tari_shutdown::Shutdown; +use tokio::task; pub use crate::config::{ApplicationConfig, ValidatorNodeConfig}; use crate::{ @@ -111,7 +112,7 @@ pub async fn run_validator_node( // Preload the range proof services. This avoids initialization cost during transaction processing and helps ensure // validators execute at a more similar speed. - preload_crypto_services(); + task::spawn_blocking(preload_crypto_services).await?; #[cfg(feature = "metrics")] let mut base_registry = prometheus_client::registry::Registry::default(); diff --git a/applications/tari_walletd/Cargo.toml b/applications/tari_walletd/Cargo.toml index da5d1a3552..1dbf1464d1 100644 --- a/applications/tari_walletd/Cargo.toml +++ b/applications/tari_walletd/Cargo.toml @@ -11,6 +11,7 @@ license.workspace = true minotari_app_utilities = { workspace = true } tari_bor = { workspace = true } tari_common = { workspace = true } +tari_common_types = { workspace = true } tari_crypto = { workspace = true } tari_ootle_app_utilities = { workspace = true } tari_shutdown = { workspace = true } @@ -26,7 +27,8 @@ tari_template_builtin = { workspace = true } tari_template_lib = { workspace = true } tari_template_abi = { workspace = true } tari_indexer_client = { workspace = true, features = ["client"] } -tari_key_manager = { workspace = true } +tari_transaction_key_manager = { workspace = true } +tari_transaction_components = { workspace = true } tari_transaction_manifest = { workspace = true } anyhow = { workspace = true } diff --git a/applications/tari_walletd/src/cli.rs b/applications/tari_walletd/src/cli.rs index 584a5ab753..a28f33b4f1 100644 --- a/applications/tari_walletd/src/cli.rs +++ b/applications/tari_walletd/src/cli.rs @@ -25,8 +25,8 @@ use std::{net::SocketAddr, path::PathBuf}; use clap::{Args, Parser}; use minotari_app_utilities::common_cli_args::CommonCliArgs; use tari_common::configuration::{ConfigOverrideProvider, Network as L1Network}; +use tari_common_types::seeds::seed_words::SeedWords; use tari_crypto::tari_utilities::SafePassword; -use tari_key_manager::SeedWords; use tari_ootle_app_utilities::configuration::convert_l1_network_to_network; use tari_ootle_common_types::Network; use url::Url; @@ -118,6 +118,7 @@ impl ConfigOverrideProvider for Cli { file.display().to_string(), )); } + overrides } } diff --git a/applications/tari_walletd/src/config.rs b/applications/tari_walletd/src/config.rs index 2d4351d775..23a4d56bed 100644 --- a/applications/tari_walletd/src/config.rs +++ b/applications/tari_walletd/src/config.rs @@ -79,6 +79,7 @@ pub struct WalletDaemonConfig { /// The number of contiguous failures to find an account derived from a public key before abandoning recovery and /// assuming that there are no further accounts. pub recovery_abandon_count: usize, + pub override_keyring_password: Option, } fn return_default_jwt_expiry() -> Duration { @@ -103,6 +104,7 @@ impl Default for WalletDaemonConfig { web_ui_address: Some("127.0.0.1:5100".parse().unwrap()), value_lookup_table_file: None, recovery_abandon_count: 10, + override_keyring_password: None, } } } diff --git a/applications/tari_walletd/src/lib.rs b/applications/tari_walletd/src/lib.rs index abcdd86a2b..f38b9e85c4 100644 --- a/applications/tari_walletd/src/lib.rs +++ b/applications/tari_walletd/src/lib.rs @@ -34,6 +34,7 @@ mod webrtc; use std::{fs, panic, process}; use log::*; +use tari_common_types::seeds::seed_words::SeedWords; use tari_ootle_common_types::{optional::Optional, NumPreshards}; use tari_ootle_wallet_sdk::{ apis::{ @@ -48,7 +49,6 @@ use tari_shutdown::ShutdownSignal; use tari_template_lib::constants::XTR; use crate::{ - cli::Cli, config::ApplicationConfig, handlers::{auth::create_authenticator, HandlerContext}, indexer_jrpc_impl::IndexerJsonRpcNetworkInterface, @@ -63,17 +63,17 @@ const DEFAULT_FEE: u64 = 1500; const NUM_PRESHARDS: NumPreshards = NumPreshards::current(); pub async fn run_tari_ootle_walletd( - cli: Cli, config: ApplicationConfig, + seed_words: Option<&SeedWords>, shutdown_signal: ShutdownSignal, ) -> Result<(), anyhow::Error> { // Uncomment to enable tokio tracing via tokio-console // console_subscriber::init(); let wallet_store = init_wallet_store(&config)?; - let mut wallet_sdk = initialize_wallet_sdk(&cli, &config, wallet_store.clone())?; + let mut wallet_sdk = initialize_wallet_sdk(&config, wallet_store.clone())?; - let needs_seed_recovery = wallet_sdk.initialize_cipher_seed(cli.wallet_restore.seed_words.as_ref())?; + let needs_seed_recovery = wallet_sdk.initialize_cipher_seed(seed_words)?; wallet_sdk.key_manager_api().get_or_create_initial(KeyBranch::Account)?; @@ -170,13 +170,12 @@ pub fn init_wallet_store(config: &ApplicationConfig) -> anyhow::Result anyhow::Result> { let sdk_config = WalletSdkConfig { network: config.ootle_wallet_daemon.network, - override_keyring_password: cli.override_keyring_password.clone(), + override_keyring_password: config.ootle_wallet_daemon.override_keyring_password.clone(), }; let config_api = ConfigApi::new(&store); let indexer_jrpc_endpoint = if let Some(indexer_url) = config_api.get(ConfigKey::IndexerUrl).optional()? { diff --git a/applications/tari_walletd/src/main.rs b/applications/tari_walletd/src/main.rs index 3d09608e88..34d3926282 100644 --- a/applications/tari_walletd/src/main.rs +++ b/applications/tari_walletd/src/main.rs @@ -50,7 +50,7 @@ async fn main() -> Result<(), anyhow::Error> { process::exit(1); })); - let cli = Cli::init(); + let mut cli = Cli::init(); let config_path = cli.common.config_path(); let cfg = load_configuration(config_path, true, &cli, cli.network_override())?; let mut config = ApplicationConfig::load_from(&cfg)?; @@ -58,6 +58,9 @@ async fn main() -> Result<(), anyhow::Error> { if let Some(network) = cli.network_override() { config.ootle_wallet_daemon.network = network; } + if let Some(password) = cli.override_keyring_password.take() { + config.ootle_wallet_daemon.override_keyring_password = Some(password); + } match &cli.command { Some(Subcommand::Run) | None => run(cli, config).await?, @@ -68,7 +71,7 @@ async fn main() -> Result<(), anyhow::Error> { output_path, }) => { let wallet_store = init_wallet_store(&config)?; - let mut sdk = initialize_wallet_sdk(&cli, &config, wallet_store)?; + let mut sdk = initialize_wallet_sdk(&config, wallet_store)?; sdk.initialize_cipher_seed(cli.wallet_restore.seed_words.as_ref())?; let km = sdk.key_manager_api(); let secret = if let Some(index) = key_index { @@ -105,7 +108,7 @@ async fn main() -> Result<(), anyhow::Error> { }, Some(Subcommand::SeedWords) => { let wallet_store = init_wallet_store(&config)?; - let mut sdk = initialize_wallet_sdk(&cli, &config, wallet_store)?; + let mut sdk = initialize_wallet_sdk(&config, wallet_store)?; sdk.initialize_cipher_seed(cli.wallet_restore.seed_words.as_ref())?; let seed_words = sdk.load_seed_words()?; println!("{}", seed_words.join(" ").reveal()) @@ -124,7 +127,7 @@ async fn run(cli: Cli, config: ApplicationConfig) -> Result<(), anyhow::Error> { if let Err(e) = initialize_logging( &cli.common.log_config_path("ootle_wallet_daemon"), - &cli.common.get_base_path(), + config.common.base_path(), include_str!("../log4rs_sample.yml"), ) { eprintln!("{}", e); @@ -138,5 +141,5 @@ async fn run(cli: Cli, config: ApplicationConfig) -> Result<(), anyhow::Error> { config.ootle_wallet_daemon.indexer_json_rpc_url ); - run_tari_ootle_walletd(cli, config, shutdown_signal).await + run_tari_ootle_walletd(config, cli.wallet_restore.seed_words.as_ref(), shutdown_signal).await } diff --git a/applications/tari_walletd/src/services/recovery_service.rs b/applications/tari_walletd/src/services/recovery_service.rs index f574372dc0..2bc8515f81 100644 --- a/applications/tari_walletd/src/services/recovery_service.rs +++ b/applications/tari_walletd/src/services/recovery_service.rs @@ -6,7 +6,6 @@ use std::{collections::HashMap, time::Duration}; use log::{error, info, warn}; use tari_crypto::{keys::PublicKey, ristretto::RistrettoPublicKey}; use tari_engine_types::{component::derive_component_address_from_public_key, ToByteType}; -use tari_key_manager::key_manager::DerivedKey; use tari_ootle_common_types::{ optional::{IsNotFoundError, Optional}, substate_type::SubstateType, @@ -24,6 +23,7 @@ use tari_ootle_wallet_sdk::{ use tari_shutdown::ShutdownSignal; use tari_template_builtin::ACCOUNT_TEMPLATE_ADDRESS; use tari_template_lib::prelude::RistrettoPublicKeyBytes; +use tari_transaction_components::key_manager::tari_key_manager::DerivedKey; use crate::services::{account_monitor::AccountMonitorError, AccountMonitorHandle}; @@ -163,7 +163,7 @@ where /// Attempt to recover an account by the provided public key. async fn try_recover_account( &self, - key: &DerivedKey, + key: &DerivedKey, owner_key_cache: &mut HashMap, ) -> Result<(), AccountScannerError> { let network_interface = self.wallet_sdk.get_network_interface(); diff --git a/applications/tari_watcher/Cargo.toml b/applications/tari_watcher/Cargo.toml index 45862e0779..f2e86882fe 100644 --- a/applications/tari_watcher/Cargo.toml +++ b/applications/tari_watcher/Cargo.toml @@ -12,7 +12,7 @@ license.workspace = true minotari_wallet_grpc_client = { workspace = true } minotari_node_grpc_client = { workspace = true } minotari_app_grpc = { workspace = true } -tari_core = { workspace = true } # Used for VN registration signature +tari_transaction_components = { workspace = true } # Used for VN registration signature tari_crypto = { workspace = true } # Used for `.to_vec()` in registration request tari_ootle_common_types = { workspace = true } tari_shutdown = { workspace = true } diff --git a/applications/tari_watcher/src/minotari.rs b/applications/tari_watcher/src/minotari.rs index b15a3630c9..02a0fb61e2 100644 --- a/applications/tari_watcher/src/minotari.rs +++ b/applications/tari_watcher/src/minotari.rs @@ -8,7 +8,6 @@ use log::*; use minotari_app_grpc::tari_rpc::{self as grpc, GetActiveValidatorNodesResponse, RegisterValidatorNodeResponse}; use minotari_node_grpc_client::BaseNodeGrpcClient; use minotari_wallet_grpc_client::WalletGrpcClient; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::tari_utilities::ByteArray; use tari_ootle_common_types::layer_one_transaction::{ LayerOnePayloadType, @@ -17,6 +16,7 @@ use tari_ootle_common_types::layer_one_transaction::{ ValidatorRegistrationParams, }; use tari_sidechain::EvictionProof; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tonic::transport::Channel; use url::Url; @@ -140,10 +140,11 @@ impl MinotariNodes { max_epoch: 0u64, fee_per_gram: 10, sidechain_deployment_key: vec![], - payment_id: PaymentId::Open { - user_data: format!("VN registration: {}", info.public_key).into_bytes(), - tx_type: TxType::ValidatorNodeRegistration, - } + payment_id: MemoField::new_open( + format!("VN registration: {}", info.public_key).into_bytes(), + TxType::ValidatorNodeRegistration, + ) + .map_err(|e| anyhow!("Failed to create payment ID: {}", e))? .to_bytes(), }) .await? @@ -198,10 +199,11 @@ impl MinotariNodes { validator_node_claim_public_key: registration.claim_public_key.as_bytes().to_vec(), max_epoch: registration.max_epoch.as_u64(), fee_per_gram: 10, - payment_id: PaymentId::Open { - user_data: format!("VN registration: {}", registration.public_key).into_bytes(), - tx_type: TxType::ValidatorNodeRegistration, - } + payment_id: MemoField::new_open( + format!("VN registration: {}", registration.public_key).into_bytes(), + TxType::ValidatorNodeRegistration, + ) + .map_err(|e| anyhow!("Failed to create payment ID: {}", e))? .to_bytes(), sidechain_deployment_key: registration .sidechain_public_key diff --git a/clients/base_node_client/Cargo.toml b/clients/base_node_client/Cargo.toml index 3ca097e473..1d0188b7a4 100644 --- a/clients/base_node_client/Cargo.toml +++ b/clients/base_node_client/Cargo.toml @@ -10,7 +10,8 @@ license.workspace = true minotari_app_grpc = { workspace = true } minotari_node_grpc_client = { workspace = true } tari_common_types = { workspace = true } -tari_core = { workspace = true, default-features = false, features = ["base_node"] } # Currently needed to compile (it shouldnt be) +tari_transaction_components = { workspace = true, default-features = false } +tari_node_components = { workspace = true, default-features = false } tari_utilities = { workspace = true } tari_ootle_common_types = { workspace = true } tari_template_lib = { workspace = true } diff --git a/clients/base_node_client/src/grpc.rs b/clients/base_node_client/src/grpc.rs index 9e5655bf90..66d60aeeab 100644 --- a/clients/base_node_client/src/grpc.rs +++ b/clients/base_node_client/src/grpc.rs @@ -27,13 +27,10 @@ use log::*; use minotari_app_grpc::tari_rpc::{self as grpc, GetShardKeyRequest, GetValidatorNodeChangesRequest}; use minotari_node_grpc_client::BaseNodeGrpcClient; use tari_common_types::types::FixedHash; -use tari_core::{ - base_node::comms_interface::ValidatorNodeChange, - blocks::BlockHeader, - transactions::transaction_components::CodeTemplateRegistration, -}; +use tari_node_components::blocks::BlockHeader; use tari_ootle_common_types::{Epoch, SubstateAddress}; use tari_template_lib::types::crypto::RistrettoPublicKeyBytes; +use tari_transaction_components::transaction_components::CodeTemplateRegistration; use tari_utilities::ByteArray; use url::Url; @@ -130,7 +127,7 @@ impl BaseNodeClient for GrpcBaseNodeClient { &mut self, epoch: Epoch, sidechain_id: Option<&RistrettoPublicKeyBytes>, - ) -> Result, BaseNodeClientError> { + ) -> Result, BaseNodeClientError> { let client = self.connection().await?; let result = client .get_validator_node_changes(GetValidatorNodeChangesRequest { @@ -140,14 +137,7 @@ impl BaseNodeClient for GrpcBaseNodeClient { .await? .into_inner(); - let changes = result - .changes - .into_iter() - .map(TryInto::try_into) - .collect::>() - .map_err(|err| { - BaseNodeClientError::InvalidPeerMessage(format!("Error converting validator node changes: {}", err)) - })?; + let changes = result.changes; Ok(changes) } diff --git a/clients/base_node_client/src/traits.rs b/clients/base_node_client/src/traits.rs index 5954699bfb..b3a2abf054 100644 --- a/clients/base_node_client/src/traits.rs +++ b/clients/base_node_client/src/traits.rs @@ -2,14 +2,12 @@ // SPDX-License-Identifier: BSD-3-Clause use async_trait::async_trait; +use minotari_app_grpc::tari_rpc::ValidatorNodeChange; use tari_common_types::types::FixedHash; -use tari_core::{ - base_node::comms_interface::ValidatorNodeChange, - blocks::BlockHeader, - transactions::transaction_components::CodeTemplateRegistration, -}; +use tari_node_components::blocks::BlockHeader; use tari_ootle_common_types::{Epoch, SubstateAddress}; use tari_template_lib::prelude::RistrettoPublicKeyBytes; +use tari_transaction_components::transaction_components::CodeTemplateRegistration; use crate::{ error::BaseNodeClientError, diff --git a/clients/base_node_client/src/types.rs b/clients/base_node_client/src/types.rs index ba3b3b4f2b..dc4a9ea04e 100644 --- a/clients/base_node_client/src/types.rs +++ b/clients/base_node_client/src/types.rs @@ -3,9 +3,9 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::FixedHash; -use tari_core::transactions::{tari_amount::MicroMinotari, transaction_components::TransactionOutput}; use tari_ootle_common_types::{Epoch, SubstateAddress}; use tari_template_lib::prelude::RistrettoPublicKeyBytes; +use tari_transaction_components::{tari_amount::MicroMinotari, transaction_components::TransactionOutput}; #[derive(Debug, Clone)] pub struct BaseLayerMetadata { diff --git a/crates/epoch_manager/Cargo.toml b/crates/epoch_manager/Cargo.toml index 001e06fc10..3f0e04b04b 100644 --- a/crates/epoch_manager/Cargo.toml +++ b/crates/epoch_manager/Cargo.toml @@ -10,6 +10,7 @@ license.workspace = true [dependencies] tari_common_types = { workspace = true } tari_crypto = { workspace = true } +minotari_app_grpc = { workspace = true, optional = true } tari_ootle_common_types = { workspace = true } tari_ootle_storage = { workspace = true } tari_ootle_storage_sqlite = { workspace = true, optional = true } @@ -29,4 +30,5 @@ url = { workspace = true } service = [ "log", "tari_ootle_storage_sqlite", + "minotari_app_grpc" ] diff --git a/crates/epoch_manager/src/epoch_event_oracle/event.rs b/crates/epoch_manager/src/epoch_event_oracle/event.rs index ba79937b6c..bf01534fcf 100644 --- a/crates/epoch_manager/src/epoch_event_oracle/event.rs +++ b/crates/epoch_manager/src/epoch_event_oracle/event.rs @@ -3,6 +3,7 @@ use std::fmt::Display; +use anyhow::Context; use tari_common_types::types::FixedHash; use tari_engine_types::confidential::UnclaimedConfidentialOutput; use tari_ootle_common_types::{displayable::Displayable, Epoch, SubstateAddress}; @@ -146,6 +147,39 @@ pub enum ValidatorNodeChange { }, } +#[cfg(feature = "service")] +impl TryFrom for ValidatorNodeChange { + type Error = anyhow::Error; + + fn try_from(value: minotari_app_grpc::tari_rpc::ValidatorNodeChange) -> Result { + match value.change { + Some(minotari_app_grpc::tari_rpc::validator_node_change::Change::Add(add)) => { + let registration = add + .registration + .ok_or_else(|| anyhow::anyhow!("ValidatorNodeChange Add missing registration field"))?; + let claim_public_key = RistrettoPublicKeyBytes::from_bytes(®istration.claim_public_key) + .context("Invalid claim_public_key")?; + let validator_node_public_key = RistrettoPublicKeyBytes::from_bytes(®istration.public_key) + .context("Invalid validator_node_public_key")?; + Ok(ValidatorNodeChange::Add { + claim_public_key, + validator_node_public_key, + activation_epoch: Epoch(add.activation_epoch), + minimum_value_promise: add.minimum_value_promise, + shard_key: SubstateAddress::from_bytes(&add.shard_key)?, + }) + }, + Some(minotari_app_grpc::tari_rpc::validator_node_change::Change::Remove(remove)) => { + Ok(ValidatorNodeChange::Remove { + public_key: RistrettoPublicKeyBytes::from_bytes(&remove.public_key) + .context("invalid public key in ValidatorNodeChange::Remove")?, + }) + }, + None => Err(anyhow::anyhow!("ValidatorNodeChange missing change field")), + } + } +} + impl Display for ValidatorNodeChange { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/crates/epoch_oracles/Cargo.toml b/crates/epoch_oracles/Cargo.toml index b2422e370f..08da0ef780 100644 --- a/crates/epoch_oracles/Cargo.toml +++ b/crates/epoch_oracles/Cargo.toml @@ -9,7 +9,8 @@ license.workspace = true [dependencies] tari_base_node_client = { workspace = true, optional = true } tari_common_types = { workspace = true } -tari_core = { workspace = true, optional = true } +tari_transaction_components = { workspace = true, optional = true } +minotari_app_grpc = { workspace = true, optional = true } tari_ootle_common_types = { workspace = true } tari_ootle_storage = { workspace = true } tari_ootle_storage_sqlite = { workspace = true } @@ -26,12 +27,13 @@ serde = { workspace = true } url = { workspace = true, optional = true } [dev-dependencies] -tokio = { workspace = true, features = ["time", "macros"] } +tokio = { workspace = true, features = ["time", "macros", "rt"] } [features] base_layer = [ "tari_base_node_client", - "tari_core", + "minotari_app_grpc", + "tari_transaction_components", "url" ] diff --git a/crates/epoch_oracles/src/base_layer/mod.rs b/crates/epoch_oracles/src/base_layer/mod.rs index eb27eede16..b993232091 100644 --- a/crates/epoch_oracles/src/base_layer/mod.rs +++ b/crates/epoch_oracles/src/base_layer/mod.rs @@ -17,18 +17,20 @@ use tari_base_node_client::{ BaseNodeClientError, }; use tari_common_types::types::FixedHash; -use tari_core::{ - base_node::comms_interface::ValidatorNodeChange as BaseLayerValidatorNodeChange, - transactions::transaction_components::{OutputType, SideChainFeature, SideChainFeatureData, TransactionOutput}, -}; use tari_engine_types::confidential::UnclaimedConfidentialOutput; -use tari_epoch_manager::epoch_event_oracle::{EpochEvent, EpochEventOracle, ValidatorNodeChange}; -use tari_ootle_common_types::{displayable::Displayable, optional::Optional, Epoch, SubstateAddress}; +use tari_epoch_manager::epoch_event_oracle::{EpochEvent, EpochEventOracle}; +use tari_ootle_common_types::{displayable::Displayable, optional::Optional}; use tari_template_lib::{ models::EncryptedData, prelude::PedersenCommitmentBytes, types::crypto::RistrettoPublicKeyBytes, }; +use tari_transaction_components::transaction_components::{ + OutputType, + SideChainFeature, + SideChainFeatureData, + TransactionOutput, +}; use tari_utilities::ByteArray; use tokio::time; use url::Url; @@ -238,7 +240,7 @@ impl BaseLayerOracleInner { .await? .pop() .ok_or_else(|| { - BaseLayerOracleError::InvalidSideChainUtxoResponse(format!( + BaseLayerOracleError::InvalidBaseNodeResponse(format!( "Base layer returned empty response for height {}", current_height )) @@ -389,7 +391,7 @@ impl BaseLayerOracleInner { let encrypted_data_bytes = encrypted_data.as_bytes().to_vec(); let encrypted_data = EncryptedData::try_from(encrypted_data_bytes).map_err(|len| { - BaseLayerOracleError::InvalidSideChainUtxoResponse(format!( + BaseLayerOracleError::InvalidBaseNodeResponse(format!( "Encrypted data incorrect length of bytes: {len}" )) })?; @@ -465,39 +467,14 @@ impl BaseLayerOracleInner { .map_err(BaseLayerOracleError::BaseNodeError)?; let node_changes = node_changes .into_iter() - .map(|ch| match ch { - BaseLayerValidatorNodeChange::Add { - registration, - activation_epoch, - minimum_value_promise, - shard_key, - } => ValidatorNodeChange::Add { - claim_public_key: RistrettoPublicKeyBytes::from_bytes( - registration.claim_public_key().as_bytes(), - ) - .expect( - "claim_public_key: Compressed and RistrettoPublicKeyBytes must be \ - the same length", - ), - validator_node_public_key: RistrettoPublicKeyBytes::from_bytes( - registration.public_key().as_bytes(), - ) - .expect( - "validator_node_public_key: Compressed and \ - RistrettoPublicKeyBytes must be the same length", - ), - activation_epoch: Epoch::from(activation_epoch.as_u64()), - minimum_value_promise: minimum_value_promise.as_u64(), - shard_key: SubstateAddress::from_hash_and_version(shard_key, 0), - }, - BaseLayerValidatorNodeChange::Remove { public_key } => ValidatorNodeChange::Remove { - public_key: RistrettoPublicKeyBytes::from_bytes(public_key.as_bytes()).expect( - "public_key: Compressed and RistrettoPublicKeyBytes must be the \ - same length", - ), - }, - }) - .collect::>(); + .map(TryInto::try_into) + .collect::, _>>() + .map_err(|e| { + BaseLayerOracleError::InvalidBaseNodeResponse(format!( + "Failed to convert validator node change: {}", + e + )) + })?; // This maybe empty if the MR changed as a result of other side chain IDs if !node_changes.is_empty() { @@ -535,7 +512,7 @@ impl BaseLayerOracleInner { "⛓️ No more blocks to scan. Last scanned block height: {}", block_info.height ); if block_info.height != end_height { - return Err(BaseLayerOracleError::InvalidSideChainUtxoResponse(format!( + return Err(BaseLayerOracleError::InvalidBaseNodeResponse(format!( "Expected to scan to height {}, but got to height {}", end_height, block_info.height ))); @@ -702,8 +679,8 @@ pub enum BaseLayerOracleError { StoreError(anyhow::Error), #[error("Base node client error: {0}")] BaseNodeError(#[from] BaseNodeClientError), - #[error("Invalid side chain utxo response: {0}")] - InvalidSideChainUtxoResponse(String), + #[error("Invalid base node response: {0}")] + InvalidBaseNodeResponse(String), #[error("Template URL failed to parse: {0}")] TemplateUrlParseError(#[from] url::ParseError), } diff --git a/crates/wallet/sdk/Cargo.toml b/crates/wallet/sdk/Cargo.toml index 40cb6600d1..d0ad6af8c2 100644 --- a/crates/wallet/sdk/Cargo.toml +++ b/crates/wallet/sdk/Cargo.toml @@ -16,7 +16,8 @@ tari_ootle_common_types = { workspace = true } tari_ootle_wallet_crypto = { workspace = true } tari_template_builtin = { workspace = true } tari_consensus_types = { workspace = true } -tari_key_manager = { workspace = true } +tari_transaction_key_manager = { workspace = true } +tari_transaction_components = { workspace = true } tari_transaction = { workspace = true } tari_template_lib = { workspace = true } tari_template_abi = { workspace = true } diff --git a/crates/wallet/sdk/src/apis/confidential_outputs.rs b/crates/wallet/sdk/src/apis/confidential_outputs.rs index 109deef96f..2bfbb39d73 100644 --- a/crates/wallet/sdk/src/apis/confidential_outputs.rs +++ b/crates/wallet/sdk/src/apis/confidential_outputs.rs @@ -4,11 +4,11 @@ use log::*; use tari_crypto::ristretto::{pedersen::PedersenCommitment, RistrettoPublicKey}; use tari_engine_types::{crypto::PrivateOutput, FromByteType, ToByteType}; -use tari_key_manager::key_manager::DerivedKey; use tari_ootle_common_types::optional::{IsNotFoundError, Optional}; use tari_ootle_wallet_crypto::{kdfs, MaskAndValue}; use tari_template_lib::{models::VaultId, prelude::PedersenCommitmentBytes, types::Amount}; use tari_transaction::TransactionId; +use tari_transaction_components::key_manager::tari_key_manager::DerivedKey; use crate::{ apis::{ @@ -265,7 +265,7 @@ where TStore: WalletStore fn validate_output( &self, account: &Account, - key: &DerivedKey, + key: &DerivedKey, vault_id: VaultId, commitment: PedersenCommitmentBytes, output: &PrivateOutput, diff --git a/crates/wallet/sdk/src/apis/key_manager.rs b/crates/wallet/sdk/src/apis/key_manager.rs index 69dcffec2b..1cbc6d5a68 100644 --- a/crates/wallet/sdk/src/apis/key_manager.rs +++ b/crates/wallet/sdk/src/apis/key_manager.rs @@ -4,20 +4,21 @@ use blake2::Blake2b; use digest::consts::U64; use tari_bor::{Deserialize, Serialize}; +use tari_common_types::seeds::cipher_seed::CipherSeed; use tari_crypto::{keys::PublicKey as _, ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; -use tari_key_manager::{ - cipher_seed::CipherSeed, - key_manager::{DerivedKey, KeyManager}, -}; use tari_ootle_common_types::optional::{IsNotFoundError, Optional}; use tari_template_lib::types::crypto::RistrettoPublicKeyBytes; +use tari_transaction_components::{ + key_manager, + key_manager::tari_key_manager::{DerivedKey, TariKeyManager}, +}; use crate::{ models::{KeyPair, WalletKey}, storage::{WalletStorageError, WalletStore, WalletStoreReader, WalletStoreWriter}, }; -pub type WalletKeyManager = KeyManager>; +pub type WalletKeyManager = TariKeyManager>; #[derive(Debug, Clone, Copy, Deserialize, Serialize)] #[cfg_attr(feature = "ts", derive(ts_rs::TS), ts(export, export_to = "wallet-daemon-client/"))] @@ -85,7 +86,7 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { let km = self.get_key_manager(branch.as_ref(), index); let key = km .derive_key(index) - .map_err(tari_key_manager::error::KeyManagerError::from)?; + .map_err(key_manager::error::KeyManagerServiceError::from)?; let pk = RistrettoPublicKey::from_secret_key(&key.key); keys.push(WalletKey { branch: branch.as_ref().to_string(), @@ -99,16 +100,12 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { Ok(keys) } - pub fn derive_key>( - &self, - branch: B, - index: u64, - ) -> Result, KeyManagerApiError> { + pub fn derive_key>(&self, branch: B, index: u64) -> Result { let km = self.get_or_create_key_manager(branch)?; let key = km .derive_key(index) // TODO: Key manager shouldn't return other errors - .map_err(tari_key_manager::error::KeyManagerError::from)?; + .map_err(key_manager::error::KeyManagerServiceError::from)?; Ok(key) } @@ -121,20 +118,17 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { }) } - pub fn derive_account_keypair( - &self, - index: u64, - ) -> Result<(DerivedKey, RistrettoPublicKey), KeyManagerApiError> { + pub fn derive_account_keypair(&self, index: u64) -> Result<(DerivedKey, RistrettoPublicKey), KeyManagerApiError> { let key = self.derive_account_key(index)?; let public_key = RistrettoPublicKey::from_secret_key(&key.key); Ok((key, public_key)) } - pub fn derive_account_key(&self, index: u64) -> Result, KeyManagerApiError> { + pub fn derive_account_key(&self, index: u64) -> Result { self.derive_key(KeyBranch::Account, index) } - pub fn next_account_key(&self) -> Result, KeyManagerApiError> { + pub fn next_account_key(&self) -> Result { self.next_key(KeyBranch::Account) } @@ -152,14 +146,14 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { Ok(tx.key_manager_get_last_index(branch).optional()?.unwrap_or(0)) } - pub fn next_key>(&self, branch: B) -> Result, KeyManagerApiError> { + pub fn next_key>(&self, branch: B) -> Result { let mut tx = self.store.create_write_tx()?; let index = tx.key_manager_get_last_index(branch.as_ref()).optional()?.unwrap_or(0); let mut key_manager = WalletKeyManager::from(self.cipher_seed.clone(), branch.as_ref().to_string(), index); let key = key_manager .next_key() // TODO: Key manager shouldn't return other errors - .map_err(tari_key_manager::error::KeyManagerError::from)?; + .map_err(key_manager::error::KeyManagerServiceError::from)?; tx.key_manager_insert(&key_manager.branch_seed, key_manager.key_index())?; tx.commit()?; Ok(key) @@ -182,10 +176,7 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { Ok(()) } - pub fn get_active_key>( - &self, - branch: B, - ) -> Result<(u64, DerivedKey), KeyManagerApiError> { + pub fn get_active_key>(&self, branch: B) -> Result<(u64, DerivedKey), KeyManagerApiError> { let index = self .store .with_read_tx(|tx| tx.key_manager_get_active_index(branch.as_ref())) @@ -198,7 +189,7 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { &self, branch: B, maybe_index: Option, - ) -> Result<(u64, DerivedKey), KeyManagerApiError> { + ) -> Result<(u64, DerivedKey), KeyManagerApiError> { match maybe_index { Some(index) => Ok((index, self.derive_key(branch, index)?)), None => self.get_active_key(branch), @@ -214,12 +205,12 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { public_key: &RistrettoPublicKeyBytes, start_index: u64, end_index: u64, - ) -> Result<(u64, DerivedKey), KeyManagerApiError> { + ) -> Result<(u64, DerivedKey), KeyManagerApiError> { let km = self.get_or_create_key_manager(branch)?; for index in start_index..=end_index { let key = km .derive_key(index) - .map_err(tari_key_manager::error::KeyManagerError::from)?; + .map_err(key_manager::error::KeyManagerServiceError::from)?; if RistrettoPublicKey::from_secret_key(&key.key).as_bytes() == public_key.as_bytes() { return Ok((index, key)); } @@ -258,7 +249,7 @@ impl<'a, TStore: WalletStore> KeyManagerApi<'a, TStore> { } fn get_key_manager>(&self, branch: B, index: u64) -> WalletKeyManager { - KeyManager::from(self.cipher_seed.clone(), branch.as_ref().to_string(), index) + WalletKeyManager::from(self.cipher_seed.clone(), branch.as_ref().to_string(), index) } } @@ -267,7 +258,7 @@ pub enum KeyManagerApiError { #[error("Store error: {0}")] StoreError(#[from] WalletStorageError), #[error("Key manager error: {0}")] - KeyManagerError(#[from] tari_key_manager::error::KeyManagerError), + KeyManagerError(#[from] key_manager::error::KeyManagerServiceError), #[error("Key for public key {key}, branch {branch} not found")] KeyNotFound { key: RistrettoPublicKeyBytes, diff --git a/crates/wallet/sdk/src/lib.rs b/crates/wallet/sdk/src/lib.rs index 3304dd9f27..652a2fb532 100644 --- a/crates/wallet/sdk/src/lib.rs +++ b/crates/wallet/sdk/src/lib.rs @@ -8,8 +8,8 @@ pub mod models; mod sdk; pub use sdk::{WalletSdk, WalletSdkConfig}; -pub mod network; +pub use tari_common_types::seeds::cipher_seed::CipherSeed; -pub use tari_key_manager::cipher_seed::CipherSeed; +pub mod network; -pub type WalletSecretKey = tari_key_manager::key_manager::DerivedKey; +pub type WalletSecretKey = tari_transaction_components::key_manager::tari_key_manager::DerivedKey; diff --git a/crates/wallet/sdk/src/models/key.rs b/crates/wallet/sdk/src/models/key.rs index 47435e1962..ccead219bd 100644 --- a/crates/wallet/sdk/src/models/key.rs +++ b/crates/wallet/sdk/src/models/key.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause use tari_crypto::ristretto::{RistrettoPublicKey, RistrettoSecretKey}; -use tari_key_manager::key_manager::DerivedKey; +use tari_transaction_components::key_manager::tari_key_manager::DerivedKey; #[derive(Clone)] pub struct WalletKey { @@ -24,7 +24,7 @@ impl WalletKey { #[derive(Clone)] pub struct KeyPair { pub public_key: RistrettoPublicKey, - pub secret_key: DerivedKey, + pub secret_key: DerivedKey, } impl KeyPair { diff --git a/crates/wallet/sdk/src/sdk.rs b/crates/wallet/sdk/src/sdk.rs index 220d17a473..4b3950f1db 100644 --- a/crates/wallet/sdk/src/sdk.rs +++ b/crates/wallet/sdk/src/sdk.rs @@ -6,13 +6,13 @@ use std::sync::Arc; use digest::crypto_common::rand_core::{OsRng, RngCore}; use log::{info, warn}; use passwords::PasswordGenerator; -use tari_crypto::tari_utilities::SafePassword; -use tari_key_manager::{ +use tari_common_types::seeds::{ cipher_seed::CipherSeed, - error::KeyManagerError, + error::CipherError, mnemonic::{Mnemonic, MnemonicLanguage}, - SeedWords, + seed_words::SeedWords, }; +use tari_crypto::tari_utilities::SafePassword; use tari_ootle_common_types::{ optional::{IsNotFoundError, Optional}, Network, @@ -27,7 +27,7 @@ use crate::{ confidential_outputs::ConfidentialOutputsApi, confidential_transfer::ConfidentialTransferApi, config::{ConfigApi, ConfigApiError, ConfigKey}, - key_manager::KeyManagerApi, + key_manager::{KeyManagerApi, KeyManagerApiError}, non_fungible_tokens::NonFungibleTokensApi, resources::ResourcesApi, stealth_crypto::StealthCryptoApi, @@ -354,7 +354,9 @@ pub enum WalletSdkError { #[error("OS Keyring error: {0}")] KeyRing(#[from] keyring::Error), #[error("Key manager error: {0}")] - KeyManager(#[from] KeyManagerError), + KeyManager(#[from] KeyManagerApiError), + #[error("Cipher error: {0}")] + CipherError(#[from] CipherError), #[error("Failed to generate password for cipher seed: {0}")] PasswordGeneration(String), #[error( @@ -373,10 +375,11 @@ impl IsNotFoundError for WalletSdkError { match self { Self::WalletStorageError(e) => e.is_not_found_error(), Self::ConfigApiError(e) => e.is_not_found_error(), + Self::KeyManager(e) => e.is_not_found_error(), Self::KeyRing(keyring::Error::NoEntry) => true, Self::KeyRing(_) | + Self::CipherError(_) | Self::PasswordGeneration(_) | - Self::KeyManager(_) | Self::InvariantError { .. } | Self::FailedToAccessKeyRing | Self::NetworkParseError(_) => false, diff --git a/cucumber-output-junit.xml b/cucumber-output-junit.xml new file mode 100644 index 0000000000..d29d734f5d --- /dev/null +++ b/cucumber-output-junit.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index b2c756e62c..7a6bb1fee8 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -15,7 +15,8 @@ tari_validator_node = { workspace = true, default-features = false } tari_indexer = { workspace = true, default-features = false } tari_ootle_walletd = { workspace = true, default-features = false } -tari_core = { workspace = true, default-features = true } +tari_transaction_components = { workspace = true } +tari_transaction_key_manager = { workspace = true } minotari_app_grpc = { workspace = true } minotari_app_utilities = { workspace = true } minotari_node_grpc_client = { workspace = true } @@ -43,8 +44,8 @@ tari_base_node_client = { workspace = true } tari_transaction_manifest = { workspace = true } tari_ootle_wallet_sdk = { workspace = true } -tari_comms = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } -tari_comms_dht = { git = "https://github.com/tari-project/tari.git", tag = "v4.9.0-pre.1" } +tari_comms = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_comms_dht = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } anyhow = { workspace = true } config = { workspace = true } diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index ca688019b3..351f0ebc38 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -39,15 +39,6 @@ use tari_common_types::{ tari_address::{TariAddress, TariAddressFeatures}, types::{CompressedPublicKey, PrivateKey}, }; -use tari_core::{ - consensus::ConsensusManager, - transactions::transaction_key_manager::{ - create_memory_db_key_manager, - MemoryDbKeyManager, - TariKeyId, - TransactionKeyManagerInterface, - }, -}; use tari_crypto::{ keys::SecretKey, ristretto::{RistrettoComSig, RistrettoPublicKey}, @@ -55,6 +46,11 @@ use tari_crypto::{ use tari_ootle_common_types::SubstateRequirement; use tari_sidechain::EvictionProof; use tari_template_lib::prelude::{PedersenCommitmentBytes, RistrettoPublicKeyBytes}; +use tari_transaction_components::{ + consensus::ConsensusManager, + key_manager::{TariKeyId, TransactionKeyManagerInterface}, +}; +use tari_transaction_key_manager::{create_memory_db_key_manager, MemoryDbKeyManager}; use template::RegisteredTemplate; use validator_node::ValidatorNodeProcess; use wallet::WalletProcess; @@ -77,6 +73,7 @@ pub mod wallet_daemon; pub mod wallet_daemon_cli; #[derive(cucumber::World)] +#[world(init = Self::init)] pub struct TariWorld { pub base_nodes: IndexMap, pub wallets: IndexMap, @@ -109,6 +106,43 @@ pub struct TariWorld { } impl TariWorld { + async fn init() -> Self { + let wallet_private_key = PrivateKey::random(&mut OsRng); + let default_payment_address = TariAddress::new_single_address( + CompressedPublicKey::from_secret_key(&wallet_private_key), + L1Network::LocalNet, + TariAddressFeatures::create_interactive_and_one_sided(), + ) + .unwrap(); + Self { + base_nodes: IndexMap::new(), + wallets: IndexMap::new(), + validator_nodes: IndexMap::new(), + indexers: IndexMap::new(), + vn_seeds: IndexMap::new(), + miners: IndexMap::new(), + templates: IndexMap::new(), + outputs: IndexMap::new(), + http_server: None, + template_mock_server_port: None, + current_scenario_name: None, + commitments: IndexMap::new(), + commitment_ownership_proofs: IndexMap::new(), + rangeproofs: IndexMap::new(), + addresses: IndexMap::new(), + num_databases_saved: 0, + account_keys: IndexMap::new(), + key_manager: create_memory_db_key_manager().await.unwrap(), + wallet_keys: IndexMap::new(), + claim_public_keys: IndexMap::new(), + wallet_daemons: IndexMap::new(), + wallet_private_key, + default_payment_address, + consensus_manager: ConsensusManager::builder(L1Network::LocalNet).build(), + eviction_proofs: HashMap::new(), + } + } + pub fn mark_point_in_logs(&self, point_name: &str) { fn write_point(file_name: &str, point_name: &str) { let base_dir = get_base_dir(); @@ -136,6 +170,10 @@ impl TariWorld { write_point("wallet_daemon.log", point_name); } + pub fn get_current_scenario_name(&self) -> &str { + self.current_scenario_name.as_deref().expect("No current scenario") + } + pub fn get_mock_server(&self) -> &MockHttpServer { self.http_server.as_ref().unwrap() } @@ -281,45 +319,6 @@ impl TariWorld { } } -impl Default for TariWorld { - fn default() -> Self { - let wallet_private_key = PrivateKey::random(&mut OsRng); - let default_payment_address = TariAddress::new_single_address( - CompressedPublicKey::from_secret_key(&wallet_private_key), - L1Network::LocalNet, - TariAddressFeatures::create_interactive_and_one_sided(), - ) - .unwrap(); - Self { - base_nodes: IndexMap::new(), - wallets: IndexMap::new(), - validator_nodes: IndexMap::new(), - indexers: IndexMap::new(), - vn_seeds: IndexMap::new(), - miners: IndexMap::new(), - templates: IndexMap::new(), - outputs: IndexMap::new(), - http_server: None, - template_mock_server_port: None, - current_scenario_name: None, - commitments: IndexMap::new(), - commitment_ownership_proofs: IndexMap::new(), - rangeproofs: IndexMap::new(), - addresses: IndexMap::new(), - num_databases_saved: 0, - account_keys: IndexMap::new(), - key_manager: create_memory_db_key_manager().unwrap(), - wallet_keys: IndexMap::new(), - claim_public_keys: IndexMap::new(), - wallet_daemons: IndexMap::new(), - wallet_private_key, - default_payment_address, - consensus_manager: ConsensusManager::builder(L1Network::LocalNet).build().unwrap(), - eviction_proofs: HashMap::new(), - } - } -} - impl Debug for TariWorld { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("TariWorld") diff --git a/integration_tests/src/miner.rs b/integration_tests/src/miner.rs index 34636606cf..3b089b4901 100644 --- a/integration_tests/src/miner.rs +++ b/integration_tests/src/miner.rs @@ -29,15 +29,14 @@ use minotari_app_grpc::{ }; use minotari_node_grpc_client::BaseNodeGrpcClient; use tari_common_types::tari_address::TariAddress; -use tari_core::{ +use tari_transaction_components::{ consensus::ConsensusManager, - transactions::{ - generate_coinbase_with_wallet_output, - tari_amount::MicroMinotari, - transaction_components::{payment_id::PaymentId, RangeProofType, WalletOutput}, - transaction_key_manager::{MemoryDbKeyManager, TariKeyId}, - }, + generate_coinbase_with_wallet_output, + key_manager::TariKeyId, + transaction_components::{MemoField, RangeProofType, WalletOutput}, + MicroMinotari, }; +use tari_transaction_key_manager::MemoryDbKeyManager; use crate::TariWorld; @@ -161,7 +160,7 @@ async fn create_block_template_with_coinbase( stealth_payment, consensus_manager.consensus_constants(height), RangeProofType::BulletProofPlus, - PaymentId::Empty, + MemoField::new_empty(), ) .await .unwrap(); diff --git a/integration_tests/src/validator_node.rs b/integration_tests/src/validator_node.rs index de6202cc71..7a82e04750 100644 --- a/integration_tests/src/validator_node.rs +++ b/integration_tests/src/validator_node.rs @@ -51,9 +51,7 @@ use tokio::task; use crate::{ helpers::{check_join_handle, get_os_assigned_port, get_os_assigned_ports, wait_listener_on_local_port}, - indexer::spawn_indexer, logging::get_base_dir_for_scenario, - wallet_daemon::spawn_wallet_daemon, TariWorld, }; @@ -112,12 +110,7 @@ pub async fn spawn_validator_node( let walletd = match world.wallet_daemons.get(&wallet_daemon_name) { Some(walletd) => walletd, None => { - let indexer_name = format!("{}_indexer", wallet_daemon_name); - if world.indexers.get(&indexer_name).is_none() { - spawn_indexer(world, indexer_name.clone(), base_node_name).await; - } - spawn_wallet_daemon(world, wallet_daemon_name.clone(), indexer_name).await; - world.wallet_daemons.get(&wallet_daemon_name).unwrap() + panic!("No wallet daemon named {} found", wallet_daemon_name); }, }; let mut wallet_client = walletd.get_authed_client().await; diff --git a/integration_tests/src/wallet.rs b/integration_tests/src/wallet.rs index 718c54b085..cdfc7044a4 100644 --- a/integration_tests/src/wallet.rs +++ b/integration_tests/src/wallet.rs @@ -31,7 +31,7 @@ use std::{ use minotari_app_grpc::{ authentication::ClientAuthenticationInterceptor, - tari_rpc::{wallet_client::WalletClient, ConnectivityStatus, Empty, GetIdentityRequest, SetBaseNodeRequest}, + tari_rpc::{wallet_client::WalletClient, GetIdentityRequest}, }; use minotari_app_utilities::common_cli_args::CommonCliArgs; use minotari_console_wallet::{run_wallet_with_cli, ApplicationConfig}; @@ -115,23 +115,16 @@ impl WalletProcess { pub async fn spawn_wallet(world: &mut TariWorld, wallet_name: String, base_node_name: String) { // each spawned wallet will use different ports let (port, grpc_port) = get_os_assigned_ports(); - // let (port, grpc_port) = match world.base_nodes.values().last() { - // Some(v) => (v.port + 1, v.grpc_port + 1), - // None => (48000, 48500), // default ports if it's the first wallet to be spawned - // }; - let base_node_public_key = world - .base_nodes - .get(&base_node_name) - .unwrap() - .identity - .public_key() - .clone(); - let base_node_port = world.base_nodes.get(&base_node_name).unwrap().port; + + // let base_node_public_key = world + // .base_nodes + // .get(&base_node_name) + // .unwrap() + // .identity + // .public_key() + // .clone(); + // let base_node_port = world.base_nodes.get(&base_node_name).unwrap().port; let base_node_http_port = world.base_nodes.get(&base_node_name).unwrap().http_port; - let set_base_node_request = SetBaseNodeRequest { - net_address: format! {"/ip4/127.0.0.1/tcp/{}", base_node_port}, - public_key_hex: base_node_public_key.to_string(), - }; let temp_dir = get_base_dir_for_scenario( "console_wallet", world.current_scenario_name.as_ref().unwrap(), @@ -143,7 +136,7 @@ pub async fn spawn_wallet(world: &mut TariWorld, wallet_name: String, base_node_ let handle = thread::spawn({ let mut shutdown = shutdown.clone(); move || { - let mut wallet_config = minotari_console_wallet::ApplicationConfig { + let mut wallet_config = ApplicationConfig { common: CommonConfig::default(), auto_update: AutoUpdateConfig::default(), wallet: WalletConfig::default(), @@ -176,12 +169,12 @@ pub async fn spawn_wallet(world: &mut TariWorld, wallet_name: String, base_node_ database_url: DbConnectionUrl::File(temp_dir.join("dht.sqlite")), ..DhtConfig::default_local_test() }; - wallet_config.wallet.http_client_url = format!("http://127.0.0.1:{}", base_node_http_port); + wallet_config.wallet.http_server_url = format!("http://127.0.0.1:{}", base_node_http_port); - wallet_config.wallet.custom_base_node = Some(format!( - "{}::/ip4/127.0.0.1/tcp/{}", - base_node_public_key, base_node_port - )); + // wallet_config.wallet.base_node_service_peers = Some(format!( + // "{}::/ip4/127.0.0.1/tcp/{}", + // base_node_public_key, base_node_port + // )); let mut builder = runtime::Builder::new_multi_thread(); let rt = builder.enable_all().build().unwrap(); @@ -219,20 +212,20 @@ pub async fn spawn_wallet(world: &mut TariWorld, wallet_name: String, base_node_ // eprintln!("Wallet {} comms address: {}", wallet_name, identity.public_address); // TODO: Clean up - let mut status = wallet_client.get_network_status(Empty {}).await.unwrap().into_inner(); - let mut counter = 0; - while status.status != ConnectivityStatus::Online as i32 { - eprintln!( - "Waiting for wallet to connect to base node {} {} {} (status: {:?})", - base_node_name, set_base_node_request.public_key_hex, set_base_node_request.net_address, status - ); - tokio::time::sleep(Duration::from_secs(1)).await; - counter += 1; - if counter > 20 { - panic!("Wallet failed to connect to base node"); - } - status = wallet_client.get_network_status(Empty {}).await.unwrap().into_inner(); - } + // let mut status = wallet_client.get_network_status(Empty {}).await.unwrap().into_inner(); + // let mut counter = 0; + // while status.status != ConnectivityStatus::Online as i32 { + // eprintln!( + // "Waiting for wallet to connect to base node {} on port {} (status: {:?})", + // base_node_name, base_node_port, status + // ); + // tokio::time::sleep(Duration::from_secs(1)).await; + // counter += 1; + // if counter > 20 { + // panic!("Wallet failed to connect to base node"); + // } + // status = wallet_client.get_network_status(Empty {}).await.unwrap().into_inner(); + // } world.wallets.insert(wallet_name.clone(), wallet_process); } diff --git a/integration_tests/src/wallet_daemon.rs b/integration_tests/src/wallet_daemon.rs index 18dfaf9fb6..653836fe43 100644 --- a/integration_tests/src/wallet_daemon.rs +++ b/integration_tests/src/wallet_daemon.rs @@ -29,8 +29,7 @@ use reqwest::Url; use tari_common::configuration::CommonConfig; use tari_ootle_common_types::Network; use tari_ootle_walletd::{ - cli::Cli, - config::{ApplicationConfig, WalletDaemonConfig}, + config::{ApplicationConfig, WalletDaemonAuth, WalletDaemonConfig}, run_tari_ootle_walletd, }; use tari_shutdown::Shutdown; @@ -57,13 +56,9 @@ pub struct TariWalletDaemonProcess { pub async fn spawn_wallet_daemon(world: &mut TariWorld, wallet_daemon_name: String, indexer_name: String) { let (signaling_server_port, json_rpc_port) = get_os_assigned_ports(); - let base_dir = get_base_dir_for_scenario( - "wallet_daemon", - world.current_scenario_name.as_ref().unwrap(), - &wallet_daemon_name, - ); + let base_dir = get_base_dir_for_scenario("wallet_daemon", world.get_current_scenario_name(), &wallet_daemon_name); - let indexer_jrpc_port = world.indexers.get(&indexer_name).unwrap().json_rpc_port; + let indexer_jrpc_port = world.get_indexer(&indexer_name).json_rpc_port; let shutdown = Shutdown::new(); let shutdown_signal = shutdown.to_signal(); @@ -81,11 +76,11 @@ pub async fn spawn_wallet_daemon(world: &mut TariWorld, wallet_daemon_name: Stri config.ootle_wallet_daemon.signaling_server_address = Some(signaling_server_addr); config.ootle_wallet_daemon.indexer_json_rpc_url = indexer_url.parse().unwrap(); config.ootle_wallet_daemon.network = Network::LocalNet; - let mut cli = Cli::init(); + config.ootle_wallet_daemon.authentication = WalletDaemonAuth::None; + config.ootle_wallet_daemon.override_keyring_password = Some("secret".into()); // Avoid using keyring in cucumber tests - cli.override_keyring_password = Some("secret".into()); - let handle = task::spawn(run_tari_ootle_walletd(cli, config, shutdown_signal)); + let handle = task::spawn(run_tari_ootle_walletd(config, None, shutdown_signal)); // Wait for node to start up let handle = wait_listener_on_local_port(handle, json_rpc_port).await; diff --git a/integration_tests/tests/features/claim_burn.feature b/integration_tests/tests/features/claim_burn.feature index d1ad22ae24..eeba3d865b 100644 --- a/integration_tests/tests/features/claim_burn.feature +++ b/integration_tests/tests/features/claim_burn.feature @@ -6,26 +6,9 @@ Feature: Claim Burn @concurrent # @serial @fixed + @doit Scenario: Claim base layer burn funds with wallet daemon - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 4 new blocks - When wallet WALLET has at least 5000 T - When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 26 new blocks - Then VN has scanned to height 27 - Then the validator node VN is listed as registered - - # Initialize an indexer - Given an indexer IDX connected to base node BASE - - # Initialize the wallet daemon - Given a wallet daemon WALLET_D connected to indexer IDX + Given a network with registered validator VN and wallet daemon WALLET_D # When I create a component SECOND_LAYER_TARI of template "fees" on VN using "new" When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins @@ -33,7 +16,7 @@ Feature: Claim Burn When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACC, range proof RANGEPROOF and claim public key CLAIM_PUBKEY # unfortunately have to wait for this to get into the mempool.... - Then there is 1 transaction in the mempool of BASE within 10 seconds + Then there is 1 transaction in the mempool of BASE_NODE within 10 seconds When miner MINER mines 13 new blocks Then VN has scanned to height 40 diff --git a/integration_tests/tests/features/wallet_daemon.feature b/integration_tests/tests/features/wallet_daemon.feature index 0ff1001ddf..5cf0aa9c9f 100644 --- a/integration_tests/tests/features/wallet_daemon.feature +++ b/integration_tests/tests/features/wallet_daemon.feature @@ -126,9 +126,6 @@ Feature: Wallet Daemon # Initialize a base node, wallet, miner and VN Given a network with registered validator VAL_1 and wallet daemon WALLET_D - # Initialize an indexer - Given an indexer IDX connected to base node NETWORK_BASE - # Initialize the wallet daemon Given a wallet daemon WALLET_D connected to indexer IDX diff --git a/integration_tests/tests/steps/miner.rs b/integration_tests/tests/steps/miner.rs index 15dc36c7d1..8b7f4405f8 100644 --- a/integration_tests/tests/steps/miner.rs +++ b/integration_tests/tests/steps/miner.rs @@ -30,11 +30,15 @@ pub async fn miner_mines_new_blocks(world: &mut TariWorld, miner_name: String, n let mut iter_count = 0; while tip.height_of_longest_chain < start_tip + num_blocks { tip = client.get_tip_info().await.unwrap(); - tokio::time::sleep(std::time::Duration::from_millis(350)).await; + tokio::time::sleep(std::time::Duration::from_millis(500)).await; if iter_count > 100 { panic!("Timed out waiting for tip height to reach {}", start_tip + num_blocks); } iter_count += 1; } + eprintln!( + "Base node {} reached tip height {}", + bn.name, tip.height_of_longest_chain + ); } } diff --git a/integration_tests/tests/steps/network.rs b/integration_tests/tests/steps/network.rs index 3d50daf1c2..f1f3247174 100644 --- a/integration_tests/tests/steps/network.rs +++ b/integration_tests/tests/steps/network.rs @@ -4,9 +4,11 @@ use cucumber::given; use integration_tests::{ base_node::spawn_base_node, + indexer::spawn_indexer, miner::register_miner_process, validator_node::spawn_validator_node, wallet::spawn_wallet, + wallet_daemon::spawn_wallet_daemon, }; use crate::{ @@ -16,9 +18,10 @@ use crate::{ #[given(expr = "a network with registered validator {word} and wallet daemon {word}")] async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: String) { - const BASE_NODE_NAME: &str = "NETWORK_BASE"; - const WALLET_NAME: &str = "NETWORK_CONSOLE_WALLET"; - const MINER_NAME: &str = "NETWORK_MINER"; + const BASE_NODE_NAME: &str = "BASE_NODE"; + const WALLET_NAME: &str = "CONSOLE_WALLET"; + const MINER_NAME: &str = "MINER"; + const INDEXER_NAME: &str = "INDEXER"; spawn_base_node(world, BASE_NODE_NAME.to_string()).await; spawn_wallet(world, WALLET_NAME.to_string(), BASE_NODE_NAME.to_string()).await; @@ -28,6 +31,8 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S BASE_NODE_NAME.to_string(), WALLET_NAME.to_string(), ); + spawn_indexer(world, INDEXER_NAME.to_string(), BASE_NODE_NAME.to_string()).await; + spawn_wallet_daemon(world, walletd_name.clone(), INDEXER_NAME.to_string()).await; let vn = spawn_validator_node( world, vn_name.clone(), @@ -38,7 +43,7 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S .await; world.validator_nodes.insert(vn_name.clone(), vn); - miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 6).await; + miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 10).await; wallet::check_balance(world, WALLET_NAME.to_string(), 20, "T".to_string()).await; validator_node::send_vn_registration_with_claim_wallet(world, vn_name.clone(), WALLET_NAME.to_string()).await; miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 26).await; diff --git a/integration_tests/tests/steps/validator_node.rs b/integration_tests/tests/steps/validator_node.rs index 2bd246f752..1e69cc9342 100644 --- a/integration_tests/tests/steps/validator_node.rs +++ b/integration_tests/tests/steps/validator_node.rs @@ -21,11 +21,11 @@ use log::warn; use minotari_app_grpc::tari_rpc::{RegisterValidatorNodeRequest, Signature}; use notify::Watcher; use tari_base_node_client::{grpc::GrpcBaseNodeClient, BaseNodeClient}; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::tari_utilities::ByteArray; use tari_engine_types::substate::SubstateId; use tari_ootle_common_types::{layer_one_transaction::LayerOneTransactionDef, Epoch, SubstateAddress}; use tari_sidechain::EvictionProof; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tari_validator_node_client::types::{ AddPeerRequest, GetBlocksRequest, @@ -183,11 +183,9 @@ pub async fn send_vn_registration_with_claim_wallet(world: &mut TariWorld, vn_na .map(|key| key.to_vec()) .unwrap_or_default(), fee_per_gram: 1, - payment_id: PaymentId::Open { - user_data: "Register by cucumber".as_bytes().to_vec(), - tx_type: TxType::ValidatorNodeRegistration, - } - .to_bytes(), + payment_id: MemoField::new_open_from_string("Register by cucumber", TxType::ValidatorNodeRegistration) + .unwrap() + .to_bytes(), }) .await .unwrap() diff --git a/integration_tests/tests/steps/wallet.rs b/integration_tests/tests/steps/wallet.rs index 8673e4197e..700dd152c5 100644 --- a/integration_tests/tests/steps/wallet.rs +++ b/integration_tests/tests/steps/wallet.rs @@ -6,12 +6,12 @@ use std::time::Duration; use cucumber::{given, then, when}; use minotari_app_grpc::tari_rpc::{GetBalanceRequest, SubmitValidatorEvictionProofRequest, ValidateRequest}; use tari_common_types::types::PrivateKey; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::{ ristretto::{pedersen::PedersenCommitment, RistrettoComSig, RistrettoPublicKey}, tari_utilities::ByteArray, }; use tari_template_lib::prelude::PedersenCommitmentBytes; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tokio::time::sleep; use crate::{spawn_wallet, TariWorld}; @@ -50,11 +50,9 @@ async fn when_i_burn_on_wallet( .create_burn_transaction(minotari_app_grpc::tari_rpc::CreateBurnTransactionRequest { amount: amount * 1_000_000, fee_per_gram: 1, - payment_id: PaymentId::Open { - user_data: "Burn".as_bytes().to_vec(), - tx_type: TxType::Burn, - } - .to_bytes(), + payment_id: MemoField::new_open("Burn".as_bytes().to_vec(), TxType::Burn) + .unwrap() + .to_bytes(), claim_public_key: public_key.to_vec(), sidechain_deployment_key: vec![], }) @@ -87,6 +85,7 @@ async fn when_i_burn_on_wallet( #[when(expr = "wallet {word} has at least {int} {word}")] pub async fn check_balance(world: &mut TariWorld, wallet_name: String, balance: u64, units: String) { + const MAX_WAIT_TIME_SECS: u64 = 100; let wallet = world .wallets .get(&wallet_name) @@ -116,10 +115,10 @@ pub async fn check_balance(world: &mut TariWorld, wallet_name: String, balance: ); sleep(Duration::from_secs(1)).await; - if iterations == 40 { + if iterations == MAX_WAIT_TIME_SECS { panic!( - "Wallet {} did not have at least {} uT after 40 seconds (balance: {} uT, pending: {} uT)", - wallet_name, balance, resp.available_balance, resp.pending_incoming_balance + "Wallet {} did not have at least {} uT after {} seconds (balance: {} uT, pending: {} uT)", + wallet_name, balance, MAX_WAIT_TIME_SECS, resp.available_balance, resp.pending_incoming_balance ); } iterations += 1; diff --git a/integration_tests/tests/steps/wallet_daemon.rs b/integration_tests/tests/steps/wallet_daemon.rs index b83e338c52..7454777fe6 100644 --- a/integration_tests/tests/steps/wallet_daemon.rs +++ b/integration_tests/tests/steps/wallet_daemon.rs @@ -6,10 +6,10 @@ use std::time::Duration; use cucumber::{then, when}; use integration_tests::{wallet_daemon_cli, TariWorld}; use log::info; -use tari_core::transactions::transaction_components::payment_id::{PaymentId, TxType}; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tari_ootle_wallet_sdk::apis::key_manager::KeyBranch; use tari_template_lib::prelude::Amount; +use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tari_wallet_daemon_client::ComponentAddressOrName; #[when( @@ -248,7 +248,7 @@ async fn when_i_burn_funds_with_wallet_daemon( .create_burn_transaction(minotari_app_grpc::tari_rpc::CreateBurnTransactionRequest { amount: amount * 1_000_000, fee_per_gram: 1, - payment_id: PaymentId::open_from_string("Burn", TxType::Burn).to_bytes(), + payment_id: MemoField::open_from_string("Burn", TxType::Burn).to_bytes(), claim_public_key: public_key.to_vec(), sidechain_deployment_key: vec![], }) From 793996d8fd07e94fc1c9488335c363143925230f Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Mon, 1 Sep 2025 17:16:28 +0400 Subject: [PATCH 2/4] fix some of the cucumbers --- Cargo.lock | 139 ++++++------- Cargo.toml | 48 ++--- .../tari_indexer/src/network_client.rs | 15 +- .../src/process_definitions/minotari_node.rs | 1 - .../process_definitions/minotari_wallet.rs | 3 +- .../processes/wallet_daemon.rs | 2 +- applications/tari_walletd/src/cli.rs | 2 +- applications/tari_walletd/src/main.rs | 14 +- .../src/epoch_event_oracle/event.rs | 5 +- crates/wallet/sdk/src/apis/accounts.rs | 4 + integration_tests/Cargo.toml | 5 +- integration_tests/src/base_node.rs | 5 +- integration_tests/src/indexer.rs | 19 +- integration_tests/src/lib.rs | 33 +-- .../src/templates/basic_nft/src/lib.rs | 12 +- .../src/templates/faucet/src/lib.rs | 6 +- integration_tests/src/util.rs | 6 + integration_tests/src/validator_node.rs | 25 ++- integration_tests/src/wallet.rs | 5 + integration_tests/src/wallet_daemon.rs | 43 +++- integration_tests/src/wallet_daemon_cli.rs | 11 +- integration_tests/tests/cucumber.rs | 2 +- .../tests/features/claim_burn.feature | 60 ++---- .../tests/features/claim_fees.feature | 12 +- .../tests/features/committee.feature | 4 +- .../tests/features/epoch_change.feature | 4 +- .../tests/features/eviction.feature | 2 +- .../tests/features/state_sync.feature | 8 +- .../tests/features/substates.feature | 2 +- .../tests/features/transfer.feature | 87 ++------ .../tests/features/wallet_daemon.feature | 10 +- integration_tests/tests/log4rs/cucumber.yml | 17 ++ integration_tests/tests/steps/common.rs | 23 ++- integration_tests/tests/steps/indexer.rs | 16 +- integration_tests/tests/steps/network.rs | 43 +++- .../tests/steps/validator_node.rs | 50 +++-- integration_tests/tests/steps/wallet.rs | 73 +++---- .../tests/steps/wallet_daemon.rs | 191 +++++++----------- 38 files changed, 511 insertions(+), 496 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3116a12ac1..6fccdccb64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5007,6 +5007,7 @@ dependencies = [ "minotari_node", "minotari_node_grpc_client", "minotari_wallet", + "multiaddr 0.18.1", "notify", "rand 0.8.5", "regex", @@ -6057,9 +6058,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.25.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -6542,8 +6543,8 @@ dependencies = [ [[package]] name = "minotari_app_grpc" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "argon2 0.4.1", "base64 0.13.1", @@ -6573,8 +6574,8 @@ dependencies = [ [[package]] name = "minotari_app_utilities" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "clap 3.2.25", "dialoguer 0.10.4", @@ -6595,8 +6596,8 @@ dependencies = [ [[package]] name = "minotari_console_wallet" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "blake2", "chrono", @@ -6651,16 +6652,16 @@ dependencies = [ [[package]] name = "minotari_ledger_wallet_common" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "bs58 0.5.1", ] [[package]] name = "minotari_ledger_wallet_comms" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "borsh", "dialoguer 0.11.0", @@ -6681,8 +6682,8 @@ dependencies = [ [[package]] name = "minotari_node" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -6735,16 +6736,16 @@ dependencies = [ [[package]] name = "minotari_node_grpc_client" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "minotari_app_grpc", ] [[package]] name = "minotari_node_wallet_client" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -6761,8 +6762,8 @@ dependencies = [ [[package]] name = "minotari_wallet" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "argon2 0.4.1", @@ -6816,7 +6817,7 @@ dependencies = [ [[package]] name = "minotari_wallet_grpc_client" version = "0.1.0" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "minotari_app_grpc", "tari_common", @@ -10618,8 +10619,8 @@ dependencies = [ [[package]] name = "tari_common" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "cargo_toml", @@ -10644,8 +10645,8 @@ dependencies = [ [[package]] name = "tari_common_sqlite" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "diesel", "diesel_migrations", @@ -10661,8 +10662,8 @@ dependencies = [ [[package]] name = "tari_common_types" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "argon2 0.4.1", "base64 0.21.7", @@ -10698,8 +10699,8 @@ dependencies = [ [[package]] name = "tari_comms" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -10744,8 +10745,8 @@ dependencies = [ [[package]] name = "tari_comms_dht" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "bitflags 2.9.2", @@ -10778,8 +10779,8 @@ dependencies = [ [[package]] name = "tari_comms_rpc_macros" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "proc-macro2", "quote", @@ -10828,8 +10829,8 @@ dependencies = [ [[package]] name = "tari_core" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -11015,13 +11016,13 @@ dependencies = [ [[package]] name = "tari_features" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" [[package]] name = "tari_hashing" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "blake2", "borsh", @@ -11122,8 +11123,8 @@ dependencies = [ [[package]] name = "tari_jellyfish" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "borsh", "digest", @@ -11136,8 +11137,8 @@ dependencies = [ [[package]] name = "tari_libtor" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "derivative", "libtor", @@ -11150,8 +11151,8 @@ dependencies = [ [[package]] name = "tari_max_size" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "borsh", "serde", @@ -11161,8 +11162,8 @@ dependencies = [ [[package]] name = "tari_metrics" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "once_cell", "prometheus", @@ -11171,8 +11172,8 @@ dependencies = [ [[package]] name = "tari_mmr" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "borsh", "digest", @@ -11202,8 +11203,8 @@ dependencies = [ [[package]] name = "tari_node_components" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "blake2", "borsh", @@ -11512,8 +11513,8 @@ dependencies = [ [[package]] name = "tari_p2p" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "futures 0.3.31", @@ -11609,8 +11610,8 @@ dependencies = [ [[package]] name = "tari_script" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "blake2", "borsh", @@ -11627,8 +11628,8 @@ dependencies = [ [[package]] name = "tari_service_framework" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -11642,16 +11643,16 @@ dependencies = [ [[package]] name = "tari_shutdown" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "futures 0.3.31", ] [[package]] name = "tari_sidechain" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "borsh", "hex", @@ -11733,8 +11734,8 @@ dependencies = [ [[package]] name = "tari_storage" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "bincode 1.3.3", "lmdb-zero", @@ -11916,8 +11917,8 @@ dependencies = [ [[package]] name = "tari_test_utils" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "futures 0.3.31", "rand 0.8.5", @@ -11947,8 +11948,8 @@ dependencies = [ [[package]] name = "tari_transaction_components" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "anyhow", "async-trait", @@ -11992,8 +11993,8 @@ dependencies = [ [[package]] name = "tari_transaction_key_manager" -version = "5.0.0-pre.8" -source = "git+https://github.com/tari-project/tari.git?tag=v5.0.0-pre.8#98ef4c6f0afbfb6b77fa7b47d50b1afd878729c5" +version = "5.0.0" +source = "git+https://github.com/tari-project/tari.git?branch=development#213a0c510457be9eae5a140f2a72fb0dc4d13764" dependencies = [ "async-trait", "chacha20poly1305", diff --git a/Cargo.toml b/Cargo.toml index 3de4106a23..30bc0afbc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,28 +123,28 @@ tari_wallet_daemon_client = { path = "clients/wallet_daemon_client" } transaction_generator = { path = "utilities/transaction_generator" } # external minotari/tari dependencies -minotari_app_grpc = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_app_utilities = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_console_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_node = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_common = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_common_sqlite = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_hashing = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_sidechain = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_jellyfish = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +minotari_app_grpc = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_app_utilities = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_console_wallet = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_node = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_wallet = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_common = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_common_types = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_common_sqlite = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_hashing = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_sidechain = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_jellyfish = { git = "https://github.com/tari-project/tari.git", branch = "development" } # avoid including default features so each crate can choose which ones to import -tari_transaction_components = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_node_components = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_transaction_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_metrics = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_mmr = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_p2p = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_transaction_components = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_node_components = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_transaction_key_manager = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_metrics = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_mmr = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_p2p = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_shutdown = { git = "https://github.com/tari-project/tari.git", branch = "development" } tari_crypto = "0.22.0" tari_utilities = "0.8.0" @@ -202,7 +202,7 @@ libp2p-identity = { git = "https://github.com/tari-project/rust-libp2p.git", rev libp2p = { git = "https://github.com/tari-project/rust-libp2p.git", rev = "debc01257dd979418d7793f2dc91d25471de5c38", version = "0.56.0", default-features = false } #libp2p = "0.53.1" #libp2p-identity = "0.2.8" -libsqlite3-sys = "0.25" +libsqlite3-sys = "0.30.1" log = "0.4.20" log4rs = "1.3" mime_guess = "2.0.4" @@ -299,9 +299,9 @@ overflow-checks = true #tari_common_sqlite = { path = "../tari/common_sqlite" } #tari_comms = { path = "../tari/comms/core" } #tari_comms_rpc_macros = { path = "../tari/comms/rpc_macros" } -#tari_transaction_components = { path = "../tari/base_layer/tari_transaction_components" } -#tari_node_components = { path = "../tari/base_layer/tari_node_components" } -#tari_transaction_key_manager = { path = "../tari/base_layer/key_manager" } +#tari_transaction_components = { path = "../tari/base_layer/transaction_components" } +#tari_node_components = { path = "../tari/base_layer/node_components" } +#tari_transaction_key_manager = { path = "../tari/base_layer/transaction_key_manager" } #tari_mmr = { path = "../tari/base_layer/mmr" } #tari_p2p = { path = "../tari/base_layer/p2p" } #tari_shutdown = { path = "../tari/infrastructure/shutdown" } diff --git a/applications/tari_indexer/src/network_client.rs b/applications/tari_indexer/src/network_client.rs index 5d063b76d5..afde94aad3 100644 --- a/applications/tari_indexer/src/network_client.rs +++ b/applications/tari_indexer/src/network_client.rs @@ -49,16 +49,16 @@ where return Err(NetworkClientError::NoInputsProvided); } + // Ensure initial scanning has completed to ensure an accurate epoch + self.epoch_manager.wait_for_initial_scanning_to_complete().await?; + let tx_id = transaction.calculate_id(); info!( target: LOG_TARGET, - "Submitting transaction {} to the validator node", tx_id + "Submitting transaction {} to the network", tx_id ); - // Ensure initial scanning has completed to ensure an accurate epoch - self.epoch_manager.wait_for_initial_scanning_to_complete().await?; - let involved = transaction .all_inputs_iter() // The version does not affect the shard group @@ -148,6 +148,13 @@ where let epoch = self.epoch_manager.current_epoch().await?; let num_committees = self.epoch_manager.get_num_committees(epoch).await?; + info!( + target: LOG_TARGET, + "Fetching committee members at epoch {} ({} total committees)", + epoch, + num_committees, + ); + let mut all_members = HashMap::new(); for substate_address in substate_addresses { let shard_group = substate_address.to_shard_group(self.num_preshards, num_committees); diff --git a/applications/tari_swarm_daemon/src/process_definitions/minotari_node.rs b/applications/tari_swarm_daemon/src/process_definitions/minotari_node.rs index f42985eda1..7185446e7c 100644 --- a/applications/tari_swarm_daemon/src/process_definitions/minotari_node.rs +++ b/applications/tari_swarm_daemon/src/process_definitions/minotari_node.rs @@ -56,7 +56,6 @@ impl ProcessDefinition for MinotariNode { .arg(format!("-pbase_node.http_wallet_query_service.port={http_api_port}")) .args([ "--non-interactive", - "--enable-grpc", "--enable-mining", "--enable-second-layer", "-pbase_node.p2p.allow_test_addresses=true", diff --git a/applications/tari_swarm_daemon/src/process_definitions/minotari_wallet.rs b/applications/tari_swarm_daemon/src/process_definitions/minotari_wallet.rs index 3937835b8e..770d6074ab 100644 --- a/applications/tari_swarm_daemon/src/process_definitions/minotari_wallet.rs +++ b/applications/tari_swarm_daemon/src/process_definitions/minotari_wallet.rs @@ -57,7 +57,6 @@ impl ProcessDefinition for MinotariWallet { .arg("--enable-grpc") .arg("--password") .arg("password") - .arg(format!("-pwallet.custom_base_node={}", base_node_addresses[0])) .arg("-pwallet.p2p.transport.type=tcp") .arg(format!( "-pwallet.p2p.transport.tcp.listener_address={listener_address}" @@ -65,7 +64,7 @@ impl ProcessDefinition for MinotariWallet { .arg(format!("-pwallet.p2p.public_addresses={public_address}")) .arg(format!("-pwallet.grpc_address=/ip4/{listen_ip}/tcp/{grpc_port}")) .arg(format!( - "-pwallet.http_client_url=http://{listen_ip}:{base_node_api_port}" + "-pwallet.http_server_url=http://{listen_ip}:{base_node_api_port}" )) .args(["--non-interactive", "-pwallet.p2p.allow_test_addresses=true"]) .arg(format!( diff --git a/applications/tari_swarm_daemon/src/process_manager/processes/wallet_daemon.rs b/applications/tari_swarm_daemon/src/process_manager/processes/wallet_daemon.rs index f08a247242..17dc926a5d 100644 --- a/applications/tari_swarm_daemon/src/process_manager/processes/wallet_daemon.rs +++ b/applications/tari_swarm_daemon/src/process_manager/processes/wallet_daemon.rs @@ -29,7 +29,7 @@ impl WalletDaemonProcess { .allocated_ports() .get("jrpc") .ok_or_else(|| anyhow!("No wallet JSON-RPC port allocated"))?; - let mut client = WalletDaemonClient::connect(format!("http://localhost:{port}"), None)?; + let mut client = WalletDaemonClient::connect(format!("http://localhost:{port}/json_rpc"), None)?; let AuthLoginResponse { auth_token, .. } = client .auth_request(AuthLoginRequest { permissions: vec!["Admin".to_string()], diff --git a/applications/tari_walletd/src/cli.rs b/applications/tari_walletd/src/cli.rs index a28f33b4f1..f54aa9696d 100644 --- a/applications/tari_walletd/src/cli.rs +++ b/applications/tari_walletd/src/cli.rs @@ -128,7 +128,7 @@ pub enum Subcommand { #[clap(name = "run", about = "Run the wallet daemon")] Run, #[clap(about = "Generate a new key and output the public key")] - CreateKey { + CreateAccount { #[clap(long, alias = "key")] key_index: Option, #[clap(long)] diff --git a/applications/tari_walletd/src/main.rs b/applications/tari_walletd/src/main.rs index 34d3926282..4748d3d32b 100644 --- a/applications/tari_walletd/src/main.rs +++ b/applications/tari_walletd/src/main.rs @@ -27,6 +27,7 @@ use log::*; use serde_json::json; use tari_common::initialize_logging; use tari_crypto::{keys::PublicKey, ristretto::RistrettoPublicKey}; +use tari_engine_types::ToByteType; use tari_ootle_app_utilities::configuration::load_configuration; use tari_ootle_wallet_sdk::apis::key_manager::KeyBranch; use tari_ootle_walletd::{ @@ -64,8 +65,7 @@ async fn main() -> Result<(), anyhow::Error> { match &cli.command { Some(Subcommand::Run) | None => run(cli, config).await?, - // TODO: rather implement create account and return the key - Some(Subcommand::CreateKey { + Some(Subcommand::CreateAccount { key_index, set_active, output_path, @@ -79,13 +79,21 @@ async fn main() -> Result<(), anyhow::Error> { } else { km.next_account_key()? }; + let public_key = RistrettoPublicKey::from_secret_key(&secret.key); + + let account_addr = sdk + .accounts_api() + .derive_account_address_from_public_key(&public_key.to_byte_type()); + sdk.accounts_api() + .add_account(Some("Fee"), &account_addr, secret.key_index, false, true)?; if *set_active { km.set_active_key(KeyBranch::Account, secret.key_index)?; } let json = json!({ - "public_key": RistrettoPublicKey::from_secret_key(&secret.key), + "address": account_addr, + "public_key": public_key, "key_index": secret.key_index, }); match output_path { diff --git a/crates/epoch_manager/src/epoch_event_oracle/event.rs b/crates/epoch_manager/src/epoch_event_oracle/event.rs index bf01534fcf..9415d168e0 100644 --- a/crates/epoch_manager/src/epoch_event_oracle/event.rs +++ b/crates/epoch_manager/src/epoch_event_oracle/event.rs @@ -166,7 +166,10 @@ impl TryFrom for ValidatorNode validator_node_public_key, activation_epoch: Epoch(add.activation_epoch), minimum_value_promise: add.minimum_value_promise, - shard_key: SubstateAddress::from_bytes(&add.shard_key)?, + shard_key: { + let hash = FixedHash::try_from(add.shard_key.as_slice()).context("Invalid shard key hash")?; + SubstateAddress::from_hash_and_version(hash, 0) + }, }) }, Some(minotari_app_grpc::tari_rpc::validator_node_change::Change::Remove(remove)) => { diff --git a/crates/wallet/sdk/src/apis/accounts.rs b/crates/wallet/sdk/src/apis/accounts.rs index f1c1fdc20e..edfb5682b5 100644 --- a/crates/wallet/sdk/src/apis/accounts.rs +++ b/crates/wallet/sdk/src/apis/accounts.rs @@ -54,6 +54,10 @@ impl<'a, TStore: WalletStore, TNetworkInterface> AccountsApi<'a, TStore, TNetwor } } + pub fn derive_account_address_from_public_key(&self, public_key: &RistrettoPublicKeyBytes) -> ComponentAddress { + derive_component_address_from_public_key(&ACCOUNT_TEMPLATE_ADDRESS, public_key) + } + pub fn create_account( &self, account_name: Option<&str>, diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 7a6bb1fee8..abacf64cdc 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -44,14 +44,15 @@ tari_base_node_client = { workspace = true } tari_transaction_manifest = { workspace = true } tari_ootle_wallet_sdk = { workspace = true } -tari_comms = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } -tari_comms_dht = { git = "https://github.com/tari-project/tari.git", tag = "v5.0.0-pre.8" } +tari_comms = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_comms_dht = { git = "https://github.com/tari-project/tari.git", branch = "development" } anyhow = { workspace = true } config = { workspace = true } cucumber = { version = "0.21.1", features = ["default", "libtest", "output-junit"] } httpmock = { version = "0.8.0-alpha.1", features = ["remote"] } indexmap = { workspace = true } +multiaddr = { workspace = true } libp2p = { workspace = true } log = { workspace = true, features = ["std"] } log4rs = { workspace = true, features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } diff --git a/integration_tests/src/base_node.rs b/integration_tests/src/base_node.rs index 4e0c6de3b9..a9c8e222cd 100644 --- a/integration_tests/src/base_node.rs +++ b/integration_tests/src/base_node.rs @@ -36,6 +36,7 @@ use tokio::task; use crate::{ helpers::{get_os_assigned_port, get_os_assigned_ports, wait_listener_on_local_port}, logging::get_base_dir_for_scenario, + util::cucumber_log, TariWorld, }; @@ -67,7 +68,7 @@ pub async fn spawn_base_node(world: &mut TariWorld, bn_name: String) { // }; let base_node_address = Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", port)).unwrap(); let base_node_identity = NodeIdentity::random(&mut OsRng, base_node_address, PeerFeatures::COMMUNICATION_NODE); - println!("Base node identity: {}", base_node_identity); + cucumber_log(format!("Base node identity: {}", base_node_identity)); let identity = base_node_identity.clone(); let temp_dir = get_base_dir_for_scenario("base_node", world.current_scenario_name.as_ref().unwrap(), &bn_name); let temp_dir_path = temp_dir.clone(); @@ -93,7 +94,7 @@ pub async fn spawn_base_node(world: &mut TariWorld, bn_name: String) { }, }; - println!("Using base_node temp_dir: {}", temp_dir.display()); + cucumber_log(format!("Using base_node temp_dir: {}", temp_dir.display())); base_node_config.common.base_path.clone_from(&temp_dir); base_node_config.base_node.network = Network::LocalNet; base_node_config.base_node.grpc_enabled = true; diff --git a/integration_tests/src/indexer.rs b/integration_tests/src/indexer.rs index adf4d31c79..dbc662f647 100644 --- a/integration_tests/src/indexer.rs +++ b/integration_tests/src/indexer.rs @@ -26,6 +26,7 @@ use std::{ time::{Duration, SystemTime}, }; +use multiaddr::multiaddr; use reqwest::Url; use tari_common::{ configuration::{CommonConfig, StringList}, @@ -40,12 +41,12 @@ use tari_indexer::{ use tari_indexer_client::{ graphql_client::IndexerGraphQLClient, json_rpc_client::IndexerJsonRpcClient, - types::{GetNonFungiblesRequest, GetSubstateRequest, GetSubstateResponse, NonFungibleSubstate}, + types::{AddPeerRequest, GetNonFungiblesRequest, GetSubstateRequest, GetSubstateResponse, NonFungibleSubstate}, }; use tari_ootle_app_utilities::{epoch_oracle_config::EpochOracleConfig, p2p_config::PeerSeedsConfig}; use tari_ootle_common_types::Network; use tari_shutdown::Shutdown; -use tari_template_lib::types::ObjectKey; +use tari_template_lib::{prelude::RistrettoPublicKeyBytes, types::ObjectKey}; use tokio::task; use crate::{ @@ -69,6 +70,18 @@ pub struct IndexerProcess { } impl IndexerProcess { + pub async fn add_peer(&self, public_key: RistrettoPublicKeyBytes, port: u16) { + let mut jrpc_client = self.get_jrpc_indexer_client(); + jrpc_client + .add_peer(AddPeerRequest { + public_key, + addresses: vec![multiaddr!(Ip4([127, 0, 0, 1]), Tcp(port))], + wait_for_dial: true, + }) + .await + .unwrap(); + } + pub async fn get_substate(&self, world: &TariWorld, output_ref: String, version: u32) -> GetSubstateResponse { let address = get_address_from_output(world, output_ref); @@ -159,7 +172,7 @@ pub async fn spawn_indexer(world: &mut TariWorld, indexer_name: String, base_nod // we need to add all the validator nodes as seed peers let peer_seeds: Vec = world .all_running_validators_iter() - .map(|vn| format!("{}::/ip4/127.0.0.1/tcp/{}", vn.public_key, vn.port)) + .map(|vn| format!("{}::/ip4/127.0.0.1/tcp/{}", vn.public_key, vn.p2p_port)) .collect(); let shutdown = Shutdown::new(); diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index 351f0ebc38..22f829fd2a 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -39,18 +39,17 @@ use tari_common_types::{ tari_address::{TariAddress, TariAddressFeatures}, types::{CompressedPublicKey, PrivateKey}, }; -use tari_crypto::{ - keys::SecretKey, - ristretto::{RistrettoComSig, RistrettoPublicKey}, -}; +use tari_crypto::keys::SecretKey; +use tari_engine_types::substate::SubstateId; use tari_ootle_common_types::SubstateRequirement; use tari_sidechain::EvictionProof; -use tari_template_lib::prelude::{PedersenCommitmentBytes, RistrettoPublicKeyBytes}; +use tari_template_lib::prelude::RistrettoPublicKeyBytes; use tari_transaction_components::{ consensus::ConsensusManager, key_manager::{TariKeyId, TransactionKeyManagerInterface}, }; use tari_transaction_key_manager::{create_memory_db_key_manager, MemoryDbKeyManager}; +use tari_wallet_daemon_client::types::ExtClaimBurnProof; use template::RegisteredTemplate; use validator_node::ValidatorNodeProcess; use wallet::WalletProcess; @@ -86,16 +85,13 @@ pub struct TariWorld { pub http_server: Option, pub template_mock_server_port: Option, pub current_scenario_name: Option, - pub commitments: IndexMap, - pub commitment_ownership_proofs: IndexMap, - pub rangeproofs: IndexMap>, - pub addresses: IndexMap, + pub claim_proofs: HashMap, + pub substate_ids: IndexMap, pub num_databases_saved: usize, pub account_keys: IndexMap, pub key_manager: MemoryDbKeyManager, /// Key name -> key index pub wallet_keys: IndexMap, - pub claim_public_keys: IndexMap, pub wallet_daemons: IndexMap, /// Used for all one-sided coinbase payments pub wallet_private_key: PrivateKey, @@ -126,15 +122,12 @@ impl TariWorld { http_server: None, template_mock_server_port: None, current_scenario_name: None, - commitments: IndexMap::new(), - commitment_ownership_proofs: IndexMap::new(), - rangeproofs: IndexMap::new(), - addresses: IndexMap::new(), + claim_proofs: HashMap::new(), + substate_ids: IndexMap::new(), num_databases_saved: 0, account_keys: IndexMap::new(), key_manager: create_memory_db_key_manager().await.unwrap(), wallet_keys: IndexMap::new(), - claim_public_keys: IndexMap::new(), wallet_daemons: IndexMap::new(), wallet_private_key, default_payment_address, @@ -275,8 +268,7 @@ impl TariWorld { p.shutdown.trigger(); } self.outputs.clear(); - self.commitments.clear(); - self.commitment_ownership_proofs.clear(); + self.claim_proofs.clear(); self.miners.clear(); } @@ -333,14 +325,11 @@ impl Debug for TariWorld { .field("http_server", &self.http_server) .field("template_mock_server_port", &self.template_mock_server_port) .field("current_scenario_name", &self.current_scenario_name) - .field("commitments", &self.commitments.keys()) - .field("commitment_ownership_proofs", &self.commitment_ownership_proofs.keys()) - .field("rangeproofs", &self.rangeproofs.keys()) - .field("addresses", &self.addresses.keys()) + .field("claim_proofs", &self.claim_proofs.keys()) + .field("addresses", &self.substate_ids.keys()) .field("num_databases_saved", &self.num_databases_saved) .field("account_keys", &self.account_keys.keys()) .field("wallet_keys", &self.wallet_keys.keys()) - .field("claim_public_keys", &self.claim_public_keys.keys()) .field("wallet_daemons", &self.wallet_daemons.keys()) .finish() } diff --git a/integration_tests/src/templates/basic_nft/src/lib.rs b/integration_tests/src/templates/basic_nft/src/lib.rs index da47588235..67a9ecd35a 100644 --- a/integration_tests/src/templates/basic_nft/src/lib.rs +++ b/integration_tests/src/templates/basic_nft/src/lib.rs @@ -48,8 +48,8 @@ mod sparkle_nft_template { resource_address, vault, }) - .with_access_rules(AccessRules::allow_all()) - .create() + .with_access_rules(AccessRules::allow_all()) + .create() } pub fn new_with_initial_nft(nft: NonFungibleId) -> Component { @@ -65,12 +65,12 @@ mod sparkle_nft_template { resource_address: bucket.resource_address(), vault: Vault::from_bucket(bucket), }) - .with_access_rules(AccessRules::allow_all()) - .create() + .with_access_rules(AccessRules::allow_all()) + .create() } pub fn take_initial_nft(&mut self) -> Bucket { - self.vault.withdraw(Amount(1)) + self.vault.withdraw(1) } pub fn mint(&mut self, name: String, url: String) -> Bucket { @@ -119,7 +119,7 @@ mod sparkle_nft_template { bucket.resource_address() == self.resource_address, "Cannot burn bucket not from this collection" ); - debug!("Burning bucket {} containing {}", bucket.id(), bucket.amount()); + debug!("Burning bucket containing {}", bucket.amount()); // This is all that's required, typically the template would not need to include a burn function because a // native instruction can be used instead bucket.burn(); diff --git a/integration_tests/src/templates/faucet/src/lib.rs b/integration_tests/src/templates/faucet/src/lib.rs index de603840c1..f46e82196f 100644 --- a/integration_tests/src/templates/faucet/src/lib.rs +++ b/integration_tests/src/templates/faucet/src/lib.rs @@ -39,12 +39,12 @@ mod faucet_template { Component::new(Self { vault: Vault::from_bucket(coins), }) - .with_access_rules(AccessRules::allow_all()) - .create() + .with_access_rules(AccessRules::allow_all()) + .create() } pub fn take_free_coins(&mut self) -> Bucket { - self.take_amount_of_free_coins(Amount(1000)) + self.take_amount_of_free_coins(1000.into()) } pub fn take_amount_of_free_coins(&mut self, amount: Amount) -> Bucket { diff --git a/integration_tests/src/util.rs b/integration_tests/src/util.rs index 307883d53d..5567adf2da 100644 --- a/integration_tests/src/util.rs +++ b/integration_tests/src/util.rs @@ -1,9 +1,15 @@ // Copyright 2025 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +use log::info; use tari_ootle_common_types::Network; use tari_transaction::TransactionBuilder; pub fn transaction_builder() -> TransactionBuilder { TransactionBuilder::new().for_network(Network::LocalNet.as_byte()) } + +pub fn cucumber_log>(msg: T) { + // eprintln!("CUCUMBER: {}", msg.as_ref()); + info!(target: "cucumber", "{}", msg.as_ref()); +} diff --git a/integration_tests/src/validator_node.rs b/integration_tests/src/validator_node.rs index 7a82e04750..b56bd944f0 100644 --- a/integration_tests/src/validator_node.rs +++ b/integration_tests/src/validator_node.rs @@ -59,7 +59,7 @@ use crate::{ pub struct ValidatorNodeProcess { pub name: String, pub public_key: RistrettoPublicKeyBytes, - pub port: u16, + pub p2p_port: u16, pub json_rpc_port: u16, pub web_ui_port: u16, pub base_node_grpc_port: u16, @@ -94,6 +94,25 @@ impl ValidatorNodeProcess { let file = File::open(resp.path).expect("Could not open file"); serde_json::from_reader(file).expect("Could not parse file") } + + pub async fn wait_for_consensus_to_start(&self) { + let mut client = self.create_client(); + let mut attempts = 60; + loop { + let resp = client.get_consensus_status().await.unwrap(); + if resp.state == "Running" { + return; + } + attempts -= 1; + if attempts == 0 { + panic!( + "Validator node did not start consensus in time: status: {}, epoch: {}", + resp.state, resp.epoch + ); + } + tokio::time::sleep(std::time::Duration::from_secs(1)).await; + } + } } pub async fn spawn_validator_node( @@ -125,7 +144,7 @@ pub async fn spawn_validator_node( let peer_seeds: Vec = world .vn_seeds .values() - .map(|vn| format!("{}::/ip4/127.0.0.1/tcp/{}", vn.public_key, vn.port)) + .map(|vn| format!("{}::/ip4/127.0.0.1/tcp/{}", vn.public_key, vn.p2p_port)) .collect(); let temp_dir = get_base_dir_for_scenario( @@ -188,7 +207,7 @@ pub async fn spawn_validator_node( ValidatorNodeProcess { name: name.clone(), public_key, - port, + p2p_port: port, base_node_grpc_port, web_ui_port, handle, diff --git a/integration_tests/src/wallet.rs b/integration_tests/src/wallet.rs index cdfc7044a4..7aaff5a88b 100644 --- a/integration_tests/src/wallet.rs +++ b/integration_tests/src/wallet.rs @@ -154,6 +154,11 @@ pub async fn spawn_wallet(world: &mut TariWorld, wallet_name: String, base_node_ wallet_config.wallet.data_dir = temp_dir.join("data/wallet"); wallet_config.wallet.db_file = temp_dir.join("db/console_wallet.db"); wallet_config.wallet.contacts_auto_ping_interval = Duration::from_secs(2); + wallet_config + .wallet + .output_manager_service_config + .num_confirmations_required = 1; + wallet_config.wallet.output_manager_service_config.prevent_fee_gt_amount = false; wallet_config .wallet .base_node_service_config diff --git a/integration_tests/src/wallet_daemon.rs b/integration_tests/src/wallet_daemon.rs index 653836fe43..c9a252112b 100644 --- a/integration_tests/src/wallet_daemon.rs +++ b/integration_tests/src/wallet_daemon.rs @@ -33,8 +33,20 @@ use tari_ootle_walletd::{ run_tari_ootle_walletd, }; use tari_shutdown::Shutdown; +use tari_transaction::TransactionId; use tari_wallet_daemon_client::{ - types::{AuthLoginAcceptRequest, AuthLoginRequest, AuthLoginResponse}, + error::WalletDaemonClientError, + types::{ + AuthLoginAcceptRequest, + AuthLoginRequest, + AuthLoginResponse, + ClaimBurnRequest, + ClaimBurnResponse, + ExtClaimBurnProof, + TransactionWaitResultRequest, + TransactionWaitResultResponse, + }, + ComponentAddressOrName, WalletDaemonClient, }; use tokio::task; @@ -103,7 +115,7 @@ impl TariWalletDaemonProcess { self.shutdown.trigger(); } - pub fn get_client(&self) -> WalletDaemonClient { + fn get_client(&self) -> WalletDaemonClient { let endpoint = Url::parse(&format!("http://127.0.0.1:{}", self.json_rpc_port)).unwrap(); WalletDaemonClient::connect(endpoint, None).unwrap() } @@ -129,4 +141,31 @@ impl TariWalletDaemonProcess { client.set_auth_token(auth_response.permissions_token); client } + + pub async fn claim_burn( + &self, + account_name: &str, + claim_proof: ExtClaimBurnProof, + ) -> Result { + let mut client = self.get_authed_client().await; + + let req = ClaimBurnRequest { + account: ComponentAddressOrName::Name(account_name.into()), + claim_proof, + max_fee: Some(5000), + }; + + client.claim_burn(req).await + } + + pub async fn wait_for_transaction_result(&self, tx_id: TransactionId) -> TransactionWaitResultResponse { + let mut client = self.get_authed_client().await; + client + .wait_transaction_result(TransactionWaitResultRequest { + transaction_id: tx_id, + timeout_secs: Some(30), + }) + .await + .unwrap() + } } diff --git a/integration_tests/src/wallet_daemon_cli.rs b/integration_tests/src/wallet_daemon_cli.rs index 69de76fa4d..a4f0fa40a9 100644 --- a/integration_tests/src/wallet_daemon_cli.rs +++ b/integration_tests/src/wallet_daemon_cli.rs @@ -391,7 +391,7 @@ pub async fn get_balance(world: &mut TariWorld, account_name: &str, wallet_daemo .await .expect("Failed to get balance from account"); eprintln!("resp = {}", serde_json::to_string_pretty(&resp).unwrap()); - resp.balances.iter().map(|e| e.balance).sum() + resp.balances.iter().map(|e| e.balance + e.confidential_balance).sum() } pub async fn get_confidential_balance( @@ -901,13 +901,8 @@ pub async fn confidential_transfer( add_substate_ids(world, outputs_name, resp.result.result.any_accept().unwrap()); } -pub async fn get_auth_wallet_daemon_client(world: &TariWorld, wallet_daemon_name: &str) -> WalletDaemonClient { - world - .wallet_daemons - .get(wallet_daemon_name) - .unwrap_or_else(|| panic!("Wallet daemon not found with name {}", wallet_daemon_name)) - .get_authed_client() - .await +pub async fn get_auth_wallet_daemon_client(world: &TariWorld, name: &str) -> WalletDaemonClient { + world.get_wallet_daemon(name).get_authed_client().await } async fn get_account_from_name(client: &mut WalletDaemonClient, account_name: String) -> Account { diff --git a/integration_tests/tests/cucumber.rs b/integration_tests/tests/cucumber.rs index 8f2c3b1de8..90e3efde16 100644 --- a/integration_tests/tests/cucumber.rs +++ b/integration_tests/tests/cucumber.rs @@ -677,7 +677,7 @@ async fn given_all_validator_connects_to_other_vns(world: &mut TariWorld) { .map(|vn| { ( vn.public_key, - Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.port)).unwrap(), + Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.p2p_port)).unwrap(), ) }) .collect::>(); diff --git a/integration_tests/tests/features/claim_burn.feature b/integration_tests/tests/features/claim_burn.feature index eeba3d865b..d3411527e3 100644 --- a/integration_tests/tests/features/claim_burn.feature +++ b/integration_tests/tests/features/claim_burn.feature @@ -6,62 +6,44 @@ Feature: Claim Burn @concurrent # @serial @fixed - @doit Scenario: Claim base layer burn funds with wallet daemon Given a network with registered validator VN and wallet daemon WALLET_D - # When I create a component SECOND_LAYER_TARI of template "fees" on VN using "new" - When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins + When I create an account ACC via the wallet daemon WALLET_D - When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACC, range proof RANGEPROOF and claim public key CLAIM_PUBKEY + When I burn 10T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D # unfortunately have to wait for this to get into the mempool.... - Then there is 1 transaction in the mempool of BASE_NODE within 10 seconds - When miner MINER mines 13 new blocks - Then VN has scanned to height 40 + Then there is 1 transaction in the mempool of NETWORK_BASE_NODE within 10 seconds + When miner NETWORK_MINER mines 13 new blocks + Then VN has scanned to at least height 30 - When I convert commitment COMMITMENT into COMM_ADDRESS address + When I convert commitment in proof BURN_PROOF into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACC via the wallet daemon WALLET_D - # Then account ACC has one confidential bucket in it + When I claim burn BURN_PROOF and spend it into account ACC using wallet daemon WALLET_D + + Then I wait for ACC on wallet daemon WALLET_D to have balance gte 900000 # @serial @concurrent Scenario: Double Claim base layer burn funds with wallet daemon. should fail - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 4 new blocks - When wallet WALLET has at least 10000 T - When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 26 new blocks - Then VN has scanned to height 27 - Then the validator node VN is listed as registered - - # Initialize an indexer - Given an indexer IDX connected to base node BASE - - # Initialize the wallet daemon - Given a wallet daemon WALLET_D connected to indexer IDX + Given a network with registered validator VN and wallet daemon WALLET_D - # When I create a component SECOND_LAYER_TARI of template "fees" on VN using "new" - When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins + When I create an account ACC via the wallet daemon WALLET_D - When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACC, range proof RANGEPROOF and claim public key CLAIM_PUBKEY + When I burn 10T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D # unfortunately have to wait for this to get into the mempool.... - Then there is 1 transaction in the mempool of BASE within 10 seconds - When miner MINER mines 13 new blocks - Then VN has scanned to height 40 + Then there is 1 transaction in the mempool of NETWORK_BASE_NODE within 10 seconds + When miner NETWORK_MINER mines 13 new blocks + Then VN has scanned to at least height 30 - When I convert commitment COMMITMENT into COMM_ADDRESS address + When I convert commitment in proof BURN_PROOF into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACC via the wallet daemon WALLET_D - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACC via the wallet daemon WALLET_D, it fails -# Then account ACC has one confidential bucket in it + When I claim burn BURN_PROOF and spend it into account ACC using wallet daemon WALLET_D + When I claim burn BURN_PROOF and spend it into account ACC using wallet daemon WALLET_D, it fails + + # Then we check the balance + Then I wait for ACC on wallet daemon WALLET_D to have balance gte 900000 diff --git a/integration_tests/tests/features/claim_fees.feature b/integration_tests/tests/features/claim_fees.feature index a4b8247680..7404aa08d4 100644 --- a/integration_tests/tests/features/claim_fees.feature +++ b/integration_tests/tests/features/claim_fees.feature @@ -24,8 +24,8 @@ Feature: Claim Fees When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET When miner MINER mines 16 new blocks - Then VN has scanned to height 17 - And indexer IDX has scanned to height 17 + Then VN has scanned to at least height 17 + And indexer IDX has scanned to at least height 17 Then the validator node VN is listed as registered When indexer IDX connects to all other validators @@ -37,7 +37,7 @@ Feature: Claim Fees # Progress to the next epoch When miner MINER mines 10 new blocks - Then VN has scanned to height 27 + Then VN has scanned to at least height 27 When I check the balance of ACC2 on wallet daemon WALLET_D the amount is at most 9800 @@ -69,8 +69,8 @@ Feature: Claim Fees When wallet WALLET has at least 10000 T When validator node VN sends a registration transaction to base wallet WALLET When miner MINER mines 16 new blocks - Then VN has scanned to height 17 - And indexer IDX has scanned to height 17 + Then VN has scanned to at least height 17 + And indexer IDX has scanned to at least height 17 Then the validator node VN is listed as registered When indexer IDX connects to all other validators @@ -83,7 +83,7 @@ Feature: Claim Fees # Progress to the next epoch When miner MINER mines 10 new blocks - Then VN has scanned to height 27 + Then VN has scanned to at least height 27 # Can't claim fees with different account When I claim fees for validator VN into account ACC1 using the wallet daemon WALLET_D, it fails diff --git a/integration_tests/tests/features/committee.feature b/integration_tests/tests/features/committee.feature index bfa8304a8a..ecbaa98262 100644 --- a/integration_tests/tests/features/committee.feature +++ b/integration_tests/tests/features/committee.feature @@ -29,8 +29,8 @@ Feature: Committee scenarios # Register the "counter" template # When base wallet WALLET registers the template "counter" When miner MINER mines 25 new blocks - Then VAL_1 has scanned to height 28 - Then VAL_2 has scanned to height 28 + Then VAL_1 has scanned to at least height 28 + Then VAL_2 has scanned to at least height 28 Then the validator node VAL_1 is listed as registered Then the validator node VAL_2 is listed as registered diff --git a/integration_tests/tests/features/epoch_change.feature b/integration_tests/tests/features/epoch_change.feature index 326d5b8cc6..44f2573905 100644 --- a/integration_tests/tests/features/epoch_change.feature +++ b/integration_tests/tests/features/epoch_change.feature @@ -38,7 +38,7 @@ Feature: Epoch change When Block height on VN VAL is at least 6 When miner MINER mines 7 new blocks - Then VAL has scanned to height 40 + Then VAL has scanned to at least height 40 Then the validator node VAL has started epoch 4 # @serial @@ -79,7 +79,7 @@ Feature: Epoch change # # # Mine them into registered epoch # When miner MINER mines 10 new blocks -# Then VAL_1 has scanned to height 21 +# Then VAL_1 has scanned to at least height 21 # Then the validator node VAL_1 is listed as registered # Then the validator node VAL_2 is listed as registered # Then the validator node VAL_3 is listed as registered diff --git a/integration_tests/tests/features/eviction.feature b/integration_tests/tests/features/eviction.feature index e36c4be945..3fe2e5e811 100644 --- a/integration_tests/tests/features/eviction.feature +++ b/integration_tests/tests/features/eviction.feature @@ -33,7 +33,7 @@ Feature: Eviction scenarios When miner MINER mines 26 new blocks Then all validators have scanned to height 32 - And indexer IDX has scanned to height 32 + And indexer IDX has scanned to at least height 32 Then all validator nodes are listed as registered When indexer IDX connects to all other validators diff --git a/integration_tests/tests/features/state_sync.feature b/integration_tests/tests/features/state_sync.feature index da73a3760b..5805d0c638 100644 --- a/integration_tests/tests/features/state_sync.feature +++ b/integration_tests/tests/features/state_sync.feature @@ -23,8 +23,8 @@ Feature: State Sync When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET When miner MINER mines 26 new blocks - Then VN has scanned to height 27 - And indexer IDX has scanned to height 27 + Then VN has scanned to at least height 27 + And indexer IDX has scanned to at least height 27 Then the validator node VN is listed as registered When indexer IDX connects to all other validators @@ -44,8 +44,8 @@ Feature: State Sync When validator node VN2 sends a registration transaction to base wallet WALLET When miner MINER mines 23 new blocks - Then VN has scanned to height 50 - Then VN2 has scanned to height 50 + Then VN has scanned to at least height 50 + Then VN2 has scanned to at least height 50 Then the validator node VN2 is listed as registered When I wait for validator VN has leaf block height of at least 1 at epoch 4 diff --git a/integration_tests/tests/features/substates.feature b/integration_tests/tests/features/substates.feature index 82b3d18a67..beb35defd9 100644 --- a/integration_tests/tests/features/substates.feature +++ b/integration_tests/tests/features/substates.feature @@ -24,7 +24,7 @@ Feature: Substates # Register the "counter" template When base wallet WALLET registers the template "counter" When miner MINER mines 23 new blocks - Then VAL_1 has scanned to height 26 + Then VAL_1 has scanned to at least height 26 Then the validator node VAL_1 is listed as registered Then the template "counter" is listed as registered by the validator node VAL_1 diff --git a/integration_tests/tests/features/transfer.feature b/integration_tests/tests/features/transfer.feature index bb929f2809..d8e7deab83 100644 --- a/integration_tests/tests/features/transfer.feature +++ b/integration_tests/tests/features/transfer.feature @@ -6,24 +6,7 @@ Feature: Account transfers Scenario: Transfer tokens to account that does not previously exist - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 4 new blocks - When wallet WALLET has at least 5000 T - When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 26 new blocks - Then the validator node VN is listed as registered - - # Initialize an indexer - Given an indexer IDX connected to base node BASE - - # Initialize the wallet daemon - Given a wallet daemon WALLET_D connected to indexer IDX + Given a network with registered validator VN and wallet daemon WALLET_D # Publish the "fauset" template When I create an account ACC via the wallet daemon WALLET_D with 2000000 free coins @@ -36,14 +19,14 @@ Feature: Account transfers When I call function "mint" on template "faucet" using account ACCOUNT to pay fees via wallet daemon WALLET_D with args "amount_10000" named "FAUCET" # Burn some tari in the base layer to have funds for fees in the sender account - When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACCOUNT, range proof RANGEPROOF and claim public key CLAIM_PUBKEY - When miner MINER mines 13 new blocks - Then VN has scanned to height 40 - Then indexer IDX has scanned to height 40 + When I burn 10T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D + When miner NETWORK_MINER mines 13 new blocks + Then VN has scanned to at least height 40 + Then indexer NETWORK_INDEXER has scanned to at least height 40 - When I convert commitment COMMITMENT into COMM_ADDRESS address + When I convert commitment in proof BURN_PROOF into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACCOUNT via the wallet daemon WALLET_D + When I claim burn BURN_PROOF and spend it into account ACCOUNT using wallet daemon WALLET_D # Wait for the wallet daemon account monitor to update the sender account information @@ -79,25 +62,9 @@ Feature: Account transfers ``` When I print the cucumber world + @doit Scenario: Transfer tokens to existing account - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 4 new blocks - When wallet WALLET has at least 5000 T - When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 26 new blocks - Then the validator node VN is listed as registered - - # Initialize an indexer - Given an indexer IDX connected to base node BASE - - # Initialize different wallet daemons to simulate different users - Given a wallet daemon WALLET_D connected to indexer IDX + Given a network with registered validator VN and wallet daemon WALLET_D # Publish the "fauset" template When I create an account ACC via the wallet daemon WALLET_D with 2000000 free coins @@ -111,14 +78,14 @@ Feature: Account transfers When I call function "mint" on template "faucet" using account ACCOUNT_1 to pay fees via wallet daemon WALLET_D with args "amount_10000" named "FAUCET" # Burn some tari in the base layer to have funds for fees in the sender account - When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACCOUNT_1, range proof RANGEPROOF and claim public key CLAIM_PUBKEY + When I burn 10T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D When miner MINER mines 13 new blocks - Then VN has scanned to height 40 - Then indexer IDX has scanned to height 40 + Then VN has scanned to at least height 40 + Then indexer IDX has scanned to at least height 40 - When I convert commitment COMMITMENT into COMM_ADDRESS address + When I convert commitment in proof BURN_PROOF into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACCOUNT_1 via the wallet daemon WALLET_D + When I claim burn BURN_PROOF and spend it into account ACCOUNT_1 using wallet daemon WALLET_D # Wait for the wallet daemon account monitor to update the sender account information @@ -148,28 +115,12 @@ Feature: Account transfers ``` When I print the cucumber world + @doit Scenario: Confidential transfer to account that does not previously exist - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 4 new blocks - When wallet WALLET has at least 5000 T - When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 26 new blocks - Then the validator node VN is listed as registered - - # Initialize an indexer - Given an indexer IDX connected to base node BASE - - # Initialize the wallet daemon - Given a wallet daemon WALLET_D connected to indexer IDX - - Then VN has scanned to height 27 - Then indexer IDX has scanned to height 27 + Given a network with registered validator VN and wallet daemon WALLET_D + + Then VN has scanned to at least height 27 + Then indexer NETWORK_INDEXER has scanned to at least height 27 # Create the sender account When I create an account ACC_1 via the wallet daemon WALLET_D with 10000 free coins diff --git a/integration_tests/tests/features/wallet_daemon.feature b/integration_tests/tests/features/wallet_daemon.feature index 5cf0aa9c9f..7aea616f38 100644 --- a/integration_tests/tests/features/wallet_daemon.feature +++ b/integration_tests/tests/features/wallet_daemon.feature @@ -21,7 +21,7 @@ Feature: Wallet Daemon # VN registration When validator node VAL_1 sends a registration transaction to base wallet WALLET When miner MINER mines 26 new blocks - Then VAL_1 has scanned to height 27 + Then VAL_1 has scanned to at least height 27 Then the validator node VAL_1 is listed as registered # Initialize an indexer @@ -104,17 +104,17 @@ Feature: Wallet Daemon When I create an account ACCOUNT_1 via the wallet daemon WALLET_D with 10000 free coins When I create an account ACCOUNT_2 via the wallet daemon WALLET_D - When I burn 1000T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACCOUNT_1, range proof RANGEPROOF and claim public key CLAIM_PUBKEY + When I burn 1000T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D # unfortunately have to wait for this to get into the mempool.... Then there is 1 transaction in the mempool of BASE within 10 seconds When miner MINER mines 13 new blocks - Then VN has scanned to height 40 + Then VN has scanned to at least height 40 - When I convert commitment COMMITMENT into COMM_ADDRESS address + When I convert commitment in proof BURN_PROOF into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds - When I claim burn COMMITMENT with PROOF, RANGEPROOF and CLAIM_PUBKEY and spend it into account ACCOUNT_1 via the wallet daemon WALLET_D + When I claim burn BURN_PROOF and spend it into account ACCOUNT_1 using wallet daemon WALLET_D When I print the cucumber world # TODO: remove the wait When I wait 5 seconds diff --git a/integration_tests/tests/log4rs/cucumber.yml b/integration_tests/tests/log4rs/cucumber.yml index f47df724b2..b5f80b941d 100644 --- a/integration_tests/tests/log4rs/cucumber.yml +++ b/integration_tests/tests/log4rs/cucumber.yml @@ -12,6 +12,22 @@ refresh_rate: 30 seconds appenders: + cucumber: + kind: rolling_file + path: "{{log_dir}}/cucumber.log" + policy: + kind: compound + trigger: + kind: size + limit: 100mb + roller: + kind: fixed_window + base: 1 + count: 10 + pattern: "{{log_dir}}/ootle.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S)} [{t}] {l:5} {m}// {f}:{L}{n}" + # An appender named "ootle" that writes to a file with a custom pattern encoder ootle: kind: rolling_file @@ -122,6 +138,7 @@ loggers: cucumber: level: debug appenders: + - cucumber - ootle additive: false diff --git a/integration_tests/tests/steps/common.rs b/integration_tests/tests/steps/common.rs index 2f2711669b..9791ecc06c 100644 --- a/integration_tests/tests/steps/common.rs +++ b/integration_tests/tests/steps/common.rs @@ -2,16 +2,21 @@ // SPDX-License-Identifier: BSD-3-Clause use cucumber::when; -use tari_crypto::tari_utilities::hex::Hex; +use integration_tests::util::cucumber_log; +use tari_template_lib::models::UnclaimedConfidentialOutputAddress; use crate::TariWorld; -#[when(expr = "I convert commitment {word} into {word} address")] -async fn when_i_convert_commitment_into_address(world: &mut TariWorld, commitment_name: String, new_name: String) { - let commitment = world - .commitments - .get(&commitment_name) - .unwrap_or_else(|| panic!("Commitment {} not found", commitment_name)); - let address = format!("commitment_{}", commitment.to_hex()); - world.addresses.insert(new_name, address); +#[when(expr = "I convert commitment in proof {word} into {word} address")] +async fn when_i_convert_commitment_into_address(world: &mut TariWorld, proof_name: String, new_name: String) { + let proof = world + .claim_proofs + .get(&proof_name) + .unwrap_or_else(|| panic!("BurnProof {} not found", proof_name)); + let address = UnclaimedConfidentialOutputAddress::from_commitment(&proof.claim_proof.commitment); + cucumber_log(format!( + "Converted commitment {} into address: {}", + proof.claim_proof.commitment, address + )); + world.substate_ids.insert(new_name, address.into()); } diff --git a/integration_tests/tests/steps/indexer.rs b/integration_tests/tests/steps/indexer.rs index 7e4f3c1a41..95dd9b6411 100644 --- a/integration_tests/tests/steps/indexer.rs +++ b/integration_tests/tests/steps/indexer.rs @@ -25,7 +25,7 @@ async fn given_validator_connects_to_other_vns(world: &mut TariWorld, name: Stri .map(|vn| { ( vn.public_key, - Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.port)).unwrap(), + Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.p2p_port)).unwrap(), ) }); @@ -46,26 +46,18 @@ async fn given_validator_connects_to_other_vns(world: &mut TariWorld, name: Stri } } -#[then(expr = "indexer {word} has scanned to height {int}")] -async fn indexer_has_scanned_to_height(world: &mut TariWorld, name: String, block_height: u64) { +#[then(expr = "indexer {word} has scanned to at least height {int}")] +pub async fn indexer_has_scanned_to_at_least_height(world: &mut TariWorld, name: String, block_height: u64) { let indexer = world.get_indexer(&name); let mut client = indexer.get_jrpc_indexer_client(); let mut last_block_height = 0; let mut remaining = 10; loop { let stats = client.get_epoch_manager_stats().await.expect("Failed to get stats"); - if stats.current_block_height == block_height { + if stats.current_block_height >= block_height { return; } - assert!( - stats.current_block_height <= block_height, - "Indexer {} has scanned past block height {} to height {}", - name, - block_height, - stats.current_block_height - ); - if stats.current_block_height != last_block_height { last_block_height = stats.current_block_height; // Reset the timer each time the scanned height changes diff --git a/integration_tests/tests/steps/network.rs b/integration_tests/tests/steps/network.rs index f1f3247174..84e92c0958 100644 --- a/integration_tests/tests/steps/network.rs +++ b/integration_tests/tests/steps/network.rs @@ -6,33 +6,39 @@ use integration_tests::{ base_node::spawn_base_node, indexer::spawn_indexer, miner::register_miner_process, + util::cucumber_log, validator_node::spawn_validator_node, wallet::spawn_wallet, wallet_daemon::spawn_wallet_daemon, }; use crate::{ - steps::{miner, validator_node, wallet}, + steps::{indexer, miner, validator_node, wallet}, TariWorld, }; #[given(expr = "a network with registered validator {word} and wallet daemon {word}")] async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: String) { - const BASE_NODE_NAME: &str = "BASE_NODE"; - const WALLET_NAME: &str = "CONSOLE_WALLET"; - const MINER_NAME: &str = "MINER"; - const INDEXER_NAME: &str = "INDEXER"; + const BASE_NODE_NAME: &str = "NETWORK_BASE_NODE"; + const CONSOLE_WALLET_NAME: &str = "NETWORK_CONSOLE_WALLET"; + const MINER_NAME: &str = "NETWORK_MINER"; + const INDEXER_NAME: &str = "NETWORK_INDEXER"; spawn_base_node(world, BASE_NODE_NAME.to_string()).await; - spawn_wallet(world, WALLET_NAME.to_string(), BASE_NODE_NAME.to_string()).await; + cucumber_log("Base node started"); + spawn_wallet(world, CONSOLE_WALLET_NAME.to_string(), BASE_NODE_NAME.to_string()).await; + cucumber_log("Console wallet started"); register_miner_process( world, MINER_NAME.to_string(), BASE_NODE_NAME.to_string(), - WALLET_NAME.to_string(), + CONSOLE_WALLET_NAME.to_string(), ); + cucumber_log("Miner started"); spawn_indexer(world, INDEXER_NAME.to_string(), BASE_NODE_NAME.to_string()).await; + cucumber_log("Indexer started"); spawn_wallet_daemon(world, walletd_name.clone(), INDEXER_NAME.to_string()).await; + cucumber_log("Wallet daemon started"); let vn = spawn_validator_node( world, vn_name.clone(), @@ -41,11 +47,26 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S format!("{}_claim_fee", vn_name), ) .await; + cucumber_log("Validator node started"); + + world + .get_indexer(INDEXER_NAME) + .add_peer(vn.public_key, vn.p2p_port) + .await; world.validator_nodes.insert(vn_name.clone(), vn); miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 10).await; - wallet::check_balance(world, WALLET_NAME.to_string(), 20, "T".to_string()).await; - validator_node::send_vn_registration_with_claim_wallet(world, vn_name.clone(), WALLET_NAME.to_string()).await; - miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 26).await; - validator_node::assert_vn_is_registered(world, vn_name).await; + cucumber_log("Mined 10 blocks"); + wallet::check_balance(world, CONSOLE_WALLET_NAME.to_string(), 20, "T".to_string()).await; + cucumber_log("Console wallet has balance"); + validator_node::send_vn_registration(world, vn_name.clone(), CONSOLE_WALLET_NAME.to_string()).await; + cucumber_log("Validator node sent registration"); + miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 20).await; + cucumber_log("Mined 26 blocks"); + indexer::indexer_has_scanned_to_at_least_height(world, INDEXER_NAME.to_string(), 20).await; + cucumber_log("Indexer has scanned up to or past height 26"); + validator_node::assert_vn_is_registered(world, vn_name.clone()).await; + cucumber_log("Validator node is registered"); + world.get_validator_node(&vn_name).wait_for_consensus_to_start().await; + cucumber_log("Validator node consensus started"); } diff --git a/integration_tests/tests/steps/validator_node.rs b/integration_tests/tests/steps/validator_node.rs index 1e69cc9342..b714d24f0f 100644 --- a/integration_tests/tests/steps/validator_node.rs +++ b/integration_tests/tests/steps/validator_node.rs @@ -12,6 +12,7 @@ use integration_tests::{ base_node::get_base_node_client, template, template::{send_template_registration, RegisteredTemplate}, + util::cucumber_log, validator_node::spawn_validator_node, validator_node_cli::create_key, TariWorld, @@ -22,8 +23,12 @@ use minotari_app_grpc::tari_rpc::{RegisterValidatorNodeRequest, Signature}; use notify::Watcher; use tari_base_node_client::{grpc::GrpcBaseNodeClient, BaseNodeClient}; use tari_crypto::tari_utilities::ByteArray; -use tari_engine_types::substate::SubstateId; -use tari_ootle_common_types::{layer_one_transaction::LayerOneTransactionDef, Epoch, SubstateAddress}; +use tari_ootle_common_types::{ + layer_one_transaction::LayerOneTransactionDef, + optional::Optional, + Epoch, + SubstateAddress, +}; use tari_sidechain::EvictionProof; use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; use tari_validator_node_client::types::{ @@ -137,7 +142,7 @@ async fn given_validator_connects_to_other_vns(world: &mut TariWorld, name: Stri .map(|vn| { ( vn.public_key, - Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.port)).unwrap(), + Multiaddr::from_str(&format!("/ip4/127.0.0.1/tcp/{}", vn.p2p_port)).unwrap(), ) }) .collect::>(); @@ -161,7 +166,7 @@ async fn given_validator_connects_to_other_vns(world: &mut TariWorld, name: Stri } #[when(expr = "validator node {word} sends a registration transaction to base wallet {word}")] -pub async fn send_vn_registration_with_claim_wallet(world: &mut TariWorld, vn_name: String, base_wallet_name: String) { +pub async fn send_vn_registration(world: &mut TariWorld, vn_name: String, base_wallet_name: String) { let vn = world.get_validator_node(&vn_name); let mut base_layer_wallet = world.get_wallet(&base_wallet_name).create_client().await; @@ -195,6 +200,10 @@ pub async fn send_vn_registration_with_claim_wallet(world: &mut TariWorld, vn_na "Failed to register validator node {}", response.failure_message ); + cucumber_log(format!( + "Validator node registration tx id: {}", + response.transaction_id + )); world.mark_point_in_logs("after register_validator_node"); } @@ -281,7 +290,7 @@ pub async fn assert_vn_is_registered(world: &mut TariWorld, vn_name: String) { // get the list of registered vns from the base node let height = base_node_client.get_tip_info().await.unwrap().height_of_longest_chain; let vns = base_node_client.get_validator_nodes(height).await.unwrap(); - assert!(!vns.is_empty()); + assert!(!vns.is_empty(), "vns are empty at height {}", height); // retrieve the VN's public key let mut client = vn.get_client(); @@ -298,7 +307,10 @@ pub async fn assert_vn_is_registered(world: &mut TariWorld, vn_name: String) { break; } if count > 20 { - panic!("Timed out waiting for validator node to pick up registration"); + panic!( + "Timed out waiting for validator node to pick up registration (current block height: {})", + stats.current_block_height + ); } count += 1; tokio::time::sleep(Duration::from_secs(1)).await; @@ -376,13 +388,13 @@ async fn then_validator_node_has_state_at( timeout_secs: u64, ) { let state_address = world - .addresses + .substate_ids .get(&state_address_name) .unwrap_or_else(|| panic!("Address {} not found", state_address_name)); + cucumber_log(format!("Waiting for state at address {}", state_address)); let vn = world.get_validator_node(&vn_name); let mut client = vn.create_client(); - let substate_address = - SubstateAddress::from_substate_id(&SubstateId::from_str(state_address).expect("Invalid state address"), 0); + let substate_address = SubstateAddress::from_substate_id(state_address, 0); let mut attempts = 0; loop { match client @@ -390,13 +402,14 @@ async fn then_validator_node_has_state_at( address: substate_address, }) .await + .optional() + .unwrap() { - Ok(_) => return, - Err(e) => { + Some(_) => return, + None => { attempts += 1; if attempts == timeout_secs { - println!("Failed to get state: {}", e); - panic!("Failed to get state: {}", e); + panic!("State at address {} not found", state_address); } }, } @@ -422,7 +435,7 @@ async fn vn_has_scanned_to_epoch(world: &mut TariWorld, vn_name: String, epoch: assert_eq!(stats.current_epoch, epoch); } -#[then(expr = "{word} has scanned to height {int}")] +#[then(expr = "{word} has scanned to at least height {int}")] async fn vn_has_scanned_to_height(world: &mut TariWorld, vn_name: String, block_height: u64) { let vn = world.get_validator_node(&vn_name); let mut client = vn.create_client(); @@ -430,16 +443,9 @@ async fn vn_has_scanned_to_height(world: &mut TariWorld, vn_name: String, block_ let mut remaining = 10; loop { let stats = client.get_epoch_manager_stats().await.expect("Failed to get stats"); - if stats.current_block_height == block_height { + if stats.current_block_height >= block_height { return; } - assert!( - stats.current_block_height <= block_height, - "Validator {} has scanned past the target height {}. Current height: {}", - vn_name, - block_height, - stats.current_block_height - ); if stats.current_block_height != last_block_height { last_block_height = stats.current_block_height; diff --git a/integration_tests/tests/steps/wallet.rs b/integration_tests/tests/steps/wallet.rs index 700dd152c5..a7cce995a9 100644 --- a/integration_tests/tests/steps/wallet.rs +++ b/integration_tests/tests/steps/wallet.rs @@ -5,13 +5,16 @@ use std::time::Duration; use cucumber::{given, then, when}; use minotari_app_grpc::tari_rpc::{GetBalanceRequest, SubmitValidatorEvictionProofRequest, ValidateRequest}; -use tari_common_types::types::PrivateKey; -use tari_crypto::{ - ristretto::{pedersen::PedersenCommitment, RistrettoComSig, RistrettoPublicKey}, - tari_utilities::ByteArray, +use tari_ootle_wallet_sdk::apis::key_manager::KeyBranch; +use tari_template_lib::{ + prelude::{PedersenCommitmentBytes, RistrettoPublicKeyBytes, Scalar32Bytes}, + types::crypto::{CommitmentSignatureBytes, RangeProofBytes}, }; -use tari_template_lib::prelude::PedersenCommitmentBytes; -use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; +use tari_transaction_components::{ + tari_amount::T, + transaction_components::{memo_field::TxType, MemoField}, +}; +use tari_wallet_daemon_client::types::{ClaimBurnProof, ExtClaimBurnProof}; use tokio::time::sleep; use crate::{spawn_wallet, TariWorld}; @@ -21,39 +24,32 @@ async fn start_wallet(world: &mut TariWorld, wallet_name: String, bn_name: Strin spawn_wallet(world, wallet_name, bn_name).await; } -#[when( - expr = "I burn {int}T on wallet {word} into commitment {word} with proof {word} for {word}, range proof {word} \ - and claim public key {word}" -)] +#[when(expr = "I burn {int}T on wallet {word} to proof {word} for wallet daemon {word}")] async fn when_i_burn_on_wallet( world: &mut TariWorld, amount: u64, wallet_name: String, - commitment_name: String, - proof: String, - account_name: String, - range_proof: String, - claim_public_key_name: String, + proof_name: String, + walletd_name: String, ) { let wallet = world .wallets .get(&wallet_name) .unwrap_or_else(|| panic!("Wallet {} not found", wallet_name)); - let public_key = world - .account_keys - .get(&account_name) - .unwrap_or_else(|| panic!("Account {} not found", account_name)); + let walletd = world.get_wallet_daemon(&walletd_name); + let mut client = walletd.get_authed_client().await; + let nonce = client.create_key(KeyBranch::Nonce).await.unwrap(); let mut client = wallet.create_client().await; let resp = client .create_burn_transaction(minotari_app_grpc::tari_rpc::CreateBurnTransactionRequest { - amount: amount * 1_000_000, + amount: (amount * T).as_u64(), fee_per_gram: 1, payment_id: MemoField::new_open("Burn".as_bytes().to_vec(), TxType::Burn) .unwrap() .to_bytes(), - claim_public_key: public_key.to_vec(), + claim_public_key: nonce.public_key.as_bytes().to_vec(), sidechain_deployment_key: vec![], }) .await @@ -61,26 +57,21 @@ async fn when_i_burn_on_wallet( .into_inner(); assert!(resp.is_success); - world.commitments.insert( - commitment_name, - PedersenCommitmentBytes::try_from(resp.commitment.as_slice()).unwrap(), - ); let ownership_proof = resp.ownership_proof.unwrap(); - world.commitment_ownership_proofs.insert( - proof, - RistrettoComSig::new( - PedersenCommitment::from_public_key( - &RistrettoPublicKey::from_canonical_bytes(&ownership_proof.public_nonce).unwrap(), + world.claim_proofs.insert(proof_name, ExtClaimBurnProof { + claim_proof: ClaimBurnProof { + reciprocal_claim_public_key: RistrettoPublicKeyBytes::from_bytes(&resp.reciprocal_claim_public_key) + .unwrap(), + commitment: PedersenCommitmentBytes::from_bytes(&resp.commitment).unwrap(), + ownership_proof: CommitmentSignatureBytes::new( + PedersenCommitmentBytes::from_bytes(&ownership_proof.public_nonce).unwrap(), + Scalar32Bytes::from_bytes(&ownership_proof.u).unwrap(), + Scalar32Bytes::from_bytes(&ownership_proof.v).unwrap(), ), - PrivateKey::from_canonical_bytes(&ownership_proof.u).unwrap(), - PrivateKey::from_canonical_bytes(&ownership_proof.v).unwrap(), - ), - ); - world.rangeproofs.insert(range_proof, resp.range_proof); - world.claim_public_keys.insert( - claim_public_key_name, - RistrettoPublicKey::from_canonical_bytes(&resp.reciprocal_claim_public_key).unwrap(), - ); + range_proof: RangeProofBytes::try_from(resp.range_proof).unwrap(), + }, + owner_nonce_key_index: nonce.id, + }); } #[when(expr = "wallet {word} has at least {int} {word}")] @@ -113,9 +104,9 @@ pub async fn check_balance(world: &mut TariWorld, wallet_name: String, balance: "Waiting for wallet {} to have at least {} uT (balance: {} uT, pending: {} uT)", wallet_name, balance, resp.available_balance, resp.pending_incoming_balance ); - sleep(Duration::from_secs(1)).await; + sleep(Duration::from_secs(2)).await; - if iterations == MAX_WAIT_TIME_SECS { + if iterations == MAX_WAIT_TIME_SECS.div_ceil(2) { panic!( "Wallet {} did not have at least {} uT after {} seconds (balance: {} uT, pending: {} uT)", wallet_name, balance, MAX_WAIT_TIME_SECS, resp.available_balance, resp.pending_incoming_balance diff --git a/integration_tests/tests/steps/wallet_daemon.rs b/integration_tests/tests/steps/wallet_daemon.rs index 7454777fe6..de267e7b18 100644 --- a/integration_tests/tests/steps/wallet_daemon.rs +++ b/integration_tests/tests/steps/wallet_daemon.rs @@ -3,109 +3,70 @@ use std::time::Duration; +use anyhow::Context; use cucumber::{then, when}; -use integration_tests::{wallet_daemon_cli, TariWorld}; -use log::info; -use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; +use integration_tests::{util::cucumber_log, wallet_daemon_cli, TariWorld}; +use tari_engine_types::commit_result::FinalizeResult; use tari_ootle_wallet_sdk::apis::key_manager::KeyBranch; -use tari_template_lib::prelude::Amount; +use tari_template_lib::prelude::{crypto::CommitmentSignatureBytes, Amount, PedersenCommitmentBytes, Scalar32Bytes}; use tari_transaction_components::transaction_components::{memo_field::TxType, MemoField}; -use tari_wallet_daemon_client::ComponentAddressOrName; +use tari_wallet_daemon_client::{ + types::{ClaimBurnProof, ExtClaimBurnProof}, + ComponentAddressOrName, +}; -#[when( - expr = "I claim burn {word} with {word}, {word} and {word} and spend it into account {word} via the wallet daemon \ - {word}" -)] -async fn when_i_claim_burn_via_wallet_daemon( +async fn claim_burn( world: &mut TariWorld, - commitment_name: String, proof_name: String, - rangeproof_name: String, - claim_pubkey_name: String, account_name: String, wallet_daemon_name: String, -) { - // First create the account with this name - wallet_daemon_cli::create_account(world, account_name.clone(), wallet_daemon_name.clone()).await; - let commitment = world - .commitments - .get(&commitment_name) - .unwrap_or_else(|| panic!("Commitment {} not found", commitment_name)); - let proof = world - .commitment_ownership_proofs +) -> anyhow::Result { + let claim_proof = world + .claim_proofs .get(&proof_name) - .unwrap_or_else(|| panic!("Proof {} not found", proof_name)); - let rangeproof = world - .rangeproofs - .get(&rangeproof_name) - .unwrap_or_else(|| panic!("Rangeproof {} not found", rangeproof_name)); - let reciprocal_claim_public_key = world - .claim_public_keys - .get(&claim_pubkey_name) - .unwrap_or_else(|| panic!("Claim public key {} not found", claim_pubkey_name)); + .unwrap_or_else(|| panic!("Burn proof {} not found", proof_name)); + let walletd = world.get_wallet_daemon(&wallet_daemon_name); // Then burn into the new account - let claim_burn_resp = wallet_daemon_cli::claim_burn( - world, - account_name, - *commitment, - rangeproof.clone().try_into().unwrap(), - proof.clone(), - reciprocal_claim_public_key.clone(), - wallet_daemon_name, - 5000, - ) - .await - .unwrap(); - if let Some(ref reason) = claim_burn_resp.result.result.fee_reject() { + let claim_burn_resp = walletd.claim_burn(&account_name, claim_proof.clone()).await?; + let resp = walletd + .wait_for_transaction_result(claim_burn_resp.transaction_id) + .await; + assert!(!resp.timed_out, "Timed out waiting for claim burn transaction result"); + Ok(resp.result.expect("transaction result is None when claiming burn")) +} + +#[when(expr = "I claim burn {word} and spend it into account {word} using wallet daemon {word}")] +#[then(expr = "I claim burn {word} and spend it into account {word} using wallet daemon {word}")] +async fn when_i_claim_burn_via_wallet_daemon( + world: &mut TariWorld, + proof_name: String, + account_name: String, + wallet_daemon_name: String, +) { + let result = claim_burn(world, proof_name, account_name, wallet_daemon_name) + .await + .unwrap(); + if let Some(ref reason) = result.any_reject() { panic!("Transaction failed: {}", reason); } } -#[when( - expr = "I claim burn {word} with {word}, {word} and {word} and spend it into account {word} via the wallet daemon \ - {word}, it fails" -)] +#[when(expr = "I claim burn {word} and spend it into account {word} using wallet daemon {word}, it fails")] async fn when_i_claim_burn_via_wallet_daemon_it_fails( world: &mut TariWorld, - commitment_name: String, proof_name: String, - rangeproof_name: String, - claim_pubkey_name: String, account_name: String, wallet_daemon_name: String, ) { - let commitment = world - .commitments - .get(&commitment_name) - .unwrap_or_else(|| panic!("Commitment {} not found", commitment_name)); - let proof = world - .commitment_ownership_proofs - .get(&proof_name) - .unwrap_or_else(|| panic!("Proof {} not found", proof_name)); - let rangeproof = world - .rangeproofs - .get(&rangeproof_name) - .unwrap_or_else(|| panic!("Rangeproof {} not found", rangeproof_name)); - let reciprocal_claim_public_key = world - .claim_public_keys - .get(&claim_pubkey_name) - .unwrap_or_else(|| panic!("Claim public key {} not found", claim_pubkey_name)); - - // TODO: The walletd picks up the substate that doesnt exist before the transaction is submitted. This doesnt test - // the validator node behaviour. We should submit the transaction directly without using the wallet's claim burn - // implementation - let _err = wallet_daemon_cli::claim_burn( - world, - account_name, - *commitment, - rangeproof.clone().try_into().unwrap(), - proof.clone(), - reciprocal_claim_public_key.clone(), - wallet_daemon_name, - 5000, - ) - .await - .unwrap_err(); + let _result = claim_burn(world, proof_name, account_name, wallet_daemon_name) + .await + .unwrap_err(); + + // TODO: the wallet/indexer cannot find the substate before we submit the transaction, so this doesnt test the VN + // behaviour. assert!( + // result.any_reject().is_some(), + // "Expected transaction to fail, but it succeeded" + // ); } #[when(expr = "I claim fees for validator {word} into account {word} using the wallet daemon {word}")] @@ -120,7 +81,7 @@ async fn when_i_claim_fees_for_validator_and_epoch( .unwrap(); resp.result.result.any_accept().unwrap_or_else(|| { panic!( - "Expected fee claim to succeeded but failed with {}", + "Expected fee claim to succeed but failed with {}", resp.result.result.fee_reject().unwrap() ) }); @@ -213,30 +174,20 @@ async fn when_i_create_account_via_wallet_daemon_with_free_coins_using_key( .await; } -#[when( - expr = "I burn {int}T on wallet {word} with wallet daemon {word} into commitment {word} with proof {word} for \ - {word}, range proof {word} and claim public key {word}" -)] +#[when(expr = "I burn {int}T on wallet {word} for wallet daemon {word} into proof {word}")] async fn when_i_burn_funds_with_wallet_daemon( world: &mut TariWorld, amount: u64, wallet_name: String, wallet_daemon_name: String, - commitment_name: String, - ownership_proof_name: String, - account_name: String, - rangeproof_name: String, - claim_pubkey_name: String, + proof_name: String, ) { let mut wallet_daemon_client = wallet_daemon_cli::get_auth_wallet_daemon_client(world, &wallet_daemon_name).await; - let account = wallet_daemon_client - .accounts_get(account_name.parse().unwrap()) - .await - .unwrap(); - let public_key = account.public_key; - eprintln!("Burning funds using claim key {public_key}"); - info!("Burning funds using claim key {public_key}"); + let nonce = wallet_daemon_client.create_key(KeyBranch::Nonce).await.unwrap(); + + let public_key = nonce.public_key; + cucumber_log("Burning funds using claim key {public_key}"); let wallet = world .wallets @@ -256,21 +207,30 @@ async fn when_i_burn_funds_with_wallet_daemon( .unwrap() .into_inner(); - assert!(resp.is_success); - world - .commitments - .insert(commitment_name, resp.commitment.as_slice().try_into().unwrap()); - - let ownership_proof = resp.ownership_proof.unwrap(); - world - .commitment_ownership_proofs - .insert(ownership_proof_name, ownership_proof.try_into().unwrap()); - world.rangeproofs.insert(rangeproof_name, resp.range_proof); - - world.claim_public_keys.insert( - claim_pubkey_name, - RistrettoPublicKey::from_canonical_bytes(&resp.reciprocal_claim_public_key).unwrap(), + assert!(resp.is_success, "Burn transaction failed: {}", resp.failure_message); + + let ownership_proof = resp.ownership_proof.as_ref().unwrap(); + let ownership_proof = CommitmentSignatureBytes::new( + PedersenCommitmentBytes::from_bytes(&ownership_proof.public_nonce) + .context("comsig public_nonce parse error") + .unwrap(), + Scalar32Bytes::from_bytes(&ownership_proof.u) + .context("comsig u parse error") + .unwrap(), + Scalar32Bytes::from_bytes(&ownership_proof.v) + .context("comsig v parse error") + .unwrap(), ); + + world.claim_proofs.insert(proof_name, ExtClaimBurnProof { + claim_proof: ClaimBurnProof { + reciprocal_claim_public_key: resp.reciprocal_claim_public_key.as_slice().try_into().unwrap(), + commitment: resp.commitment.as_slice().try_into().unwrap(), + ownership_proof, + range_proof: resp.range_proof.try_into().unwrap(), + }, + owner_nonce_key_index: nonce.id, + }); } #[when(regex = r"I check the balance of (\S+) on wallet daemon (\S+) the amount is (at )?(\S+) (\d+)")] @@ -309,6 +269,7 @@ async fn check_account_balance_via_daemon( } #[when(expr = "I wait for {word} on wallet daemon {word} to have balance {word} {int}")] +#[then(expr = "I wait for {word} on wallet daemon {word} to have balance {word} {int}")] async fn wait_account_balance_via_daemon( world: &mut TariWorld, account_name: String, @@ -334,7 +295,7 @@ async fn wait_account_balance_via_daemon( } i += 1; - if i == 10 { + if i == 30 { panic!("Timeout waiting for balance. Current balance = {}", current_balance); } tokio::time::sleep(Duration::from_secs(1)).await; From 716a3c3867a080978648d4552464cc2b45387d24 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Mon, 1 Sep 2025 17:23:13 +0400 Subject: [PATCH 3/4] machete --- .gitignore | 1 + Cargo.lock | 3 --- applications/tari_walletd/Cargo.toml | 1 - crates/epoch_oracles/Cargo.toml | 2 -- crates/wallet/sdk/Cargo.toml | 1 - cucumber-output-junit.xml | 1 - 6 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 cucumber-output-junit.xml diff --git a/.gitignore b/.gitignore index 314f9887f1..41c5ca6516 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ clients/validator_node_grpc_client/package-lock.json # moon .moon/cache .moon/docker +./cucumber-output-junit.xml \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 6fccdccb64..9087f3421f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10997,7 +10997,6 @@ version = "0.11.2" dependencies = [ "anyhow", "log", - "minotari_app_grpc", "serde", "tari_base_node_client", "tari_common_types", @@ -11421,7 +11420,6 @@ dependencies = [ "tari_template_lib", "tari_transaction", "tari_transaction_components", - "tari_transaction_key_manager", "tempfile", "thiserror 1.0.69", "time", @@ -11496,7 +11494,6 @@ dependencies = [ "tari_template_lib", "tari_transaction", "tari_transaction_components", - "tari_transaction_key_manager", "tari_transaction_manifest", "tari_utilities", "tari_wallet_daemon_client", diff --git a/applications/tari_walletd/Cargo.toml b/applications/tari_walletd/Cargo.toml index 1dbf1464d1..3b02f7ad07 100644 --- a/applications/tari_walletd/Cargo.toml +++ b/applications/tari_walletd/Cargo.toml @@ -27,7 +27,6 @@ tari_template_builtin = { workspace = true } tari_template_lib = { workspace = true } tari_template_abi = { workspace = true } tari_indexer_client = { workspace = true, features = ["client"] } -tari_transaction_key_manager = { workspace = true } tari_transaction_components = { workspace = true } tari_transaction_manifest = { workspace = true } diff --git a/crates/epoch_oracles/Cargo.toml b/crates/epoch_oracles/Cargo.toml index 08da0ef780..e2c400346e 100644 --- a/crates/epoch_oracles/Cargo.toml +++ b/crates/epoch_oracles/Cargo.toml @@ -10,7 +10,6 @@ license.workspace = true tari_base_node_client = { workspace = true, optional = true } tari_common_types = { workspace = true } tari_transaction_components = { workspace = true, optional = true } -minotari_app_grpc = { workspace = true, optional = true } tari_ootle_common_types = { workspace = true } tari_ootle_storage = { workspace = true } tari_ootle_storage_sqlite = { workspace = true } @@ -33,7 +32,6 @@ tokio = { workspace = true, features = ["time", "macros", "rt"] } [features] base_layer = [ "tari_base_node_client", - "minotari_app_grpc", "tari_transaction_components", "url" ] diff --git a/crates/wallet/sdk/Cargo.toml b/crates/wallet/sdk/Cargo.toml index d0ad6af8c2..b89c99a272 100644 --- a/crates/wallet/sdk/Cargo.toml +++ b/crates/wallet/sdk/Cargo.toml @@ -16,7 +16,6 @@ tari_ootle_common_types = { workspace = true } tari_ootle_wallet_crypto = { workspace = true } tari_template_builtin = { workspace = true } tari_consensus_types = { workspace = true } -tari_transaction_key_manager = { workspace = true } tari_transaction_components = { workspace = true } tari_transaction = { workspace = true } tari_template_lib = { workspace = true } diff --git a/cucumber-output-junit.xml b/cucumber-output-junit.xml deleted file mode 100644 index d29d734f5d..0000000000 --- a/cucumber-output-junit.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 3b06c81fc07540a13fe0d368ec5a358f1970f57e Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Mon, 1 Sep 2025 17:51:02 +0400 Subject: [PATCH 4/4] fixes --- README.md | 24 +++++-------------- .../src/process_definitions/mod.rs | 2 +- .../wallet_daemon_create_key.rs | 12 ++++++---- applications/tari_walletd/src/cli.rs | 2 ++ applications/tari_walletd/src/main.rs | 3 ++- .../src/epoch_event_oracle/event.rs | 2 +- .../tests/features/transfer.feature | 4 +--- integration_tests/tests/log4rs/cucumber.yml | 2 +- integration_tests/tests/steps/network.rs | 2 +- 9 files changed, 22 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 5827bfcf03..be62303e9c 100644 --- a/README.md +++ b/README.md @@ -62,17 +62,15 @@ This will start a wallet connected to the Igor Testnet. You can view the public Navigate to http://127.0.0.1:5100 to create an account, claim test tokens and start testing features. -## Running the Ootle Locally (Localnet Development Environment) +## Running a Small Ootle Network Locally (Localnet) NOTE: This repo is heavily under development, so these instructions may change without notice. Confirm you have installed all the prerequisites listed in the **Prerequisites** section (Rust, Node.js, npm, linux dependencies) -### Running - The easiest way to test out the Ootle is to use the `tari_swarm_daemon`. This will spin up all necessary MinoTari and -Ootle components for a localnet. +Ootle applications for a localnet. Clone both the tari and tari-ootle repositories in the same folder: @@ -83,24 +81,14 @@ git clone https://github.com/tari-project/tari.git git clone https://github.com/tari-project/tari-ootle.git ootle ``` -So: - -| tari -| ootle - -`cd` into `tari` and change the branch `v5.0.0-pre.8`: - ```shell cd tari -git fetch origin tag v5.0.0-pre.8 -git checkout v5.0.0-pre.8 -``` - -Once done, change directory to the `ootle` and run the following from the ootle folder: - -```shell +git checkout development +cd ../ootle rustup target add wasm32-unknown-unknown +# Creates an initial "swarm" config in data/swarm/config.toml cargo run --bin tari_swarm_daemon --release -- -c data/swarm/config.toml init +# Build all the necessary binaries (this may take a while) and starts the swarm cargo run --bin tari_swarm_daemon --release -- -c data/swarm/config.toml start ``` diff --git a/applications/tari_swarm_daemon/src/process_definitions/mod.rs b/applications/tari_swarm_daemon/src/process_definitions/mod.rs index a6b9d76c4e..0014fe3d28 100644 --- a/applications/tari_swarm_daemon/src/process_definitions/mod.rs +++ b/applications/tari_swarm_daemon/src/process_definitions/mod.rs @@ -27,6 +27,6 @@ pub fn get_definition(instance_type: InstanceType) -> Box Box::new(wallet_daemon::WalletDaemon::new()), InstanceType::TariIndexer => Box::new(indexer::Indexer::new()), InstanceType::TariSignalingServer => Box::new(signaling_server::SignalingServer::new()), - InstanceType::TariWalletDaemonCreateKey => Box::new(wallet_daemon_create_key::WalletDaemonCreateKey::new()), + InstanceType::TariWalletDaemonCreateKey => Box::new(wallet_daemon_create_key::WalletDaemonCreateAccount::new()), } } diff --git a/applications/tari_swarm_daemon/src/process_definitions/wallet_daemon_create_key.rs b/applications/tari_swarm_daemon/src/process_definitions/wallet_daemon_create_key.rs index 5171815686..1418e72e78 100644 --- a/applications/tari_swarm_daemon/src/process_definitions/wallet_daemon_create_key.rs +++ b/applications/tari_swarm_daemon/src/process_definitions/wallet_daemon_create_key.rs @@ -9,16 +9,16 @@ use tokio::process::Command; use crate::process_definitions::{wallet_daemon, wallet_daemon::WalletDaemon, ProcessContext, ProcessDefinition}; #[derive(Debug, Default)] -pub struct WalletDaemonCreateKey; +pub struct WalletDaemonCreateAccount; -impl WalletDaemonCreateKey { +impl WalletDaemonCreateAccount { pub fn new() -> Self { Self } } #[async_trait] -impl ProcessDefinition for WalletDaemonCreateKey { +impl ProcessDefinition for WalletDaemonCreateAccount { async fn get_command(&self, context: ProcessContext<'_>) -> anyhow::Result { let mut command = Command::new(context.bin()); let output_path = context.processes_path().join("claim_key.json"); @@ -30,14 +30,16 @@ impl ProcessDefinition for WalletDaemonCreateKey { .arg("--network") .arg(context.network().to_string()) .args([ - "create-key", + "create-account", + "--name", + "Fees", "--key", "0", "--set-active", "--output", output_path .to_str() - .expect("Non-UTF8 output path in WalletDaemonCreateKey"), + .expect("Non-UTF8 output path in WalletDaemonCreateAccount"), ]); if let Some(override_keyring_password) = diff --git a/applications/tari_walletd/src/cli.rs b/applications/tari_walletd/src/cli.rs index f54aa9696d..2ea106a73d 100644 --- a/applications/tari_walletd/src/cli.rs +++ b/applications/tari_walletd/src/cli.rs @@ -129,6 +129,8 @@ pub enum Subcommand { Run, #[clap(about = "Generate a new key and output the public key")] CreateAccount { + #[clap(long)] + name: Option, #[clap(long, alias = "key")] key_index: Option, #[clap(long)] diff --git a/applications/tari_walletd/src/main.rs b/applications/tari_walletd/src/main.rs index 4748d3d32b..988c25f3e7 100644 --- a/applications/tari_walletd/src/main.rs +++ b/applications/tari_walletd/src/main.rs @@ -66,6 +66,7 @@ async fn main() -> Result<(), anyhow::Error> { match &cli.command { Some(Subcommand::Run) | None => run(cli, config).await?, Some(Subcommand::CreateAccount { + name, key_index, set_active, output_path, @@ -85,7 +86,7 @@ async fn main() -> Result<(), anyhow::Error> { .accounts_api() .derive_account_address_from_public_key(&public_key.to_byte_type()); sdk.accounts_api() - .add_account(Some("Fee"), &account_addr, secret.key_index, false, true)?; + .add_account(name.as_deref(), &account_addr, secret.key_index, false, true)?; if *set_active { km.set_active_key(KeyBranch::Account, secret.key_index)?; diff --git a/crates/epoch_manager/src/epoch_event_oracle/event.rs b/crates/epoch_manager/src/epoch_event_oracle/event.rs index 9415d168e0..183ce53197 100644 --- a/crates/epoch_manager/src/epoch_event_oracle/event.rs +++ b/crates/epoch_manager/src/epoch_event_oracle/event.rs @@ -3,7 +3,6 @@ use std::fmt::Display; -use anyhow::Context; use tari_common_types::types::FixedHash; use tari_engine_types::confidential::UnclaimedConfidentialOutput; use tari_ootle_common_types::{displayable::Displayable, Epoch, SubstateAddress}; @@ -152,6 +151,7 @@ impl TryFrom for ValidatorNode type Error = anyhow::Error; fn try_from(value: minotari_app_grpc::tari_rpc::ValidatorNodeChange) -> Result { + use anyhow::Context; match value.change { Some(minotari_app_grpc::tari_rpc::validator_node_change::Change::Add(add)) => { let registration = add diff --git a/integration_tests/tests/features/transfer.feature b/integration_tests/tests/features/transfer.feature index d8e7deab83..319c4c2d79 100644 --- a/integration_tests/tests/features/transfer.feature +++ b/integration_tests/tests/features/transfer.feature @@ -62,7 +62,6 @@ Feature: Account transfers ``` When I print the cucumber world - @doit Scenario: Transfer tokens to existing account Given a network with registered validator VN and wallet daemon WALLET_D @@ -79,7 +78,7 @@ Feature: Account transfers # Burn some tari in the base layer to have funds for fees in the sender account When I burn 10T on wallet NETWORK_CONSOLE_WALLET to proof BURN_PROOF for wallet daemon WALLET_D - When miner MINER mines 13 new blocks + When miner NETWORK_MINER mines 13 new blocks Then VN has scanned to at least height 40 Then indexer IDX has scanned to at least height 40 @@ -115,7 +114,6 @@ Feature: Account transfers ``` When I print the cucumber world - @doit Scenario: Confidential transfer to account that does not previously exist Given a network with registered validator VN and wallet daemon WALLET_D diff --git a/integration_tests/tests/log4rs/cucumber.yml b/integration_tests/tests/log4rs/cucumber.yml index b5f80b941d..57a89f0ba5 100644 --- a/integration_tests/tests/log4rs/cucumber.yml +++ b/integration_tests/tests/log4rs/cucumber.yml @@ -24,7 +24,7 @@ appenders: kind: fixed_window base: 1 count: 10 - pattern: "{{log_dir}}/ootle.{}.log" + pattern: "{{log_dir}}/cucumber.{}.log" encoder: pattern: "{d(%Y-%m-%d %H:%M:%S)} [{t}] {l:5} {m}// {f}:{L}{n}" diff --git a/integration_tests/tests/steps/network.rs b/integration_tests/tests/steps/network.rs index 84e92c0958..f1ac2ead57 100644 --- a/integration_tests/tests/steps/network.rs +++ b/integration_tests/tests/steps/network.rs @@ -62,7 +62,7 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S validator_node::send_vn_registration(world, vn_name.clone(), CONSOLE_WALLET_NAME.to_string()).await; cucumber_log("Validator node sent registration"); miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 20).await; - cucumber_log("Mined 26 blocks"); + cucumber_log("Mined 20 blocks"); indexer::indexer_has_scanned_to_at_least_height(world, INDEXER_NAME.to_string(), 20).await; cucumber_log("Indexer has scanned up to or past height 26"); validator_node::assert_vn_is_registered(world, vn_name.clone()).await;