From 5ec2975436f509eecfd9dc5251002db0215db8ff Mon Sep 17 00:00:00 2001 From: Mike the Tike Date: Fri, 10 Dec 2021 15:08:57 +0200 Subject: [PATCH] chore: merge development --- Cargo.lock | 2828 +++++++++++++++-- .../src/conversions/aggregate_body.rs | 3 +- .../src/conversions/com_signature.rs | 2 +- .../tari_app_grpc/src/conversions/mod.rs | 2 +- .../src/conversions/new_block_template.rs | 1 + .../src/conversions/output_features.rs | 3 - .../tari_app_grpc/src/conversions/peer.rs | 2 - .../src/conversions/signature.rs | 2 +- .../src/conversions/transaction.rs | 2 - .../src/conversions/transaction_output.rs | 2 - .../src/conversions/unblinded_output.rs | 2 - .../tari_app_utilities/src/initialization.rs | 16 - .../tari_app_utilities/src/utilities.rs | 1 + applications/tari_base_node/src/main.rs | 7 +- applications/tari_base_node/src/parser.rs | 5 + .../src/automation/commands.rs | 19 +- .../src/automation/error.rs | 10 +- .../src/grpc/wallet_grpc_server.rs | 20 +- .../src/ui/components/send_tab.rs | 2 +- .../src/ui/components/transactions_tab.rs | 2 +- .../src/ui/state/wallet_event_monitor.rs | 5 +- .../tari_console_wallet/src/wallet_modes.rs | 2 +- .../tari_merge_mining_proxy/src/proxy.rs | 21 +- applications/tari_mining_node/src/config.rs | 13 +- .../tari_mining_node/src/difficulty.rs | 2 - applications/tari_mining_node/src/main.rs | 53 +- applications/tari_mining_node/src/miner.rs | 4 +- .../src/stratum/controller.rs | 10 +- .../stratum/stratum_controller/controller.rs | 1 - .../src/stratum/stratum_miner/miner.rs | 6 +- .../tari_stratum_transcoder/src/proxy.rs | 20 +- .../tari_validator_node/src/dan_node.rs | 2 +- .../tari_validator_node/src/p2p/rpc/mod.rs | 2 - .../tari_validator_node/src/p2p/rpc/tests.rs | 52 - base_layer/common_types/src/types/mod.rs | 4 - .../comms_interface/inbound_handlers.rs | 3 +- .../comms_interface/local_interface.rs | 2 +- .../core/src/base_node/proto/response.rs | 3 +- .../core/src/base_node/proto/wallet_rpc.rs | 5 - base_layer/core/src/base_node/rpc/service.rs | 1 + .../states/horizon_state_sync/error.rs | 7 - .../base_node/sync/block_sync/synchronizer.rs | 1 + .../sync/header_sync/synchronizer.rs | 19 +- .../base_node/sync/header_sync/validator.rs | 5 - .../core/src/base_node/sync/rpc/service.rs | 18 +- .../src/base_node/sync/rpc/sync_utxos_task.rs | 8 - .../core/src/blocks/accumulated_data.rs | 13 +- base_layer/core/src/blocks/block.rs | 1 + base_layer/core/src/blocks/block_header.rs | 4 +- base_layer/core/src/blocks/genesis_block.rs | 245 +- base_layer/core/src/chain_storage/async_db.rs | 11 - .../src/chain_storage/blockchain_backend.rs | 4 +- .../src/chain_storage/blockchain_database.rs | 5 +- .../core/src/chain_storage/db_transaction.rs | 6 - .../core/src/chain_storage/lmdb_db/lmdb.rs | 9 +- .../core/src/chain_storage/lmdb_db/lmdb_db.rs | 154 +- .../core/src/chain_storage/lmdb_db/mod.rs | 2 + .../core/src/chain_storage/pruned_output.rs | 2 + .../tests/blockchain_database.rs | 58 +- .../core/src/chain_storage/utxo_mined_info.rs | 2 + .../core/src/consensus/consensus_constants.rs | 1 + base_layer/core/src/mempool/rpc/test.rs | 2 + .../core/src/proof_of_work/monero_rx/error.rs | 2 - .../proof_of_work/monero_rx/fixed_array.rs | 5 +- .../src/proof_of_work/monero_rx/helpers.rs | 10 +- .../proof_of_work/monero_rx/merkle_tree.rs | 7 +- .../src/proof_of_work/monero_rx/pow_data.rs | 15 +- base_layer/core/src/proto/transaction.rs | 1 + .../core/src/test_helpers/blockchain.rs | 9 +- base_layer/core/src/test_helpers/mod.rs | 6 - .../src/transactions/transaction/error.rs | 3 +- .../transaction/full_rewind_result.rs | 6 +- .../core/src/transactions/transaction/mod.rs | 15 +- .../transaction/output_features.rs | 10 +- .../transactions/transaction/rewind_result.rs | 6 +- .../transactions/transaction/transaction.rs | 18 +- .../transaction/transaction_input.rs | 21 +- .../transaction/transaction_kernel.rs | 12 +- .../transaction/transaction_output.rs | 38 +- .../transaction/unblinded_output.rs | 8 +- .../transaction/unblinded_output_builder.rs | 1 + .../transaction_protocol/proto/mod.rs | 2 +- .../transaction_protocol/recipient.rs | 5 +- .../transaction_protocol/sender.rs | 19 +- ..._builder.rs => transaction_initializer.rs} | 31 +- .../block_validators/async_validator.rs | 1 + .../validation/block_validators/body_only.rs | 8 +- .../src/validation/block_validators/test.rs | 2 + base_layer/core/src/validation/helpers.rs | 11 +- base_layer/core/src/validation/test.rs | 1 + base_layer/core/tests/base_node_rpc.rs | 1 + base_layer/core/tests/block_validation.rs | 11 - .../chain_storage_tests/chain_storage.rs | 10 +- .../core/tests/helpers/pow_blockchain.rs | 2 - base_layer/key_manager/Cargo.toml | 2 +- base_layer/key_manager/src/cipher_seed.rs | 28 +- base_layer/key_manager/src/key_manager.rs | 1 + base_layer/key_manager/src/wasm.rs | 22 + base_layer/tari_stratum_ffi/src/lib.rs | 4 +- .../2021-10-13-121212_add_unique_id/up.sql | 1 - .../wallet/src/base_node_service/handle.rs | 4 + .../src/output_manager_service/error.rs | 2 - .../src/output_manager_service/handle.rs | 8 +- .../src/output_manager_service/service.rs | 15 +- .../storage/database/backend.rs | 12 +- .../storage/database/mod.rs | 115 +- .../src/output_manager_service/storage/mod.rs | 2 +- .../output_manager_service/storage/models.rs | 10 +- .../storage/sqlite_db/mod.rs | 39 +- .../storage/sqlite_db/new_output_sql.rs | 15 +- .../storage/sqlite_db/output_sql.rs | 73 +- .../tasks/txo_validation_task.rs | 13 - base_layer/wallet/src/schema.rs | 5 +- base_layer/wallet/src/storage/sqlite_db.rs | 6 - .../wallet/src/transaction_service/error.rs | 6 +- .../wallet/src/transaction_service/handle.rs | 35 +- .../transaction_validation_protocol.rs | 7 +- .../wallet/src/transaction_service/service.rs | 11 +- .../transaction_service/storage/sqlite_db.rs | 2 +- .../tasks/send_finalized_transaction.rs | 27 +- .../wallet/src/utxo_scanner_service/mod.rs | 9 - .../utxo_scanner_service/utxo_scanner_task.rs | 4 +- base_layer/wallet/temp.sqlite | Bin 106496 -> 0 bytes .../tests/output_manager_service/service.rs | 20 +- .../tests/transaction_service/service.rs | 2 +- base_layer/wallet_ffi/src/callback_handler.rs | 3 +- .../wallet_ffi/src/callback_handler_tests.rs | 76 +- base_layer/wallet_ffi/src/lib.rs | 13 +- common/config/presets/base_node.toml | 10 +- common/config/presets/common.toml | 20 +- common/config/presets/console_wallet.toml | 3 +- common/logging/log4rs_sample_mining_node.yml | 17 +- common/src/configuration/base_node_config.rs | 4 +- common/src/configuration/global.rs | 125 +- .../src/configuration/merge_mining_config.rs | 8 +- common/src/configuration/mod.rs | 2 +- common/src/configuration/wallet_config.rs | 4 +- comms/dht/src/storage/connection.rs | 2 - comms/src/peer_manager/peer_query.rs | 1 + dan_layer/core/src/services/mocks/mod.rs | 45 +- .../core/src/workers/consensus_worker.rs | 45 +- dan_layer/core/src/workers/states/prepare.rs | 124 +- rustfmt.toml | 1 - 143 files changed, 3519 insertions(+), 1500 deletions(-) delete mode 100644 applications/tari_validator_node/src/p2p/rpc/tests.rs rename base_layer/core/src/transactions/transaction_protocol/{sender_transaction_protocol_builder.rs => transaction_initializer.rs} (97%) delete mode 100644 base_layer/wallet/temp.sqlite diff --git a/Cargo.lock b/Cargo.lock index cba0dcbdba..6944f5bbad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "aead" version = "0.3.2" @@ -173,12 +179,37 @@ dependencies = [ "nodrop", ] +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "arrayvec" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-io" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +dependencies = [ + "concurrent-queue", + "futures-lite", + "libc", + "log", + "once_cell", + "parking", + "polling", + "slab", + "socket2", + "waker-fn", + "winapi 0.3.9", +] + [[package]] name = "async-stream" version = "0.3.2" @@ -211,6 +242,48 @@ dependencies = [ "syn 1.0.81", ] +[[package]] +name = "atk" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a83b21d2aa75e464db56225e1bda2dd5993311ba1095acaa8fa03d1ae67026ba" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "badcf670157c84bb8b1cf6b5f70b650fed78da2033c9eed84c4e49b11cbe83ea" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "attohttpc" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8bda305457262b339322106c776e3fd21df860018e566eb6a5b1aa4b6ae02d" +dependencies = [ + "flate2", + "http", + "log", + "native-tls", + "openssl", + "serde 1.0.130", + "serde_json", + "serde_urlencoded 0.6.1", + "url 2.2.2", + "wildmatch", +] + [[package]] name = "atty" version = "0.2.14" @@ -357,6 +430,38 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "cc", + "cfg-if 1.0.0", + "constant_time_eq", + "digest 0.9.0", + "rayon", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.7.3" @@ -470,6 +575,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +[[package]] +name = "bytecodec" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf4c9d0bbf32eea58d7c0f812058138ee8edaf0f2802b6d03561b504729a325" +dependencies = [ + "bincode", + "byteorder", + "serde 1.0.130", + "trackable 0.2.24", +] + [[package]] name = "bytemuck" version = "1.7.2" @@ -497,12 +614,63 @@ dependencies = [ "serde 1.0.130", ] +[[package]] +name = "bzip2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "c_linked_list" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "cairo-rs" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b5725979db0c586d98abad2193cdb612dd40ef95cd26bd99851bf93b3cb482" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "glib", + "libc", + "thiserror", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b448b876970834fda82ba3aeaccadbd760206b75388fc5c1b02f1e343b697570" +dependencies = [ + "glib-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + [[package]] name = "case" version = "0.1.0" @@ -559,6 +727,9 @@ name = "cc" version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +dependencies = [ + "jobserver", +] [[package]] name = "cexpr" @@ -569,6 +740,16 @@ dependencies = [ "nom 5.1.2", ] +[[package]] +name = "cfb" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca453e8624711b2f0f4eb47076a318feda166252a827ee25d067b43de83dcba0" +dependencies = [ + "byteorder", + "uuid", +] + [[package]] name = "cfb-mode" version = "0.6.0" @@ -578,6 +759,15 @@ dependencies = [ "cipher 0.2.5", ] +[[package]] +name = "cfg-expr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e" +dependencies = [ + "smallvec", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -590,6 +780,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chacha20" version = "0.7.3" @@ -724,12 +920,83 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "cocoa" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc", + "objc", +] + [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a30a2b2a013da986dc5cc3eda3d19c0d59d53f835be1b2356eb8d00f000c793" +dependencies = [ + "com_macros", +] + +[[package]] +name = "com_macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7606b05842fea68ddcc89e8053b8860ebcb2a0ba8d6abfe3a148e5d5a8d3f0c1" +dependencies = [ + "com_macros_support", + "proc-macro2 1.0.32", + "syn 1.0.81", +] + +[[package]] +name = "com_macros_support" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97e9a6d20f4ac8830e309a455d7e9416e65c6af5a97c88c55fbb4c2012e107da" +dependencies = [ + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + [[package]] name = "config" version = "0.9.3" @@ -746,28 +1013,110 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "convert_case" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + [[package]] name = "core-foundation" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[package]] name = "core-foundation-sys" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.2", + "foreign-types", + "libc", +] + +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + [[package]] name = "cpufeatures" version = "0.2.1" @@ -955,7 +1304,7 @@ dependencies = [ "crossterm_winapi 0.6.2", "lazy_static 1.4.0", "libc", - "mio", + "mio 0.7.14", "parking_lot 0.10.2", "signal-hook 0.1.17", "winapi 0.3.9", @@ -970,7 +1319,7 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi 0.8.0", "libc", - "mio", + "mio 0.7.14", "parking_lot 0.11.2", "signal-hook 0.3.10", "signal-hook-mio", @@ -1011,6 +1360,33 @@ dependencies = [ "subtle", ] +[[package]] +name = "cssparser" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "matches", + "phf 0.8.0", + "proc-macro2 1.0.32", + "quote 1.0.10", + "smallvec", + "syn 1.0.81", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +dependencies = [ + "quote 1.0.10", + "syn 1.0.81", +] + [[package]] name = "csv" version = "1.1.6" @@ -1051,6 +1427,12 @@ dependencies = [ "cipher 0.3.0", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "curl-sys" version = "0.4.51+curl-7.80.0" @@ -1148,6 +1530,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "deflate" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +dependencies = [ + "adler32", + "byteorder", +] + +[[package]] +name = "deflate" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" +dependencies = [ + "adler32", + "byteorder", +] + [[package]] name = "deps_only" version = "0.1.0" @@ -1283,6 +1685,17 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +dependencies = [ + "libc", + "redox_users 0.3.5", + "winapi 0.3.9", +] + [[package]] name = "dirs-next" version = "1.0.2" @@ -1310,16 +1723,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users", + "redox_users 0.4.0", "winapi 0.3.9", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + [[package]] name = "dtoa" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +[[package]] +name = "dtoa-short" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +dependencies = [ + "dtoa", +] + [[package]] name = "ed25519" version = "1.3.0" @@ -1349,6 +1783,12 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "embed_plist" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99" + [[package]] name = "encoding_rs" version = "0.8.29" @@ -1376,6 +1816,27 @@ dependencies = [ "syn 1.0.81", ] +[[package]] +name = "enumflags2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +dependencies = [ + "enumflags2_derive", + "serde 1.0.130", +] + +[[package]] +name = "enumflags2_derive" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +dependencies = [ + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + [[package]] name = "env_logger" version = "0.6.2" @@ -1443,6 +1904,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95765f67b4b18863968b4a1bd5bb576f732b29a4a28c7cd84c09fa3e2875f33c" +[[package]] +name = "fastrand" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +dependencies = [ + "instant", +] + [[package]] name = "fd-lock" version = "3.0.0" @@ -1454,6 +1924,28 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "field-offset" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" +dependencies = [ + "memoffset", + "rustc_version 0.3.3", +] + +[[package]] +name = "filetime" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.10", + "winapi 0.3.9", +] + [[package]] name = "fixed-hash" version = "0.7.0" @@ -1481,7 +1973,7 @@ dependencies = [ "cfg-if 1.0.0", "crc32fast", "libc", - "miniz_oxide", + "miniz_oxide 0.4.4", ] [[package]] @@ -1526,12 +2018,48 @@ dependencies = [ "winapi 0.2.8", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags 1.3.2", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.1.31" @@ -1619,6 +2147,21 @@ version = "0.3.0-alpha.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4914ae450db1921a56c91bde97a27846287d062087d4a652efc09bb3a01ebda" +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.7", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.17" @@ -1706,7 +2249,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite", + "pin-project-lite 0.2.7", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1728,12 +2271,92 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "gcc" version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" +[[package]] +name = "gdk" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d749dcfc00d8de0d7c3a289e04a04293eb5ba3d8a4e64d64911d481fa9933b" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590" +dependencies = [ + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "gdk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e091b3d3d6696949ac3b3fb3c62090e5bfd7bd6850bef5c3c5ea701de1b1f1e" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "pango-sys", + "pkg-config", + "system-deps 3.2.0", +] + +[[package]] +name = "generator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "winapi 0.3.9", +] + [[package]] name = "generic-array" version = "0.12.4" @@ -1793,8 +2416,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.10.2+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1817,6 +2442,49 @@ dependencies = [ "polyval 0.5.3", ] +[[package]] +name = "gio" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0" +dependencies = [ + "bitflags 1.3.2", + "futures-channel", + "futures-core", + "futures-io", + "gio-sys 0.14.0", + "glib", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e24fb752f8f5d2cf6bbc2c606fd2bc989c81c5e2fe321ab974d54f8b6344eac" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "system-deps 1.3.2", + "winapi 0.3.9", +] + +[[package]] +name = "gio-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", + "winapi 0.3.9", +] + [[package]] name = "git2" version = "0.8.0" @@ -1833,70 +2501,215 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "h2" -version = "0.3.7" +name = "glib" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55" +checksum = "7c515f1e62bf151ef6635f528d05b02c11506de986e43b34a5c920ef0b3796a4" dependencies = [ - "bytes 1.1.0", - "fnv", + "bitflags 1.3.2", + "futures-channel", "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", + "futures-executor", + "futures-task", + "glib-macros", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "once_cell", + "smallvec", ] [[package]] -name = "hashbrown" -version = "0.11.2" +name = "glib-macros" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518" +dependencies = [ + "anyhow", + "heck", + "proc-macro-crate 1.1.0", + "proc-macro-error", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] [[package]] -name = "hdrhistogram" -version = "6.3.4" +name = "glib-sys" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d331ebcdbca4acbefe5da8c3299b2e246f198a8294cc5163354e743398b89d" +checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" dependencies = [ - "base64 0.10.1", - "byteorder", - "crossbeam-channel 0.3.9", - "flate2", - "nom 4.2.3", - "num-traits 0.2.14", + "libc", + "system-deps 1.3.2", ] [[package]] -name = "headers" -version = "0.3.5" +name = "glib-sys" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c4eb0471fcb85846d8b0690695ef354f9afb11cb03cac2e1d7c9253351afb0" +checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae" dependencies = [ - "base64 0.13.0", - "bitflags 1.3.2", - "bytes 1.1.0", - "headers-core", - "http", - "httpdate", - "mime", - "sha-1 0.9.8", + "libc", + "system-deps 3.2.0", ] [[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "globset" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "gobject-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" +dependencies = [ + "glib-sys 0.10.1", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gobject-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5" +dependencies = [ + "glib-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "gtk" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb51122dd3317e9327ec1e4faa151d1fa0d95664cd8fb8dcfacf4d4d29ac70c" +dependencies = [ + "atk", + "bitflags 1.3.2", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "once_cell", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c14c8d3da0545785a7c5a120345b3abb534010fb8ae0f2ef3f47c027fba303e" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "pango-sys", + "system-deps 3.2.0", +] + +[[package]] +name = "gtk3-macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21de1da96dc117443fb03c2e270b2d34b7de98d0a79a19bbb689476173745b79" +dependencies = [ + "anyhow", + "heck", + "proc-macro-crate 1.1.0", + "proc-macro-error", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "h2" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55" +dependencies = [ + "bytes 1.1.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 1.14.0", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "hdrhistogram" +version = "6.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d331ebcdbca4acbefe5da8c3299b2e246f198a8294cc5163354e743398b89d" +dependencies = [ + "base64 0.10.1", + "byteorder", + "crossbeam-channel 0.3.9", + "flate2", + "nom 4.2.3", + "num-traits 0.2.14", +] + +[[package]] +name = "headers" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c4eb0471fcb85846d8b0690695ef354f9afb11cb03cac2e1d7c9253351afb0" +dependencies = [ + "base64 0.13.0", + "bitflags 1.3.2", + "bytes 1.1.0", + "headers-core", + "http", + "httpdate", + "mime", + "sha-1 0.9.8", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ "http", @@ -1932,6 +2745,20 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +[[package]] +name = "html5ever" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + [[package]] name = "http" version = "0.2.5" @@ -1951,9 +2778,15 @@ checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes 1.1.0", "http", - "pin-project-lite", + "pin-project-lite 0.2.7", ] +[[package]] +name = "http-range" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee9694f83d9b7c09682fdb32213682939507884e5bcf227be9aff5d644b90dc" + [[package]] name = "httparse" version = "1.5.1" @@ -1997,9 +2830,9 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite", + "pin-project-lite 0.2.7", "socket2", - "tokio", + "tokio 1.14.0", "tower-service", "tracing", "want", @@ -2012,8 +2845,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite", - "tokio", + "pin-project-lite 0.2.7", + "tokio 1.14.0", "tokio-io-timeout", ] @@ -2026,10 +2859,20 @@ dependencies = [ "bytes 1.1.0", "hyper", "native-tls", - "tokio", + "tokio 1.14.0", "tokio-native-tls", ] +[[package]] +name = "ico" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a4b3331534254a9b64095ae60d3dc2a8225a7a70229cd5888be127cdc1f6804" +dependencies = [ + "byteorder", + "png 0.11.0", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2058,6 +2901,24 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "ignore" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" +dependencies = [ + "crossbeam-utils 0.8.5", + "globset", + "lazy_static 1.4.0", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + [[package]] name = "image" version = "0.23.14" @@ -2082,6 +2943,24 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "infer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92b41dab759f9e8427c03f519c344a14655490b8db548dac1e57a75b3258391" +dependencies = [ + "cfb", +] + +[[package]] +name = "inflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f9f47468e9a76a6452271efadc88fe865a82be91fe75e6c0c57b87ccea59d4" +dependencies = [ + "adler32", +] + [[package]] name = "instant" version = "0.1.12" @@ -2103,6 +2982,15 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90c11140ffea82edce8dcd74137ce9324ec24b3cf0175fc9d7e29164da9915b8" +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "ipnet" version = "2.3.1" @@ -2133,6 +3021,40 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "javascriptcore-rs" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca9c7d1445bba2889672fbadc16c3d5007bfdcf0a15a18a3a50fe9fab2c7427" +dependencies = [ + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f46ada8a08dcd75a10afae872fbfb51275df4a8ae0d46b8cc7c708f08dd2998" +dependencies = [ + "libc", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.55" @@ -2181,6 +3103,18 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "kuchiki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" +dependencies = [ + "cssparser", + "html5ever", + "matches", + "selectors", +] + [[package]] name = "lazy_static" version = "0.2.11" @@ -2404,12 +3338,68 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "loom" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309" +dependencies = [ + "cfg-if 1.0.0", + "generator", + "scoped-tls", + "serde 1.0.130", + "serde_json", + "tracing", + "tracing-subscriber 0.3.3", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "mac-notification-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb6b71a9a89cd38b395d994214297447e8e63b1ba5708a9a2b0b1048ceda76" +dependencies = [ + "cc", + "chrono", + "dirs", + "objc-foundation", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "maplit" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +[[package]] +name = "markup5ever" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +dependencies = [ + "log", + "phf 0.8.0", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + [[package]] name = "matchers" version = "0.0.1" @@ -2419,6 +3409,15 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] + [[package]] name = "matches" version = "0.1.9" @@ -2500,6 +3499,21 @@ dependencies = [ "unicase", ] +[[package]] +name = "minisign-verify" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db0507fe8e3c68cd62961cf9f87f6c2b21d884d3515a7150a4a3fa9d014e5c12" + +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + [[package]] name = "miniz_oxide" version = "0.4.4" @@ -2510,6 +3524,25 @@ dependencies = [ "autocfg 1.0.1", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.7.14" @@ -2518,11 +3551,23 @@ checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ "libc", "log", - "miow", + "miow 0.3.7", "ntapi", "winapi 0.3.9", ] +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "miow" version = "0.3.7" @@ -2584,7 +3629,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.1.0", "proc-macro-error", "proc-macro2 1.0.32", "quote 1.0.10", @@ -2634,6 +3679,79 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nb-connect" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" +dependencies = [ + "libc", + "socket2", +] + +[[package]] +name = "ndk" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d64d6af06fde0e527b1ba5c7b79a6cc89cfc46325b0b2887dffe8f70197e0c3c" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e9e94628f24e7a3cb5b96a2dc5683acd9230bf11991c2a1677b87695138420" +dependencies = [ + "lazy_static 1.4.0", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling", + "proc-macro-crate 0.1.5", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "ndk-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "newtype-ops" version = "0.1.4" @@ -2649,6 +3767,19 @@ dependencies = [ "smallvec", ] +[[package]] +name = "nix" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + [[package]] name = "nix" version = "0.22.0" @@ -2694,6 +3825,20 @@ dependencies = [ "version_check 0.9.3", ] +[[package]] +name = "notify-rust" +version = "4.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ebab865e67efdd7182a88d76cadbdd2a8d02d1c7a4e16bb7c234016a12cac" +dependencies = [ + "mac-notification-sys", + "serde 1.0.130", + "winrt-notification", + "zbus", + "zvariant", + "zvariant_derive", +] + [[package]] name = "ntapi" version = "0.3.6" @@ -2849,6 +3994,57 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" +dependencies = [ + "proc-macro-crate 1.1.0", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "once_cell" version = "1.8.0" @@ -2867,11 +4063,21 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176ee4b630d174d2da8241336763bb459281dddc0f4d87f72c3b1efc9a6109b7" +dependencies = [ + "pathdiff", + "winapi 0.3.9", +] + [[package]] name = "openssl" -version = "0.10.38" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", @@ -2889,18 +4095,18 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-src" -version = "300.0.2+3.0.0" +version = "111.16.0+1.1.1l" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a760a11390b1a5daf72074d4f6ff1a6e772534ae191f999f57e9ee8146d1fb" +checksum = "7ab2173f69416cf3ec12debb5823d244127d23a9b127d5a5189aa97c5fa2859f" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.71" +version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73" +checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ "autocfg 1.0.1", "cc", @@ -2925,7 +4131,7 @@ dependencies = [ "pin-project 1.0.8", "rand 0.8.4", "thiserror", - "tokio", + "tokio 1.14.0", "tokio-stream", ] @@ -2959,7 +4165,7 @@ dependencies = [ "reqwest", "thiserror", "thrift", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -2989,6 +4195,27 @@ dependencies = [ "num-traits 0.2.14", ] +[[package]] +name = "os_info" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5501659840950e918d046ad97ebe9702cbb4ec0097e47dbd27abf7692223181" +dependencies = [ + "log", + "serde 1.0.130", + "winapi 0.3.9", +] + +[[package]] +name = "os_pipe" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "packed_simd_2" version = "0.3.6" @@ -2999,6 +4226,37 @@ dependencies = [ "libm 0.1.4", ] +[[package]] +name = "pango" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546fd59801e5ca735af82839007edd226fe7d3bb06433ec48072be4439c28581" +dependencies = [ + "bitflags 1.3.2", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + [[package]] name = "parking_lot" version = "0.10.2" @@ -3065,6 +4323,23 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "patricia_tree" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c4b8ef84caee22395fa083b7d8ee9351e71cdf69a46c832528acdcac402117" +dependencies = [ + "bitflags 1.3.2", + "bytecodec", + "trackable 0.2.24", +] + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -3197,6 +4472,104 @@ dependencies = [ "zeroize", ] +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.4", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "0.4.28" @@ -3237,6 +4610,12 @@ dependencies = [ "syn 1.0.81", ] +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + [[package]] name = "pin-project-lite" version = "0.2.7" @@ -3256,14 +4635,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" [[package]] -name = "poly1305" -version = "0.7.2" +name = "png" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +checksum = "f0b0cabbbd20c2d7f06dbf015e06aad59b6ca3d9ed14848783e98af9aaf19925" dependencies = [ - "cpufeatures", - "opaque-debug 0.3.0", - "universal-hash", + "bitflags 1.3.2", + "deflate 0.7.20", + "inflate", + "num-iter", +] + +[[package]] +name = "png" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "deflate 0.8.6", + "miniz_oxide 0.3.7", +] + +[[package]] +name = "polling" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-ffi", + "winapi 0.3.9", +] + +[[package]] +name = "poly1305" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +dependencies = [ + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", ] [[package]] @@ -3295,6 +4711,21 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml 0.5.8", +] + [[package]] name = "proc-macro-crate" version = "1.1.0" @@ -3503,6 +4934,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", + "rand_pcg", ] [[package]] @@ -3602,6 +5034,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "rand_xoshiro" version = "0.1.0" @@ -3623,6 +5064,25 @@ dependencies = [ "thiserror", ] +[[package]] +name = "raw-window-handle" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" +dependencies = [ + "libc", + "raw-window-handle 0.4.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba75eee94a9d5273a68c9e1e105d9cffe1ef700532325788389e5a83e2522b7" +dependencies = [ + "cty", +] + [[package]] name = "rayon" version = "1.5.1" @@ -3672,6 +5132,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom 0.1.16", + "redox_syscall 0.1.57", + "rust-argon2", +] + [[package]] name = "redox_users" version = "0.4.0" @@ -3739,11 +5210,11 @@ dependencies = [ "mime", "native-tls", "percent-encoding 2.1.0", - "pin-project-lite", + "pin-project-lite 0.2.7", "serde 1.0.130", "serde_json", - "serde_urlencoded", - "tokio", + "serde_urlencoded 0.7.0", + "tokio 1.14.0", "tokio-native-tls", "url 2.2.2", "wasm-bindgen", @@ -3752,6 +5223,29 @@ dependencies = [ "winreg", ] +[[package]] +name = "rfd" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "609ed912e110af7d7084b6b17d2a68b25e766208e015a37beba1be3c2d7cbb3b" +dependencies = [ + "block", + "dispatch", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "gtk-sys", + "js-sys", + "lazy_static 1.4.0", + "objc", + "objc-foundation", + "objc_id", + "raw-window-handle 0.3.4", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winapi 0.3.9", +] + [[package]] name = "ring" version = "0.16.20" @@ -3831,6 +5325,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils 0.8.5", +] + [[package]] name = "rust-ini" version = "0.13.0" @@ -3880,6 +5386,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustversion" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" + [[package]] name = "rustyline" version = "9.0.0" @@ -3894,7 +5406,7 @@ dependencies = [ "libc", "log", "memchr", - "nix", + "nix 0.22.0", "radix_trie", "scopeguard", "smallvec", @@ -3983,8 +5495,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", + "core-foundation 0.9.2", + "core-foundation-sys 0.8.3", "libc", "security-framework-sys", ] @@ -3995,10 +5507,30 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "selectors" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" +dependencies = [ + "bitflags 1.3.2", + "cssparser", + "derive_more", + "fxhash", + "log", + "matches", + "phf 0.8.0", + "phf_codegen", + "precomputed-hash", + "servo_arc", + "smallvec", + "thin-slice", +] + [[package]] name = "semver" version = "0.11.0" @@ -4123,6 +5655,18 @@ dependencies = [ "serde 0.8.23", ] +[[package]] +name = "serde_urlencoded" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +dependencies = [ + "dtoa", + "itoa", + "serde 1.0.130", + "url 2.2.2", +] + [[package]] name = "serde_urlencoded" version = "0.7.0" @@ -4147,6 +5691,16 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -4206,6 +5760,16 @@ dependencies = [ "lazy_static 1.4.0", ] +[[package]] +name = "shared_child" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6be9f7d5565b1483af3e72975e2dee33879b3b86bd48c0929fccf6585d79e65a" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "shlex" version = "0.1.1" @@ -4219,7 +5783,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" dependencies = [ "libc", - "mio", + "mio 0.7.14", "signal-hook-registry", ] @@ -4240,7 +5804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29fd5867f1c4f2c5be079aee7a2adf1152ebb04a4bc4d341f504b7dece607ed4" dependencies = [ "libc", - "mio", + "mio 0.7.14", "signal-hook 0.3.10", ] @@ -4270,6 +5834,12 @@ dependencies = [ "num-traits 0.2.14", ] +[[package]] +name = "siphasher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" + [[package]] name = "slab" version = "0.4.5" @@ -4309,18 +5879,48 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "soup-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7adf08565630bbb71f955f11f8a68464817ded2703a3549747c235b58a13e" +dependencies = [ + "bitflags 1.3.2", + "gio-sys 0.10.1", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "pkg-config", + "system-deps 1.3.2", +] + [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stack-buf" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7386b49cb287f6fafbfd3bd604914bccb99fb8d53483f40e1ecfda5d45f3370" +[[package]] +name = "state" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf4f5369e6d3044b5e365c9690f451516ac8f0954084622b49ea3fde2f6de5" +dependencies = [ + "loom", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -4342,6 +5942,32 @@ dependencies = [ "futures 0.1.31", ] +[[package]] +name = "string_cache" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "923f0f39b6267d37d23ce71ae7235602134b250ace715dd2c90421998ddac0c6" +dependencies = [ + "lazy_static 1.4.0", + "new_debug_unreachable", + "parking_lot 0.11.2", + "phf_shared 0.8.0", + "precomputed-hash", + "serde 1.0.130", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro2 1.0.32", + "quote 1.0.10", +] + [[package]] name = "strsim" version = "0.8.0" @@ -4380,29 +6006,23 @@ dependencies = [ [[package]] name = "strum" -version = "0.19.5" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89a286a7e3b5720b9a477b23253bc50debac207c8d21505f8e70b36792f11b5" +checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" [[package]] name = "strum" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" -dependencies = [ - "strum_macros 0.22.0", -] +checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" [[package]] -name = "strum_macros" -version = "0.17.1" +name = "strum" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6e163a520367c465f59e0a61a23cfae3b10b6546d78b6f672a382be79f7110" +checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" dependencies = [ - "heck", - "proc-macro2 1.0.32", - "quote 1.0.10", - "syn 1.0.81", + "strum_macros 0.22.0", ] [[package]] @@ -4419,9 +6039,9 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.19.4" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e61bb0be289045cb80bfce000512e32d09f8337e54c186725da381377ad1f8d5" +checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" dependencies = [ "heck", "proc-macro2 1.0.32", @@ -4513,6 +6133,89 @@ dependencies = [ "unicode-xid 0.2.2", ] +[[package]] +name = "system-deps" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b" +dependencies = [ + "heck", + "pkg-config", + "strum 0.18.0", + "strum_macros 0.18.0", + "thiserror", + "toml 0.5.8", + "version-compare 0.0.10", +] + +[[package]] +name = "system-deps" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6" +dependencies = [ + "anyhow", + "cfg-expr", + "heck", + "itertools 0.10.1", + "pkg-config", + "strum 0.21.0", + "strum_macros 0.21.1", + "thiserror", + "toml 0.5.8", + "version-compare 0.0.11", +] + +[[package]] +name = "tao" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa57de7c282b68f8906278543a724ed8f5a2568f069dd0cc05fc10d1f07036b" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "cc", + "cocoa", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "core-video-sys", + "crossbeam-channel 0.5.1", + "dispatch", + "gdk", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "glib-sys 0.14.0", + "gtk", + "instant", + "lazy_static 1.4.0", + "libc", + "log", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot 0.11.2", + "raw-window-handle 0.3.4", + "scopeguard", + "serde 1.0.130", + "unicode-segmentation", + "winapi 0.3.9", + "x11-dl", +] + +[[package]] +name = "tar" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "tari_app_grpc" version = "0.22.0" @@ -4524,6 +6227,7 @@ dependencies = [ "tari_comms", "tari_core", "tari_crypto", + "tari_utilities", "tonic", "tonic-build", ] @@ -4541,16 +6245,17 @@ dependencies = [ "rand 0.8.4", "serde 1.0.130", "structopt", - "strum 0.19.5", - "strum_macros 0.19.4", + "strum 0.22.0", + "strum_macros 0.22.0", "tari_common", "tari_common_types", "tari_comms", "tari_core", "tari_crypto", "tari_p2p", + "tari_utilities", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", ] @@ -4573,8 +6278,8 @@ dependencies = [ "reqwest", "rustyline", "rustyline-derive", - "strum 0.19.5", - "strum_macros 0.18.0", + "strum 0.22.0", + "strum_macros 0.22.0", "tari_app_grpc", "tari_app_utilities", "tari_common", @@ -4588,12 +6293,13 @@ dependencies = [ "tari_p2p", "tari_service_framework", "tari_shutdown", + "tari_utilities", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", "tracing", "tracing-opentelemetry", - "tracing-subscriber", + "tracing-subscriber 0.2.25", "warp", ] @@ -4617,25 +6323,53 @@ dependencies = [ ] [[package]] -name = "tari_common" -version = "0.22.0" +name = "tari_collectibles" +version = "0.1.0" dependencies = [ - "anyhow", - "config", - "dirs-next 1.0.2", - "get_if_addrs", - "git2", - "log", - "log4rs 1.0.0", - "multiaddr", - "path-clean", - "prost-build", - "serde 1.0.130", - "serde_json", + "blake2", + "diesel", + "diesel_migrations", + "futures 0.3.17", + "prost", + "prost-types", + "rand 0.8.4", + "serde 1.0.130", + "serde_json", + "tari_app_grpc", + "tari_common_types", + "tari_crypto", + "tari_dan_common_types", + "tari_key_manager", + "tari_mmr", + "tari_utilities", + "tauri", + "tauri-build", + "thiserror", + "tonic", + "uuid", +] + +[[package]] +name = "tari_common" +version = "0.22.0" +dependencies = [ + "anyhow", + "config", + "dirs-next 1.0.2", + "fs2 0.4.3", + "get_if_addrs", + "git2", + "log", + "log4rs 1.0.0", + "multiaddr", + "path-clean", + "prost-build", + "serde 1.0.130", + "serde_json", "sha2", "structopt", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", "tempfile", "thiserror", "toml 0.5.8", @@ -4662,7 +6396,7 @@ dependencies = [ "serde 1.0.130", "tari_crypto", "thiserror", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -4702,10 +6436,10 @@ dependencies = [ "tari_metrics", "tari_shutdown", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", "tokio-stream", "tokio-util", "tower", @@ -4751,11 +6485,11 @@ dependencies = [ "tari_crypto", "tari_shutdown", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", "tari_utilities", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", "tokio-stream", "tower", "tower-test", @@ -4772,8 +6506,8 @@ dependencies = [ "quote 1.0.10", "syn 1.0.81", "tari_comms", - "tari_test_utils", - "tokio", + "tari_test_utils 0.22.0", + "tokio 1.14.0", "tower-service", ] @@ -4795,8 +6529,8 @@ dependencies = [ "rpassword", "rustyline", "sha2", - "strum 0.19.5", - "strum_macros 0.19.4", + "strum 0.22.0", + "strum_macros 0.22.0", "tari_app_grpc", "tari_app_utilities", "tari_common", @@ -4808,13 +6542,14 @@ dependencies = [ "tari_key_manager", "tari_p2p", "tari_shutdown", + "tari_utilities", "tari_wallet", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", "tracing", "tracing-opentelemetry", - "tracing-subscriber", + "tracing-subscriber 0.2.25", "tui", "unicode-segmentation", "unicode-width", @@ -4836,7 +6571,7 @@ dependencies = [ "derive_more", "digest 0.9.0", "env_logger 0.7.1", - "fs2", + "fs2 0.3.0", "futures 0.3.17", "hex", "integer-encoding 3.0.2", @@ -4855,7 +6590,7 @@ dependencies = [ "serde 1.0.130", "serde_json", "sha3", - "strum_macros 0.17.1", + "strum_macros 0.22.0", "tari_common", "tari_common_types", "tari_comms", @@ -4867,10 +6602,11 @@ dependencies = [ "tari_service_framework", "tari_shutdown", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", + "tari_utilities", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", "tracing", "tracing-attributes", "tracing-futures", @@ -4902,6 +6638,68 @@ dependencies = [ "thiserror", ] +[[package]] +name = "tari_dan_common_types" +version = "0.1.0" +dependencies = [ + "prost", + "prost-types", + "tari_common", +] + +[[package]] +name = "tari_dan_core" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "blake2", + "bytecodec", + "clap", + "digest 0.9.0", + "futures 0.3.17", + "lmdb-zero", + "log", + "patricia_tree", + "prost", + "prost-types", + "serde 1.0.130", + "serde_json", + "tari_common", + "tari_comms", + "tari_comms_dht", + "tari_comms_rpc_macros", + "tari_core", + "tari_crypto", + "tari_dan_common_types", + "tari_mmr", + "tari_p2p", + "tari_service_framework", + "tari_shutdown", + "tari_storage", + "tari_test_utils 0.8.1", + "thiserror", + "tokio 1.14.0", + "tokio-stream", + "tonic", +] + +[[package]] +name = "tari_dan_storage_sqlite" +version = "0.1.0" +dependencies = [ + "async-trait", + "diesel", + "diesel_migrations", + "dotenv", + "log", + "tari_common", + "tari_dan_core", + "thiserror", + "tokio 1.14.0", + "tokio-stream", +] + [[package]] name = "tari_infra_derive" version = "0.22.0" @@ -4922,14 +6720,23 @@ dependencies = [ "chacha20", "chrono", "clear_on_drop", + "console_error_panic_hook", "crc32fast", "digest 0.9.0", + "getrandom 0.2.3", + "js-sys", "rand 0.8.4", + "serde 1.0.130", + "serde_derive", + "serde_json", "sha2", "strum 0.22.0", "strum_macros 0.22.0", + "tari_common_types", "tari_crypto", "thiserror", + "wasm-bindgen", + "wasm-bindgen-test", ] [[package]] @@ -4962,11 +6769,11 @@ dependencies = [ "tari_crypto", "tari_utilities", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", "tracing", "tracing-futures", - "tracing-subscriber", + "tracing-subscriber 0.2.25", "url 2.2.2", ] @@ -5003,8 +6810,9 @@ dependencies = [ "tari_comms", "tari_core", "tari_crypto", + "tari_utilities", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", ] @@ -5036,7 +6844,7 @@ dependencies = [ "chrono", "clap", "env_logger 0.6.2", - "fs2", + "fs2 0.3.0", "futures 0.3.17", "futures-timer", "lazy_static 1.4.0", @@ -5059,11 +6867,11 @@ dependencies = [ "tari_service_framework", "tari_shutdown", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", "tari_utilities", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", "tokio-stream", "tower", "tower-service", @@ -5081,9 +6889,9 @@ dependencies = [ "futures-test", "log", "tari_shutdown", - "tari_test_utils", + "tari_test_utils 0.22.0", "thiserror", - "tokio", + "tokio 1.14.0", "tower", "tower-service", ] @@ -5093,7 +6901,7 @@ name = "tari_shutdown" version = "0.22.0" dependencies = [ "futures 0.3.17", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -5159,15 +6967,29 @@ dependencies = [ "tari_crypto", "tari_utilities", "thiserror", - "tokio", + "tokio 1.14.0", "tonic", "tonic-build", "tracing", "tracing-futures", - "tracing-subscriber", + "tracing-subscriber 0.2.25", "url 2.2.2", ] +[[package]] +name = "tari_test_utils" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f11c0804a3f136ad0f821981411215886f0039bf1519c4ec0ec0af8098a8def" +dependencies = [ + "futures 0.3.17", + "futures-test", + "lazy_static 1.4.0", + "rand 0.7.3", + "tempfile", + "tokio 0.2.25", +] + [[package]] name = "tari_test_utils" version = "0.22.0" @@ -5178,7 +7000,7 @@ dependencies = [ "rand 0.8.4", "tari_shutdown", "tempfile", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -5199,6 +7021,47 @@ dependencies = [ "thiserror", ] +[[package]] +name = "tari_validator_node" +version = "0.10.1" +dependencies = [ + "anyhow", + "async-trait", + "blake2", + "bytecodec", + "clap", + "digest 0.9.0", + "futures 0.3.17", + "lmdb-zero", + "log", + "patricia_tree", + "prost", + "prost-types", + "serde 1.0.130", + "serde_json", + "tari_app_grpc", + "tari_app_utilities", + "tari_common", + "tari_comms", + "tari_comms_dht", + "tari_comms_rpc_macros", + "tari_core", + "tari_crypto", + "tari_dan_core", + "tari_dan_storage_sqlite", + "tari_mmr", + "tari_p2p", + "tari_service_framework", + "tari_shutdown", + "tari_storage", + "tari_test_utils 0.8.1", + "thiserror", + "tokio 1.14.0", + "tokio-stream", + "tonic", + "tonic-build", +] + [[package]] name = "tari_wallet" version = "0.22.0" @@ -5215,7 +7078,7 @@ dependencies = [ "diesel_migrations", "digest 0.9.0", "env_logger 0.7.1", - "fs2", + "fs2 0.3.0", "futures 0.3.17", "libsqlite3-sys", "lmdb-zero", @@ -5226,6 +7089,8 @@ dependencies = [ "serde 1.0.130", "serde_json", "sha2", + "strum 0.22.0", + "strum_macros 0.22.0", "tari_common", "tari_common_sqlite", "tari_common_types", @@ -5238,10 +7103,11 @@ dependencies = [ "tari_service_framework", "tari_shutdown", "tari_storage", - "tari_test_utils", + "tari_test_utils 0.22.0", + "tari_utilities", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", "tower", ] @@ -5267,12 +7133,159 @@ dependencies = [ "tari_p2p", "tari_service_framework", "tari_shutdown", - "tari_test_utils", + "tari_test_utils 0.22.0", "tari_utilities", "tari_wallet", "tempfile", "thiserror", - "tokio", + "tokio 1.14.0", +] + +[[package]] +name = "tauri" +version = "1.0.0-beta.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79a0579dcc6fb883fe90dd3c66d76b8b8f4a1786e1e915e314b2017a500ede09" +dependencies = [ + "attohttpc", + "base64 0.13.0", + "bincode", + "cfg_aliases", + "dirs-next 2.0.0", + "either", + "embed_plist", + "flate2", + "futures 0.3.17", + "futures-lite", + "glib", + "gtk", + "http", + "ignore", + "minisign-verify", + "notify-rust", + "once_cell", + "open", + "os_info", + "os_pipe", + "percent-encoding 2.1.0", + "rand 0.8.4", + "raw-window-handle 0.3.4", + "rfd", + "semver 1.0.4", + "serde 1.0.130", + "serde_json", + "serde_repr", + "shared_child", + "state", + "tar", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "tempfile", + "thiserror", + "tokio 1.14.0", + "url 2.2.2", + "uuid", + "zip", +] + +[[package]] +name = "tauri-build" +version = "1.0.0-beta.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9c9a9bea25b9d6f5845b8662e18447e17218f99860cab37e39e2b57a9fcd49" +dependencies = [ + "anyhow", + "proc-macro2 1.0.32", + "quote 1.0.10", + "serde_json", + "tauri-utils", + "winres", +] + +[[package]] +name = "tauri-codegen" +version = "1.0.0-beta.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1663739ab53e281919676f216fb56a031104d0d2cd1a2dd5b012d279bcdb0ea4" +dependencies = [ + "blake3", + "kuchiki", + "proc-macro2 1.0.32", + "quote 1.0.10", + "regex", + "serde 1.0.130", + "serde_json", + "tauri-utils", + "thiserror", + "walkdir", + "zstd", +] + +[[package]] +name = "tauri-macros" +version = "1.0.0-beta.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddf9f5868402323f35ef94fa6ab1d5d10b29aea9de598d829723aa1db5693b4" +dependencies = [ + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", + "tauri-codegen", +] + +[[package]] +name = "tauri-runtime" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c52eccfb7f2ce5a09262bdc3671f0f07f637e27f8aa25e5f38145cddcd4e01" +dependencies = [ + "gtk", + "http", + "http-range", + "infer", + "serde 1.0.130", + "serde_json", + "tauri-utils", + "thiserror", + "uuid", + "winapi 0.3.9", +] + +[[package]] +name = "tauri-runtime-wry" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fed8dd0a448c303fa764859d6dfa1c746c4f2c6c30a83c162f8bebb12e4af4e" +dependencies = [ + "gtk", + "ico", + "infer", + "png 0.16.8", + "tauri-runtime", + "tauri-utils", + "uuid", + "winapi 0.3.9", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "1.0.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb9b79594f22b6ed0cc8362e0dfde5b7969962de3cd8ca683de702e59e8221b" +dependencies = [ + "html5ever", + "kuchiki", + "phf 0.10.0", + "proc-macro2 1.0.32", + "quote 1.0.10", + "serde 1.0.130", + "serde_json", + "thiserror", + "url 2.2.2", + "zstd", ] [[package]] @@ -5289,6 +7302,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "tendril" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33" +dependencies = [ + "futf", + "mac", + "utf-8", +] + [[package]] name = "termcolor" version = "1.1.2" @@ -5309,7 +7333,7 @@ dependencies = [ "tari_core", "tari_crypto", "tari_utilities", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -5321,6 +7345,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" + [[package]] name = "thiserror" version = "1.0.30" @@ -5427,6 +7457,20 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +dependencies = [ + "bytes 0.5.6", + "lazy_static 1.4.0", + "mio 0.6.23", + "num_cpus", + "pin-project-lite 0.1.12", + "slab", +] + [[package]] name = "tokio" version = "1.14.0" @@ -5437,10 +7481,10 @@ dependencies = [ "bytes 1.1.0", "libc", "memchr", - "mio", + "mio 0.7.14", "num_cpus", "once_cell", - "pin-project-lite", + "pin-project-lite 0.2.7", "signal-hook-registry", "tokio-macros", "winapi 0.3.9", @@ -5452,8 +7496,8 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" dependencies = [ - "pin-project-lite", - "tokio", + "pin-project-lite 0.2.7", + "tokio 1.14.0", ] [[package]] @@ -5474,7 +7518,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio", + "tokio 1.14.0", ] [[package]] @@ -5484,7 +7528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls", - "tokio", + "tokio 1.14.0", "webpki", ] @@ -5495,8 +7539,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", - "pin-project-lite", - "tokio", + "pin-project-lite 0.2.7", + "tokio 1.14.0", "tokio-util", ] @@ -5509,7 +7553,7 @@ dependencies = [ "async-stream", "bytes 1.1.0", "futures-core", - "tokio", + "tokio 1.14.0", "tokio-stream", ] @@ -5522,7 +7566,7 @@ dependencies = [ "futures-util", "log", "pin-project 1.0.8", - "tokio", + "tokio 1.14.0", "tungstenite", ] @@ -5537,8 +7581,8 @@ dependencies = [ "futures-io", "futures-sink", "log", - "pin-project-lite", - "tokio", + "pin-project-lite 0.2.7", + "tokio 1.14.0", ] [[package]] @@ -5580,7 +7624,7 @@ dependencies = [ "pin-project 1.0.8", "prost", "prost-derive", - "tokio", + "tokio 1.14.0", "tokio-stream", "tokio-util", "tower", @@ -5613,10 +7657,10 @@ dependencies = [ "hdrhistogram", "indexmap", "pin-project 1.0.8", - "pin-project-lite", + "pin-project-lite 0.2.7", "rand 0.8.4", "slab", - "tokio", + "tokio 1.14.0", "tokio-stream", "tokio-util", "tower-layer", @@ -5644,7 +7688,7 @@ checksum = "a4546773ffeab9e4ea02b8872faa49bb616a80a7da66afc2f32688943f97efa7" dependencies = [ "futures-util", "pin-project 1.0.8", - "tokio", + "tokio 1.14.0", "tokio-test", "tower-layer", "tower-service", @@ -5658,7 +7702,7 @@ checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite", + "pin-project-lite 0.2.7", "tracing-attributes", "tracing-core", ] @@ -5714,7 +7758,7 @@ dependencies = [ "tracing", "tracing-core", "tracing-log", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -5736,7 +7780,7 @@ dependencies = [ "ansi_term 0.12.1", "chrono", "lazy_static 1.4.0", - "matchers", + "matchers 0.0.1", "regex", "serde 1.0.130", "serde_json", @@ -5750,11 +7794,58 @@ dependencies = [ ] [[package]] -name = "traitobject" -version = "0.1.0" +name = "tracing-subscriber" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - +checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3" +dependencies = [ + "ansi_term 0.12.1", + "lazy_static 1.4.0", + "matchers 0.1.0", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trackable" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98abb9e7300b9ac902cc04920945a874c1973e08c310627cc4458c04b70dd32" +dependencies = [ + "trackable 1.2.0", + "trackable_derive", +] + +[[package]] +name = "trackable" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "017e2a1a93718e4e8386d037cfb8add78f1d690467f4350fb582f55af1203167" +dependencies = [ + "trackable_derive", +] + +[[package]] +name = "trackable_derive" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebeb235c5847e2f82cfe0f07eb971d1e5f6804b18dac2ae16349cc604380f82f" +dependencies = [ + "quote 1.0.10", + "syn 1.0.81", +] + +[[package]] +name = "traitobject" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" + [[package]] name = "trust-dns-client" version = "0.21.0-alpha.4" @@ -5773,7 +7864,7 @@ dependencies = [ "ring", "rustls", "thiserror", - "tokio", + "tokio 1.14.0", "trust-dns-proto", "webpki", ] @@ -5801,7 +7892,7 @@ dependencies = [ "smallvec", "thiserror", "tinyvec", - "tokio", + "tokio 1.14.0", "tokio-rustls", "url 2.2.2", "webpki", @@ -6022,6 +8113,7 @@ dependencies = [ "idna 0.2.3", "matches", "percent-encoding 2.1.0", + "serde 1.0.130", ] [[package]] @@ -6036,6 +8128,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.3", + "serde 1.0.130", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -6048,6 +8150,18 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version-compare" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" + +[[package]] +name = "version-compare" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" + [[package]] name = "version_check" version = "0.1.5" @@ -6060,6 +8174,18 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "walkdir" version = "2.3.2" @@ -6102,8 +8228,8 @@ dependencies = [ "scoped-tls", "serde 1.0.130", "serde_json", - "serde_urlencoded", - "tokio", + "serde_urlencoded 0.7.0", + "tokio 1.14.0", "tokio-stream", "tokio-tungstenite", "tokio-util", @@ -6130,6 +8256,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if 1.0.0", + "serde 1.0.130", + "serde_json", "wasm-bindgen-macro", ] @@ -6189,6 +8317,30 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +[[package]] +name = "wasm-bindgen-test" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96f1aa7971fdf61ef0f353602102dbea75a56e225ed036c1e3740564b91e6b7e" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6006f79628dfeb96a86d4db51fbf1344cd7fd8408f06fc9aa3c84913a4789688" +dependencies = [ + "proc-macro2 1.0.32", + "quote 1.0.10", +] + [[package]] name = "web-sys" version = "0.3.55" @@ -6199,6 +8351,52 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webkit2gtk" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e47b7f870883fc21612d2a51b74262f7f2cc5371f1621370817292a35300a9" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys 0.14.0", + "glib", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66ccc9f0cb4de7c3b92376a5bf64e7ddffb33852f092721731a039ec38dda98" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pango-sys", + "pkg-config", + "soup-sys", + "system-deps 3.2.0", +] + [[package]] name = "webpki" version = "0.21.4" @@ -6209,6 +8407,38 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webview2" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "283bf6b0ed9c83faea8c7bfe40bb261592147a109effaa4077eed294863d5031" +dependencies = [ + "com", + "once_cell", + "webview2-sys", + "widestring", + "winapi 0.3.9", +] + +[[package]] +name = "webview2-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b7889e893ac4c50d7346356be3ce13a85e56512c38b8fde0526559b8012a4c" +dependencies = [ + "com", + "winapi 0.3.9", +] + +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + [[package]] name = "which" version = "3.1.1" @@ -6229,6 +8459,18 @@ dependencies = [ "libc", ] +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + +[[package]] +name = "wildmatch" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f44b95f62d34113cf558c93511ac93027e03e9c29a60dd0fd70e6e025c7270a" + [[package]] name = "winapi" version = "0.2.8" @@ -6272,6 +8514,42 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f39345ae0c8ab072c0ac7fe8a8b411636aa34f89be19ddd0d9226544f13944" +dependencies = [ + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_i686_gnu" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0866510a3eca9aed73a077490bbbf03e5eaac4e1fd70849d89539e5830501fd" + +[[package]] +name = "windows_i686_msvc" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384a173630588044205a2993b6864a2f56e5a8c1e7668c07b93ec18cf4888dc4" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399" + [[package]] name = "winreg" version = "0.7.0" @@ -6281,6 +8559,77 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml 0.5.8", +] + +[[package]] +name = "winrt-notification" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda101fb8e034a25f3d50a0714d7ca4f234a4fc7bc57427f6d81040db0ccbe6a" +dependencies = [ + "strum 0.22.0", + "windows", + "xml-rs", +] + +[[package]] +name = "wry" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9549393a3917b5303277abb0267f8eecf9fd629b25f1c04e5284aa58b61915" +dependencies = [ + "cocoa", + "core-graphics 0.22.3", + "gdk", + "gio", + "glib", + "gtk", + "http", + "libc", + "log", + "objc", + "objc_id", + "once_cell", + "serde 1.0.130", + "serde_json", + "tao", + "thiserror", + "url 2.2.2", + "webkit2gtk", + "webkit2gtk-sys", + "webview2", + "webview2-sys", + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "x11-dl" +version = "2.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" +dependencies = [ + "lazy_static 1.4.0", + "libc", + "pkg-config", +] + [[package]] name = "x25519-dalek" version = "1.2.0" @@ -6292,6 +8641,21 @@ dependencies = [ "zeroize", ] +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +dependencies = [ + "libc", +] + +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "yaml-rust" version = "0.4.5" @@ -6315,6 +8679,41 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "zbus" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2326acc379a3ac4e34b794089f5bdb17086bf29a5fdf619b7b4cc772dc2e9dad" +dependencies = [ + "async-io", + "byteorder", + "derivative", + "enumflags2", + "fastrand", + "futures 0.3.17", + "nb-connect", + "nix 0.17.0", + "once_cell", + "polling", + "scoped-tls", + "serde 1.0.130", + "serde_repr", + "zbus_macros", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93" +dependencies = [ + "proc-macro-crate 0.1.5", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] + [[package]] name = "zeroize" version = "1.3.0" @@ -6335,3 +8734,72 @@ dependencies = [ "syn 1.0.81", "synstructure", ] + +[[package]] +name = "zip" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +dependencies = [ + "byteorder", + "bzip2", + "crc32fast", + "flate2", + "thiserror", + "time", +] + +[[package]] +name = "zstd" +version = "0.9.0+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "4.1.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.6.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "zvariant" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde 1.0.130", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9" +dependencies = [ + "proc-macro-crate 1.1.0", + "proc-macro2 1.0.32", + "quote 1.0.10", + "syn 1.0.81", +] diff --git a/applications/tari_app_grpc/src/conversions/aggregate_body.rs b/applications/tari_app_grpc/src/conversions/aggregate_body.rs index 4f6e599888..d894a5c6c8 100644 --- a/applications/tari_app_grpc/src/conversions/aggregate_body.rs +++ b/applications/tari_app_grpc/src/conversions/aggregate_body.rs @@ -22,7 +22,8 @@ use std::convert::TryFrom; -use tari_core::{tari_utilities::convert::try_convert_all, transactions::aggregated_body::AggregateBody}; +use tari_core::transactions::aggregated_body::AggregateBody; +use tari_utilities::convert::try_convert_all; use crate::tari_rpc as grpc; diff --git a/applications/tari_app_grpc/src/conversions/com_signature.rs b/applications/tari_app_grpc/src/conversions/com_signature.rs index 33c1f9cac2..2bd1cb3ad4 100644 --- a/applications/tari_app_grpc/src/conversions/com_signature.rs +++ b/applications/tari_app_grpc/src/conversions/com_signature.rs @@ -23,7 +23,7 @@ use std::convert::TryFrom; use tari_common_types::types::{ComSignature, Commitment, PrivateKey}; -use tari_core::crypto::tari_utilities::ByteArray; +use tari_utilities::ByteArray; use crate::tari_rpc as grpc; diff --git a/applications/tari_app_grpc/src/conversions/mod.rs b/applications/tari_app_grpc/src/conversions/mod.rs index fb4a407869..fa9c2238c3 100644 --- a/applications/tari_app_grpc/src/conversions/mod.rs +++ b/applications/tari_app_grpc/src/conversions/mod.rs @@ -40,7 +40,7 @@ mod transaction_output; mod unblinded_output; use prost_types::Timestamp; -use tari_core::crypto::tari_utilities::epoch_time::EpochTime; +use tari_utilities::epoch_time::EpochTime; pub use self::{ aggregate_body::*, diff --git a/applications/tari_app_grpc/src/conversions/new_block_template.rs b/applications/tari_app_grpc/src/conversions/new_block_template.rs index 5411090a40..05efd2fee7 100644 --- a/applications/tari_app_grpc/src/conversions/new_block_template.rs +++ b/applications/tari_app_grpc/src/conversions/new_block_template.rs @@ -27,6 +27,7 @@ use tari_core::{ blocks::{NewBlockHeaderTemplate, NewBlockTemplate}, proof_of_work::ProofOfWork, }; +use tari_utilities::ByteArray; use crate::tari_rpc as grpc; diff --git a/applications/tari_app_grpc/src/conversions/output_features.rs b/applications/tari_app_grpc/src/conversions/output_features.rs index 8ee4813523..d6d90f586e 100644 --- a/applications/tari_app_grpc/src/conversions/output_features.rs +++ b/applications/tari_app_grpc/src/conversions/output_features.rs @@ -23,7 +23,6 @@ use std::convert::{TryFrom, TryInto}; use tari_common_types::types::{Commitment, PublicKey}; - use tari_core::transactions::transaction::{ AssetOutputFeatures, MintNonFungibleFeatures, @@ -36,8 +35,6 @@ use tari_crypto::tari_utilities::ByteArray; use crate::tari_rpc as grpc; -use crate::tari_rpc as grpc; - impl TryFrom for OutputFeatures { type Error = String; diff --git a/applications/tari_app_grpc/src/conversions/peer.rs b/applications/tari_app_grpc/src/conversions/peer.rs index 542d28dd18..53b540b0a1 100644 --- a/applications/tari_app_grpc/src/conversions/peer.rs +++ b/applications/tari_app_grpc/src/conversions/peer.rs @@ -25,8 +25,6 @@ use tari_utilities::ByteArray; use crate::{conversions::datetime_to_timestamp, tari_rpc as grpc}; -use crate::{conversions::datetime_to_timestamp, tari_rpc as grpc}; - impl From for grpc::Peer { fn from(peer: Peer) -> Self { let public_key = peer.public_key.to_vec(); diff --git a/applications/tari_app_grpc/src/conversions/signature.rs b/applications/tari_app_grpc/src/conversions/signature.rs index 03804733da..03c1eb47b4 100644 --- a/applications/tari_app_grpc/src/conversions/signature.rs +++ b/applications/tari_app_grpc/src/conversions/signature.rs @@ -23,7 +23,7 @@ use std::convert::TryFrom; use tari_common_types::types::{PrivateKey, PublicKey, Signature}; -use tari_core::crypto::tari_utilities::ByteArray; +use tari_utilities::ByteArray; use crate::tari_rpc as grpc; diff --git a/applications/tari_app_grpc/src/conversions/transaction.rs b/applications/tari_app_grpc/src/conversions/transaction.rs index c53505d73e..b3c4261ef0 100644 --- a/applications/tari_app_grpc/src/conversions/transaction.rs +++ b/applications/tari_app_grpc/src/conversions/transaction.rs @@ -29,8 +29,6 @@ use tari_utilities::ByteArray; use crate::tari_rpc as grpc; -use crate::tari_rpc as grpc; - impl From for grpc::Transaction { fn from(source: Transaction) -> Self { Self { diff --git a/applications/tari_app_grpc/src/conversions/transaction_output.rs b/applications/tari_app_grpc/src/conversions/transaction_output.rs index 442ac99e57..e04fec4a0b 100644 --- a/applications/tari_app_grpc/src/conversions/transaction_output.rs +++ b/applications/tari_app_grpc/src/conversions/transaction_output.rs @@ -29,8 +29,6 @@ use tari_utilities::{ByteArray, Hashable}; use crate::tari_rpc as grpc; -use crate::tari_rpc as grpc; - impl TryFrom for TransactionOutput { type Error = String; diff --git a/applications/tari_app_grpc/src/conversions/unblinded_output.rs b/applications/tari_app_grpc/src/conversions/unblinded_output.rs index e98f1676ac..d8991025dc 100644 --- a/applications/tari_app_grpc/src/conversions/unblinded_output.rs +++ b/applications/tari_app_grpc/src/conversions/unblinded_output.rs @@ -29,8 +29,6 @@ use tari_utilities::ByteArray; use crate::tari_rpc as grpc; -use crate::tari_rpc as grpc; - impl From for grpc::UnblindedOutput { fn from(output: UnblindedOutput) -> Self { grpc::UnblindedOutput { diff --git a/applications/tari_app_utilities/src/initialization.rs b/applications/tari_app_utilities/src/initialization.rs index 0d71e5abff..a1448a5da2 100644 --- a/applications/tari_app_utilities/src/initialization.rs +++ b/applications/tari_app_utilities/src/initialization.rs @@ -9,9 +9,6 @@ use tari_common::{ DatabaseType, GlobalConfig, }; -use tari_comms::multiaddr::Multiaddr; - -use crate::consts; use crate::consts; @@ -64,19 +61,6 @@ pub fn init_configuration( } } - if let Some(str) = bootstrap.wallet_grpc_address.clone() { - log::info!( - target: LOG_TARGET, - "{}", - format!("GRPC address specified in command parameters: {}", str) - ); - - let grpc_address = str - .parse::() - .map_err(|_| ExitCodes::InputError("GRPC address is not valid".to_string()))?; - global_config.grpc_console_wallet_address = grpc_address; - } - check_file_paths(&mut global_config, &bootstrap); Ok((bootstrap, global_config, cfg)) diff --git a/applications/tari_app_utilities/src/utilities.rs b/applications/tari_app_utilities/src/utilities.rs index 763b302a12..9f8a4c95b7 100644 --- a/applications/tari_app_utilities/src/utilities.rs +++ b/applications/tari_app_utilities/src/utilities.rs @@ -36,6 +36,7 @@ use tari_comms::{ utils::multiaddr::multiaddr_to_socketaddr, }; use tari_p2p::transport::{TorConfig, TransportType}; +use tari_utilities::hex::Hex; use tokio::{runtime, runtime::Runtime}; use crate::identity_management::load_from_json; diff --git a/applications/tari_base_node/src/main.rs b/applications/tari_base_node/src/main.rs index d7cb3933e2..3b1b70b541 100644 --- a/applications/tari_base_node/src/main.rs +++ b/applications/tari_base_node/src/main.rs @@ -255,14 +255,13 @@ async fn run_node(node_config: Arc, bootstrap: ConfigBootstrap) -> })?; if let Some(ref base_node_config) = node_config.base_node_config { - if let Some(address) = base_node_config.grpc_address { + if let Some(ref address) = base_node_config.grpc_address { // Go, GRPC, go go let grpc = crate::grpc::base_node_grpc_server::BaseNodeGrpcServer::from_base_node_context(&ctx); - let socket_addr = multiaddr_to_socketaddr(&node_config.grpc_base_node_address) - .map_err(|e| ExitCodes::ConfigError(e.to_string()))?; + let socket_addr = multiaddr_to_socketaddr(address).map_err(|e| ExitCodes::ConfigError(e.to_string()))?; task::spawn(run_grpc(grpc, socket_addr, shutdown.to_signal())); } - } + } // Run, node, run! let command_handler = Arc::new(Mutex::new(CommandHandler::new(runtime::Handle::current(), &ctx))); diff --git a/applications/tari_base_node/src/parser.rs b/applications/tari_base_node/src/parser.rs index fc332199ee..ddffd7793b 100644 --- a/applications/tari_base_node/src/parser.rs +++ b/applications/tari_base_node/src/parser.rs @@ -42,6 +42,11 @@ use tari_app_utilities::utilities::{ use tari_common_types::types::{Commitment, PrivateKey, PublicKey, Signature}; use tari_core::proof_of_work::PowAlgorithm; use tari_shutdown::Shutdown; +use tari_utilities::{ + hex, + hex::{from_hex, Hex}, + ByteArray, +}; use tokio::sync::Mutex; use super::LOG_TARGET; diff --git a/applications/tari_console_wallet/src/automation/commands.rs b/applications/tari_console_wallet/src/automation/commands.rs index f95f8d6f8e..6fd9610b6a 100644 --- a/applications/tari_console_wallet/src/automation/commands.rs +++ b/applications/tari_console_wallet/src/automation/commands.rs @@ -42,18 +42,15 @@ use tari_comms::{ types::CommsPublicKey, }; use tari_comms_dht::{envelope::NodeDestination, DhtDiscoveryRequester}; -use tari_core::{ - tari_utilities::hex::Hex, - transactions::{ - tari_amount::{uT, MicroTari, Tari}, - transaction::{TransactionOutput, UnblindedOutput}, - }, +use tari_core::transactions::{ + tari_amount::{uT, MicroTari, Tari}, + transaction::{TransactionOutput, UnblindedOutput}, }; use tari_crypto::{ + keys::PublicKey as PublicKeyTrait, ristretto::pedersen::PedersenCommitmentFactory, tari_utilities::{ByteArray, Hashable}, }; -use tari_crypto::{keys::PublicKey as PublicKeyTrait, ristretto::pedersen::PedersenCommitmentFactory}; use tari_utilities::hex::Hex; use tari_wallet::{ output_manager_service::handle::OutputManagerHandle, @@ -204,11 +201,11 @@ pub async fn finalise_sha_atomic_swap( PublicKey(key) => Ok(key), _ => Err(CommandError::Argument), }?; - let (tx_id, fee, amount, tx) = output_service + let (tx_id, _fee, amount, tx) = output_service .create_claim_sha_atomic_swap_transaction(output, pre_image, MicroTari(25)) .await?; transaction_service - .submit_transaction(tx_id, tx, fee, amount, "Claimed HTLC atomic swap".into()) + .submit_transaction(tx_id, tx, amount, "Claimed HTLC atomic swap".into()) .await?; Ok(tx_id) } @@ -225,11 +222,11 @@ pub async fn claim_htlc_refund( _ => Err(CommandError::Argument), }?; - let (tx_id, fee, amount, tx) = output_service + let (tx_id, _fee, amount, tx) = output_service .create_htlc_refund_transaction(output, MicroTari(25)) .await?; transaction_service - .submit_transaction(tx_id, tx, fee, amount, "Claimed HTLC refund".into()) + .submit_transaction(tx_id, tx, amount, "Claimed HTLC refund".into()) .await?; Ok(tx_id) } diff --git a/applications/tari_console_wallet/src/automation/error.rs b/applications/tari_console_wallet/src/automation/error.rs index e3600782fc..617887a6df 100644 --- a/applications/tari_console_wallet/src/automation/error.rs +++ b/applications/tari_console_wallet/src/automation/error.rs @@ -24,13 +24,11 @@ use std::num::{ParseFloatError, ParseIntError}; use log::*; use tari_common::exit_codes::ExitCodes; -use tari_core::{ - tari_utilities::hex::HexError, - transactions::{ - tari_amount::{MicroTariError, TariConversionError}, - transaction::TransactionError, - }, +use tari_core::transactions::{ + tari_amount::{MicroTariError, TariConversionError}, + transaction::TransactionError, }; +use tari_utilities::hex::HexError; use tari_wallet::{ error::{WalletError, WalletStorageError}, output_manager_service::error::OutputManagerError, diff --git a/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs b/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs index dbe20e90f0..21c5cc827c 100644 --- a/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs +++ b/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs @@ -1,4 +1,4 @@ -use std::convert::TryFrom; +use std::convert::{TryFrom, TryInto}; use futures::{channel::mpsc, future, SinkExt}; use log::*; @@ -47,13 +47,14 @@ use tari_app_grpc::{ TransferResult, }, }; -use tari_common_types::types::{BlockHash, Signature}; +use tari_common_types::types::{BlockHash, PublicKey, Signature}; use tari_comms::{types::CommsPublicKey, CommsNode}; use tari_core::transactions::{ tari_amount::MicroTari, transaction::{OutputFeatures, UnblindedOutput}, }; -use tari_crypto::tari_utilities::Hashable; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::Hashable}; +use tari_utilities::{hex::Hex, ByteArray}; use tari_wallet::{ output_manager_service::handle::OutputManagerHandle, transaction_service::{handle::TransactionServiceHandle, storage::models}, @@ -201,7 +202,7 @@ impl wallet_server::Wallet for WalletGrpcServer { output.hash().to_hex() ); SendShaAtomicSwapResponse { - transaction_id: tx_id, + transaction_id: tx_id.as_u64(), pre_image: pre_image.to_hex(), output_hash: output.hash().to_hex(), is_success: true, @@ -242,12 +243,11 @@ impl wallet_server::Wallet for WalletGrpcServer { .create_claim_sha_atomic_swap_transaction(output, pre_image, message.fee_per_gram.into()) .await { - Ok((tx_id, fee, amount, tx)) => { + Ok((tx_id, _fee, amount, tx)) => { match transaction_service .submit_transaction( tx_id, tx, - fee, amount, "Claiming HTLC transaction with pre-image".to_string(), ) @@ -255,7 +255,7 @@ impl wallet_server::Wallet for WalletGrpcServer { { Ok(()) => TransferResult { address: Default::default(), - transaction_id: tx_id, + transaction_id: tx_id.as_u64(), is_success: true, failure_message: Default::default(), }, @@ -298,14 +298,14 @@ impl wallet_server::Wallet for WalletGrpcServer { .create_htlc_refund_transaction(output, message.fee_per_gram.into()) .await { - Ok((tx_id, fee, amount, tx)) => { + Ok((tx_id, _fee, amount, tx)) => { match transaction_service - .submit_transaction(tx_id, tx, fee, amount, "Creating HTLC refund transaction".to_string()) + .submit_transaction(tx_id, tx, amount, "Creating HTLC refund transaction".to_string()) .await { Ok(()) => TransferResult { address: Default::default(), - transaction_id: tx_id, + transaction_id: tx_id.as_u64(), is_success: true, failure_message: Default::default(), }, diff --git a/applications/tari_console_wallet/src/ui/components/send_tab.rs b/applications/tari_console_wallet/src/ui/components/send_tab.rs index fe25834f60..698ebd7011 100644 --- a/applications/tari_console_wallet/src/ui/components/send_tab.rs +++ b/applications/tari_console_wallet/src/ui/components/send_tab.rs @@ -14,7 +14,7 @@ use unicode_width::UnicodeWidthStr; use crate::{ ui::{ - components::{balance::Balance, Component, KeyHandled}, + components::{balance::Balance, styles, Component, KeyHandled}, state::{AppState, UiTransactionSendStatus}, widgets::{centered_rect_absolute, draw_dialog, MultiColumnList, WindowedListState}, MAX_WIDTH, diff --git a/applications/tari_console_wallet/src/ui/components/transactions_tab.rs b/applications/tari_console_wallet/src/ui/components/transactions_tab.rs index 9e87cb9080..2674aa4d5f 100644 --- a/applications/tari_console_wallet/src/ui/components/transactions_tab.rs +++ b/applications/tari_console_wallet/src/ui/components/transactions_tab.rs @@ -13,7 +13,7 @@ use tui::{ }; use crate::ui::{ - components::{balance::Balance, Component}, + components::{balance::Balance, styles, Component}, state::{AppState, CompletedTransactionInfo}, widgets::{draw_dialog, MultiColumnList, WindowedListState}, MAX_WIDTH, diff --git a/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs b/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs index dec06f19ca..8e341008c6 100644 --- a/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs +++ b/applications/tari_console_wallet/src/ui/state/wallet_event_monitor.rs @@ -33,7 +33,10 @@ use tari_wallet::{ }; use tokio::sync::{broadcast, RwLock}; -use crate::{notifier::Notifier, ui::state::AppStateInner}; +use crate::{ + notifier::Notifier, + ui::state::{AppStateInner, EventListItem}, +}; const LOG_TARGET: &str = "wallet::console_wallet::wallet_event_monitor"; diff --git a/applications/tari_console_wallet/src/wallet_modes.rs b/applications/tari_console_wallet/src/wallet_modes.rs index c84e41bfd1..c08fbfad56 100644 --- a/applications/tari_console_wallet/src/wallet_modes.rs +++ b/applications/tari_console_wallet/src/wallet_modes.rs @@ -237,7 +237,7 @@ pub fn tui_mode(config: WalletModeConfig, mut wallet: WalletSqlite) -> Result<() .and_then(|c| c.grpc_address.as_ref()) { let grpc = WalletGrpcServer::new(wallet.clone()); - handle.spawn(run_grpc(grpc, *grpc_address)); + handle.spawn(run_grpc(grpc, grpc_address.clone())); } let notifier = Notifier::new(notify_script, handle.clone(), wallet.clone()); diff --git a/applications/tari_merge_mining_proxy/src/proxy.rs b/applications/tari_merge_mining_proxy/src/proxy.rs index eee65199a2..81135b0bd4 100644 --- a/applications/tari_merge_mining_proxy/src/proxy.rs +++ b/applications/tari_merge_mining_proxy/src/proxy.rs @@ -76,20 +76,25 @@ pub struct MergeMiningProxyConfig { } impl TryFrom for MergeMiningProxyConfig { - type Error = std::io::Error; + type Error = String; fn try_from(config: GlobalConfig) -> Result { - let grpc_base_node_address = multiaddr_to_socketaddr(&config.grpc_base_node_address)?; - let grpc_console_wallet_address = multiaddr_to_socketaddr(&config.grpc_console_wallet_address)?; + let merge_mining_config = config + .merge_mining_config + .ok_or_else(|| "Merge mining config settings are missing".to_string())?; + let grpc_base_node_address = multiaddr_to_socketaddr(&merge_mining_config.base_node_grpc_address) + .map_err(|e| format!("Invalid base_node_grpc_address: {}", e))?; + let grpc_console_wallet_address = multiaddr_to_socketaddr(&merge_mining_config.wallet_grpc_address) + .map_err(|e| format!("Invalid wallet_grpc_address: {}", e))?; Ok(Self { network: config.network, - monerod_url: config.monerod_url, - monerod_username: config.monerod_username, - monerod_password: config.monerod_password, - monerod_use_auth: config.monerod_use_auth, + monerod_url: merge_mining_config.monerod_url.clone(), + monerod_username: merge_mining_config.monerod_username, + monerod_password: merge_mining_config.monerod_password, + monerod_use_auth: merge_mining_config.monerod_use_auth, grpc_base_node_address, grpc_console_wallet_address, - proxy_host_address: config.proxy_host_address, + proxy_host_address: merge_mining_config.proxy_host_address, proxy_submit_to_origin: config.proxy_submit_to_origin, wait_for_initial_sync_at_startup: config.wait_for_initial_sync_at_startup, }) diff --git a/applications/tari_mining_node/src/config.rs b/applications/tari_mining_node/src/config.rs index 58ec658d8f..04172b7c9d 100644 --- a/applications/tari_mining_node/src/config.rs +++ b/applications/tari_mining_node/src/config.rs @@ -36,17 +36,17 @@ //! All miner options configured under `[mining_node]` section of //! Tari's `config.toml`. -use std::time::Duration; +use std::{str::FromStr, time::Duration}; use serde::{Deserialize, Serialize}; use tari_app_grpc::tari_rpc::{pow_algo::PowAlgos, NewBlockTemplateRequest, PowAlgo}; use tari_common::NetworkConfigPath; -use tari_comms::utils::multiaddr::multiaddr_to_socketaddr; +use tari_comms::multiaddr::Multiaddr; #[derive(Serialize, Deserialize, Debug)] pub struct MinerConfig { - pub base_node_grpc_address: String, - pub wallet_grpc_address: String, + pub base_node_addr: Multiaddr, + pub wallet_addr: Multiaddr, pub num_mining_threads: usize, pub mine_on_tip_only: bool, pub proof_of_work_algo: ProofOfWork, @@ -69,10 +69,9 @@ impl NetworkConfigPath for MinerConfig { impl Default for MinerConfig { fn default() -> Self { - todo!("use multiaddress_to_socket"); Self { - base_node_grpc_address: "http://127.0.0.1:18142".to_string(), - wallet_grpc_address: "http://127.0.0.1:18143".to_string(), + base_node_addr: Multiaddr::from_str("/ip4/127.0.0.1/tcp/18142").unwrap(), + wallet_addr: Multiaddr::from_str("/ip4/127.0.0.1/tcp/18143").unwrap(), num_mining_threads: num_cpus::get(), mine_on_tip_only: true, proof_of_work_algo: ProofOfWork::Sha3, diff --git a/applications/tari_mining_node/src/difficulty.rs b/applications/tari_mining_node/src/difficulty.rs index b7b5bde508..3d24f7bf24 100644 --- a/applications/tari_mining_node/src/difficulty.rs +++ b/applications/tari_mining_node/src/difficulty.rs @@ -27,8 +27,6 @@ use tari_utilities::ByteArray; use crate::errors::{err_empty, MinerError}; -use crate::errors::{err_empty, MinerError}; - pub type Difficulty = u64; pub struct BlockHeaderSha3 { diff --git a/applications/tari_mining_node/src/main.rs b/applications/tari_mining_node/src/main.rs index 21cd67bf72..1698a91e45 100644 --- a/applications/tari_mining_node/src/main.rs +++ b/applications/tari_mining_node/src/main.rs @@ -44,6 +44,7 @@ use tari_common::{ ConfigBootstrap, DefaultConfigLoader, }; +use tari_comms::utils::multiaddr::multiaddr_to_socketaddr; use tari_core::blocks::BlockHeader; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::hex::Hex}; use tokio::{runtime::Runtime, time::sleep}; @@ -91,16 +92,6 @@ async fn main_inner() -> Result<(), ExitCodes> { config.mining_worker_name = global.mining_worker_name.clone(); config.mining_wallet_address = global.mining_wallet_address.clone(); config.mining_pool_address = global.mining_pool_address.clone(); - if let Some(base_node_config) = global.base_node_config { - if let Some(grpc_address) = base_node_config.grpc_address { - config.base_node_grpc_address = format!("http://{}", grpc_address); - } - } - if let Some(wallet_config) = global.wallet_config { - if let Some(grpc_address) = wallet_config.grpc_address { - config.wallet_grpc_address = format!("http://{}", grpc_address); - } - } debug!(target: LOG_TARGET_FILE, "{:?}", bootstrap); debug!(target: LOG_TARGET_FILE, "{:?}", config); @@ -175,13 +166,13 @@ async fn main_inner() -> Result<(), ExitCodes> { let mut blocks_found: u64 = 0; loop { - debug!(target: LOG_TARGET_FILE, "Starting new mining cycle"); + debug!(target: LOG_TARGET, "Starting new mining cycle"); match mining_cycle(&mut node_conn, &mut wallet_conn, &config, &bootstrap).await { err @ Err(MinerError::GrpcConnection(_)) | err @ Err(MinerError::GrpcStatus(_)) => { // Any GRPC error we will try to reconnect with a standard delay error!(target: LOG_TARGET, "Connection error: {:?}", err); loop { - debug!(target: LOG_TARGET_FILE, "Holding for {:?}", config.wait_timeout()); + info!(target: LOG_TARGET, "Holding for {:?}", config.wait_timeout()); sleep(config.wait_timeout()).await; match connect(&config).await { Ok((nc, wc)) => { @@ -197,24 +188,24 @@ async fn main_inner() -> Result<(), ExitCodes> { } }, Err(MinerError::MineUntilHeightReached(h)) => { - info!( + warn!( target: LOG_TARGET, "Prescribed blockchain height {} reached. Aborting ...", h ); return Ok(()); }, Err(MinerError::MinerLostBlock(h)) => { - info!( + warn!( target: LOG_TARGET, "Height {} already mined by other node. Restarting ...", h ); }, Err(err) => { error!(target: LOG_TARGET, "Error: {:?}", err); - debug!(target: LOG_TARGET_FILE, "Holding for {:?}", config.wait_timeout()); sleep(config.wait_timeout()).await; }, Ok(submitted) => { + info!(target: LOG_TARGET, "Found block"); if submitted { blocks_found += 1; } @@ -230,12 +221,12 @@ async fn main_inner() -> Result<(), ExitCodes> { } async fn connect(config: &MinerConfig) -> Result<(BaseNodeClient, WalletClient), MinerError> { - let base_node_addr = config.base_node_grpc_address.clone()?; + let base_node_addr = multiaddr_to_socketaddr(&config.base_node_addr)?; info!(target: LOG_TARGET, "Connecting to base node at {}", base_node_addr); - let node_conn = BaseNodeClient::connect(base_node_addr).await?; - let wallet_addr = config.wallet_grpc_address.clone()?; + let node_conn = BaseNodeClient::connect(format!("http://{}", base_node_addr)).await?; + let wallet_addr = multiaddr_to_socketaddr(&config.wallet_addr)?; info!(target: LOG_TARGET, "Connecting to wallet at {}", wallet_addr); - let wallet_conn = WalletClient::connect(wallet_addr).await?; + let wallet_conn = WalletClient::connect(format!("http://{}", wallet_addr)).await?; Ok((node_conn, wallet_conn)) } @@ -246,7 +237,7 @@ async fn mining_cycle( config: &MinerConfig, bootstrap: &ConfigBootstrap, ) -> Result { - // 1. Receive new block template + debug!(target: LOG_TARGET, "Getting new block template"); let template = node_conn .get_new_block_template(config.pow_algo_request()) .await? @@ -256,8 +247,11 @@ async fn mining_cycle( .clone() .ok_or_else(|| err_empty("new_block_template"))?; - // Validate that template is on tip if config.mine_on_tip_only { + debug!( + target: LOG_TARGET, + "Checking if base node is synced, because mine_on_tip_only is true" + ); let height = block_template .header .as_ref() @@ -266,7 +260,7 @@ async fn mining_cycle( validate_tip(node_conn, height, bootstrap.mine_until_height).await?; } - // 2. Get coinbase from wallet and add it to new block template body + debug!(target: LOG_TARGET, "Getting coinbase"); let request = coinbase_request(&template)?; let coinbase = wallet_conn.get_coinbase(request).await?.into_inner(); let (output, kernel) = extract_outputs_and_kernels(coinbase)?; @@ -281,12 +275,12 @@ async fn mining_cycle( .ok_or_else(|| err_empty("miner_data"))? .target_difficulty; - // 3. Receive new block data + debug!(target: LOG_TARGET, "Asking base node to assemble the MMR roots"); let block_result = node_conn.get_new_block(block_template).await?.into_inner(); let block = block_result.block.ok_or_else(|| err_empty("block"))?; let header = block.clone().header.ok_or_else(|| err_empty("block.header"))?; - // 4. Initialize miner and start receiving mining statuses in the loop + debug!(target: LOG_TARGET, "Initializing miner"); let mut reports = Miner::init_mining(header.clone(), target_difficulty, config.num_mining_threads); let mut reporting_timeout = Instant::now(); let mut block_submitted = false; @@ -316,12 +310,9 @@ async fn mining_cycle( if submit { // Mined a block fitting the difficulty let block_header = BlockHeader::try_from(header.clone()).map_err(MinerError::Conversion)?; - info!( + debug!( target: LOG_TARGET, - "Miner {} found block header {} with difficulty {:?}", - report.miner, - block_header, - report.difficulty, + "Miner found block header {} with difficulty {:?}", block_header, report.difficulty, ); let mut mined_block = block.clone(); mined_block.header = Some(header); @@ -347,8 +338,8 @@ async fn mining_cycle( async fn display_report(report: &MiningReport, config: &MinerConfig) { let hashrate = report.hashes as f64 / report.elapsed.as_micros() as f64; - debug!( - target: LOG_TARGET_FILE, + info!( + target: LOG_TARGET, "Miner {} reported {:.2}MH/s with total {:.2}MH/s over {} threads. Height: {}. Target: {})", report.miner, hashrate, diff --git a/applications/tari_mining_node/src/miner.rs b/applications/tari_mining_node/src/miner.rs index 89ab212450..57a1a03951 100644 --- a/applications/tari_mining_node/src/miner.rs +++ b/applications/tari_mining_node/src/miner.rs @@ -171,7 +171,7 @@ pub fn mining_task( let mut hasher = BlockHeaderSha3::new(header).unwrap(); hasher.random_nonce(); // We're mining over here! - info!(target: LOG_TARGET, "Mining thread {} started", miner); + trace!(target: LOG_TARGET, "Mining thread {} started", miner); // Mining work loop { let difficulty = hasher.difficulty(); @@ -193,7 +193,7 @@ pub fn mining_task( error!(target: LOG_TARGET, "Miner {} failed to send report: {}", miner, err); } waker.wake(); - info!(target: LOG_TARGET, "Mining thread {} stopped", miner); + trace!(target: LOG_TARGET, "Mining thread {} stopped", miner); return; } if hasher.nonce % REPORTING_FREQUENCY == 0 { diff --git a/applications/tari_mining_node/src/stratum/controller.rs b/applications/tari_mining_node/src/stratum/controller.rs index 91405f5bcf..118d3dc747 100644 --- a/applications/tari_mining_node/src/stratum/controller.rs +++ b/applications/tari_mining_node/src/stratum/controller.rs @@ -180,7 +180,7 @@ impl Controller { } fn send_message_submit(&mut self, job_id: u64, hash: String, nonce: u64) -> Result<(), Error> { - info!( + debug!( target: LOG_TARGET, "Submitting share with hash {} and nonce {}", hash, nonce ); @@ -282,15 +282,13 @@ impl Controller { let error = st.error; if let Some(error) = error { // rejected share - self.handle_error(error.clone()); - info!(target: LOG_TARGET, "Rejected"); - debug!(target: LOG_TARGET_FILE, "Share rejected: {:?}", error); + self.handle_error(error); + warn!(target: LOG_TARGET, "Rejected"); let mut stats = self.stats.write().unwrap(); stats.mining_stats.solution_stats.rejected += 1; } else { // accepted share - info!(target: LOG_TARGET, "Accepted"); - debug!(target: LOG_TARGET_FILE, "Share accepted: {:?}", st.status); + debug!(target: LOG_TARGET, "Share accepted: {:?}", st.status); } return Ok(()); } diff --git a/applications/tari_mining_node/src/stratum/stratum_controller/controller.rs b/applications/tari_mining_node/src/stratum/stratum_controller/controller.rs index bd2df5fd3b..70658c4bbc 100644 --- a/applications/tari_mining_node/src/stratum/stratum_controller/controller.rs +++ b/applications/tari_mining_node/src/stratum/stratum_controller/controller.rs @@ -72,7 +72,6 @@ impl Controller { fn display_stats(&mut self, elapsed: Duration) { let mut stats = self.stats.write().unwrap(); - debug!(target: LOG_TARGET_FILE, "{:?}", stats.mining_stats); info!( target: LOG_TARGET, "{}", diff --git a/applications/tari_mining_node/src/stratum/stratum_miner/miner.rs b/applications/tari_mining_node/src/stratum/stratum_miner/miner.rs index 5c37c42c81..436f2cdf11 100644 --- a/applications/tari_mining_node/src/stratum/stratum_miner/miner.rs +++ b/applications/tari_mining_node/src/stratum/stratum_miner/miner.rs @@ -29,10 +29,8 @@ use std::{ }; use log::*; -use tari_core::{ - blocks::BlockHeader, - crypto::tari_utilities::{hex::Hex, Hashable}, -}; +use tari_core::blocks::BlockHeader; +use tari_utilities::{hex::Hex, Hashable}; use crate::{ config::MinerConfig, diff --git a/applications/tari_stratum_transcoder/src/proxy.rs b/applications/tari_stratum_transcoder/src/proxy.rs index f1f59ae36b..d0b4eec220 100644 --- a/applications/tari_stratum_transcoder/src/proxy.rs +++ b/applications/tari_stratum_transcoder/src/proxy.rs @@ -36,7 +36,6 @@ use jsonrpc::error::StandardError; use serde_json as json; use tari_app_grpc::{tari_rpc as grpc, tari_rpc::GetCoinbaseRequest}; use tari_common::{configuration::Network, GlobalConfig}; -use tari_comms::utils::multiaddr::multiaddr_to_socketaddr; use tari_core::blocks::{Block, NewBlockTemplate}; use tari_utilities::{hex::Hex, message_format::MessageFormat}; use tracing::{debug, error}; @@ -64,15 +63,16 @@ pub struct StratumTranscoderProxyConfig { impl TryFrom for StratumTranscoderProxyConfig { type Error = std::io::Error; - fn try_from(config: GlobalConfig) -> Result { - let grpc_base_node_address = multiaddr_to_socketaddr(&config.grpc_base_node_address)?; - let grpc_console_wallet_address = multiaddr_to_socketaddr(&config.grpc_console_wallet_address)?; - Ok(Self { - network: config.network, - grpc_base_node_address, - grpc_console_wallet_address, - transcoder_host_address: config.transcoder_host_address, - }) + fn try_from(_config: GlobalConfig) -> Result { + todo!("fix") + // let grpc_base_node_address = multiaddr_to_socketaddr(&config.grpc_base_node_address)?; + // let grpc_console_wallet_address = multiaddr_to_socketaddr(&config.grpc_console_wallet_address)?; + // Ok(Self { + // network: config.network, + // grpc_base_node_address, + // grpc_console_wallet_address, + // transcoder_host_address: config.transcoder_host_address, + // }) } } diff --git a/applications/tari_validator_node/src/dan_node.rs b/applications/tari_validator_node/src/dan_node.rs index 56eda836bb..fea68289a6 100644 --- a/applications/tari_validator_node/src/dan_node.rs +++ b/applications/tari_validator_node/src/dan_node.rs @@ -352,7 +352,7 @@ impl DanNode { .chain(self.config.force_sync_peers.clone()) .collect(), dns_seeds: self.config.dns_seeds.clone(), - dns_seeds_name_server: self.config.dns_seeds_name_server, + dns_seeds_name_server: self.config.dns_seeds_name_server.clone(), dns_seeds_use_dnssec: self.config.dns_seeds_use_dnssec, auxilary_tcp_listener_address: self.config.auxilary_tcp_listener_address.clone(), } diff --git a/applications/tari_validator_node/src/p2p/rpc/mod.rs b/applications/tari_validator_node/src/p2p/rpc/mod.rs index 8a64670d61..d621ac1026 100644 --- a/applications/tari_validator_node/src/p2p/rpc/mod.rs +++ b/applications/tari_validator_node/src/p2p/rpc/mod.rs @@ -22,8 +22,6 @@ mod service_impl; pub use service_impl::ValidatorNodeRpcServiceImpl; -#[cfg(test)] -mod tests; use tari_comms::protocol::rpc::{Request, Response, RpcStatus}; use tari_comms_rpc_macros::tari_rpc; use tari_dan_core::services::MempoolService; diff --git a/applications/tari_validator_node/src/p2p/rpc/tests.rs b/applications/tari_validator_node/src/p2p/rpc/tests.rs deleted file mode 100644 index 2f748c878e..0000000000 --- a/applications/tari_validator_node/src/p2p/rpc/tests.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021, The Tari Project -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -// following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following -// disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the -// following disclaimer in the documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use tari_comms::protocol::rpc::mock::RpcRequestMock; -use tari_core::test_helpers::create_peer_manager; -use tari_dan_core::services::mocks::{create_mempool_mock, MockMempoolService}; -use tari_test_utils::paths::temp_tari_path; - -use super::ValidatorNodeRpcService; -use crate::{ - p2p::{proto::validator_node as proto, rpc::ValidatorNodeRpcServiceImpl}, - services::mocks::{create_mempool_mock, MockMempoolService}, -}; - -fn setup() -> (ValidatorNodeRpcServiceImpl, RpcRequestMock) { - let mempool = create_mempool_mock(); - let peer_manager = create_peer_manager(temp_tari_path()); - let mock = RpcRequestMock::new(peer_manager); - let service_impl = ValidatorNodeRpcServiceImpl::new(mempool); - (service_impl, mock) -} - -#[tokio::test] -async fn it_works() { - let (service_impl, req_mock) = setup(); - let msg = proto::SubmitInstructionRequest { - asset_public_key: vec![0; 32], - ..Default::default() - }; - let request = req_mock.request_no_context(msg); - let response = service_impl.submit_instruction(request).await.unwrap(); - assert_eq!(response.into_message().status, proto::Status::Accepted as i32); -} diff --git a/base_layer/common_types/src/types/mod.rs b/base_layer/common_types/src/types/mod.rs index 50ad3ce5cc..8aaf7c47de 100644 --- a/base_layer/common_types/src/types/mod.rs +++ b/base_layer/common_types/src/types/mod.rs @@ -35,10 +35,6 @@ use tari_crypto::{ }, }; -mod bullet_rangeproofs; - -pub use bullet_rangeproofs::BulletRangeProof; - pub const BLOCK_HASH_LENGTH: usize = 32; pub type BlockHash = Vec; diff --git a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs index e23ac3172a..59fc4d0e09 100644 --- a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs +++ b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs @@ -27,9 +27,10 @@ use std::{ use log::*; use strum_macros::Display; -use tari_common_types::types::{BlockHash, HashOutput}; +use tari_common_types::types::{BlockHash, HashOutput, PublicKey}; use tari_comms::peer_manager::NodeId; use tari_crypto::tari_utilities::{hash::Hashable, hex::Hex}; +use tari_utilities::ByteArray; use tokio::sync::Semaphore; use crate::{ diff --git a/base_layer/core/src/base_node/comms_interface/local_interface.rs b/base_layer/core/src/base_node/comms_interface/local_interface.rs index 8f8377f526..5e21ccb5fd 100644 --- a/base_layer/core/src/base_node/comms_interface/local_interface.rs +++ b/base_layer/core/src/base_node/comms_interface/local_interface.rs @@ -24,7 +24,7 @@ use std::{ops::RangeInclusive, sync::Arc}; use tari_common_types::{ chain_metadata::ChainMetadata, - types::{BlockHash, Commitment, HashOutput, Signature}, + types::{BlockHash, Commitment, HashOutput, PublicKey, Signature}, }; use tari_service_framework::{reply_channel::SenderService, Service}; use tokio::sync::broadcast; diff --git a/base_layer/core/src/base_node/proto/response.rs b/base_layer/core/src/base_node/proto/response.rs index 276df11ede..918f16fd57 100644 --- a/base_layer/core/src/base_node/proto/response.rs +++ b/base_layer/core/src/base_node/proto/response.rs @@ -25,6 +25,8 @@ use std::{ iter::{FromIterator, Iterator}, }; +use tari_utilities::convert::try_convert_all; + pub use crate::proto::base_node::base_node_service_response::Response as ProtoNodeCommsResponse; use crate::{ base_node::comms_interface as ci, @@ -40,7 +42,6 @@ use crate::{ }, core as core_proto_types, }, - tari_utilities::convert::try_convert_all, }; impl TryInto for ProtoNodeCommsResponse { diff --git a/base_layer/core/src/base_node/proto/wallet_rpc.rs b/base_layer/core/src/base_node/proto/wallet_rpc.rs index 50cc55a0dc..b7dbc83a7a 100644 --- a/base_layer/core/src/base_node/proto/wallet_rpc.rs +++ b/base_layer/core/src/base_node/proto/wallet_rpc.rs @@ -31,11 +31,6 @@ use tari_utilities::ByteArrayError; use crate::proto::{base_node as proto, types}; -use crate::{ - crypto::tari_utilities::ByteArrayError, - proto::{base_node as proto, types}, -}; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct TxSubmissionResponse { pub accepted: bool, diff --git a/base_layer/core/src/base_node/rpc/service.rs b/base_layer/core/src/base_node/rpc/service.rs index 75a9748019..90d8be2fc9 100644 --- a/base_layer/core/src/base_node/rpc/service.rs +++ b/base_layer/core/src/base_node/rpc/service.rs @@ -24,6 +24,7 @@ use std::convert::TryFrom; use tari_common_types::types::Signature; use tari_comms::protocol::rpc::{Request, Response, RpcStatus}; + use crate::{ base_node::{rpc::BaseNodeWalletService, state_machine_service::states::StateInfo, StateMachineHandle}, chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend, PrunedOutput, UtxoMinedInfo}, diff --git a/base_layer/core/src/base_node/state_machine_service/states/horizon_state_sync/error.rs b/base_layer/core/src/base_node/state_machine_service/states/horizon_state_sync/error.rs index 4981f4aa5f..8844d37486 100644 --- a/base_layer/core/src/base_node/state_machine_service/states/horizon_state_sync/error.rs +++ b/base_layer/core/src/base_node/state_machine_service/states/horizon_state_sync/error.rs @@ -37,13 +37,6 @@ use crate::{ validation::ValidationError, }; -use crate::{ - base_node::{comms_interface::CommsInterfaceError, state_machine_service::states::helpers::BaseNodeRequestError}, - chain_storage::{ChainStorageError, MmrTree}, - transactions::transaction::TransactionError, - validation::ValidationError, -}; - #[derive(Debug, Error)] pub enum HorizonSyncError { #[error("Peer sent an invalid response: {0}")] diff --git a/base_layer/core/src/base_node/sync/block_sync/synchronizer.rs b/base_layer/core/src/base_node/sync/block_sync/synchronizer.rs index 00948bb0ee..0a98dd3093 100644 --- a/base_layer/core/src/base_node/sync/block_sync/synchronizer.rs +++ b/base_layer/core/src/base_node/sync/block_sync/synchronizer.rs @@ -30,6 +30,7 @@ use futures::StreamExt; use log::*; use num_format::{Locale, ToFormattedString}; use tari_comms::{connectivity::ConnectivityRequester, peer_manager::NodeId, PeerConnection}; +use tari_utilities::{hex::Hex, Hashable}; use tracing; use super::error::BlockSyncError; diff --git a/base_layer/core/src/base_node/sync/header_sync/synchronizer.rs b/base_layer/core/src/base_node/sync/header_sync/synchronizer.rs index fec814da3b..6774c89b87 100644 --- a/base_layer/core/src/base_node/sync/header_sync/synchronizer.rs +++ b/base_layer/core/src/base_node/sync/header_sync/synchronizer.rs @@ -25,24 +25,6 @@ use std::{ time::{Duration, Instant}, }; -use futures::{future, stream::FuturesUnordered, StreamExt, TryFutureExt}; -use log::*; -use tari_common_types::types::HashOutput; -use tari_comms::{ - connectivity::ConnectivityRequester, - peer_manager::NodeId, - protocol::rpc::{RpcError, RpcHandshakeError}, - PeerConnection, -}; -use tari_utilities::{hex::Hex, Hashable}; -use tracing; - -use std::{ - convert::TryFrom, - sync::Arc, - time::{Duration, Instant}, -}; - use futures::StreamExt; use log::*; use tari_common_types::types::HashOutput; @@ -52,6 +34,7 @@ use tari_comms::{ protocol::rpc::{RpcError, RpcHandshakeError}, PeerConnection, }; +use tari_utilities::{hex::Hex, Hashable}; use tracing; use super::{validator::BlockHeaderSyncValidator, BlockHeaderSyncError}; diff --git a/base_layer/core/src/base_node/sync/header_sync/validator.rs b/base_layer/core/src/base_node/sync/header_sync/validator.rs index 5157286cae..cd455af136 100644 --- a/base_layer/core/src/base_node/sync/header_sync/validator.rs +++ b/base_layer/core/src/base_node/sync/header_sync/validator.rs @@ -25,11 +25,6 @@ use log::*; use tari_common_types::types::HashOutput; use tari_utilities::{epoch_time::EpochTime, hash::Hashable, hex::Hex}; -use std::cmp::Ordering; - -use log::*; -use tari_common_types::types::HashOutput; - use crate::{ base_node::sync::BlockHeaderSyncError, blocks::{BlockHeader, BlockHeaderAccumulatedData, ChainHeader}, diff --git a/base_layer/core/src/base_node/sync/rpc/service.rs b/base_layer/core/src/base_node/sync/rpc/service.rs index f977abef91..0b9c71c75e 100644 --- a/base_layer/core/src/base_node/sync/rpc/service.rs +++ b/base_layer/core/src/base_node/sync/rpc/service.rs @@ -32,28 +32,13 @@ use tari_comms::{ utils, }; use tari_crypto::tari_utilities::hex::Hex; +use tari_utilities::Hashable; use tokio::{ sync::{mpsc, RwLock}, task, }; use tracing::{instrument, span, Instrument, Level}; -use crate::{ - base_node::sync::rpc::{sync_utxos_task::SyncUtxosTask, BaseNodeSyncService}, - chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend, OrNotFound}, - iterators::NonOverlappingIntegerPairIter, - proto, - proto::base_node::{ - FindChainSplitRequest, - FindChainSplitResponse, - SyncBlocksRequest, - SyncHeadersRequest, - SyncKernelsRequest, - SyncUtxosRequest, - SyncUtxosResponse, - }, -}; - use crate::{ base_node::sync::rpc::{sync_utxos_task::SyncUtxosTask, BaseNodeSyncService}, chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend}, @@ -68,7 +53,6 @@ use crate::{ SyncUtxosRequest, SyncUtxosResponse, }, - tari_utilities::Hashable, }; const LOG_TARGET: &str = "c::base_node::sync_rpc"; diff --git a/base_layer/core/src/base_node/sync/rpc/sync_utxos_task.rs b/base_layer/core/src/base_node/sync/rpc/sync_utxos_task.rs index de27744b9f..3ee57ab6ba 100644 --- a/base_layer/core/src/base_node/sync/rpc/sync_utxos_task.rs +++ b/base_layer/core/src/base_node/sync/rpc/sync_utxos_task.rs @@ -22,8 +22,6 @@ use std::{sync::Arc, time::Instant}; -use log::*; - use log::*; use tari_comms::{protocol::rpc::RpcStatus, utils}; use tari_crypto::tari_utilities::{hex::Hex, Hashable}; @@ -36,12 +34,6 @@ use crate::{ proto::base_node::{SyncUtxo, SyncUtxosRequest, SyncUtxosResponse}, }; -use crate::{ - chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend}, - proto, - proto::base_node::{SyncUtxo, SyncUtxosRequest, SyncUtxosResponse}, -}; - const LOG_TARGET: &str = "c::base_node::sync_rpc::sync_utxo_task"; pub(crate) struct SyncUtxosTask { diff --git a/base_layer/core/src/blocks/accumulated_data.rs b/base_layer/core/src/blocks/accumulated_data.rs index 21677ef3fc..9d3e1077e8 100644 --- a/base_layer/core/src/blocks/accumulated_data.rs +++ b/base_layer/core/src/blocks/accumulated_data.rs @@ -48,13 +48,6 @@ use crate::{ transactions::aggregated_body::AggregateBody, }; -use crate::{ - blocks::{error::BlockError, Block, BlockHeader}, - proof_of_work::{AchievedTargetDifficulty, Difficulty, PowAlgorithm}, - tari_utilities::Hashable, - transactions::aggregated_body::AggregateBody, -}; - const LOG_TARGET: &str = "c::bn::acc_data"; #[derive(Debug, Serialize, Deserialize)] @@ -508,14 +501,14 @@ impl ChainBlock { #[cfg(test)] mod test { use super::*; - use crate::blocks::genesis_block::get_weatherwax_genesis_block; mod chain_block { use super::*; + use crate::blocks::genesis_block::get_dibbler_genesis_block; #[test] fn it_converts_to_a_chain_header() { - let genesis = get_weatherwax_genesis_block(); + let genesis = get_dibbler_genesis_block(); let header = genesis.to_chain_header(); assert_eq!(header.header(), genesis.header()); assert_eq!(header.accumulated_data(), genesis.accumulated_data()); @@ -523,7 +516,7 @@ mod test { #[test] fn it_provides_guarantees_about_data_integrity() { - let mut genesis = get_weatherwax_genesis_block(); + let mut genesis = get_dibbler_genesis_block(); // Mess with the header, only possible using the non-public fields genesis.block = Arc::new({ let mut b = (*genesis.block).clone(); diff --git a/base_layer/core/src/blocks/block.rs b/base_layer/core/src/blocks/block.rs index 6702b446a8..30f606d07a 100644 --- a/base_layer/core/src/blocks/block.rs +++ b/base_layer/core/src/blocks/block.rs @@ -32,6 +32,7 @@ use log::*; use serde::{Deserialize, Serialize}; use tari_common_types::types::BlockHash; use tari_crypto::tari_utilities::Hashable; +use tari_utilities::hex::Hex; use thiserror::Error; use crate::{ diff --git a/base_layer/core/src/blocks/block_header.rs b/base_layer/core/src/blocks/block_header.rs index 920355f9f8..815a36f547 100644 --- a/base_layer/core/src/blocks/block_header.rs +++ b/base_layer/core/src/blocks/block_header.rs @@ -297,8 +297,6 @@ pub(crate) mod hash_serializer { use super::*; - use super::*; - #[allow(clippy::ptr_arg)] pub fn serialize(bytes: &BlockHash, serializer: S) -> Result where S: Serializer { @@ -339,7 +337,7 @@ pub(crate) mod hash_serializer { mod test { use tari_crypto::tari_utilities::Hashable; - use crate::{blocks::BlockHeader, tari_utilities::epoch_time::EpochTime}; + use crate::blocks::BlockHeader; #[test] fn from_previous() { let mut h1 = crate::proof_of_work::sha3_test::get_header(); diff --git a/base_layer/core/src/blocks/genesis_block.rs b/base_layer/core/src/blocks/genesis_block.rs index 50b4118890..1882908c21 100644 --- a/base_layer/core/src/blocks/genesis_block.rs +++ b/base_layer/core/src/blocks/genesis_block.rs @@ -30,17 +30,6 @@ use tari_crypto::{ tari_utilities::{hash::Hashable, hex::*}, }; -// This file is used to store the genesis block -use std::sync::Arc; - -use chrono::DateTime; -use tari_common::configuration::Network; -use tari_common_types::types::{BulletRangeProof, Commitment, PrivateKey, PublicKey, Signature, BLOCK_HASH_LENGTH}; -use tari_crypto::{ - script::TariScript, - tari_utilities::{hash::Hashable, hex::*}, -}; - use crate::{ blocks::{block::Block, BlockHeader, BlockHeaderAccumulatedData, ChainBlock}, proof_of_work::{PowAlgorithm, ProofOfWork}, @@ -51,17 +40,19 @@ use crate::{ }, }; +const LATEST_BLOCK_VERSION: u16 = 2; + /// Returns the genesis block for the selected network. pub fn get_genesis_block(network: Network) -> ChainBlock { use Network::*; match network { MainNet => get_mainnet_genesis_block(), - Ridcully => get_ridcully_genesis_block(), - Stibbons => unimplemented!(), - Weatherwax => get_weatherwax_genesis_block(), + Ridcully => unimplemented!("No longer supported"), + Stibbons => unimplemented!("No longer supported"), + Weatherwax => unimplemented!("No longer supported"), LocalNet => get_igor_genesis_block(), - Igor => get_igor_genesis_block(), Dibbler => get_dibbler_genesis_block(), + Igor => get_igor_genesis_block(), } } @@ -69,212 +60,6 @@ pub fn get_mainnet_genesis_block() -> ChainBlock { unimplemented!() } -pub fn get_weatherwax_genesis_block() -> ChainBlock { - // lets get the block - let block = get_weatherwax_genesis_block_raw(); - // Lets load in the weatherwax faucet transactions - // let mut utxos = Vec::new(); - // let file = include_str!("faucets/weatherwax_faucet.json"); - // // last 2 lines are used for the kernel creation - // let mut kernel: Option = None; - // let mut counter = 1; - // for line in file.lines() { - // if counter < 4001 { - // let utxo: TransactionOutput = serde_json::from_str(line).unwrap(); - // utxos.push(utxo); - // } else { - // kernel = Some(serde_json::from_str(line).unwrap()); - // } - // counter += 1; - // } - // fix headers to new mmr roots after adding utxos - // block.header.output_mr = from_hex("a939fda2579fb0b6fd906111f61e37c5ea23eccd8b737eb7da517fde71a98078").unwrap(); - // block.header.witness_mr = from_hex("90a557390ce185318375546cb1244ffda3bb62274cce591880e2d012c38b1755").unwrap(); - // block.header.output_mmr_size += 4000; - // block.header.kernel_mr = from_hex("f5e08e66e9c0e5e3818d96a694f4f6eafd689f38cea2e52e771eab2cc7a3941a").unwrap(); - // block.header.kernel_mmr_size += 1; - // block.body.add_outputs(&mut utxos); - // block.body.add_kernels(&mut vec![kernel.unwrap()]); - let accumulated_data = BlockHeaderAccumulatedData { - hash: block.hash(), - total_kernel_offset: block.header.total_kernel_offset.clone(), - achieved_difficulty: 1.into(), - total_accumulated_difficulty: 1, - accumulated_monero_difficulty: 1.into(), - accumulated_sha_difficulty: 1.into(), - target_difficulty: 1.into(), - }; - ChainBlock::try_construct(Arc::new(block), accumulated_data).unwrap() -} - -fn get_weatherwax_genesis_block_raw() -> Block { - let sig = Signature::new( - PublicKey::from_hex("f2139d1cdbcfa670bbb60d4d03d9d50b0a522e674b11280e8064f6dc30e84133").unwrap(), - PrivateKey::from_hex("3ff7522d9a744ebf99c7b6664c0e2c8c64d2a7b902a98b78964766f9f7f2b107").unwrap(), - ); - let mut body = AggregateBody::new( - vec![], - vec![TransactionOutput { - features: OutputFeatures::create_coinbase(60), - commitment: Commitment::from_hex( - "fadafb12de96d90042dcbf839985aadb7ae88baa3446d5c6a17937ef2b36783e", - ) - .unwrap(), - proof: BulletRangeProof::from_hex("845c947cbf23683f6ff6a56d0aa55fca14a618f7476d4e29348c5cbadf2bb062b8da701a0f058eb69c88492895c3f034db194f6d1b2d29ea83c1a68cbdd19a3f90ae080cfd0315bb20cd05a462c4e06e708b015da1d70c0f87e8c7413b579008e43a6c8dc1edb72b0b67612e897d251ec55798184ff35c80d18262e98034677b73f2dcc7ae25c9119900aadaf04a16068bf57b9e8b9bb694331750dc8acc6102b8961be183419dce2f96c48ced9892e4cdb091dcda0d6a0bb4ed94fc0c63ca065f25ce1e560504d49970bcaac007f33368f15ffa0dd3f56bf799b66fa684fe0fbeb882aee4a6fe05a3ca7c488a6ba22779a42f0f5d875175b8ebc517dd49df20b4f04f027b7d22b7c62cb93727f35c18a0b776d95fac4ff5405d6ed3dbb7613152178cecea4b712aa6e6701804ded71d94cf67de2e86ae401499b39de81b7344185c9eb3bd570ac6121143a690f118d9413abb894729b6b3e057f4771b2c2204285151a56695257992f2b0331f27066270718b37ab472c339d2560c1f6559f3c4ce31ec7f7e2acdbebb1715951d8177283a1ccc2f393ce292956de5db4afde419c0264d5cc4758e6e2c07b730ad43819f3761658d63794cc8071b30f9d7cd622bece4f086b0ca6a04fee888856084543a99848f06334acf48cace58e5ef8c85412017c400b4ec92481ba6d745915aef40531db73d1d84d07d7fce25737629e0fc4ee71e7d505bfd382e362cd1ac03a67c93b8f20cb4285ce240cf1e000d48332ba32e713d6cdf6266449a0a156241f7b1b36753f46f1ecb8b1836625508c5f31bc7ebc1d7cd634272be02cc109bf86983a0591bf00bacea1287233fc12324846398be07d44e8e14bd78cd548415f6de60b5a0c43a84ac29f6a8ac0b1b748dd07a8a4124625e1055b5f5b19da79c319b6e465ca5df0eb70cb4e3dc399891ce90b").unwrap(), - // For genesis block: A default script can never be spent, intentionally - script: TariScript::default(), - // Script offset never checked for coinbase, thus can use default - sender_offset_public_key: Default::default(), - // For genesis block: Metadata signature will never be checked - metadata_signature: Default::default(), - }], - vec![TransactionKernel { - features: KernelFeatures::COINBASE_KERNEL, - fee: MicroTari(0), - lock_height: 0, - excess: Commitment::from_hex( - "f472cc347a1006b7390f9c93b3c62fba334fd99f6c9c1daf9302646cd4781f61", - ) - .unwrap(), - excess_sig: sig, - }], - ); - body.sort(1); - // set genesis timestamp - let genesis = DateTime::parse_from_rfc2822("07 Jul 2021 06:00:00 +0200").unwrap(); - let timestamp = genesis.timestamp() as u64; - Block { - header: BlockHeader { - version: 0, - height: 0, - prev_hash: vec![0; BLOCK_HASH_LENGTH], - timestamp: timestamp.into(), - output_mr: from_hex("dcc44f39b65e5e1e526887e7d56f7b85e2ea44bd29bc5bc195e6e015d19e1c06").unwrap(), - witness_mr: from_hex("e4d7dab49a66358379a901b9a36c10f070aa9d7bdc8ae752947b6fc4e55d255f").unwrap(), - output_mmr_size: 1, - kernel_mr: from_hex("589bc62ac5d9139f921c68b8075c32d8d130024acaf3196d1d6a89df601e2bcf").unwrap(), - kernel_mmr_size: 1, - input_mr: vec![0; BLOCK_HASH_LENGTH], - total_kernel_offset: PrivateKey::from_hex( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap(), - total_script_offset: PrivateKey::from_hex( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap(), - nonce: 0, - pow: ProofOfWork { - pow_algo: PowAlgorithm::Sha3, - pow_data: vec![], - }, - }, - body, - } -} - -pub fn get_ridcully_genesis_block() -> ChainBlock { - // lets get the block - let mut block = get_ridcully_genesis_block_raw(); - // Lets load in the ridcully faucet tx's - let mut utxos = Vec::new(); - let file = include_str!("faucets/ridcully_faucet.json"); - // last 2 lines are used for the kernel creation - let mut kernel: Option = None; - let mut counter = 1; - for line in file.lines() { - if counter < 4001 { - let utxo: TransactionOutput = serde_json::from_str(line).unwrap(); - utxos.push(utxo); - } else { - kernel = Some(serde_json::from_str(line).unwrap()); - } - counter += 1; - } - // fix headers to new mmr roots after adding utxos - block.header.output_mr = from_hex("a939fda2579fb0b6fd906111f61e37c5ea23eccd8b737eb7da517fde71a98078").unwrap(); - block.header.witness_mr = from_hex("90a557390ce185318375546cb1244ffda3bb62274cce591880e2d012c38b1755").unwrap(); - block.header.output_mmr_size += 4000; - block.header.kernel_mr = from_hex("f5e08e66e9c0e5e3818d96a694f4f6eafd689f38cea2e52e771eab2cc7a3941a").unwrap(); - block.header.kernel_mmr_size += 1; - block.body.add_outputs(&mut utxos); - block.body.add_kernels(&mut vec![kernel.unwrap()]); - let accumulated_data = BlockHeaderAccumulatedData { - hash: block.hash(), - total_kernel_offset: block.header.total_kernel_offset.clone(), - achieved_difficulty: 1.into(), - total_accumulated_difficulty: 1, - accumulated_monero_difficulty: 1.into(), - accumulated_sha_difficulty: 1.into(), - target_difficulty: 1.into(), - }; - // NOTE: Panic is impossible, accumulated_data hash is set from block - ChainBlock::try_construct(Arc::new(block), accumulated_data).unwrap() -} - -fn get_ridcully_genesis_block_raw() -> Block { - let sig = Signature::new( - PublicKey::from_hex("f2139d1cdbcfa670bbb60d4d03d9d50b0a522e674b11280e8064f6dc30e84133").unwrap(), - PrivateKey::from_hex("3ff7522d9a744ebf99c7b6664c0e2c8c64d2a7b902a98b78964766f9f7f2b107").unwrap(), - ); - let mut body = AggregateBody::new( - vec![], - vec![TransactionOutput { - features: OutputFeatures::create_coinbase(60), - commitment: Commitment::from_hex( - "fadafb12de96d90042dcbf839985aadb7ae88baa3446d5c6a17937ef2b36783e", - ) - .unwrap(), - proof: BulletRangeProof::from_hex("845c947cbf23683f6ff6a56d0aa55fca14a618f7476d4e29348c5cbadf2bb062b8da701a0f058eb69c88492895c3f034db194f6d1b2d29ea83c1a68cbdd19a3f90ae080cfd0315bb20cd05a462c4e06e708b015da1d70c0f87e8c7413b579008e43a6c8dc1edb72b0b67612e897d251ec55798184ff35c80d18262e98034677b73f2dcc7ae25c9119900aadaf04a16068bf57b9e8b9bb694331750dc8acc6102b8961be183419dce2f96c48ced9892e4cdb091dcda0d6a0bb4ed94fc0c63ca065f25ce1e560504d49970bcaac007f33368f15ffa0dd3f56bf799b66fa684fe0fbeb882aee4a6fe05a3ca7c488a6ba22779a42f0f5d875175b8ebc517dd49df20b4f04f027b7d22b7c62cb93727f35c18a0b776d95fac4ff5405d6ed3dbb7613152178cecea4b712aa6e6701804ded71d94cf67de2e86ae401499b39de81b7344185c9eb3bd570ac6121143a690f118d9413abb894729b6b3e057f4771b2c2204285151a56695257992f2b0331f27066270718b37ab472c339d2560c1f6559f3c4ce31ec7f7e2acdbebb1715951d8177283a1ccc2f393ce292956de5db4afde419c0264d5cc4758e6e2c07b730ad43819f3761658d63794cc8071b30f9d7cd622bece4f086b0ca6a04fee888856084543a99848f06334acf48cace58e5ef8c85412017c400b4ec92481ba6d745915aef40531db73d1d84d07d7fce25737629e0fc4ee71e7d505bfd382e362cd1ac03a67c93b8f20cb4285ce240cf1e000d48332ba32e713d6cdf6266449a0a156241f7b1b36753f46f1ecb8b1836625508c5f31bc7ebc1d7cd634272be02cc109bf86983a0591bf00bacea1287233fc12324846398be07d44e8e14bd78cd548415f6de60b5a0c43a84ac29f6a8ac0b1b748dd07a8a4124625e1055b5f5b19da79c319b6e465ca5df0eb70cb4e3dc399891ce90b").unwrap(), - // For genesis block: A default script can never be spent, intentionally - script: TariScript::default(), - // Script offset never checked for coinbase, thus can use default - sender_offset_public_key: Default::default(), - // For genesis block: Metadata signature will never be checked - metadata_signature: Default::default(), - }], - vec![TransactionKernel { - features: KernelFeatures::COINBASE_KERNEL, - fee: MicroTari(0), - lock_height: 0, - excess: Commitment::from_hex( - "f472cc347a1006b7390f9c93b3c62fba334fd99f6c9c1daf9302646cd4781f61", - ) - .unwrap(), - excess_sig: sig, - }], - ); - body.sort(1); - Block { - header: BlockHeader { - version: 0, - height: 0, - prev_hash: vec![0; BLOCK_HASH_LENGTH], - timestamp: 1_603_843_200.into(), // 10/28/2020 @ 12:00am (UTC) - output_mr: from_hex("dcc44f39b65e5e1e526887e7d56f7b85e2ea44bd29bc5bc195e6e015d19e1c06").unwrap(), - witness_mr: from_hex("e4d7dab49a66358379a901b9a36c10f070aa9d7bdc8ae752947b6fc4e55d255f").unwrap(), - output_mmr_size: 1, - kernel_mr: from_hex("589bc62ac5d9139f921c68b8075c32d8d130024acaf3196d1d6a89df601e2bcf").unwrap(), - kernel_mmr_size: 1, - input_mr: vec![0; BLOCK_HASH_LENGTH], - total_kernel_offset: PrivateKey::from_hex( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap(), - total_script_offset: PrivateKey::from_hex( - "0000000000000000000000000000000000000000000000000000000000000000", - ) - .unwrap(), - nonce: 0, - pow: ProofOfWork { - pow_algo: PowAlgorithm::Sha3, - pow_data: vec![], - }, - }, - body, - } -} - pub fn get_igor_genesis_block() -> ChainBlock { // lets get the block let block = get_igor_genesis_block_raw(); @@ -449,24 +234,6 @@ mod test { use super::*; use crate::transactions::CryptoFactories; - #[test] - fn weatherwax_genesis_sanity_check() { - let block = get_weatherwax_genesis_block(); - assert_eq!(block.block().body.outputs().len(), 1); - - let factories = CryptoFactories::default(); - let coinbase = block.block().body.outputs().first().unwrap(); - assert!(coinbase.is_coinbase()); - coinbase.verify_range_proof(&factories.range_proof).unwrap(); - assert_eq!(block.block().body.kernels().len(), 1); - for kernel in block.block().body.kernels() { - kernel.verify_signature().unwrap(); - } - - let coinbase_kernel = block.block().body.kernels().first().unwrap(); - assert!(coinbase_kernel.features.contains(KernelFeatures::COINBASE_KERNEL)); - } - #[test] fn dibbler_genesis_sanity_check() { let block = get_dibbler_genesis_block(); diff --git a/base_layer/core/src/chain_storage/async_db.rs b/base_layer/core/src/chain_storage/async_db.rs index bf4df3a9a4..6fc32f5955 100644 --- a/base_layer/core/src/chain_storage/async_db.rs +++ b/base_layer/core/src/chain_storage/async_db.rs @@ -33,19 +33,8 @@ use tari_common_types::{ chain_metadata::ChainMetadata, types::{BlockHash, Commitment, HashOutput, PublicKey, Signature}, }; -use tari_mmr::pruned_hashset::PrunedHashSet; use tari_utilities::epoch_time::EpochTime; -use std::{mem, ops::RangeBounds, sync::Arc, time::Instant}; - -use croaring::Bitmap; -use log::*; -use rand::{rngs::OsRng, RngCore}; -use tari_common_types::{ - chain_metadata::ChainMetadata, - types::{BlockHash, Commitment, HashOutput, Signature}, -}; - use crate::{ blocks::{ Block, diff --git a/base_layer/core/src/chain_storage/blockchain_backend.rs b/base_layer/core/src/chain_storage/blockchain_backend.rs index 3ac88cf6f7..05b984c02f 100644 --- a/base_layer/core/src/chain_storage/blockchain_backend.rs +++ b/base_layer/core/src/chain_storage/blockchain_backend.rs @@ -1,7 +1,9 @@ +use std::ops::Range; + use croaring::Bitmap; use tari_common_types::{ chain_metadata::ChainMetadata, - types::{Commitment, HashOutput, Signature}, + types::{Commitment, HashOutput, PublicKey, Signature}, }; use tari_mmr::Hash; diff --git a/base_layer/core/src/chain_storage/blockchain_database.rs b/base_layer/core/src/chain_storage/blockchain_database.rs index 6c282e98eb..1276ffadf0 100644 --- a/base_layer/core/src/chain_storage/blockchain_database.rs +++ b/base_layer/core/src/chain_storage/blockchain_database.rs @@ -26,7 +26,7 @@ use std::{ collections::VecDeque, convert::TryFrom, mem, - ops::{Bound, RangeBounds}, + ops::{Bound, Range, RangeBounds}, sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}, time::Instant, }; @@ -35,10 +35,11 @@ use croaring::Bitmap; use log::*; use tari_common_types::{ chain_metadata::ChainMetadata, - types::{BlockHash, Commitment, HashDigest, HashOutput, Signature}, + types::{BlockHash, Commitment, HashDigest, HashOutput, PublicKey, Signature}, }; use tari_crypto::tari_utilities::{hex::Hex, ByteArray, Hashable}; use tari_mmr::{pruned_hashset::PrunedHashSet, MerkleMountainRange, MutableMmr}; +use tari_utilities::epoch_time::EpochTime; use crate::{ blocks::{ diff --git a/base_layer/core/src/chain_storage/db_transaction.rs b/base_layer/core/src/chain_storage/db_transaction.rs index 4c1419f97c..a2dd5df79c 100644 --- a/base_layer/core/src/chain_storage/db_transaction.rs +++ b/base_layer/core/src/chain_storage/db_transaction.rs @@ -39,12 +39,6 @@ use crate::{ transactions::transaction::{TransactionKernel, TransactionOutput}, }; -use crate::{ - blocks::{Block, BlockHeader, BlockHeaderAccumulatedData, ChainBlock, ChainHeader}, - chain_storage::{error::ChainStorageError, MmrTree}, - transactions::transaction::{TransactionKernel, TransactionOutput}, -}; - #[derive(Debug)] pub struct DbTransaction { operations: Vec, diff --git a/base_layer/core/src/chain_storage/lmdb_db/lmdb.rs b/base_layer/core/src/chain_storage/lmdb_db/lmdb.rs index 26b12b3a41..607f97dfc4 100644 --- a/base_layer/core/src/chain_storage/lmdb_db/lmdb.rs +++ b/base_layer/core/src/chain_storage/lmdb_db/lmdb.rs @@ -39,7 +39,14 @@ use log::*; use serde::{de::DeserializeOwned, Serialize}; use tari_crypto::tari_utilities::hex::to_hex; -use crate::chain_storage::{error::ChainStorageError, OrNotFound}; +use crate::chain_storage::{ + error::ChainStorageError, + lmdb_db::{ + helpers::{deserialize, serialize}, + key_prefix_cursor::KeyPrefixCursor, + }, + OrNotFound, +}; pub const LOG_TARGET: &str = "c::cs::lmdb_db::lmdb"; diff --git a/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs b/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs index 9500332ffd..0ae98d3b91 100644 --- a/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs +++ b/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs @@ -25,8 +25,19 @@ #![allow(clippy::ptr_arg)] -use std::{fmt, fs, fs::File, ops::Deref, path::Path, sync::Arc, time::Instant}; +use std::{ + fmt, + fmt::Formatter, + fs, + fs::File, + mem, + ops::{Deref, Range}, + path::Path, + sync::Arc, + time::Instant, +}; +use blake2::Digest; use croaring::Bitmap; use fs2::FileExt; use lmdb_zero::{open, ConstTransaction, Database, Environment, ReadTransaction, WriteTransaction}; @@ -34,11 +45,12 @@ use log::*; use serde::{Deserialize, Serialize}; use tari_common_types::{ chain_metadata::ChainMetadata, - types::{BlockHash, Commitment, HashDigest, HashOutput, Signature, BLOCK_HASH_LENGTH}, + types::{BlockHash, Commitment, HashDigest, HashOutput, PublicKey, Signature, BLOCK_HASH_LENGTH}, }; use tari_crypto::tari_utilities::{hash::Hashable, hex::Hex, ByteArray}; use tari_mmr::{Hash, MerkleMountainRange, MutableMmr}; use tari_storage::lmdb_store::{db, LMDBBuilder, LMDBConfig, LMDBStore}; +use tari_utilities::hex::to_hex; use crate::{ blocks::{ @@ -416,7 +428,7 @@ impl LMDBDatabase { Ok(()) } - fn all_dbs(&self) -> [(&'static str, &DatabaseRef); 21] { + fn all_dbs(&self) -> [(&'static str, &DatabaseRef); 22] { [ ("metadata_db", &self.metadata_db), ("headers_db", &self.headers_db), @@ -1142,9 +1154,7 @@ impl LMDBDatabase { .. } = data; - let mut output_mmr = MutableMmr::::new(pruned_output_set, Bitmap::create())?; let mut kernel_mmr = MerkleMountainRange::::new(pruned_kernel_set); - let mut witness_mmr = MerkleMountainRange::::new(pruned_proof_set); for kernel in kernels { total_kernel_sum = &total_kernel_sum + &kernel.excess; @@ -1157,6 +1167,21 @@ impl LMDBDatabase { self.insert_kernel(txn, &block_hash, &kernel, pos as u32)?; } + let mut output_mmr = MutableMmr::::new(pruned_output_set, Bitmap::create())?; + let mut witness_mmr = MerkleMountainRange::::new(pruned_proof_set); + for output in outputs { + output_mmr.push(output.hash())?; + witness_mmr.push(output.witness_hash())?; + debug!(target: LOG_TARGET, "Inserting output `{}`", output.commitment.to_hex()); + self.insert_output( + txn, + &block_hash, + header.height, + &output, + (witness_mmr.get_leaf_count()? - 1) as u32, + )?; + } + // unique_id_index expects inputs to be inserted before outputs for input in inputs { let index = self @@ -1172,20 +1197,6 @@ impl LMDBDatabase { self.insert_input(txn, current_header_at_height.height, block_hash.clone(), input, index)?; } - for output in outputs { - total_utxo_sum = &total_utxo_sum + &output.commitment; - output_mmr.push(output.hash())?; - witness_mmr.push(output.witness_hash())?; - debug!(target: LOG_TARGET, "Inserting output `{}`", output.commitment.to_hex()); - self.insert_output( - txn, - &block_hash, - header.height, - &output, - (witness_mmr.get_leaf_count()? - 1) as u32, - )?; - } - // Merge current deletions with the tip bitmap let deleted_at_current_height = output_mmr.deleted().clone(); // Merge the new indexes with the blockchain deleted bitmap @@ -1294,8 +1305,7 @@ impl LMDBDatabase { txn: &WriteTransaction<'_>, block_hash: &BlockHash, ) -> Result<(), ChainStorageError> { - let inputs = - lmdb_delete_keys_starting_with::(txn, &self.inputs_db, block_hash.to_hex().as_str())?; + let inputs = lmdb_delete_keys_starting_with::(txn, &self.inputs_db, block_hash)?; debug!(target: LOG_TARGET, "Deleted {} input(s)", inputs.len()); Ok(()) } @@ -1395,6 +1405,63 @@ impl LMDBDatabase { Ok(()) } + + fn fetch_output_in_txn( + &self, + txn: &ConstTransaction<'_>, + output_hash: &HashOutput, + ) -> Result, ChainStorageError> { + if let Some((index, key)) = + lmdb_get::<_, (u32, Vec)>(txn, &self.txos_hash_to_index_db, output_hash.as_slice())? + { + debug!( + target: LOG_TARGET, + "Fetch output: {} Found ({}, {})", + output_hash.to_hex(), + index, + key.to_hex() + ); + match lmdb_get::<_, TransactionOutputRowData>(txn, &self.utxos_db, &key)? { + Some(TransactionOutputRowData { + output: Some(o), + mmr_position, + mined_height, + header_hash, + .. + }) => Ok(Some(UtxoMinedInfo { + output: PrunedOutput::NotPruned { output: o }, + mmr_position, + mined_height, + header_hash, + })), + Some(TransactionOutputRowData { + output: None, + mmr_position, + mined_height, + hash, + witness_hash, + header_hash, + .. + }) => Ok(Some(UtxoMinedInfo { + output: PrunedOutput::Pruned { + output_hash: hash, + witness_hash, + }, + mmr_position, + mined_height, + header_hash, + })), + _ => Ok(None), + } + } else { + debug!( + target: LOG_TARGET, + "Fetch output: {} NOT found in index", + output_hash.to_hex() + ); + Ok(None) + } + } } pub fn create_recovery_lmdb_database>(path: P) -> Result<(), ChainStorageError> { @@ -1706,11 +1773,10 @@ impl BlockchainBackend for LMDBDatabase { fn fetch_kernels_in_block(&self, header_hash: &HashOutput) -> Result, ChainStorageError> { let txn = self.read_transaction()?; - let kernels = lmdb_fetch_keys_starting_with(header_hash.to_hex().as_str(), &txn, &self.kernels_db)? + Ok(lmdb_fetch_matching_after(&txn, &self.kernels_db, header_hash)? .into_iter() .map(|f: TransactionKernelRowData| f.kernel) - .collect(); - Ok(kernels) + .collect()) } fn fetch_kernel_by_excess( @@ -1755,29 +1821,25 @@ impl BlockchainBackend for LMDBDatabase { ) -> Result<(Vec, Bitmap), ChainStorageError> { let txn = self.read_transaction()?; - let utxos = lmdb_fetch_keys_starting_with::( - header_hash.to_hex().as_str(), - &txn, - &self.utxos_db, - )? - .into_iter() - .map(|row| { - if deleted.map(|b| b.contains(row.mmr_position)).unwrap_or(false) { - return PrunedOutput::Pruned { - output_hash: row.hash, - witness_hash: row.witness_hash, - }; - } - if let Some(output) = row.output { - PrunedOutput::NotPruned { output } - } else { - PrunedOutput::Pruned { - output_hash: row.hash, - witness_hash: row.witness_hash, + let utxos = lmdb_fetch_matching_after::(&txn, &self.utxos_db, header_hash)? + .into_iter() + .map(|row| { + if deleted.map(|b| b.contains(row.mmr_position)).unwrap_or(false) { + return PrunedOutput::Pruned { + output_hash: row.hash, + witness_hash: row.witness_hash, + }; } - } - }) - .collect(); + if let Some(output) = row.output { + PrunedOutput::NotPruned { output } + } else { + PrunedOutput::Pruned { + output_hash: row.hash, + witness_hash: row.witness_hash, + } + } + }) + .collect(); let height = self.fetch_height_from_hash(&txn, header_hash)? diff --git a/base_layer/core/src/chain_storage/lmdb_db/mod.rs b/base_layer/core/src/chain_storage/lmdb_db/mod.rs index a7eeba11e0..cfbc276009 100644 --- a/base_layer/core/src/chain_storage/lmdb_db/mod.rs +++ b/base_layer/core/src/chain_storage/lmdb_db/mod.rs @@ -26,6 +26,8 @@ use tari_common_types::types::HashOutput; use crate::transactions::transaction::{TransactionInput, TransactionKernel, TransactionOutput}; +pub(crate) mod helpers; +pub(crate) mod key_prefix_cursor; mod lmdb; #[allow(clippy::module_inception)] mod lmdb_db; diff --git a/base_layer/core/src/chain_storage/pruned_output.rs b/base_layer/core/src/chain_storage/pruned_output.rs index 6d80d99552..6686285214 100644 --- a/base_layer/core/src/chain_storage/pruned_output.rs +++ b/base_layer/core/src/chain_storage/pruned_output.rs @@ -19,6 +19,8 @@ // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +use serde::{Deserialize, Serialize}; use tari_common_types::types::HashOutput; use tari_crypto::tari_utilities::Hashable; diff --git a/base_layer/core/src/chain_storage/tests/blockchain_database.rs b/base_layer/core/src/chain_storage/tests/blockchain_database.rs index 289ffea382..b663af15ad 100644 --- a/base_layer/core/src/chain_storage/tests/blockchain_database.rs +++ b/base_layer/core/src/chain_storage/tests/blockchain_database.rs @@ -22,16 +22,15 @@ use std::sync::Arc; -use tari_common::configuration::Network; +use rand::rngs::OsRng; +use tari_crypto::keys::PublicKey as PublicKeyTrait; use tari_test_utils::unpack_enum; +use tari_utilities::Hashable; use crate::{ blocks::{Block, BlockHeader, BlockHeaderAccumulatedData, ChainHeader, NewBlockTemplate}, chain_storage::{BlockchainDatabase, ChainStorageError}, - consensus::ConsensusManager, - crypto::tari_utilities::hex::Hex, proof_of_work::{AchievedTargetDifficulty, Difficulty, PowAlgorithm}, - tari_utilities::Hashable, test_helpers::{ blockchain::{create_new_blockchain, create_store_with_consensus_and_validators, TempDatabase}, create_block, @@ -376,7 +375,10 @@ mod fetch_block_hashes_from_header_tip { } mod add_block { + use tari_common_types::types::PublicKey; + use super::*; + use crate::{transactions::transaction::OutputFlags, validation::ValidationError}; #[test] fn it_rejects_duplicate_commitments_in_the_utxo_set() { @@ -584,7 +586,7 @@ mod fetch_total_size_stats { let stats = db.fetch_total_size_stats().unwrap(); assert_eq!( stats.sizes().iter().find(|s| s.name == "utxos_db").unwrap().num_entries, - 4003 + 2 ); } } @@ -634,14 +636,14 @@ mod fetch_header_containing_utxo_mmr { fn it_returns_genesis() { let db = setup(); let genesis = db.fetch_block(0).unwrap(); - assert_eq!(genesis.block().body.outputs().len(), 4001); - let mut mmr_position = 0; - genesis.block().body.outputs().iter().for_each(|_| { - let header = db.fetch_header_containing_utxo_mmr(mmr_position).unwrap(); - assert_eq!(header.height(), 0); - mmr_position += 1; - }); - let err = db.fetch_header_containing_utxo_mmr(4002).unwrap_err(); + assert_eq!(genesis.block().body.outputs().len(), 1); + // let mut mmr_position = 0; + // genesis.block().body.outputs().iter().for_each(|_| { + // let header = db.fetch_header_containing_utxo_mmr(mmr_position).unwrap(); + // assert_eq!(header.height(), 0); + // mmr_position += 1; + // }); + let err = db.fetch_header_containing_utxo_mmr(2).unwrap_err(); matches!(err, ChainStorageError::ValueNotFound { .. }); } @@ -670,14 +672,14 @@ mod fetch_header_containing_kernel_mmr { fn it_returns_genesis() { let db = setup(); let genesis = db.fetch_block(0).unwrap(); - assert_eq!(genesis.block().body.kernels().len(), 2); - let mut mmr_position = 0; - genesis.block().body.kernels().iter().for_each(|_| { - let header = db.fetch_header_containing_kernel_mmr(mmr_position).unwrap(); - assert_eq!(header.height(), 0); - mmr_position += 1; - }); - let err = db.fetch_header_containing_kernel_mmr(3).unwrap_err(); + assert_eq!(genesis.block().body.kernels().len(), 1); + // let mut mmr_position = 0; + // genesis.block().body.kernels().iter().for_each(|_| { + // let header = db.fetch_header_containing_kernel_mmr(mmr_position).unwrap(); + // assert_eq!(header.height(), 0); + // mmr_position += 1; + // }); + let err = db.fetch_header_containing_kernel_mmr(2).unwrap_err(); matches!(err, ChainStorageError::ValueNotFound { .. }); } @@ -689,7 +691,7 @@ mod fetch_header_containing_kernel_mmr { let num_genesis_kernels = genesis.block().body.kernels().len() as u64; let (txns, _) = schema_to_transaction(&[txn_schema!(from: vec![outputs[0].clone()], to: vec![50 * T])]); - let (block, _) = create_next_block(&blocks[0], txns); + let (block, _) = create_next_block(&db, &blocks[0], txns); db.add_block(block).unwrap(); let _ = add_many_chained_blocks(3, &db); @@ -736,7 +738,7 @@ mod clear_all_pending_headers { let mut prev_block = Arc::new(prev_block.try_into_block().unwrap()); let headers = (0..5) .map(|_| { - let (block, _) = create_next_block(&prev_block, vec![]); + let (block, _) = create_next_block(&db, &prev_block, vec![]); let accum = BlockHeaderAccumulatedData::builder(&prev_accum) .with_hash(block.hash()) .with_achieved_target_difficulty( @@ -764,7 +766,11 @@ mod clear_all_pending_headers { } mod fetch_utxo_by_unique_id { + use tari_common_types::types::CommitmentFactory; + use tari_crypto::{commitment::HomomorphicCommitmentFactory, ristretto::RistrettoPublicKey}; + use super::*; + use crate::transactions::transaction::OutputFlags; #[test] fn it_returns_none_if_empty() { @@ -800,7 +806,7 @@ mod fetch_utxo_by_unique_id { let asset_utxo1 = tx_outputs.iter().find(|o| o.features == features).unwrap(); // Height 2 - mint - let (block, _) = create_next_block(blocks.last().unwrap(), txns); + let (block, _) = create_next_block(&db, blocks.last().unwrap(), txns); assert!(db.add_block(block).unwrap().is_added()); // Height 4 @@ -835,7 +841,7 @@ mod fetch_utxo_by_unique_id { let asset_utxo2 = tx_outputs.iter().find(|o| o.features == features).unwrap(); // Height 5 - spend - let (block, _) = create_next_block(blocks.last().unwrap(), txns); + let (block, _) = create_next_block(&db, blocks.last().unwrap(), txns); assert!(db.add_block(block).unwrap().is_added()); // Height 10 @@ -885,7 +891,7 @@ mod fetch_utxo_by_unique_id { let (txns, _) = schema_to_transaction(&[txn_schema!(from: vec![asset_utxo2.clone()], to: vec![T])]); // Height 11 - burn - let (block, _) = create_next_block(blocks.last().unwrap(), txns); + let (block, _) = create_next_block(&db, blocks.last().unwrap(), txns); assert!(db.add_block(block).unwrap().is_added()); assert_utxo_found(asset_utxo2, None); diff --git a/base_layer/core/src/chain_storage/utxo_mined_info.rs b/base_layer/core/src/chain_storage/utxo_mined_info.rs index 9537d84d01..d8ec27c765 100644 --- a/base_layer/core/src/chain_storage/utxo_mined_info.rs +++ b/base_layer/core/src/chain_storage/utxo_mined_info.rs @@ -20,10 +20,12 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +use serde::{Deserialize, Serialize}; use tari_common_types::types::BlockHash; use crate::chain_storage::PrunedOutput; +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct UtxoMinedInfo { pub output: PrunedOutput, pub mmr_position: u32, diff --git a/base_layer/core/src/consensus/consensus_constants.rs b/base_layer/core/src/consensus/consensus_constants.rs index dcafb8bc27..3c9ac62ec7 100644 --- a/base_layer/core/src/consensus/consensus_constants.rs +++ b/base_layer/core/src/consensus/consensus_constants.rs @@ -455,6 +455,7 @@ impl ConsensusConstants { proof_of_work: algos, faucet_value: (5000 * 4000) * T, transaction_weight: TransactionWeight::v2(), + max_script_byte_size: 2048, }] } diff --git a/base_layer/core/src/mempool/rpc/test.rs b/base_layer/core/src/mempool/rpc/test.rs index 534602b12f..4cbb4304fb 100644 --- a/base_layer/core/src/mempool/rpc/test.rs +++ b/base_layer/core/src/mempool/rpc/test.rs @@ -88,6 +88,7 @@ mod get_tx_state_by_excess_sig { use tari_comms::protocol::rpc::RpcStatusCode; use tari_crypto::ristretto::{RistrettoPublicKey, RistrettoSecretKey}; use tari_test_utils::unpack_enum; + use tari_utilities::ByteArray; use super::*; use crate::{ @@ -133,6 +134,7 @@ mod submit_transaction { use tari_comms::protocol::rpc::RpcStatusCode; use tari_crypto::ristretto::RistrettoSecretKey; use tari_test_utils::unpack_enum; + use tari_utilities::ByteArray; use super::*; use crate::{ diff --git a/base_layer/core/src/proof_of_work/monero_rx/error.rs b/base_layer/core/src/proof_of_work/monero_rx/error.rs index 5a3a4f5efe..5ed779822f 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/error.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/error.rs @@ -23,8 +23,6 @@ use randomx_rs::RandomXError; use tari_utilities::hex::HexError; -use crate::crypto::tari_utilities::hex::HexError; - #[derive(Debug, thiserror::Error)] pub enum MergeMineError { #[error("Serialization error: {0}")] diff --git a/base_layer/core/src/proof_of_work/monero_rx/fixed_array.rs b/base_layer/core/src/proof_of_work/monero_rx/fixed_array.rs index f495404b0d..f15cf127f9 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/fixed_array.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/fixed_array.rs @@ -27,8 +27,7 @@ use monero::{ VarInt, }; use tari_crypto::tari_utilities::ByteArray; - -use crate::crypto::tari_utilities::ByteArrayError; +use tari_utilities::ByteArrayError; const MAX_ARR_SIZE: usize = 63; @@ -136,9 +135,9 @@ impl Encodable for FixedByteArray { #[cfg(test)] mod test { use monero::consensus; + use tari_utilities::hex::Hex; use super::*; - use crate::crypto::tari_utilities::hex::Hex; #[test] fn assert_size() { diff --git a/base_layer/core/src/proof_of_work/monero_rx/helpers.rs b/base_layer/core/src/proof_of_work/monero_rx/helpers.rs index 34a4f051a1..7d92c726f9 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/helpers.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/helpers.rs @@ -23,6 +23,7 @@ use std::iter; use log::*; use monero::{blockdata::transaction::SubField, consensus, cryptonote::hash::Hashable, VarInt}; +use tari_utilities::hex::HexError; use super::{ error::MergeMineError, @@ -196,15 +197,6 @@ mod test { use super::*; use crate::proof_of_work::{monero_rx::fixed_array::FixedByteArray, PowAlgorithm, ProofOfWork}; - use super::*; - use crate::{ - proof_of_work::{monero_rx::fixed_array::FixedByteArray, PowAlgorithm, ProofOfWork}, - tari_utilities::{ - hex::{from_hex, Hex}, - ByteArray, - }, - }; - // This tests checks the hash of monero-rs #[test] fn test_monero_rs_miner_tx_hash() { diff --git a/base_layer/core/src/proof_of_work/monero_rx/merkle_tree.rs b/base_layer/core/src/proof_of_work/monero_rx/merkle_tree.rs index b6bd3902a2..d46606ecb9 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/merkle_tree.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/merkle_tree.rs @@ -276,13 +276,10 @@ mod test { consensus::encode::{serialize, VarInt}, }; use tari_test_utils::unpack_enum; + use tari_utilities::hex::{from_hex, Hex}; use super::*; - use crate::{ - crypto::tari_utilities::hex::Hex, - proof_of_work::randomx_factory::RandomXFactory, - tari_utilities::hex::from_hex, - }; + use crate::proof_of_work::randomx_factory::RandomXFactory; mod tree_hash { use super::*; diff --git a/base_layer/core/src/proof_of_work/monero_rx/pow_data.rs b/base_layer/core/src/proof_of_work/monero_rx/pow_data.rs index d31cc46303..f7cf4840cb 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/pow_data.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/pow_data.rs @@ -26,19 +26,6 @@ use std::{ io, }; -use monero::{ - consensus::{encode, Decodable, Encodable}, - cryptonote::hash::Hashable, -}; - -use super::{deserialize, error::MergeMineError, fixed_array::FixedByteArray, merkle_tree::MerkleProof}; -use crate::{ - blocks::BlockHeader, - crypto::tari_utilities::hex::Hex, - proof_of_work::monero_rx::helpers::create_block_hashing_blob, - tari_utilities::hex::to_hex, -}; - use monero::{ consensus::{encode, Decodable, Encodable}, cryptonote::hash::Hashable, @@ -127,9 +114,9 @@ impl Encodable for MoneroPowData { #[cfg(test)] mod test { use monero::consensus; + use tari_utilities::hex::from_hex; use super::*; - use crate::crypto::tari_utilities::hex::from_hex; const POW_DATA_BLOB: &str = "0e0eff8a828606e62827cbb1c8f13eeddaae1d2c5dbb36c12a3d30d20d20b35a540bdba9d8e162604a0000202378cf4e85ef9a0629719e228c8c9807575469c3f45b3710c7960079a5dfdd661600b3cdc310a8f619ea2feadb178021ea0b853caa2f41749f7f039dcd4102d24f0504b4d72f22ca81245c538371a07331546cbd9935068637166d9cd627c521fb0e98d6161a7d971ee608b2b93719327d1cf5f95f9cc15beab7c6fb0894205c9218e4f9810873976eaf62d53ce631e8ad37bbaacc5da0267cd38342d66bdecce6541bb5c761b8ff66e7f6369cd3b0c2cb106a325c7342603516c77c9dcbb67388128a04000000000002fd873401ffc1873401c983eae58cd001026eb5be712030e2d49c9329f7f578325daa8ad7296a58985131544d8fe8a24c934d01ad27b94726423084ffc0f7eda31a8c9691836839c587664a036c3986b33f568f020861f4f1c2c37735680300916c27a920e462fbbfce5ac661ea9ef91fc78d620c61c43d5bb6a9644e3c17e000"; diff --git a/base_layer/core/src/proto/transaction.rs b/base_layer/core/src/proto/transaction.rs index b71678e523..c922f67c79 100644 --- a/base_layer/core/src/proto/transaction.rs +++ b/base_layer/core/src/proto/transaction.rs @@ -29,6 +29,7 @@ use tari_crypto::{ script::{ExecutionStack, TariScript}, tari_utilities::{ByteArray, ByteArrayError}, }; +use tari_utilities::convert::try_convert_all; use crate::{ proto, diff --git a/base_layer/core/src/test_helpers/blockchain.rs b/base_layer/core/src/test_helpers/blockchain.rs index 8f13998fcc..408cb1a5d6 100644 --- a/base_layer/core/src/test_helpers/blockchain.rs +++ b/base_layer/core/src/test_helpers/blockchain.rs @@ -23,7 +23,7 @@ use std::{ collections::HashMap, fs, - ops::Deref, + ops::{Deref, Range}, path::{Path, PathBuf}, sync::Arc, }; @@ -32,15 +32,16 @@ use croaring::Bitmap; use tari_common::configuration::Network; use tari_common_types::{ chain_metadata::ChainMetadata, - types::{Commitment, HashOutput, Signature}, + types::{Commitment, HashOutput, PublicKey, Signature}, }; use tari_storage::lmdb_store::LMDBConfig; use tari_test_utils::paths::create_temporary_data_path; +use tari_utilities::Hashable; use super::{create_block, mine_to_difficulty}; use crate::{ blocks::{ - genesis_block::get_weatherwax_genesis_block, + genesis_block::get_dibbler_genesis_block, Block, BlockAccumulatedData, BlockHeader, @@ -85,7 +86,7 @@ use crate::{ pub fn create_new_blockchain() -> BlockchainDatabase { let network = Network::LocalNet; let consensus_constants = ConsensusConstantsBuilder::new(network).build(); - let genesis = get_weatherwax_genesis_block(); + let genesis = get_dibbler_genesis_block(); let consensus_manager = ConsensusManager::builder(network) .add_consensus_constants(consensus_constants) .with_block(genesis) diff --git a/base_layer/core/src/test_helpers/mod.rs b/base_layer/core/src/test_helpers/mod.rs index 39abfaeca1..503a044c49 100644 --- a/base_layer/core/src/test_helpers/mod.rs +++ b/base_layer/core/src/test_helpers/mod.rs @@ -26,12 +26,6 @@ use std::{iter, path::Path, sync::Arc}; pub use block_spec::{BlockSpec, BlockSpecs}; -use rand::{distributions::Alphanumeric, Rng}; -use tari_common::configuration::Network; -use tari_comms::PeerManager; -use tari_storage::{lmdb_store::LMDBBuilder, LMDBWrapper}; -use std::{iter, path::Path, sync::Arc}; - use rand::{distributions::Alphanumeric, Rng}; use tari_common::configuration::Network; use tari_comms::PeerManager; diff --git a/base_layer/core/src/transactions/transaction/error.rs b/base_layer/core/src/transactions/transaction/error.rs index ab09169545..bbe8e18ffa 100644 --- a/base_layer/core/src/transactions/transaction/error.rs +++ b/base_layer/core/src/transactions/transaction/error.rs @@ -24,10 +24,9 @@ // Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. use serde::{Deserialize, Serialize}; +use tari_crypto::{range_proof::RangeProofError, script::ScriptError, signatures::CommitmentSignatureError}; use thiserror::Error; -use crate::crypto::{range_proof::RangeProofError, script::ScriptError, signatures::CommitmentSignatureError}; - //---------------------------------------- TransactionError ----------------------------------------------------// #[derive(Clone, Debug, PartialEq, Error, Deserialize, Serialize)] pub enum TransactionError { diff --git a/base_layer/core/src/transactions/transaction/full_rewind_result.rs b/base_layer/core/src/transactions/transaction/full_rewind_result.rs index cfbb00b607..df2dc480b7 100644 --- a/base_layer/core/src/transactions/transaction/full_rewind_result.rs +++ b/base_layer/core/src/transactions/transaction/full_rewind_result.rs @@ -24,11 +24,9 @@ // Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. use tari_common_types::types::BlindingFactor; +use tari_crypto::range_proof::{FullRewindResult as CryptoFullRewindResult, REWIND_USER_MESSAGE_LENGTH}; -use crate::{ - crypto::range_proof::{FullRewindResult as CryptoFullRewindResult, REWIND_USER_MESSAGE_LENGTH}, - transactions::tari_amount::MicroTari, -}; +use crate::transactions::tari_amount::MicroTari; /// A wrapper struct to hold the result of a successful range proof full rewinding to reveal the committed value, proof /// message and blinding factor diff --git a/base_layer/core/src/transactions/transaction/mod.rs b/base_layer/core/src/transactions/transaction/mod.rs index 6a3a69cdd7..58bf2f53ab 100644 --- a/base_layer/core/src/transactions/transaction/mod.rs +++ b/base_layer/core/src/transactions/transaction/mod.rs @@ -23,19 +23,20 @@ // Portions of this file were originally copyrighted (c) 2018 The Grin Developers, issued under the Apache License, // Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. +pub use asset_output_features::AssetOutputFeatures; use blake2::Digest; pub use error::TransactionError; pub use full_rewind_result::FullRewindResult; pub use kernel_builder::KernelBuilder; pub use kernel_features::KernelFeatures; pub use kernel_sum::KernelSum; +pub use mint_non_fungible_features::MintNonFungibleFeatures; pub use output_features::OutputFeatures; pub use output_flags::OutputFlags; pub use rewind_result::RewindResult; +pub use side_chain_checkpoint_features::SideChainCheckpointFeatures; use tari_common_types::types::{Commitment, HashDigest}; use tari_crypto::{script::TariScript, tari_utilities::ByteArray}; -pub use mint_non_fungible_features::MintNonFungibleFeatures; -pub use side_chain_checkpoint_features::SideChainCheckpointFeatures; pub use template_parameter::TemplateParameter; pub use transaction::Transaction; pub use transaction_builder::TransactionBuilder; @@ -330,7 +331,9 @@ mod test { let (tx, _, _) = test_helpers::create_tx(5000.into(), 3.into(), 1, 2, 1, 4); let factories = CryptoFactories::default(); - assert!(tx.validate_internal_consistency(false, &factories, None).is_ok()); + assert!(tx + .validate_internal_consistency(false, &factories, None, None, None) + .is_ok()); } #[test] @@ -343,7 +346,9 @@ mod test { assert_eq!(tx.body.kernels().len(), 1); let factories = CryptoFactories::default(); - assert!(tx.validate_internal_consistency(false, &factories, None).is_ok()); + assert!(tx + .validate_internal_consistency(false, &factories, None, None, None) + .is_ok()); let schema = txn_schema!(from: vec![outputs[1].clone()], to: vec![1 * T, 2 * T]); let (tx2, _outputs, _) = test_helpers::spend_utxos(schema); @@ -520,7 +525,7 @@ mod test { let data = [0x00u8, 0x00, 0x02]; let features = OutputFeatures::consensus_decode(&mut &data[..]).unwrap(); // Assert the flag data is preserved - assert_eq!(features.flags.bits & 0x02, 0x02); + assert_eq!(features.flags.bits() & 0x02, 0x02); } #[test] diff --git a/base_layer/core/src/transactions/transaction/output_features.rs b/base_layer/core/src/transactions/transaction/output_features.rs index 73f432e924..acb846d919 100644 --- a/base_layer/core/src/transactions/transaction/output_features.rs +++ b/base_layer/core/src/transactions/transaction/output_features.rs @@ -30,10 +30,18 @@ use std::{ use integer_encoding::{VarInt, VarIntReader, VarIntWriter}; use serde::{Deserialize, Serialize}; +use tari_common_types::types::{Commitment, PublicKey}; +use tari_utilities::ByteArray; use crate::{ consensus::{ConsensusDecoding, ConsensusEncoding, ConsensusEncodingSized}, - transactions::transaction::OutputFlags, + transactions::transaction::{ + AssetOutputFeatures, + MintNonFungibleFeatures, + OutputFlags, + SideChainCheckpointFeatures, + TemplateParameter, + }, }; /// Options for UTXO's diff --git a/base_layer/core/src/transactions/transaction/rewind_result.rs b/base_layer/core/src/transactions/transaction/rewind_result.rs index a1b68d84f4..0dba1f121d 100644 --- a/base_layer/core/src/transactions/transaction/rewind_result.rs +++ b/base_layer/core/src/transactions/transaction/rewind_result.rs @@ -22,11 +22,9 @@ // // Portions of this file were originally copyrighted (c) 2018 The Grin Developers, issued under the Apache License, // Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. +use tari_crypto::range_proof::{RewindResult as CryptoRewindResult, REWIND_USER_MESSAGE_LENGTH}; -use crate::{ - crypto::range_proof::{RewindResult as CryptoRewindResult, REWIND_USER_MESSAGE_LENGTH}, - transactions::tari_amount::MicroTari, -}; +use crate::transactions::tari_amount::MicroTari; /// A wrapper struct to hold the result of a successful range proof rewinding to reveal the committed value and proof /// message diff --git a/base_layer/core/src/transactions/transaction/transaction.rs b/base_layer/core/src/transactions/transaction/transaction.rs index c0897d8c0d..366602c107 100644 --- a/base_layer/core/src/transactions/transaction/transaction.rs +++ b/base_layer/core/src/transactions/transaction/transaction.rs @@ -31,16 +31,14 @@ use std::{ use serde::{Deserialize, Serialize}; use tari_common_types::types::{BlindingFactor, HashOutput, Signature}; - -use crate::{ - crypto::tari_utilities::hex::Hex, - transactions::{ - aggregated_body::AggregateBody, - tari_amount::{uT, MicroTari}, - transaction::{TransactionError, TransactionInput, TransactionKernel, TransactionOutput}, - weight::TransactionWeight, - CryptoFactories, - }, +use tari_crypto::tari_utilities::hex::Hex; + +use crate::transactions::{ + aggregated_body::AggregateBody, + tari_amount::{uT, MicroTari}, + transaction::{TransactionError, TransactionInput, TransactionKernel, TransactionOutput}, + weight::TransactionWeight, + CryptoFactories, }; /// A transaction which consists of a kernel offset and an aggregate body made up of inputs, outputs and kernels. diff --git a/base_layer/core/src/transactions/transaction/transaction_input.rs b/base_layer/core/src/transactions/transaction/transaction_input.rs index 87223150e8..96a996496c 100644 --- a/base_layer/core/src/transactions/transaction/transaction_input.rs +++ b/base_layer/core/src/transactions/transaction/transaction_input.rs @@ -31,18 +31,15 @@ use std::{ use blake2::Digest; use serde::{Deserialize, Serialize}; use tari_common_types::types::{Challenge, ComSignature, Commitment, CommitmentFactory, HashDigest, PublicKey}; -use tari_crypto::script::ScriptContext; - -use crate::{ - crypto::{ - commitment::HomomorphicCommitmentFactory, - script::{ExecutionStack, StackItem, TariScript}, - tari_utilities::{hex::Hex, ByteArray, Hashable}, - }, - transactions::{ - transaction, - transaction::{transaction_output::TransactionOutput, OutputFeatures, TransactionError, UnblindedOutput}, - }, +use tari_crypto::{ + commitment::HomomorphicCommitmentFactory, + script::{ExecutionStack, ScriptContext, StackItem, TariScript}, + tari_utilities::{hex::Hex, ByteArray, Hashable}, +}; + +use crate::transactions::{ + transaction, + transaction::{transaction_output::TransactionOutput, OutputFeatures, TransactionError, UnblindedOutput}, }; /// A transaction input. diff --git a/base_layer/core/src/transactions/transaction/transaction_kernel.rs b/base_layer/core/src/transactions/transaction/transaction_kernel.rs index a1ada3d801..591a7d5b97 100644 --- a/base_layer/core/src/transactions/transaction/transaction_kernel.rs +++ b/base_layer/core/src/transactions/transaction/transaction_kernel.rs @@ -31,14 +31,12 @@ use std::{ use blake2::Digest; use serde::{Deserialize, Serialize}; use tari_common_types::types::{Commitment, HashDigest, Signature}; +use tari_crypto::tari_utilities::{hex::Hex, message_format::MessageFormat, ByteArray, Hashable}; -use crate::{ - crypto::tari_utilities::{hex::Hex, message_format::MessageFormat, ByteArray, Hashable}, - transactions::{ - tari_amount::MicroTari, - transaction::{KernelFeatures, TransactionError}, - transaction_protocol::{build_challenge, TransactionMetadata}, - }, +use crate::transactions::{ + tari_amount::MicroTari, + transaction::{KernelFeatures, TransactionError}, + transaction_protocol::{build_challenge, TransactionMetadata}, }; /// The transaction kernel tracks the excess for a given transaction. For an explanation of what the excess is, and diff --git a/base_layer/core/src/transactions/transaction/transaction_output.rs b/base_layer/core/src/transactions/transaction/transaction_output.rs index 85f688f762..183f8f0345 100644 --- a/base_layer/core/src/transactions/transaction/transaction_output.rs +++ b/base_layer/core/src/transactions/transaction/transaction_output.rs @@ -44,27 +44,25 @@ use tari_common_types::types::{ RangeProof, RangeProofService, }; -use tari_crypto::keys::{PublicKey as PublicKeyTrait, SecretKey}; +use tari_crypto::{ + commitment::HomomorphicCommitmentFactory, + keys::{PublicKey as PublicKeyTrait, SecretKey}, + range_proof::RangeProofService as RangeProofServiceTrait, + ristretto::pedersen::PedersenCommitmentFactory, + script::TariScript, + tari_utilities::{hex::Hex, ByteArray, Hashable}, +}; -use crate::{ - crypto::{ - commitment::HomomorphicCommitmentFactory, - range_proof::RangeProofService as RangeProofServiceTrait, - ristretto::pedersen::PedersenCommitmentFactory, - script::TariScript, - tari_utilities::{hex::Hex, ByteArray, Hashable}, - }, - transactions::{ - tari_amount::MicroTari, - transaction, - transaction::{ - full_rewind_result::FullRewindResult, - rewind_result::RewindResult, - OutputFeatures, - OutputFlags, - TransactionError, - TransactionInput, - }, +use crate::transactions::{ + tari_amount::MicroTari, + transaction, + transaction::{ + full_rewind_result::FullRewindResult, + rewind_result::RewindResult, + OutputFeatures, + OutputFlags, + TransactionError, + TransactionInput, }, }; diff --git a/base_layer/core/src/transactions/transaction/unblinded_output.rs b/base_layer/core/src/transactions/transaction/unblinded_output.rs index 5d6a01db17..ce7caa5237 100644 --- a/base_layer/core/src/transactions/transaction/unblinded_output.rs +++ b/base_layer/core/src/transactions/transaction/unblinded_output.rs @@ -29,17 +29,15 @@ use rand::rngs::OsRng; use serde::{Deserialize, Serialize}; use tari_common_types::types::{BlindingFactor, ComSignature, CommitmentFactory, PrivateKey, PublicKey, RangeProof}; use tari_crypto::{ + commitment::HomomorphicCommitmentFactory, keys::{PublicKey as PublicKeyTrait, SecretKey}, + range_proof::{RangeProofError, RangeProofService}, + script::{ExecutionStack, TariScript}, tari_utilities::ByteArray, }; use crate::{ consensus::{ConsensusEncodingSized, ConsensusEncodingWrapper}, - crypto::{ - commitment::HomomorphicCommitmentFactory, - range_proof::{RangeProofError, RangeProofService}, - script::{ExecutionStack, TariScript}, - }, transactions::{ tari_amount::MicroTari, transaction, diff --git a/base_layer/core/src/transactions/transaction/unblinded_output_builder.rs b/base_layer/core/src/transactions/transaction/unblinded_output_builder.rs index a881ca7a65..98796b968d 100644 --- a/base_layer/core/src/transactions/transaction/unblinded_output_builder.rs +++ b/base_layer/core/src/transactions/transaction/unblinded_output_builder.rs @@ -125,6 +125,7 @@ impl UnblindedOutputBuilder { metadata_signature: self .metadata_signature .ok_or_else(|| TransactionError::ValidationError("metadata_signature must be set".to_string()))?, + script_lock_height: 0, }; Ok(ub) } diff --git a/base_layer/core/src/transactions/transaction_protocol/proto/mod.rs b/base_layer/core/src/transactions/transaction_protocol/proto/mod.rs index 6cec3e928a..3f460f7027 100644 --- a/base_layer/core/src/transactions/transaction_protocol/proto/mod.rs +++ b/base_layer/core/src/transactions/transaction_protocol/proto/mod.rs @@ -27,4 +27,4 @@ pub mod transaction_metadata; pub mod transaction_sender; // Re-export message types -// pub use protocol::*; +pub use protocol::*; diff --git a/base_layer/core/src/transactions/transaction_protocol/recipient.rs b/base_layer/core/src/transactions/transaction_protocol/recipient.rs index 5b240f394a..3b5a1fad4f 100644 --- a/base_layer/core/src/transactions/transaction_protocol/recipient.rs +++ b/base_layer/core/src/transactions/transaction_protocol/recipient.rs @@ -23,7 +23,10 @@ use std::{collections::HashMap, fmt}; use serde::{Deserialize, Serialize}; -use tari_common_types::types::{MessageHash, PrivateKey, PublicKey, Signature}; +use tari_common_types::{ + transaction::TxId, + types::{MessageHash, PrivateKey, PublicKey, Signature}, +}; use crate::transactions::{ crypto_factories::CryptoFactories, diff --git a/base_layer/core/src/transactions/transaction_protocol/sender.rs b/base_layer/core/src/transactions/transaction_protocol/sender.rs index 5f6f17577f..9810550736 100644 --- a/base_layer/core/src/transactions/transaction_protocol/sender.rs +++ b/base_layer/core/src/transactions/transaction_protocol/sender.rs @@ -24,14 +24,9 @@ use std::fmt; use digest::Digest; use serde::{Deserialize, Serialize}; -use tari_common_types::types::{ - BlindingFactor, - ComSignature, - HashOutput, - PrivateKey, - PublicKey, - RangeProofService, - Signature, +use tari_common_types::{ + transaction::TxId, + types::{BlindingFactor, ComSignature, HashOutput, PrivateKey, PublicKey, RangeProofService, Signature}, }; use tari_crypto::{ keys::PublicKey as PublicKeyTrait, @@ -61,7 +56,7 @@ use crate::{ transaction_protocol::{ build_challenge, recipient::{RecipientInfo, RecipientSignedMessage}, - sender_transaction_protocol_builder::SenderTransactionProtocolBuilder, + transaction_initializer::SenderTransactionInitializer, TransactionMetadata, TransactionProtocolError as TPE, }, @@ -165,9 +160,9 @@ pub struct SenderTransactionProtocol { impl SenderTransactionProtocol { /// Begin constructing a new transaction. All the up-front data is collected via the - /// `SenderTransactionProtocolBuilder` builder function - pub fn builder(num_recipients: usize, consensus_constants: ConsensusConstants) -> SenderTransactionProtocolBuilder { - SenderTransactionProtocolBuilder::new(num_recipients, consensus_constants) + /// `SenderTransactionInitializer` builder function + pub fn builder(num_recipients: usize, consensus_constants: ConsensusConstants) -> SenderTransactionInitializer { + SenderTransactionInitializer::new(num_recipients, consensus_constants) } /// Convenience method to check whether we're receiving recipient data diff --git a/base_layer/core/src/transactions/transaction_protocol/sender_transaction_protocol_builder.rs b/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs similarity index 97% rename from base_layer/core/src/transactions/transaction_protocol/sender_transaction_protocol_builder.rs rename to base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs index a0ca89837a..e379f77286 100644 --- a/base_layer/core/src/transactions/transaction_protocol/sender_transaction_protocol_builder.rs +++ b/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs @@ -28,7 +28,10 @@ use std::{ use digest::Digest; use log::*; use rand::rngs::OsRng; -use tari_common_types::types::{BlindingFactor, HashOutput, PrivateKey, PublicKey}; +use tari_common_types::{ + transaction::TxId, + types::{BlindingFactor, HashOutput, PrivateKey, PublicKey}, +}; use tari_crypto::{ commitment::HomomorphicCommitmentFactory, keys::{PublicKey as PublicKeyTrait, SecretKey}, @@ -71,7 +74,7 @@ pub const LOG_TARGET: &str = "c::tx::tx_protocol::tx_initializer"; /// which returns an instance of this builder. Once all the sender's information has been added via the builder /// methods, you can call `build()` which will return a #[derive(Debug, Clone)] -pub struct SenderTransactionProtocolBuilder { +pub struct SenderTransactionInitializer { num_recipients: usize, amounts: FixedSet, lock_height: Option, @@ -100,7 +103,7 @@ pub struct SenderTransactionProtocolBuilder { } pub struct BuildError { - pub builder: SenderTransactionProtocolBuilder, + pub builder: SenderTransactionInitializer, pub message: String, } @@ -110,7 +113,7 @@ impl Debug for BuildError { } } -impl SenderTransactionProtocolBuilder { +impl SenderTransactionInitializer { pub fn new(num_recipients: usize, consensus_constants: ConsensusConstants) -> Self { Self { fee: Fee::new(*consensus_constants.transaction_weight()), @@ -667,7 +670,7 @@ mod test { transaction::{OutputFeatures, MAX_TRANSACTION_INPUTS}, transaction_protocol::{ sender::SenderState, - sender_transaction_protocol_builder::SenderTransactionProtocolBuilder, + transaction_initializer::SenderTransactionInitializer, TransactionProtocolError, }, }, @@ -680,7 +683,7 @@ mod test { let factories = CryptoFactories::default(); let p = TestParams::new(); // Start the builder - let builder = SenderTransactionProtocolBuilder::new(0, create_consensus_constants(0)); + let builder = SenderTransactionInitializer::new(0, create_consensus_constants(0)); let err = builder.build::(&factories, None, Some(u64::MAX)).unwrap_err(); let script = script!(Nop); // We should have a bunch of fields missing still, but we can recover and continue @@ -755,7 +758,7 @@ mod test { MicroTari(500) - expected_fee, ); // Start the builder - let mut builder = SenderTransactionProtocolBuilder::new(0, constants); + let mut builder = SenderTransactionInitializer::new(0, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -806,7 +809,7 @@ mod test { ..Default::default() }); // Start the builder - let mut builder = SenderTransactionProtocolBuilder::new(0, constants); + let mut builder = SenderTransactionInitializer::new(0, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -845,7 +848,7 @@ mod test { ); let constants = create_consensus_constants(0); // Start the builder - let mut builder = SenderTransactionProtocolBuilder::new(0, constants); + let mut builder = SenderTransactionInitializer::new(0, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -873,7 +876,7 @@ mod test { let output = create_unblinded_output(script.clone(), OutputFeatures::default(), p.clone(), MicroTari(500)); // Start the builder let constants = create_consensus_constants(0); - let mut builder = SenderTransactionProtocolBuilder::new(0, constants); + let mut builder = SenderTransactionInitializer::new(0, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -905,7 +908,7 @@ mod test { let output = create_unblinded_output(script.clone(), OutputFeatures::default(), p.clone(), MicroTari(400)); // Start the builder let constants = create_consensus_constants(0); - let mut builder = SenderTransactionProtocolBuilder::new(0, constants); + let mut builder = SenderTransactionInitializer::new(0, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -940,7 +943,7 @@ mod test { let output = create_unblinded_output(script.clone(), OutputFeatures::default(), p.clone(), MicroTari(15000)); // Start the builder let constants = create_consensus_constants(0); - let mut builder = SenderTransactionProtocolBuilder::new(2, constants); + let mut builder = SenderTransactionInitializer::new(2, constants); builder .with_lock_height(0) .with_offset(p.offset) @@ -995,7 +998,7 @@ mod test { MicroTari(1500) - expected_fee, ); // Start the builder - let mut builder = SenderTransactionProtocolBuilder::new(1, constants); + let mut builder = SenderTransactionInitializer::new(1, constants); builder .with_lock_height(1234) .with_offset(p.offset) @@ -1047,7 +1050,7 @@ mod test { let (utxo1, input1) = create_test_input((2u64.pow(32) + 20000u64).into(), 0, &factories.commitment); let fee_per_gram = MicroTari(6); let constants = create_consensus_constants(0); - let mut builder = SenderTransactionProtocolBuilder::new(1, constants); + let mut builder = SenderTransactionInitializer::new(1, constants); builder .with_lock_height(1234) .with_offset(p.offset) diff --git a/base_layer/core/src/validation/block_validators/async_validator.rs b/base_layer/core/src/validation/block_validators/async_validator.rs index 6bd984f37d..aa27ff65d9 100644 --- a/base_layer/core/src/validation/block_validators/async_validator.rs +++ b/base_layer/core/src/validation/block_validators/async_validator.rs @@ -26,6 +26,7 @@ use futures::{stream::FuturesUnordered, StreamExt}; use log::*; use tari_common_types::types::{Commitment, HashOutput, PublicKey}; use tari_crypto::{commitment::HomomorphicCommitmentFactory, script::ScriptContext}; +use tari_utilities::Hashable; use tokio::task; use super::LOG_TARGET; diff --git a/base_layer/core/src/validation/block_validators/body_only.rs b/base_layer/core/src/validation/block_validators/body_only.rs index af0c418dac..0955f01402 100644 --- a/base_layer/core/src/validation/block_validators/body_only.rs +++ b/base_layer/core/src/validation/block_validators/body_only.rs @@ -22,6 +22,7 @@ use log::*; use tari_common_types::chain_metadata::ChainMetadata; +use tari_utilities::hex::Hex; use super::LOG_TARGET; use crate::{ @@ -29,7 +30,6 @@ use crate::{ chain_storage, chain_storage::BlockchainBackend, consensus::ConsensusManager, - crypto::tari_utilities::hex::Hex, validation::{helpers, PostOrphanBodyValidation, ValidationError}, }; @@ -48,12 +48,6 @@ impl BodyOnlyValidator { } } -impl BodyOnlyValidator { - pub fn new() -> Self { - Self - } -} - impl PostOrphanBodyValidation for BodyOnlyValidator { /// The consensus checks that are done (in order of cheapest to verify to most expensive): /// 1. Does the block satisfy the stateless checks? diff --git a/base_layer/core/src/validation/block_validators/test.rs b/base_layer/core/src/validation/block_validators/test.rs index c8dd0a88a4..2679fd12cb 100644 --- a/base_layer/core/src/validation/block_validators/test.rs +++ b/base_layer/core/src/validation/block_validators/test.rs @@ -210,6 +210,8 @@ async fn it_limits_the_script_byte_size() { } mod unique_id { + use tari_common_types::types::PublicKey; + use super::*; pub fn create_block( diff --git a/base_layer/core/src/validation/helpers.rs b/base_layer/core/src/validation/helpers.rs index 06994274d5..ce48ca26ea 100644 --- a/base_layer/core/src/validation/helpers.rs +++ b/base_layer/core/src/validation/helpers.rs @@ -21,14 +21,17 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use std::cmp::Ordering; -use std::cmp::Ordering; - use log::*; use tari_common_types::types::{Commitment, CommitmentFactory, PublicKey}; use tari_crypto::{ + commitment::HomomorphicCommitmentFactory, keys::PublicKey as PublicKeyTrait, script::TariScript, - tari_utilities::{epoch_time::EpochTime, hash::Hashable, hex::Hex}, + tari_utilities::{ + epoch_time::EpochTime, + hash::Hashable, + hex::{to_hex, Hex}, + }, }; use crate::{ @@ -41,7 +44,6 @@ use crate::{ ConsensusEncodingWrapper, ConsensusManager, }, - crypto::{commitment::HomomorphicCommitmentFactory, tari_utilities::hex::to_hex}, proof_of_work::{ monero_difficulty, monero_rx::MoneroPowData, @@ -480,6 +482,7 @@ pub fn check_outputs( constants: &ConsensusConstants, body: &AggregateBody, ) -> Result<(), ValidationError> { + let mut unique_ids = Vec::new(); let max_script_size = constants.get_max_script_byte_size(); for output in body.outputs() { check_tari_script_byte_size(&output.script, max_script_size)?; diff --git a/base_layer/core/src/validation/test.rs b/base_layer/core/src/validation/test.rs index 8a82306a25..9354504fd2 100644 --- a/base_layer/core/src/validation/test.rs +++ b/base_layer/core/src/validation/test.rs @@ -25,6 +25,7 @@ use std::sync::Arc; use tari_common::configuration::Network; use tari_common_types::types::Commitment; use tari_crypto::{commitment::HomomorphicCommitment, script}; +use tari_utilities::Hashable; use crate::{ blocks::{BlockHeader, BlockHeaderAccumulatedData, ChainBlock, ChainHeader}, diff --git a/base_layer/core/tests/base_node_rpc.rs b/base_layer/core/tests/base_node_rpc.rs index 3af1f95e97..0564c8a4c2 100644 --- a/base_layer/core/tests/base_node_rpc.rs +++ b/base_layer/core/tests/base_node_rpc.rs @@ -56,6 +56,7 @@ use tari_core::{ txn_schema, }; use tari_crypto::tari_utilities::epoch_time::EpochTime; +use tari_utilities::Hashable; use tempfile::{tempdir, TempDir}; use crate::helpers::{ diff --git a/base_layer/core/tests/block_validation.rs b/base_layer/core/tests/block_validation.rs index 17877190c2..0bb673e36a 100644 --- a/base_layer/core/tests/block_validation.rs +++ b/base_layer/core/tests/block_validation.rs @@ -70,17 +70,6 @@ use crate::helpers::{ test_blockchain::TestBlockchain, }; -use crate::helpers::{ - block_builders::{ - chain_block_with_coinbase, - chain_block_with_new_coinbase, - create_coinbase, - create_genesis_block_with_utxos, - find_header_with_achieved_difficulty, - }, - test_blockchain::TestBlockchain, -}; - mod helpers; #[test] diff --git a/base_layer/core/tests/chain_storage_tests/chain_storage.rs b/base_layer/core/tests/chain_storage_tests/chain_storage.rs index aaed30cff9..b3879920ba 100644 --- a/base_layer/core/tests/chain_storage_tests/chain_storage.rs +++ b/base_layer/core/tests/chain_storage_tests/chain_storage.rs @@ -54,7 +54,7 @@ use tari_core::{ txn_schema, validation::{mocks::MockValidator, DifficultyCalculator, ValidationError}, }; -use tari_crypto::{script::StackItem, tari_utilities::Hashable}; +use tari_crypto::{keys::PublicKey as PublicKeyTrait, script::StackItem, tari_utilities::Hashable}; use tari_storage::lmdb_store::LMDBConfig; use tari_test_utils::{paths::create_temporary_data_path, unpack_enum}; @@ -244,7 +244,7 @@ fn rewind_to_height() { #[ignore = "To be completed with pruned mode"] fn rewind_past_horizon_height() { let network = Network::LocalNet; - let block0 = genesis_block::get_ridcully_genesis_block(); + let block0 = genesis_block::get_dibbler_genesis_block(); let consensus_manager = ConsensusManagerBuilder::new(network).with_block(block0.clone()).build(); let validators = Validators::new( MockValidator::new(true), @@ -1213,7 +1213,7 @@ fn restore_metadata_and_pruning_horizon_update() { MockValidator::new(true), ); let network = Network::LocalNet; - let block0 = genesis_block::get_ridcully_genesis_block(); + let block0 = genesis_block::get_dibbler_genesis_block(); let rules = ConsensusManagerBuilder::new(network).with_block(block0.clone()).build(); let mut config = BlockchainDatabaseConfig::default(); let block_hash: BlockHash; @@ -1452,7 +1452,7 @@ fn orphan_cleanup_on_block_add() { #[ignore = "To be completed with pruned mode"] fn horizon_height_orphan_cleanup() { let network = Network::LocalNet; - let block0 = genesis_block::get_ridcully_genesis_block(); + let block0 = genesis_block::get_dibbler_genesis_block(); let consensus_manager = ConsensusManagerBuilder::new(network).with_block(block0.clone()).build(); let validators = Validators::new( MockValidator::new(true), @@ -1810,7 +1810,7 @@ fn fails_validation() { #[test] fn pruned_mode_cleanup_and_fetch_block() { let network = Network::LocalNet; - let block0 = genesis_block::get_weatherwax_genesis_block(); + let block0 = genesis_block::get_dibbler_genesis_block(); let consensus_manager = ConsensusManagerBuilder::new(network).with_block(block0.clone()).build(); let validators = Validators::new( MockValidator::new(true), diff --git a/base_layer/core/tests/helpers/pow_blockchain.rs b/base_layer/core/tests/helpers/pow_blockchain.rs index 896d41e4fe..1cc66f44d9 100644 --- a/base_layer/core/tests/helpers/pow_blockchain.rs +++ b/base_layer/core/tests/helpers/pow_blockchain.rs @@ -44,8 +44,6 @@ use tari_utilities::hex::Hex; use super::block_builders::chain_block; -use super::block_builders::chain_block; - #[allow(dead_code)] pub fn create_test_pow_blockchain( db: &BlockchainDatabase, diff --git a/base_layer/key_manager/Cargo.toml b/base_layer/key_manager/Cargo.toml index 19e0d582d4..8d63746f82 100644 --- a/base_layer/key_manager/Cargo.toml +++ b/base_layer/key_manager/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" crate-type = ["lib", "cdylib"] [dependencies] -tari_common_types = { version = "^0.13", path = "../../base_layer/common_types" } +tari_common_types = { version = "^0.22", path = "../../base_layer/common_types" } tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", branch = "main" } arrayvec = "0.7.1" diff --git a/base_layer/key_manager/src/cipher_seed.rs b/base_layer/key_manager/src/cipher_seed.rs index 7e97b6ef5f..c226b3dc95 100644 --- a/base_layer/key_manager/src/cipher_seed.rs +++ b/base_layer/key_manager/src/cipher_seed.rs @@ -48,14 +48,14 @@ pub const CIPHER_SEED_SALT_BYTES: usize = 5; pub const CIPHER_SEED_MAC_BYTES: usize = 5; /// This is an implementation of a Cipher Seed based on the `aezeed` encoding scheme (https://github.com/lightningnetwork/lnd/tree/master/aezeed) -/// The goal of the scheme is produce a wallet seed that is versioned, contains the birthday of the wallet, starting -/// entropy of the wallet to seed key generation, can be enciphered with a passphrase and has a checksum. +/// The goal of the scheme is produce a wallet seed that is versioned, contains the birthday of the wallet, +/// starting entropy of the wallet to seed key generation, can be enciphered with a passphrase and has a checksum. /// The `aezeed` scheme uses a new AEZ AEAD scheme which allows for enciphering arbitrary length texts and choosing -/// custom MAC sizes. AEZ is unfortunately not available in the RustCrypto implementations yet so we use a similar AEAD -/// scheme using the primitives available in RustCrypto. -/// Our scheme must be able to be represented with the 24 word seed phrase using the BIP-39 word lists. The world lists -/// contain 2048 words which are 11 bits of information giving us a total of 33 bytes to work with for the final -/// encoding. +/// custom MAC sizes. AEZ is unfortunately not available in the RustCrypto implementations yet so we use a similar +/// AEAD scheme using the primitives available in RustCrypto. +/// Our scheme must be able to be represented with the 24 word seed phrase using the BIP-39 word lists. The world +/// lists contain 2048 words which are 11 bits of information giving us a total of 33 bytes to work with for the +/// final encoding. /// In our scheme we will have the following data: /// version 1 byte /// birthday 2 bytes Days since Unix Epoch @@ -72,15 +72,17 @@ pub const CIPHER_SEED_MAC_BYTES: usize = 5; /// salt 5 bytes /// checksum 4 bytes /// -/// The final 33 byte enciphered data is what will be encoded using the Mnemonic Word lists to create a 24 word seed -/// phrase. +/// The final 33 byte enciphered data is what will be encoded using the Mnemonic Word lists to create a 24 word +/// seed phrase. /// /// The checksum allows us to confirm that a given seed phrase decodes into an intact enciphered CipherSeed. -/// The MAC allows us to confirm that a given passphrase correctly decrypts the CipherSeed and that the version and salt -/// are not tampered with. If no passphrase is provided a default string will be used +/// The MAC allows us to confirm that a given passphrase correctly decrypts the CipherSeed and that the version and +/// salt are not tampered with. If no passphrase is provided a default string will be used /// -/// The Birthday is included to enable more efficient recoveries. Knowing the birthday of the seed phrase means we only -/// have to scan the blocks in the chain since that day for full recovery, rather than scanning the entire blockchain. +/// The Birthday is included to enable more efficient recoveries. Knowing the birthday of the seed phrase means we +/// only have to scan the blocks in the chain since that day for full recovery, rather than scanning the entire +/// blockchain. +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CipherSeed { diff --git a/base_layer/key_manager/src/key_manager.rs b/base_layer/key_manager/src/key_manager.rs index 6c5955300d..12f784d5b4 100644 --- a/base_layer/key_manager/src/key_manager.rs +++ b/base_layer/key_manager/src/key_manager.rs @@ -23,6 +23,7 @@ use std::marker::PhantomData; use digest::Digest; +use serde::{Deserialize, Serialize}; use tari_crypto::{ keys::SecretKey, tari_utilities::{byte_array::ByteArrayError, hex::Hex}, diff --git a/base_layer/key_manager/src/wasm.rs b/base_layer/key_manager/src/wasm.rs index 880d2ad524..aed0835ddb 100644 --- a/base_layer/key_manager/src/wasm.rs +++ b/base_layer/key_manager/src/wasm.rs @@ -1,3 +1,25 @@ +// Copyright 2021. The Tari Project +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +// following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following +// disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote +// products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + use std::fmt::Display; use console_error_panic_hook; diff --git a/base_layer/tari_stratum_ffi/src/lib.rs b/base_layer/tari_stratum_ffi/src/lib.rs index be40d7bbac..bae8217579 100644 --- a/base_layer/tari_stratum_ffi/src/lib.rs +++ b/base_layer/tari_stratum_ffi/src/lib.rs @@ -38,9 +38,11 @@ use tari_core::{ blocks::Block, proof_of_work::{sha3_difficulty, Difficulty}, }; -use tari_crypto::tari_utilities::hex::Hex; +use tari_crypto::tari_utilities::{hex::Hex, message_format::MessageFormat}; +use tari_utilities::Hashable; use crate::error::{InterfaceError, StratumTranscoderError}; + pub type TariPublicKey = tari_comms::types::CommsPublicKey; /// Validates a hex string is convertible into a TariPublicKey diff --git a/base_layer/wallet/migrations/2021-10-13-121212_add_unique_id/up.sql b/base_layer/wallet/migrations/2021-10-13-121212_add_unique_id/up.sql index 40d65bfc07..437e0d87da 100644 --- a/base_layer/wallet/migrations/2021-10-13-121212_add_unique_id/up.sql +++ b/base_layer/wallet/migrations/2021-10-13-121212_add_unique_id/up.sql @@ -2,7 +2,6 @@ -- alter table completed_transactions add unique_id blob; alter table outputs add metadata blob; alter table outputs add features_mint_asset_public_key blob; -alter table outputs add features_mint_asset_owner_commitment blob; alter table outputs add features_sidechain_checkpoint_merkle_root blob; alter table outputs add features_parent_public_key blob; alter table outputs add features_unique_id blob; diff --git a/base_layer/wallet/src/base_node_service/handle.rs b/base_layer/wallet/src/base_node_service/handle.rs index 06819f6ea8..ecf2e13a2b 100644 --- a/base_layer/wallet/src/base_node_service/handle.rs +++ b/base_layer/wallet/src/base_node_service/handle.rs @@ -21,6 +21,7 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use std::{fmt, fmt::Formatter, sync::Arc, time::Duration}; + use tari_common_types::chain_metadata::ChainMetadata; use tari_service_framework::reply_channel::SenderService; use tokio::sync::broadcast; @@ -54,6 +55,9 @@ impl fmt::Display for BaseNodeEvent { BaseNodeEvent::BaseNodeStateChanged(state) => { write!(f, "BaseNodeStateChanged: Synced:{:?}", state.is_synced) }, + BaseNodeEvent::NewBlockDetected(s) => { + write!(f, "NewBlockDetected: {}", s) + }, } } } diff --git a/base_layer/wallet/src/output_manager_service/error.rs b/base_layer/wallet/src/output_manager_service/error.rs index 8dc2ba0fc6..b1175ebd6e 100644 --- a/base_layer/wallet/src/output_manager_service/error.rs +++ b/base_layer/wallet/src/output_manager_service/error.rs @@ -37,8 +37,6 @@ use thiserror::Error; use crate::{base_node_service::error::BaseNodeServiceError, error::WalletStorageError}; -use crate::base_node_service::error::BaseNodeServiceError; - #[derive(Debug, Error)] pub enum OutputManagerError { #[error("Build error: `{0}`")] diff --git a/base_layer/wallet/src/output_manager_service/handle.rs b/base_layer/wallet/src/output_manager_service/handle.rs index 8198b1debd..710037e11c 100644 --- a/base_layer/wallet/src/output_manager_service/handle.rs +++ b/base_layer/wallet/src/output_manager_service/handle.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::{fmt, sync::Arc}; +use std::{fmt, fmt::Formatter, sync::Arc}; use aes_gcm::Aes256Gcm; use tari_common_types::{ @@ -208,7 +208,7 @@ pub enum OutputManagerResponse { CreatePayToSelfWithOutputs { transaction: Box, tx_id: TxId }, ReinstatedCancelledInboundTx, CoinbaseAbandonedSet, - ClaimHtlcTransaction((u64, MicroTari, MicroTari, Transaction)), + ClaimHtlcTransaction((TxId, MicroTari, MicroTari, Transaction)), } pub type OutputManagerEventSender = broadcast::Sender>; @@ -559,7 +559,7 @@ impl OutputManagerHandle { &mut self, output: HashOutput, fee_per_gram: MicroTari, - ) -> Result<(u64, MicroTari, MicroTari, Transaction), OutputManagerError> { + ) -> Result<(TxId, MicroTari, MicroTari, Transaction), OutputManagerError> { match self .handle .call(OutputManagerRequest::CreateHtlcRefundTransaction(output, fee_per_gram)) @@ -575,7 +575,7 @@ impl OutputManagerHandle { output: HashOutput, pre_image: PublicKey, fee_per_gram: MicroTari, - ) -> Result<(u64, MicroTari, MicroTari, Transaction), OutputManagerError> { + ) -> Result<(TxId, MicroTari, MicroTari, Transaction), OutputManagerError> { match self .handle .call(OutputManagerRequest::CreateClaimShaAtomicSwapTransaction( diff --git a/base_layer/wallet/src/output_manager_service/service.rs b/base_layer/wallet/src/output_manager_service/service.rs index fc406b5d4c..4cb9b2e29c 100644 --- a/base_layer/wallet/src/output_manager_service/service.rs +++ b/base_layer/wallet/src/output_manager_service/service.rs @@ -914,7 +914,11 @@ where builder .with_output(ub.clone(), sender_offset_private_key.clone()) .map_err(|e| OutputManagerError::BuildError(e.message))?; - db_outputs.push(DbUnblindedOutput::from_unblinded_output(ub, &self.resources.factories)?) + db_outputs.push(DbUnblindedOutput::from_unblinded_output( + ub, + &self.resources.factories, + None, + )?) } // let mut change_keys = None; @@ -938,7 +942,7 @@ where // } let mut stp = builder - .build::(&self.resources.factories) + .build::(&self.resources.factories, None, None) .map_err(|e| OutputManagerError::BuildError(e.message))?; // if let Some((spending_key, script_private_key)) = change_keys { // // let change_script_offset_public_key = stp.get_change_sender_offset_public_key()?.ok_or_else(|| { @@ -972,6 +976,7 @@ where db_outputs.push(DbUnblindedOutput::from_unblinded_output( unblinded_output, &self.resources.factories, + None, )?); } let tx_id = stp.get_tx_id()?; @@ -980,7 +985,7 @@ where .db .encumber_outputs(tx_id, input_selection.into_selected(), db_outputs) .await?; - stp.finalize(KernelFeatures::empty(), &self.resources.factories)?; + stp.finalize(KernelFeatures::empty(), &self.resources.factories, None, None)?; Ok((tx_id, stp.take_transaction()?)) } @@ -1462,7 +1467,7 @@ where output: TransactionOutput, pre_image: PublicKey, fee_per_gram: MicroTari, - ) -> Result<(u64, MicroTari, MicroTari, Transaction), OutputManagerError> { + ) -> Result<(TxId, MicroTari, MicroTari, Transaction), OutputManagerError> { let spending_key = PrivateKey::from_bytes( CommsPublicKey::shared_secret( self.node_identity.as_ref().secret_key(), @@ -1552,7 +1557,7 @@ where &mut self, output_hash: HashOutput, fee_per_gram: MicroTari, - ) -> Result<(u64, MicroTari, MicroTari, Transaction), OutputManagerError> { + ) -> Result<(TxId, MicroTari, MicroTari, Transaction), OutputManagerError> { let output = self .resources .db diff --git a/base_layer/wallet/src/output_manager_service/storage/database/backend.rs b/base_layer/wallet/src/output_manager_service/storage/database/backend.rs index f1762131dc..c4f22d0e9d 100644 --- a/base_layer/wallet/src/output_manager_service/storage/database/backend.rs +++ b/base_layer/wallet/src/output_manager_service/storage/database/backend.rs @@ -7,7 +7,7 @@ use tari_core::transactions::transaction::{OutputFlags, TransactionOutput}; use crate::output_manager_service::{ error::OutputManagerStorageError, - service::Balance, + service::{Balance, UTXOSelectionStrategy}, storage::{ database::{DbKey, DbValue, WriteOperation}, models::DbUnblindedOutput, @@ -21,8 +21,6 @@ use crate::output_manager_service::{ pub trait OutputManagerBackend: Send + Sync + Clone { /// Retrieve the record associated with the provided DbKey fn fetch(&self, key: &DbKey) -> Result, OutputManagerStorageError>; - /// Fetch outputs that can be spent - fn fetch_spendable_outputs(&self) -> Result, OutputManagerStorageError>; /// Fetch outputs with specific features fn fetch_with_features(&self, features: OutputFlags) -> Result, OutputManagerStorageError>; /// Fetch outputs with specific features for a given asset public key @@ -107,4 +105,12 @@ pub trait OutputManagerBackend: Send + Sync + Clone { fn reinstate_cancelled_inbound_output(&self, tx_id: TxId) -> Result<(), OutputManagerStorageError>; /// Return the available, time locked, pending incoming and pending outgoing balance fn get_balance(&self, tip: Option) -> Result; + /// Import unvalidated output + fn add_unvalidated_output(&self, output: DbUnblindedOutput, tx_id: TxId) -> Result<(), OutputManagerStorageError>; + fn fetch_unspent_outputs_for_spending( + &self, + strategy: UTXOSelectionStrategy, + amount: u64, + current_tip_height: Option, + ) -> Result, OutputManagerStorageError>; } diff --git a/base_layer/wallet/src/output_manager_service/storage/database/mod.rs b/base_layer/wallet/src/output_manager_service/storage/database/mod.rs index 0bd69d4875..655a4cffcc 100644 --- a/base_layer/wallet/src/output_manager_service/storage/database/mod.rs +++ b/base_layer/wallet/src/output_manager_service/storage/database/mod.rs @@ -20,128 +20,37 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +mod backend; use std::{ fmt::{Display, Error, Formatter}, sync::Arc, }; use aes_gcm::Aes256Gcm; +pub use backend::OutputManagerBackend; use log::*; use tari_common_types::{ transaction::TxId, types::{BlindingFactor, Commitment, HashOutput, PublicKey}, }; -use tari_core::transactions::{tari_amount::MicroTari, transaction::TransactionOutput}; +use tari_core::transactions::{ + tari_amount::MicroTari, + transaction::{OutputFlags, TransactionOutput}, +}; use tari_crypto::tari_utilities::hex::Hex; use tari_key_manager::cipher_seed::CipherSeed; use crate::output_manager_service::{ error::OutputManagerStorageError, service::{Balance, UTXOSelectionStrategy}, - storage::models::{DbUnblindedOutput, KnownOneSidedPaymentScript, OutputStatus}, + storage::{ + models::{DbUnblindedOutput, KnownOneSidedPaymentScript}, + OutputStatus, + }, }; const LOG_TARGET: &str = "wallet::output_manager_service::database"; -/// This trait defines the required behaviour that a storage backend must provide for the Output Manager service. -/// Data is passed to and from the backend via the [DbKey], [DbValue], and [DbValueKey] enums. If new data types are -/// required to be supported by the backends then these enums can be updated to reflect this requirement and the trait -/// will remain the same -pub trait OutputManagerBackend: Send + Sync + Clone { - /// Retrieve the record associated with the provided DbKey - fn fetch(&self, key: &DbKey) -> Result, OutputManagerStorageError>; - /// Retrieve outputs that have been mined but not spent yet (have not been deleted) - fn fetch_mined_unspent_outputs(&self) -> Result, OutputManagerStorageError>; - /// Retrieve outputs that have not been found or confirmed in the block chain yet - fn fetch_unconfirmed_outputs(&self) -> Result, OutputManagerStorageError>; - /// Modify the state the of the backend with a write operation - fn write(&self, op: WriteOperation) -> Result, OutputManagerStorageError>; - fn fetch_pending_incoming_outputs(&self) -> Result, OutputManagerStorageError>; - - fn set_received_output_mined_height( - &self, - hash: Vec, - mined_height: u64, - mined_in_block: Vec, - mmr_position: u64, - confirmed: bool, - ) -> Result<(), OutputManagerStorageError>; - - fn set_output_to_unmined(&self, hash: Vec) -> Result<(), OutputManagerStorageError>; - - fn set_outputs_to_be_revalidated(&self) -> Result<(), OutputManagerStorageError>; - - fn mark_output_as_spent( - &self, - hash: Vec, - mark_deleted_at_height: u64, - mark_deleted_in_block: Vec, - confirmed: bool, - ) -> Result<(), OutputManagerStorageError>; - - fn mark_output_as_unspent(&self, hash: Vec) -> Result<(), OutputManagerStorageError>; - /// This method encumbers the specified outputs into a `PendingTransactionOutputs` record. This is a short term - /// encumberance in case the app is closed or crashes before transaction neogtiation is complete. These will be - /// cleared on startup of the service. - fn short_term_encumber_outputs( - &self, - tx_id: TxId, - outputs_to_send: &[DbUnblindedOutput], - outputs_to_receive: &[DbUnblindedOutput], - ) -> Result<(), OutputManagerStorageError>; - /// This method confirms that a transaction negotiation is complete and outputs can be fully encumbered. This - /// reserves these outputs until the transaction is confirmed or cancelled - fn confirm_encumbered_outputs(&self, tx_id: TxId) -> Result<(), OutputManagerStorageError>; - /// Clear all pending transaction encumberances marked as short term. These are the result of an unfinished - /// transaction negotiation - fn clear_short_term_encumberances(&self) -> Result<(), OutputManagerStorageError>; - /// This method must take all the `outputs_to_be_spent` from the specified transaction and move them back into the - /// `UnspentOutputs` pool. The `outputs_to_be_received`'` will be marked as cancelled inbound outputs in case they - /// need to be recovered. - fn cancel_pending_transaction(&self, tx_id: TxId) -> Result<(), OutputManagerStorageError>; - /// This method will increment the currently stored key index for the key manager config. Increment this after each - /// key is generated - fn increment_key_index(&self) -> Result<(), OutputManagerStorageError>; - /// This method will set the currently stored key index for the key manager - fn set_key_index(&self, index: u64) -> Result<(), OutputManagerStorageError>; - /// This method will update an output's metadata signature, akin to 'finalize output' - fn update_output_metadata_signature(&self, output: &TransactionOutput) -> Result<(), OutputManagerStorageError>; - /// If an invalid output is found to be valid this function will turn it back into an unspent output - fn revalidate_unspent_output(&self, spending_key: &Commitment) -> Result<(), OutputManagerStorageError>; - /// Apply encryption to the backend. - fn apply_encryption(&self, cipher: Aes256Gcm) -> Result<(), OutputManagerStorageError>; - /// Remove encryption from the backend. - fn remove_encryption(&self) -> Result<(), OutputManagerStorageError>; - - /// Get the output that was most recently mined, ordered descending by mined height - fn get_last_mined_output(&self) -> Result, OutputManagerStorageError>; - /// Get the output that was most recently spent, ordered descending by mined height - fn get_last_spent_output(&self) -> Result, OutputManagerStorageError>; - /// Check if there is a pending coinbase transaction at this block height, if there is clear it. - fn clear_pending_coinbase_transaction_at_block_height( - &self, - block_height: u64, - ) -> Result<(), OutputManagerStorageError>; - /// Set if a coinbase output is abandoned or not - fn set_coinbase_abandoned(&self, tx_id: TxId, abandoned: bool) -> Result<(), OutputManagerStorageError>; - /// Reinstate a cancelled inbound output - fn reinstate_cancelled_inbound_output(&self, tx_id: TxId) -> Result<(), OutputManagerStorageError>; - /// Return the available, time locked, pending incoming and pending outgoing balance - fn get_balance( - &self, - current_tip_for_time_lock_calculation: Option, - ) -> Result; - /// Import unvalidated output - fn add_unvalidated_output(&self, output: DbUnblindedOutput, tx_id: TxId) -> Result<(), OutputManagerStorageError>; - - fn fetch_unspent_outputs_for_spending( - &self, - strategy: UTXOSelectionStrategy, - amount: u64, - current_tip_height: Option, - ) -> Result, OutputManagerStorageError>; -} - /// Holds the state of the KeyManager being used by the Output Manager Service #[derive(Clone, Debug, PartialEq)] pub struct KeyManagerState { @@ -387,10 +296,6 @@ where T: OutputManagerBackend + 'static Ok(result) } - pub fn fetch_spendable_outputs(&self) -> Result, OutputManagerStorageError> { - self.db.fetch_spendable_outputs() - } - pub async fn fetch_with_features( &self, feature: OutputFlags, diff --git a/base_layer/wallet/src/output_manager_service/storage/mod.rs b/base_layer/wallet/src/output_manager_service/storage/mod.rs index a89c38f074..a70f71cae1 100644 --- a/base_layer/wallet/src/output_manager_service/storage/mod.rs +++ b/base_layer/wallet/src/output_manager_service/storage/mod.rs @@ -24,4 +24,4 @@ pub mod database; pub mod models; mod output_status; pub mod sqlite_db; -pub use output_status::*; +pub use output_status::OutputStatus; diff --git a/base_layer/wallet/src/output_manager_service/storage/models.rs b/base_layer/wallet/src/output_manager_service/storage/models.rs index 9a8ccc01ec..235432c974 100644 --- a/base_layer/wallet/src/output_manager_service/storage/models.rs +++ b/base_layer/wallet/src/output_manager_service/storage/models.rs @@ -29,8 +29,6 @@ use tari_utilities::hash::Hashable; use crate::output_manager_service::{error::OutputManagerStorageError, storage::OutputStatus}; -use crate::output_manager_service::error::OutputManagerStorageError; - #[derive(Debug, Clone)] pub struct DbUnblindedOutput { pub commitment: Commitment, @@ -42,7 +40,7 @@ pub struct DbUnblindedOutput { pub mined_mmr_position: Option, pub marked_deleted_at_height: Option, pub marked_deleted_in_block: Option, - pub spend_priority: SpendingPriority, + pub spending_priority: SpendingPriority, } impl DbUnblindedOutput { @@ -62,7 +60,7 @@ impl DbUnblindedOutput { mined_mmr_position: None, marked_deleted_at_height: None, marked_deleted_in_block: None, - spend_priority: spend_priority.unwrap_or(SpendingPriority::Normal), + spending_priority: spend_priority.unwrap_or(SpendingPriority::Normal), }) } @@ -70,7 +68,7 @@ impl DbUnblindedOutput { output: UnblindedOutput, factory: &CryptoFactories, rewind_data: &RewindData, - spend_priority: Option, + spending_priority: Option, ) -> Result { let tx_out = output.as_rewindable_transaction_output(factory, rewind_data)?; Ok(DbUnblindedOutput { @@ -83,7 +81,7 @@ impl DbUnblindedOutput { mined_mmr_position: None, marked_deleted_at_height: None, marked_deleted_in_block: None, - spend_priority: spend_priority.unwrap_or(SpendingPriority::Normal), + spending_priority: spending_priority.unwrap_or(SpendingPriority::Normal), }) } } diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs index b54b2f61ba..010905a369 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs @@ -34,9 +34,9 @@ pub use new_output_sql::NewOutputSql; pub use output_sql::OutputSql; use tari_common_types::{ transaction::TxId, - types::{Commitment, PrivateKey}, + types::{Commitment, PrivateKey, PublicKey}, }; -use tari_core::transactions::transaction::TransactionOutput; +use tari_core::transactions::transaction::{OutputFlags, TransactionOutput}; use tari_crypto::{ script::{ExecutionStack, TariScript}, tari_utilities::{ @@ -53,10 +53,11 @@ use crate::{ service::{Balance, UTXOSelectionStrategy}, storage::{ database::{DbKey, DbKeyValuePair, DbValue, KeyManagerState, OutputManagerBackend, WriteOperation}, - models::{DbUnblindedOutput, KnownOneSidedPaymentScript, OutputStatus}, + models::{DbUnblindedOutput, KnownOneSidedPaymentScript}, + OutputStatus, }, }, - schema::{key_manager_states, known_one_sided_payment_scripts, outputs}, + schema::{key_manager_states, known_one_sided_payment_scripts, outputs, outputs::columns}, storage::sqlite_utilities::wallet_db_connection::WalletDbConnection, util::{ diesel_ext::ExpectedRowsExtension, @@ -317,7 +318,7 @@ impl OutputManagerBackend for OutputManagerSqliteDatabase { } fn fetch_with_features(&self, flags: OutputFlags) -> Result, OutputManagerStorageError> { - let conn = self.database_connection.acquire_lock(); + let conn = self.database_connection.get_pooled_connection()?; let mut outputs = OutputSql::index_by_feature_flags(flags, &conn)?; for o in outputs.iter_mut() { self.decrypt_if_necessary(o)?; @@ -333,7 +334,7 @@ impl OutputManagerBackend for OutputManagerSqliteDatabase { &self, public_key: PublicKey, ) -> Result { - let conn = self.database_connection.acquire_lock(); + let conn = self.database_connection.get_pooled_connection()?; let mut o: OutputSql = outputs::table .filter(columns::features_unique_id.eq(public_key.to_vec())) .filter(columns::features_parent_public_key.is_null()) @@ -1266,26 +1267,6 @@ impl OutputManagerBackend for OutputManagerSqliteDatabase { } } -impl TryFrom for OutputStatus { - type Error = OutputManagerStorageError; - - fn try_from(value: i32) -> Result { - match value { - 0 => Ok(OutputStatus::Unspent), - 1 => Ok(OutputStatus::Spent), - 2 => Ok(OutputStatus::EncumberedToBeReceived), - 3 => Ok(OutputStatus::EncumberedToBeSpent), - 4 => Ok(OutputStatus::Invalid), - 5 => Ok(OutputStatus::CancelledInbound), - 6 => Ok(OutputStatus::UnspentMinedUnconfirmed), - 7 => Ok(OutputStatus::SpentMinedUnconfirmed), - 8 => Ok(OutputStatus::ShortTermEncumberedToBeSpent), - 9 => Ok(OutputStatus::ShortTermEncumberedToBeReceived), - _ => Err(OutputManagerStorageError::ConversionError), - } - } -} - /// These are the fields that can be updated for an Output #[derive(Default)] pub struct UpdateOutput { @@ -1866,7 +1847,7 @@ mod test { let (_, uo) = make_input(MicroTari::from(100 + OsRng.next_u64() % 1000)); let uo = DbUnblindedOutput::from_unblinded_output(uo, &factories, None).unwrap(); - let output = NewOutputSql::new(uo, OutputStatus::Unspent, None, None); + let output = NewOutputSql::new(uo, OutputStatus::Unspent, None, None).unwrap(); let key = GenericArray::from_slice(b"an example very very secret key."); let cipher = Aes256Gcm::new(key); @@ -1984,12 +1965,12 @@ mod test { let (_, uo) = make_input(MicroTari::from(100 + OsRng.next_u64() % 1000)); let uo = DbUnblindedOutput::from_unblinded_output(uo, &factories, None).unwrap(); - let output = NewOutputSql::new(uo, OutputStatus::Unspent, None, None); + let output = NewOutputSql::new(uo, OutputStatus::Unspent, None, None).unwrap(); output.commit(&conn).unwrap(); let (_, uo2) = make_input(MicroTari::from(100 + OsRng.next_u64() % 1000)); let uo2 = DbUnblindedOutput::from_unblinded_output(uo2, &factories, None).unwrap(); - let output2 = NewOutputSql::new(uo2, OutputStatus::Unspent, None, None); + let output2 = NewOutputSql::new(uo2, OutputStatus::Unspent, None, None).unwrap(); output2.commit(&conn).unwrap(); } diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs index 2ed62c6294..71fe2491d2 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs @@ -27,10 +27,7 @@ use tari_crypto::tari_utilities::ByteArray; use crate::{ output_manager_service::{ error::OutputManagerStorageError, - storage::{ - models::{DbUnblindedOutput, OutputStatus}, - sqlite_db::OutputSql, - }, + storage::{models::DbUnblindedOutput, sqlite_db::OutputSql, OutputStatus}, }, schema::outputs, util::encryption::{decrypt_bytes_integral_nonce, encrypt_bytes_integral_nonce, Encryptable}, @@ -53,7 +50,6 @@ pub struct NewOutputSql { pub script_private_key: Vec, pub metadata: Option>, pub features_mint_asset_public_key: Option>, - pub features_mint_asset_owner_commitment: Option>, pub features_parent_public_key: Option>, pub features_unique_id: Option>, pub sender_offset_public_key: Vec, @@ -79,7 +75,7 @@ impl NewOutputSql { flags: output.unblinded_output.features.flags.bits() as i32, maturity: output.unblinded_output.features.maturity as i64, status: status as i32, - received_in_tx_id: received_in_tx_id.map(|i| i as i64), + received_in_tx_id: received_in_tx_id.map(|i| i.as_u64() as i64), hash: Some(output.hash), script: output.unblinded_output.script.as_bytes(), input_data: output.unblinded_output.input_data.as_bytes(), @@ -91,11 +87,7 @@ impl NewOutputSql { .mint_non_fungible .clone() .map(|a| a.asset_public_key.to_vec()), - features_mint_asset_owner_commitment: output - .unblinded_output - .features - .mint_non_fungible - .map(|a| a.asset_owner_commitment.to_vec()), + features_parent_public_key: output.unblinded_output.features.parent_public_key.map(|a| a.to_vec()), features_unique_id: output.unblinded_output.features.unique_id, sender_offset_public_key: output.unblinded_output.sender_offset_public_key.to_vec(), @@ -153,7 +145,6 @@ impl From for NewOutputSql { script_private_key: o.script_private_key, metadata: o.metadata, features_mint_asset_public_key: o.features_mint_asset_public_key, - features_mint_asset_owner_commitment: o.features_mint_asset_owner_commitment, features_parent_public_key: o.features_parent_public_key, features_unique_id: o.features_unique_id, sender_offset_public_key: o.sender_offset_public_key, diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs index 1b605233c1..2035b4acfb 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::convert::TryFrom; +use std::convert::{TryFrom, TryInto}; use aes_gcm::Aes256Gcm; use diesel::{prelude::*, sql_query, SqliteConnection}; @@ -29,27 +29,33 @@ use tari_common_types::{ transaction::TxId, types::{ComSignature, Commitment, PrivateKey, PublicKey}, }; -use tari_core::{ - tari_utilities::hash::Hashable, - transactions::{ - tari_amount::MicroTari, - transaction::{OutputFeatures, OutputFlags, UnblindedOutput}, - CryptoFactories, +use tari_core::transactions::{ + tari_amount::MicroTari, + transaction::{ + AssetOutputFeatures, + MintNonFungibleFeatures, + OutputFeatures, + OutputFlags, + SideChainCheckpointFeatures, + UnblindedOutput, }, + CryptoFactories, }; use tari_crypto::{ commitment::HomomorphicCommitmentFactory, script::{ExecutionStack, TariScript}, tari_utilities::ByteArray, }; +use tari_utilities::{hash::Hashable, hex::Hex}; use crate::{ output_manager_service::{ error::OutputManagerStorageError, service::{Balance, UTXOSelectionStrategy}, storage::{ - models::{DbUnblindedOutput, OutputStatus}, - sqlite_db::{NewOutputSql, UpdateOutput, UpdateOutputSql}, + models::DbUnblindedOutput, + sqlite_db::{UpdateOutput, UpdateOutputSql}, + OutputStatus, }, }, schema::outputs, @@ -87,15 +93,14 @@ pub struct OutputSql { pub received_in_tx_id: Option, pub spent_in_tx_id: Option, pub coinbase_block_height: Option, - pub script_lock_height: i64, - pub spend_priority: i32, pub metadata: Option>, pub features_mint_asset_public_key: Option>, - pub features_mint_asset_owner_commitment: Option>, pub features_sidechain_checkpoint_merkle_root: Option>, pub features_parent_public_key: Option>, pub features_unique_id: Option>, pub features_sidechain_committee: Option, + pub script_lock_height: i64, + pub spending_priority: i32, pub features_asset_json: Option, } @@ -364,8 +369,8 @@ impl OutputSql { Ok(outputs::table .filter( outputs::received_in_tx_id - .eq(Some(tx_id as i64)) - .or(outputs::spent_in_tx_id.eq(Some(tx_id as i64))), + .eq(Some(tx_id.as_u64() as i64)) + .or(outputs::spent_in_tx_id.eq(Some(tx_id.as_u64() as i64))), ) .filter(outputs::status.eq(status as i32)) .load(conn)?) @@ -379,8 +384,8 @@ impl OutputSql { Ok(outputs::table .filter( outputs::received_in_tx_id - .eq(Some(tx_id as i64)) - .or(outputs::spent_in_tx_id.eq(Some(tx_id as i64))), + .eq(Some(tx_id.as_u64() as i64)) + .or(outputs::spent_in_tx_id.eq(Some(tx_id.as_u64() as i64))), ) .filter( outputs::status @@ -484,10 +489,7 @@ impl TryFrom for DbUnblindedOutput { let mint_non_fungible = match o.features_mint_asset_public_key { Some(ref public_key) => Some(MintNonFungibleFeatures { asset_public_key: PublicKey::from_bytes(public_key)?, - asset_owner_commitment: o - .features_mint_asset_owner_commitment - .map(|ao| Commitment::from_bytes(&ao)) - .unwrap()?, + asset_owner_commitment: o.commitment.clone().map(|ao| Commitment::from_bytes(&ao)).unwrap()?, }), None => None, }; @@ -527,9 +529,11 @@ impl TryFrom for DbUnblindedOutput { target: LOG_TARGET, "Could not create PrivateKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, - features, + features, TariScript::from_bytes(o.script.as_slice())?, ExecutionStack::from_bytes(o.input_data.as_slice())?, PrivateKey::from_vec(&o.script_private_key).map_err(|_| { @@ -537,14 +541,18 @@ impl TryFrom for DbUnblindedOutput { target: LOG_TARGET, "Could not create PrivateKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, PublicKey::from_vec(&o.sender_offset_public_key).map_err(|_| { error!( target: LOG_TARGET, "Could not create PublicKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, ComSignature::new( Commitment::from_vec(&o.metadata_signature_nonce).map_err(|_| { @@ -552,21 +560,27 @@ impl TryFrom for DbUnblindedOutput { target: LOG_TARGET, "Could not create PublicKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, PrivateKey::from_vec(&o.metadata_signature_u_key).map_err(|_| { error!( target: LOG_TARGET, "Could not create PrivateKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, PrivateKey::from_vec(&o.metadata_signature_v_key).map_err(|_| { error!( target: LOG_TARGET, "Could not create PrivateKey from stored bytes, They might be encrypted" ); - OutputManagerStorageError::ConversionError + OutputManagerStorageError::ConversionError { + reason: "PrivateKey could not be converted from bytes".to_string(), + } })?, ), o.script_lock_height as u64, @@ -588,17 +602,18 @@ impl TryFrom for DbUnblindedOutput { }, Some(c) => Commitment::from_vec(&c)?, }; - let spend_priority = (o.spend_priority as u32).into(); + let spending_priority = (o.spending_priority as u32).into(); Ok(Self { commitment, unblinded_output, hash, + status: o.status.try_into()?, mined_height: o.mined_height.map(|mh| mh as u64), mined_in_block: o.mined_in_block, mined_mmr_position: o.mined_mmr_position.map(|mp| mp as u64), marked_deleted_at_height: o.marked_deleted_at_height.map(|d| d as u64), marked_deleted_in_block: o.marked_deleted_in_block, - spend_priority, + spending_priority, }) } } diff --git a/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs b/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs index 0e436a69f8..f4938eeca6 100644 --- a/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs +++ b/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs @@ -45,19 +45,6 @@ use crate::{ }, }; -use crate::{ - connectivity_service::WalletConnectivityInterface, - output_manager_service::{ - config::OutputManagerServiceConfig, - error::{OutputManagerError, OutputManagerProtocolError, OutputManagerProtocolErrorExt}, - handle::{OutputManagerEvent, OutputManagerEventSender}, - storage::{ - database::{OutputManagerBackend, OutputManagerDatabase}, - models::DbUnblindedOutput, - }, - }, -}; - const LOG_TARGET: &str = "wallet::output_service::txo_validation_task"; pub struct TxoValidationTask { diff --git a/base_layer/wallet/src/schema.rs b/base_layer/wallet/src/schema.rs index edfa1b0c0f..db55a6b6ab 100644 --- a/base_layer/wallet/src/schema.rs +++ b/base_layer/wallet/src/schema.rs @@ -113,15 +113,14 @@ table! { received_in_tx_id -> Nullable, spent_in_tx_id -> Nullable, coinbase_block_height -> Nullable, - script_lock_height -> BigInt, - spending_priority -> Integer, metadata -> Nullable, features_mint_asset_public_key -> Nullable, - features_mint_asset_owner_commitment -> Nullable, features_sidechain_checkpoint_merkle_root -> Nullable, features_parent_public_key -> Nullable, features_unique_id -> Nullable, features_sidechain_committee -> Nullable, + script_lock_height -> BigInt, + spending_priority -> Integer, features_asset_json -> Nullable, } } diff --git a/base_layer/wallet/src/storage/sqlite_db.rs b/base_layer/wallet/src/storage/sqlite_db.rs index 48cb91f15a..f1201a5a52 100644 --- a/base_layer/wallet/src/storage/sqlite_db.rs +++ b/base_layer/wallet/src/storage/sqlite_db.rs @@ -740,12 +740,6 @@ mod test { sqlite_utilities::run_migration_and_create_sqlite_connection, }; - use crate::storage::{ - database::{DbKey, DbValue, WalletBackend}, - sqlite_db::{ClientKeyValueSql, WalletSettingSql, WalletSqliteDatabase}, - sqlite_utilities::run_migration_and_create_sqlite_connection, - }; - #[test] fn test_unencrypted_secret_public_key_setting() { let db_name = format!("{}.sqlite3", string(8).as_str()); diff --git a/base_layer/wallet/src/transaction_service/error.rs b/base_layer/wallet/src/transaction_service/error.rs index 1540b83bb3..406457b0b2 100644 --- a/base_layer/wallet/src/transaction_service/error.rs +++ b/base_layer/wallet/src/transaction_service/error.rs @@ -243,14 +243,14 @@ impl From for TransactionServiceError { } pub trait TransactionServiceProtocolErrorExt { - fn for_protocol(self, id: u64) -> Result; + fn for_protocol>(self, id: T) -> Result; } impl> TransactionServiceProtocolErrorExt for Result { - fn for_protocol(self, id: u64) -> Result { + fn for_protocol>(self, id: T) -> Result { match self { Ok(r) => Ok(r), - Err(e) => Err(TransactionServiceProtocolError::new(id, e.into())), + Err(e) => Err(TransactionServiceProtocolError::new(id.into(), e.into())), } } } diff --git a/base_layer/wallet/src/transaction_service/handle.rs b/base_layer/wallet/src/transaction_service/handle.rs index c97cfdc6d5..11f6df342c 100644 --- a/base_layer/wallet/src/transaction_service/handle.rs +++ b/base_layer/wallet/src/transaction_service/handle.rs @@ -34,10 +34,13 @@ use tari_utilities::hex::Hex; use tokio::sync::broadcast; use tower::Service; -use crate::transaction_service::{ - error::TransactionServiceError, - protocols::TxRejection, - storage::models::{CompletedTransaction, InboundTransaction, OutboundTransaction, WalletTransaction}, +use crate::{ + transaction_service::{ + error::TransactionServiceError, + protocols::TxRejection, + storage::models::{CompletedTransaction, InboundTransaction, OutboundTransaction, WalletTransaction}, + }, + OperationId, }; /// API Request enum @@ -195,7 +198,7 @@ pub enum TransactionEvent { num_confirmations: u64, is_valid: bool, }, - TransactionValidationStateChanged(u64), + TransactionValidationStateChanged(OperationId), Error(String), } @@ -226,8 +229,8 @@ impl fmt::Display for TransactionEvent { TransactionEvent::TransactionStoreForwardSendResult(tx, success) => { write!(f, "TransactionStoreForwardSendResult for {}:{}", tx, success) }, - TransactionEvent::TransactionCancelled(tx) => { - write!(f, "TransactionCancelled for {}", tx) + TransactionEvent::TransactionCancelled(tx, rejection) => { + write!(f, "TransactionCancelled for {}:{:?}", tx, rejection) }, TransactionEvent::TransactionBroadcast(tx) => { write!(f, "TransactionBroadcast for {}", tx) @@ -252,24 +255,12 @@ impl fmt::Display for TransactionEvent { tx_id, num_confirmations, is_valid ) }, - TransactionEvent::TransactionValidationTimedOut(tx) => { - write!(f, "TransactionValidationTimedOut for {}", tx) - }, - TransactionEvent::TransactionValidationSuccess(tx) => { - write!(f, "TransactionValidationSuccess for {}", tx) - }, - TransactionEvent::TransactionValidationFailure(tx) => { - write!(f, "TransactionValidationFailure for {}", tx) - }, - TransactionEvent::TransactionValidationAborted(tx) => { - write!(f, "TransactionValidationAborted for {}", tx) - }, - TransactionEvent::TransactionValidationDelayed(tx) => { - write!(f, "TransactionValidationDelayed for {}", tx) - }, TransactionEvent::Error(error) => { write!(f, "Error:{}", error) }, + TransactionEvent::TransactionValidationStateChanged(operation_id) => { + write!(f, "Transaction validation state changed: {}", operation_id) + }, } } } diff --git a/base_layer/wallet/src/transaction_service/protocols/transaction_validation_protocol.rs b/base_layer/wallet/src/transaction_service/protocols/transaction_validation_protocol.rs index 92cb6776b9..87cf6c1dba 100644 --- a/base_layer/wallet/src/transaction_service/protocols/transaction_validation_protocol.rs +++ b/base_layer/wallet/src/transaction_service/protocols/transaction_validation_protocol.rs @@ -54,6 +54,7 @@ use crate::{ sqlite_db::UnconfirmedTransactionInfo, }, }, + OperationId, }; const LOG_TARGET: &str = "wallet::transaction_service::protocols::validation_protocol"; @@ -211,7 +212,7 @@ where "Checking last mined transactions to see if the base node has re-orged (Operation ID: {})", self.operation_id ); - let op_id = self.operation_id.as_u64(); + let op_id = self.operation_id; while let Some(last_mined_transaction) = self.db.fetch_last_mined_transaction().await.for_protocol(op_id)? { let mined_height = last_mined_transaction .mined_height @@ -255,9 +256,7 @@ where ); self.update_transaction_as_unmined(last_mined_transaction.tx_id, &last_mined_transaction.status) .await?; - self.publish_event(TransactionEvent::TransactionValidationStateChanged( - last_mined_transaction.tx_id, - )); + self.publish_event(TransactionEvent::TransactionValidationStateChanged(op_id)); } else { info!( target: LOG_TARGET, diff --git a/base_layer/wallet/src/transaction_service/service.rs b/base_layer/wallet/src/transaction_service/service.rs index 815dcded95..783e4c4159 100644 --- a/base_layer/wallet/src/transaction_service/service.rs +++ b/base_layer/wallet/src/transaction_service/service.rs @@ -31,7 +31,7 @@ use chrono::{NaiveDateTime, Utc}; use digest::Digest; use futures::{pin_mut, stream::FuturesUnordered, Stream, StreamExt}; use log::*; -use rand::{rngs::OsRng, RngCore}; +use rand::rngs::OsRng; use sha2::Sha256; use tari_common_types::{ transaction::{TransactionDirection, TransactionStatus, TxId}, @@ -56,7 +56,7 @@ use tari_core::{ }; use tari_crypto::{ inputs, - keys::{DiffieHellmanSharedSecret, PublicKey as PKtrait}, + keys::{DiffieHellmanSharedSecret, PublicKey as PKtrait, SecretKey}, script, tari_utilities::ByteArray, }; @@ -98,6 +98,7 @@ use crate::{ types::HashDigest, util::watch::Watch, utxo_scanner_service::RECOVERY_KEY, + OperationId, }; const LOG_TARGET: &str = "wallet::transaction_service::service"; @@ -832,10 +833,10 @@ where fee_per_gram: MicroTari, message: String, transaction_broadcast_join_handles: &mut FuturesUnordered< - JoinHandle>, + JoinHandle>, >, ) -> Result, TransactionServiceError> { - let tx_id = OsRng.next_u64(); + let tx_id = TxId::new_random(); // this can be anything, so lets generate a random private key let pre_image = PublicKey::from_secret_key(&PrivateKey::random(&mut OsRng)); let hash: [u8; 32] = Sha256::digest(pre_image.as_bytes()).into(); @@ -849,7 +850,7 @@ where // Prepare sender part of the transaction let mut stp = self .output_manager_service - .prepare_transaction_to_send(tx_id, amount, fee_per_gram, None, message.clone(), script.clone()) + .prepare_transaction_to_send(tx_id, amount, None, fee_per_gram, None, message.clone(), script.clone()) .await?; // This call is needed to advance the state from `SingleRoundMessageReady` to `SingleRoundMessageReady`, diff --git a/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs b/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs index e601da2525..52431d153a 100644 --- a/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs +++ b/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs @@ -2002,7 +2002,7 @@ impl TryFrom for UnconfirmedTransactionInfo { fn try_from(i: UnconfirmedTransactionInfoSql) -> Result { Ok(Self { - tx_id: i.tx_id as u64, + tx_id: (i.tx_id as u64).into(), signature: Signature::new( PublicKey::from_vec(&i.transaction_signature_nonce)?, PrivateKey::from_vec(&i.transaction_signature_key)?, diff --git a/base_layer/wallet/src/transaction_service/tasks/send_finalized_transaction.rs b/base_layer/wallet/src/transaction_service/tasks/send_finalized_transaction.rs index 5cca7b444f..b1520fa744 100644 --- a/base_layer/wallet/src/transaction_service/tasks/send_finalized_transaction.rs +++ b/base_layer/wallet/src/transaction_service/tasks/send_finalized_transaction.rs @@ -1,15 +1,3 @@ -use std::time::Duration; - -use log::*; -use tari_common_types::transaction::TxId; -use tari_comms::{peer_manager::NodeId, types::CommsPublicKey}; -use tari_comms_dht::{ - domain_message::OutboundDomainMessage, - outbound::{OutboundEncryption, OutboundMessageRequester, SendMessageResponse}, -}; -use tari_core::transactions::{transaction::Transaction, transaction_protocol::proto}; -use tari_p2p::tari_message::TariMessageType; - // Copyright 2020. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the @@ -32,11 +20,18 @@ use tari_p2p::tari_message::TariMessageType; // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. -use crate::transaction_service::{ - config::TransactionRoutingMechanism, - error::TransactionServiceError, - tasks::wait_on_dial::wait_on_dial, + +use std::time::Duration; + +use log::*; +use tari_common_types::transaction::TxId; +use tari_comms::{peer_manager::NodeId, types::CommsPublicKey}; +use tari_comms_dht::{ + domain_message::OutboundDomainMessage, + outbound::{OutboundEncryption, OutboundMessageRequester, SendMessageResponse}, }; +use tari_core::transactions::{transaction::Transaction, transaction_protocol::proto}; +use tari_p2p::tari_message::TariMessageType; use crate::transaction_service::{ config::TransactionRoutingMechanism, diff --git a/base_layer/wallet/src/utxo_scanner_service/mod.rs b/base_layer/wallet/src/utxo_scanner_service/mod.rs index 921a82888e..b17c5c775e 100644 --- a/base_layer/wallet/src/utxo_scanner_service/mod.rs +++ b/base_layer/wallet/src/utxo_scanner_service/mod.rs @@ -7,15 +7,6 @@ use tari_core::transactions::CryptoFactories; use tari_service_framework::{async_trait, ServiceInitializationError, ServiceInitializer, ServiceInitializerContext}; use tokio::sync::broadcast; -use std::{sync::Arc, time::Duration}; - -use futures::future; -use log::*; -use tari_comms::{connectivity::ConnectivityRequester, NodeIdentity}; -use tari_core::transactions::CryptoFactories; -use tari_service_framework::{async_trait, ServiceInitializationError, ServiceInitializer, ServiceInitializerContext}; -use tokio::sync::broadcast; - use crate::{ base_node_service::handle::BaseNodeServiceHandle, connectivity_service::{WalletConnectivityHandle, WalletConnectivityInterface}, diff --git a/base_layer/wallet/src/utxo_scanner_service/utxo_scanner_task.rs b/base_layer/wallet/src/utxo_scanner_service/utxo_scanner_task.rs index ade9ea7539..143ce198e8 100644 --- a/base_layer/wallet/src/utxo_scanner_service/utxo_scanner_task.rs +++ b/base_layer/wallet/src/utxo_scanner_service/utxo_scanner_task.rs @@ -30,8 +30,7 @@ use futures::StreamExt; use log::*; use tari_common_types::transaction::TxId; use tari_comms::{ - connectivity::ConnectivityRequester, - peer_manager::{NodeId, Peer}, + peer_manager::NodeId, protocol::rpc::{RpcError, RpcStatus}, types::CommsPublicKey, PeerConnection, @@ -47,6 +46,7 @@ use tari_core::{ }, }; use tari_shutdown::ShutdownSignal; +use tari_utilities::{hex::Hex, Hashable}; use tokio::{sync::broadcast, time}; use crate::{ diff --git a/base_layer/wallet/temp.sqlite b/base_layer/wallet/temp.sqlite deleted file mode 100644 index eb9017a9103f69d6185dcf4af92241c5fd0181a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 106496 zcmeI4U2GfKb;n74kQONpWn1?6W3?WCY-_=C%ppZf46tn}nb8WCWt*m)7{+!mB1h8H z{94Y?Yc&m8+1_Rov@wu}q<{?1$r6`)Wv~Ml?6l`C*-S#0!5VQ~7_OUI{qV1XC z-1*`RDI5DxOMiML&YXMhopXQp+$QOR~({WOWrvJ-O1j7HREO?jfdS0@`KxvRI#d#Tmc+g)9gTJ@SF zx^BjwJ{*nn7cWMie@&M+>x!$$bvd?NE)^>!p;BC0D+w1|B^QLtsf0iut*ta`YI9q9 zr0fbyYqyt#JLT0|#qtB;X6b>je!C*9Z>+7&^^_mW^{!&nGCr&8mC{P7+`BP;`;@op z^0vlGhbhyLbUUiPYw8bE)^yTlO%GGnpGayg+zjemDlsSQ$l6Y?`$l(XKRCz5`9dN3 zjRz*(YOB$%E4osX^p4!rtV>SxH(&`HJYS2Jvt!}5PNbT-s zU9Fl!XVx~y&uPcF@(oH&(R8&b8}_?v53eXUTHU7ZZJX{aQ{8gk6SoxGW87N9E4oli z?M_Q?RaT(-Q%a@{FN)wJ;n6U z_ho8Gmo!DE;oa7Jw<(WL`U;sd8Vi7hcjyw(hlE+4O3c1}BF5jn61JfE9xjPK0rzYt z5$E&y=uQRuQFqX`#cS`qCQqSj>Gqn-iOx? zuhZ|apQEpm7t(-f-D;KQljF74R^s^f?DM4~aeiST`r$>khxLy&?OFZ83C~~$s)UcW zIU9!$`D?UN8ob>;W34yC-QfT6g12uc+DjaZ^E@Bj>#Y}UMd?sXL%)uDoWv9{r*Q3? zp&^g3vA%kDqhv)sM)fePuC;IWc#MCW4_o_88zj;En%+A;73XJWqI*ZoUP;_2mhoEOFDv#*-tM7yNaked`HbR;9t zP_%x@5zpB5m$OlH;!?}C?8VZx0b35(kTu?k`1S?41V9v>gx5t?QwP^7UR|BFn1f!2V*e^g%qdL;kDw~ux2fk zk{CM~GY*`Qy_IO3FBYRuPn(`9Ni|i`l)9uhyZ<;(fZZ191l(``zmXT-txD#crOY}c{_f#r>IxwKx9Y?ax2BQbuv7}oJ{ zvm`ONjNqI+m7?G0lcyr-e@Op%`djIp^iui_?%%nOxj*5abHC0la>r7irT#kgN2%XT zRZ?F_9hv<35~^T#vkMEs!0Fk1u^%30uqLwMbJWpsfj}m8V&`KqDDALPu;ZnnUw6 z0D*SJ9W7DJ&R-9`2fGeLnSjk@UZ%|1teH=^v&4IQ=61TWK|YKfRpJ zq-W9z?mxI+aDU7FCHE2c2iyl-hm*K9uE1U5j;8)6^)IQvPyJQu&r;u~Ch!3P5C8!X z009sH0T2KI5C8!X*e3x>8$^xco|AGqZ;R~wlHd|q$)t0Rh-Hr6bVMvoG{ZzrPUsC= zWG8^m+9EsKb7p$F$4kBR$jl{-xkOgtVAK}bS%MKtIZaS%&PXg+DFNgCKmDbD zd_VvMKmY_l00ck)1V8`;KmY_l00a&&0i6F2@Zh3rAOHd&00JNY0w4eaAOHd&00JOj z5y1H$t^fic00JNY0w4eaAOHd&00JNY0tcUf@$dif_x}(6IHQLk00JNY0w4eaAOHd& z00JNY0*9Lb-v1x&@kj4L00ck)1V8`;KmY_l00ck)1P%uQoc|BUIHQ*!00JNY0w4ea zAOHd&00JNY0*9Lb{{H{r9)I*61V8`;KmY_l00ck)1V8`;K;Uo?!2AEhG0x~E2!H?x zfB*=900@8p2!H?xfWYA!3m00ck)1V8`;KmY_l z00ck)1P%}Zy#GHygNd$y00@8p2!H?xfB*=900@8p2!KEc0lfbY0Ru4zfB*=900@8p z2!H?xfB*=9001TYf zDoQ~B1V8`;KmY_l00ck)1V8`;KmY_@Hv+DI|36K(rjgUnf_RZ%urX zsEz$(e24p#n#_;I_|=Qih}x_vPqg>ys;)?KS8tj3Qmd=CySgT|>NQDp-HbndI2z|K zUW`8fnl5kF6<3k#a%{P58a?sJ_|z*rW8#ysPxteTQn6AJD#fL>l5oNG^b5k}R6?MS z)>fJ|wYe=lQg(%_~ynzc>FPCLex z4_r;rbhRlP_Pc8juP8TK-KOqso9--A-E!X(w-kF+-CDydx=>5)PD^i9TXkxoQu<28 z-4I>-p4b~gpH6^J^;K*rnkH}enLGT6x=K}bxzYAM^ajn3%Id9>OUg`5CFX>x+^j0~ zx>B>jvI6PpeNL2O_xkvrysWIy_RTllA{i4q}pn3sU4bX#>{Y=VfUriQbTRhGzzk| zSE4q19qO$YMxEK`*+iVr=c6CS&B;jJrY?D>VvsE9nTSCe;nVO{X5g#Lq2aTD247Jh zD;;MF40p$VKOSDk8G7cewhJ(UGhbfTdwbrcb*ojHVFTUh^K#kQ#K)1-{K7)?!;5U6 zw7lkKI>t+duzfdpy_Upa`P51>#y`x5H5TM^k{BeN{9y7(+%WeW3qEsQ`weZe{hmMJ z@$x{Ga5pzccDS# zUDFCCXWvIXuFs^*+g-6yXy_?ytgqhPC|MCG?QyadRQ3%!+c#5*+0}^{|L#IqHv(s% z8N&C^-NfWSN2YjDj6VCS*}+G9GpFMGwQJEmwb$Xgsx);Yypzo6SgZO4N4yC9#f*g! ze_N5$&{6vOWQuus=N9q$RbwLw;)4>gzH!#s=K-jdn+E$emqtEX)%c3vt+k&2L|& z{-q&cRj{8#uC>Qc$N4K)qI-%-);EECwN~CAR*!L>M zTX$@hcF?)JQ7)I(E0V1;dv7GhZx_R+Z@5{K7+yA-8s#G6BR`F#|AKqLWn$kN`Kj?I z5{dpVOCF5xx$l@1-v@%g)$=jFcs9(ZSZajjan9t=y-Mn5`s?jC&D76}UpD6;YnD<( zuFG-HEW6+;vC}gBi>zl6>yOXxyj=g{k;v%p@Mq6P|M0inhFYe?JO)}qwp@7)vF<|c zWqSi#cHN7_oN)E3kxmoTX4P850~@EnzM<+3+Gl;mY$q{~t-TbLPosD1NpiV0>;}Af zF1Lz(?MZ&wQo3LVMApSYUGXHv+>Q7-4Qj-bEOR&VGM0p7V4NJxe!8}wmW zlRUJ`+!tE4qqhCSYADzZ>|Wk( zP?of%sYVLgYQWmGhSrxmk0>i$Q+h9XWZj#f9=u6I>-x^TWzyTAOlL+*ZVRKH{QcRcC=)6Y;$eM2>3Rh~q-=yq-E7tO< zYHCfX?#P6K&Xd(gZF;w%OAV#-sIEwzR!jFkzb$tR1g;#9ufc9peXpw+Z`XVUt|yt1 zpH8o*bmfWe>Rhj1zoC&A86`rqTdxlqj^*3y_bTNgMOlLNSXW1T87ASfBbudy{<||V z{=J)F2Zl#Y;zb8rg;t3g`DI()H3C#RY#RX$WyppooO*iYjW~bvX7t%DGXNN(KBV}B zCtx3<%mR5U;xYFSa|#d0-?+mfwu0FUfF0CWuasRe-7sA(a zjcZ|p(U)_h1f@UEb{zlzzXNfOM<+l41V8`;KmY_l00ck)1V8`;KwuyNoc{;nK_Li$ z00@8p2!H?xfB*=900@8p2pk9kIR77rVMHfD00ck)1V8`;KmY_l00ck)1VCUQf&T*_ C(f`!| diff --git a/base_layer/wallet/tests/output_manager_service/service.rs b/base_layer/wallet/tests/output_manager_service/service.rs index 654a973586..11e0d065da 100644 --- a/base_layer/wallet/tests/output_manager_service/service.rs +++ b/base_layer/wallet/tests/output_manager_service/service.rs @@ -1080,7 +1080,9 @@ async fn test_txo_validation() { MicroTari::from(output1_value), ); let output1_tx_output = output1.as_transaction_output(&factories).unwrap(); - oms.add_output_with_tx_id(1.into(), output1.clone(), None).await.unwrap(); + oms.add_output_with_tx_id(1.into(), output1.clone(), None) + .await + .unwrap(); let output2_value = 2_000_000; let output2 = create_unblinded_output( @@ -1091,7 +1093,9 @@ async fn test_txo_validation() { ); let output2_tx_output = output2.as_transaction_output(&factories).unwrap(); - oms.add_output_with_tx_id(2.into(), output2.clone(), None).await.unwrap(); + oms.add_output_with_tx_id(2.into(), output2.clone(), None) + .await + .unwrap(); let output3_value = 4_000_000; let output3 = create_unblinded_output( @@ -1101,7 +1105,9 @@ async fn test_txo_validation() { MicroTari::from(output3_value), ); - oms.add_output_with_tx_id(3.into(), output3.clone(), None).await.unwrap(); + oms.add_output_with_tx_id(3.into(), output3.clone(), None) + .await + .unwrap(); let mut block1_header = BlockHeader::new(1); block1_header.height = 1; @@ -1575,7 +1581,9 @@ async fn test_txo_revalidation() { MicroTari::from(output1_value), ); let output1_tx_output = output1.as_transaction_output(&factories).unwrap(); - oms.add_output_with_tx_id(1.into(), output1.clone(), None).await.unwrap(); + oms.add_output_with_tx_id(1.into(), output1.clone(), None) + .await + .unwrap(); let output2_value = 2_000_000; let output2 = create_unblinded_output( @@ -1586,7 +1594,9 @@ async fn test_txo_revalidation() { ); let output2_tx_output = output2.as_transaction_output(&factories).unwrap(); - oms.add_output_with_tx_id(2.into(), output2.clone(), None).await.unwrap(); + oms.add_output_with_tx_id(2.into(), output2.clone(), None) + .await + .unwrap(); let mut block1_header = BlockHeader::new(1); block1_header.height = 1; diff --git a/base_layer/wallet/tests/transaction_service/service.rs b/base_layer/wallet/tests/transaction_service/service.rs index ae669a81a6..d8e74ca601 100644 --- a/base_layer/wallet/tests/transaction_service/service.rs +++ b/base_layer/wallet/tests/transaction_service/service.rs @@ -1048,7 +1048,7 @@ fn test_htlc_send_and_claim() { .unwrap(); bob_ts - .submit_transaction(tx_id_htlc, tx, htlc_fee, htlc_amount, "".to_string()) + .submit_transaction(tx_id_htlc, tx, htlc_amount, "".to_string()) .await .unwrap(); assert_eq!( diff --git a/base_layer/wallet_ffi/src/callback_handler.rs b/base_layer/wallet_ffi/src/callback_handler.rs index 89d1043e2e..177220b53c 100644 --- a/base_layer/wallet_ffi/src/callback_handler.rs +++ b/base_layer/wallet_ffi/src/callback_handler.rs @@ -65,7 +65,6 @@ use tari_wallet::{ models::{CompletedTransaction, InboundTransaction}, }, }, - OperationId, }; const LOG_TARGET: &str = "wallet::transaction_service::callback_handler"; @@ -260,7 +259,7 @@ where TBackend: TransactionBackend + 'static self.trigger_balance_refresh().await; }, TransactionEvent::TransactionValidationStateChanged(request_key) => { - self.transaction_validation_complete_event(request_key); + self.transaction_validation_complete_event(request_key.as_u64()); self.trigger_balance_refresh().await; }, TransactionEvent::TransactionMinedRequestTimedOut(_tx_id) | diff --git a/base_layer/wallet_ffi/src/callback_handler_tests.rs b/base_layer/wallet_ffi/src/callback_handler_tests.rs index 6daa27c3e0..8d8917ad50 100644 --- a/base_layer/wallet_ffi/src/callback_handler_tests.rs +++ b/base_layer/wallet_ffi/src/callback_handler_tests.rs @@ -171,10 +171,10 @@ mod test { unsafe extern "C" fn tx_cancellation_callback(tx: *mut CompletedTransaction, _reason: u64) { let mut lock = CALLBACK_STATE.lock().unwrap(); - match (*tx).tx_id { - TxId(3) => lock.tx_cancellation_callback_called_inbound = true, - TxId(4) => lock.tx_cancellation_callback_called_completed = true, - TxId(5) => lock.tx_cancellation_callback_called_outbound = true, + match (*tx).tx_id.as_u64() { + 3 => lock.tx_cancellation_callback_called_inbound = true, + 4 => lock.tx_cancellation_callback_called_completed = true, + 5 => lock.tx_cancellation_callback_called_outbound = true, _ => (), } drop(lock); @@ -209,7 +209,7 @@ mod test { let rtp = ReceiverTransactionProtocol::new_placeholder(); let inbound_tx = InboundTransaction::new( - TxId(1u64), + 1u64.into(), PublicKey::from_secret_key(&PrivateKey::random(&mut OsRng)), 22 * uT, rtp, @@ -218,7 +218,7 @@ mod test { Utc::now().naive_utc(), ); let completed_tx = CompletedTransaction::new( - TxId(2u64), + 2u64.into(), PublicKey::from_secret_key(&PrivateKey::random(&mut OsRng)), PublicKey::from_secret_key(&PrivateKey::random(&mut OsRng)), MicroTari::from(100), @@ -238,7 +238,7 @@ mod test { ); let stp = SenderTransactionProtocol::new_placeholder(); let outbound_tx = OutboundTransaction::new( - TxId(3u64), + 3u64.into(), PublicKey::from_secret_key(&PrivateKey::random(&mut OsRng)), 22 * uT, 23 * uT, @@ -249,32 +249,32 @@ mod test { false, ); let inbound_tx_cancelled = InboundTransaction { - tx_id: TxId(4u64), + tx_id: 4u64.into(), ..inbound_tx.clone() }; let completed_tx_cancelled = CompletedTransaction { - tx_id: TxId(5u64), + tx_id: 5u64.into(), ..completed_tx.clone() }; runtime - .block_on(db.add_pending_inbound_transaction(1u64, inbound_tx.clone())) + .block_on(db.add_pending_inbound_transaction(1u64.into(), inbound_tx.clone())) .unwrap(); runtime - .block_on(db.insert_completed_transaction(2u64, completed_tx.clone())) + .block_on(db.insert_completed_transaction(2u64.into(), completed_tx.clone())) .unwrap(); runtime - .block_on(db.add_pending_inbound_transaction(4u64, inbound_tx_cancelled)) + .block_on(db.add_pending_inbound_transaction(4u64.into(), inbound_tx_cancelled)) .unwrap(); - runtime.block_on(db.cancel_pending_transaction(4u64)).unwrap(); + runtime.block_on(db.cancel_pending_transaction(4u64.into())).unwrap(); runtime - .block_on(db.insert_completed_transaction(5u64, completed_tx_cancelled.clone())) + .block_on(db.insert_completed_transaction(5u64.into(), completed_tx_cancelled.clone())) .unwrap(); - runtime.block_on(db.reject_completed_transaction(5u64)).unwrap(); + runtime.block_on(db.reject_completed_transaction(5u64.into())).unwrap(); runtime - .block_on(db.add_pending_outbound_transaction(3u64, outbound_tx.clone())) + .block_on(db.add_pending_outbound_transaction(3u64.into(), outbound_tx.clone())) .unwrap(); - runtime.block_on(db.cancel_pending_transaction(3u64)).unwrap(); + runtime.block_on(db.cancel_pending_transaction(3u64.into())).unwrap(); let (transaction_event_sender, transaction_event_receiver) = broadcast::channel(20); let (oms_event_sender, oms_event_receiver) = broadcast::channel(20); @@ -330,7 +330,7 @@ mod test { // changed from an initial zero balance. // Balance updated should be detected with following event, total = 1 times transaction_event_sender - .send(Arc::new(TransactionEvent::ReceivedTransaction(1u64))) + .send(Arc::new(TransactionEvent::ReceivedTransaction(1u64.into()))) .unwrap(); let start = Instant::now(); while start.elapsed().as_secs() < 10 { @@ -349,7 +349,7 @@ mod test { mock_output_manager_service_state.set_balance(balance.clone()); // Balance updated should be detected with following event, total = 2 times transaction_event_sender - .send(Arc::new(TransactionEvent::ReceivedTransactionReply(2u64))) + .send(Arc::new(TransactionEvent::ReceivedTransactionReply(2u64.into()))) .unwrap(); let start = Instant::now(); while start.elapsed().as_secs() < 10 { @@ -368,7 +368,7 @@ mod test { mock_output_manager_service_state.set_balance(balance.clone()); // Balance updated should be detected with following event, total = 3 times transaction_event_sender - .send(Arc::new(TransactionEvent::ReceivedFinalizedTransaction(2u64))) + .send(Arc::new(TransactionEvent::ReceivedFinalizedTransaction(2u64.into()))) .unwrap(); let start = Instant::now(); while start.elapsed().as_secs() < 10 { @@ -384,31 +384,35 @@ mod test { assert_eq!(callback_balance_updated, 3); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionBroadcast(2u64))) + .send(Arc::new(TransactionEvent::TransactionBroadcast(2u64.into()))) .unwrap(); transaction_event_sender .send(Arc::new(TransactionEvent::TransactionMined { - tx_id: 2u64, + tx_id: 2u64.into(), is_valid: true, })) .unwrap(); transaction_event_sender .send(Arc::new(TransactionEvent::TransactionMinedUnconfirmed { - tx_id: 2u64, + tx_id: 2u64.into(), num_confirmations: 22u64, is_valid: true, })) .unwrap(); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionDirectSendResult(2u64, true))) + .send(Arc::new(TransactionEvent::TransactionDirectSendResult( + 2u64.into(), + true, + ))) .unwrap(); transaction_event_sender .send(Arc::new(TransactionEvent::TransactionStoreForwardSendResult( - 2u64, true, + 2u64.into(), + true, ))) .unwrap(); @@ -417,7 +421,7 @@ mod test { // Balance updated should be detected with following event, total = 4 times transaction_event_sender .send(Arc::new(TransactionEvent::TransactionCancelled( - 3u64, + 3u64.into(), TxRejection::UserCancelled, ))) .unwrap(); @@ -436,14 +440,14 @@ mod test { transaction_event_sender .send(Arc::new(TransactionEvent::TransactionCancelled( - 4u64, + 4u64.into(), TxRejection::UserCancelled, ))) .unwrap(); transaction_event_sender .send(Arc::new(TransactionEvent::TransactionCancelled( - 5u64, + 5u64.into(), TxRejection::UserCancelled, ))) .unwrap(); @@ -476,7 +480,9 @@ mod test { assert_eq!(callback_balance_updated, 5); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionValidationStateChanged(1u64))) + .send(Arc::new(TransactionEvent::TransactionValidationStateChanged( + 1u64.into(), + ))) .unwrap(); oms_event_sender @@ -492,7 +498,9 @@ mod test { .unwrap(); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionValidationStateChanged(2u64))) + .send(Arc::new(TransactionEvent::TransactionValidationStateChanged( + 2u64.into(), + ))) .unwrap(); oms_event_sender @@ -508,7 +516,9 @@ mod test { .unwrap(); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionValidationStateChanged(3u64))) + .send(Arc::new(TransactionEvent::TransactionValidationStateChanged( + 3u64.into(), + ))) .unwrap(); oms_event_sender @@ -524,7 +534,9 @@ mod test { .unwrap(); transaction_event_sender - .send(Arc::new(TransactionEvent::TransactionValidationStateChanged(4u64))) + .send(Arc::new(TransactionEvent::TransactionValidationStateChanged( + 4u64.into(), + ))) .unwrap(); dht_event_sender diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index 65a6cfb0d9..d30978d71b 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -3850,10 +3850,11 @@ pub unsafe extern "C" fn wallet_send_transaction( .block_on((*wallet).wallet.transaction_service.send_one_sided_transaction( (*dest_public_key).clone(), MicroTari::from(amount), + None, MicroTari::from(fee_per_gram), message_string, )) { - Ok(tx_id) => tx_id, + Ok(tx_id) => tx_id.as_u64(), Err(e) => { error = LibWalletError::from(WalletError::TransactionServiceError(e)).code; ptr::swap(error_out, &mut error as *mut c_int); @@ -3868,10 +3869,10 @@ pub unsafe extern "C" fn wallet_send_transaction( (*dest_public_key).clone(), MicroTari::from(amount), None, - MicroTari::from(fee_per_gram), - message_string, - )) { - Ok(tx_id) => tx_id.as_u64(), + MicroTari::from(fee_per_gram), + message_string, + )) { + Ok(tx_id) => tx_id.as_u64(), Err(e) => { error = LibWalletError::from(WalletError::TransactionServiceError(e)).code; ptr::swap(error_out, &mut error as *mut c_int); @@ -4760,7 +4761,7 @@ pub unsafe extern "C" fn wallet_import_utxo( ptr::swap(error_out, &mut error as *mut c_int); return 0; } - tx_id + tx_id.as_u64() }, Err(e) => { error = LibWalletError::from(e).code; diff --git a/common/config/presets/base_node.toml b/common/config/presets/base_node.toml index f1145ef36e..88b234ed1d 100644 --- a/common/config/presets/base_node.toml +++ b/common/config/presets/base_node.toml @@ -24,6 +24,11 @@ [base_node] # network = "weatherwax" +# Enable the gRPC server for the base node. Set this to true if you want to enable third-party wallet software +grpc_enabled = true +# The socket to expose for the gRPC base node server. This value is ignored if grpc_enabled is false. +grpc_address = "/ip4/127.0.0.1/tcp/18142" + # Configuration options for testnet Weatherwax [base_node.weatherwax] @@ -82,11 +87,6 @@ force_sync_peers = [ # do we allow test addresses to be accpted like 127.0.0.1 allow_test_addresses = false -# Enable the gRPC server for the base node. Set this to true if you want to enable third-party wallet software -grpc_enabled = true -# The socket to expose for the gRPC base node server. This value is ignored if grpc_enabled is false. -# Valid values here are IPv4 and IPv6 TCP sockets, local unix sockets (e.g. "ipc://base-node-gprc.sock.100") -grpc_base_node_address = "127.0.0.1:18142" # A path to the file that stores your node identity and secret key base_node_identity_file = "config/base_node_id.json" diff --git a/common/config/presets/common.toml b/common/config/presets/common.toml index 11d5d77c7d..78d978ead3 100644 --- a/common/config/presets/common.toml +++ b/common/config/presets/common.toml @@ -114,4 +114,22 @@ dns_seeds_use_dnssec = false # auto_update.check_interval = 300 # "auto_update.dns_hosts" = ["updates.igor.taripulse.com"] # "auto_update.hashes_url" = "https://
/hashes.txt" -# "auto_update.hashes_sig_url" = "https://
/hashes.txt.sig" \ No newline at end of file +# "auto_update.hashes_sig_url" = "https://
/hashes.txt.sig" + +[common.dibbler] +dns_seeds =["seeds.dibbler.tari.com"] +peer_seeds = [ + "721e9da488302e69523bca1a9cdcbd2419dddda11698a1e8c6c7bd619659ff21::/onion3/qw4ymrzbanbcr3wwlesxbot72iayd7xdjcrtnacbwgk637vfon47hqad:18141", + # 333388d1cbe3e2bd17453d052f + "c2eca9cf32261a1343e21ed718e79f25bfc74386e9305350b06f62047f519347::/onion3/6yxqk2ybo43u73ukfhyc42qn25echn4zegjpod2ccxzr2jd5atipwzqd:18141", + # 555575715a49fc242d756e52ca + "42fcde82b44af1de95a505d858cb31a422c56c4ac4747fbf3da47d648d4fc346::/onion3/2l3e7ysmihc23zybapdrsbcfg6omtjtfkvwj65dstnfxkwtai2fawtyd:18141", + # 77771f53be07fab4be5f1e1ff7 + "50e6aa8f6c50f1b9d9b3d438dfd2a29cfe1f3e3a650bd9e6b1e10f96b6c38f4d::/onion3/7s6y3cz5bnewlj5ypm7sekhgvqjyrq4bpaj5dyvvo7vxydj7hsmyf5ad:18141", + # 9999016f1f3a6162dddf5a45aa + "36a9df45e1423b5315ffa7a91521924210c8e1d1537ad0968450f20f21e5200d::/onion3/v24qfheti2rztlwzgk6v4kdbes3ra7mo3i2fobacqkbfrk656e3uvnid:18141", + # bbbb8358387d81c388fadb4649 + "be128d570e8ec7b15c101ee1a56d6c56dd7d109199f0bd02f182b71142b8675f::/onion3/ha422qsy743ayblgolui5pg226u42wfcklhc5p7nbhiytlsp4ir2syqd:18141", + # eeeeb0a943ed143e613a135392 + "3e0321c0928ca559ab3c0a396272dfaea705efce88440611a38ff3898b097217::/onion3/sl5ledjoaisst6d4fh7kde746dwweuge4m4mf5nkzdhmy57uwgtb7qqd:18141" +] \ No newline at end of file diff --git a/common/config/presets/console_wallet.toml b/common/config/presets/console_wallet.toml index 270182f485..7c5ea1dc59 100644 --- a/common/config/presets/console_wallet.toml +++ b/common/config/presets/console_wallet.toml @@ -17,8 +17,7 @@ console_wallet_db_file = "wallet/console-wallet.dat" # Enable the gRPC server for the base node. Set this to true if you want to enable third-party wallet software grpc_enabled = true # The socket to expose for the gRPC wallet server. This value is ignored if grpc_enabled is false. -# Valid values here are IPv4 and IPv6 TCP sockets, local unix sockets (e.g. "ipc://base-node-gprc.sock.100") -grpc_address = "127.0.0.1:18143" +grpc_address = "/ip4/127.0.0.1/tcp/18143" # Console wallet password # Should you wish to start your console wallet without typing in your password, the following options are available: diff --git a/common/logging/log4rs_sample_mining_node.yml b/common/logging/log4rs_sample_mining_node.yml index c3e85184ec..0ace9bddfb 100644 --- a/common/logging/log4rs_sample_mining_node.yml +++ b/common/logging/log4rs_sample_mining_node.yml @@ -13,7 +13,10 @@ appenders: stdout: kind: console encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {h({l}):5} {m}{n}" + pattern: "{d(%H:%M)} {h({l}):5} {m}{n}" + filters: + - kind: threshold + level: info # An appender named "base_layer" that writes to a file with a custom pattern encoder mining_node: kind: rolling_file @@ -33,8 +36,9 @@ appenders: # Set the default logging level to "warn" and attach the "stdout" appender to the root root: - level: warn + level: info appenders: + - mining_node - stdout loggers: @@ -43,15 +47,8 @@ loggers: level: debug appenders: - mining_node - additive: false - tari_mining_node::logging: + tari_mining_node: level: debug appenders: - mining_node - additive: false - tari_mining_node::miner: - level: info - appenders: - - stdout - additive: false diff --git a/common/src/configuration/base_node_config.rs b/common/src/configuration/base_node_config.rs index d4431d09b4..7b8689f5b7 100644 --- a/common/src/configuration/base_node_config.rs +++ b/common/src/configuration/base_node_config.rs @@ -20,9 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::net::SocketAddr; +use multiaddr::Multiaddr; #[derive(Debug, Clone, Default)] pub struct BaseNodeConfig { - pub grpc_address: Option, + pub grpc_address: Option, } diff --git a/common/src/configuration/global.rs b/common/src/configuration/global.rs index 626eb633b3..5a5957d7b6 100644 --- a/common/src/configuration/global.rs +++ b/common/src/configuration/global.rs @@ -39,7 +39,15 @@ use multiaddr::{Error, Multiaddr, Protocol}; use tari_storage::lmdb_store::LMDBConfig; use crate::{ - configuration::{bootstrap::ApplicationType, name_server::DnsNameServer, Network}, + configuration::{ + bootstrap::ApplicationType, + name_server::DnsNameServer, + BaseNodeConfig, + MergeMiningConfig, + Network, + ValidatorNodeConfig, + WalletConfig, + }, ConfigurationError, }; @@ -76,10 +84,6 @@ pub struct GlobalConfig { pub core_threads: Option, pub base_node_identity_file: PathBuf, pub public_address: Option, - pub grpc_enabled: bool, - pub grpc_base_node_address: Multiaddr, - pub grpc_console_wallet_address: Multiaddr, - pub public_address: Multiaddr, pub base_node_config: Option, pub wallet_config: Option, pub peer_seeds: Vec, @@ -122,11 +126,6 @@ pub struct GlobalConfig { pub wallet_base_node_service_request_max_age: u64, pub wallet_balance_enquiry_cooldown_period: u64, pub prevent_fee_gt_amount: bool, - pub monerod_url: Vec, - pub monerod_username: String, - pub monerod_password: String, - pub monerod_use_auth: bool, - pub proxy_host_address: SocketAddr, pub transcoder_host_address: SocketAddr, pub proxy_submit_to_origin: bool, pub force_sync_peers: Vec, @@ -189,7 +188,7 @@ fn convert_node_config( let db_type = cfg .get_str(&key) .map(|s| s.to_lowercase()) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))?; + .unwrap_or_else(|_| "lmdb".to_string()); let db_type = match db_type.as_str() { "memory" => Ok(DatabaseType::Memory), @@ -263,24 +262,16 @@ fn convert_node_config( let db_config = LMDBConfig::new_from_mb(init_size_mb, grow_size_mb, resize_threshold_mb); let key = config_string("base_node", net_str, "orphan_storage_capacity"); - let orphan_storage_capacity = cfg - .get_int(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? as usize; + let orphan_storage_capacity = cfg.get_int(&key).unwrap_or(720) as usize; let key = config_string("base_node", net_str, "orphan_db_clean_out_threshold"); - let orphan_db_clean_out_threshold = cfg - .get_int(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? as usize; + let orphan_db_clean_out_threshold = cfg.get_int(&key).unwrap_or(0) as usize; let key = config_string("base_node", net_str, "pruning_horizon"); - let pruning_horizon = cfg - .get_int(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? as u64; + let pruning_horizon = cfg.get_int(&key).unwrap_or(0) as u64; let key = config_string("base_node", net_str, "pruned_mode_cleanup_interval"); - let pruned_mode_cleanup_interval = cfg - .get_int(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? as u64; + let pruned_mode_cleanup_interval = cfg.get_int(&key).unwrap_or(50) as u64; // Thread counts let key = config_string("base_node", net_str, "core_threads"); @@ -340,10 +331,10 @@ fn convert_node_config( bn_config.grpc_address = if grpc_enabled { let key = "base_node.grpc_address"; - let addr = cfg.get_str(key).unwrap_or_else(|_| "127.0.0.1:18142".to_string()); + let addr = cfg.get_str(key).unwrap_or_else(|_| "/tcp/127.0.0.1/18142".to_string()); let grpc_address = addr - .parse::() + .parse::() .map_err(|e| ConfigurationError::new(key, &e.to_string()))?; Some(grpc_address) @@ -363,10 +354,10 @@ fn convert_node_config( config.grpc_address = if grpc_enabled { let key = "wallet.grpc_address"; - let addr = cfg.get_str(key).unwrap_or_else(|_| "127.0.0.1:18143".to_string()); + let addr = cfg.get_str(key).unwrap_or_else(|_| "/tcp/127.0.0.1/18143".to_string()); let grpc_address = addr - .parse::() + .parse::() .map_err(|e| ConfigurationError::new(key, &e.to_string()))?; Some(grpc_address) @@ -389,18 +380,16 @@ fn convert_node_config( // TODO: dns resolver presets e.g. "cloudflare", "quad9", "custom" (maybe just in toml) and // add support for multiple addresses let key = config_string("common", net_str, "dns_seeds_name_server"); - let dns_seeds_name_server = cfg - .get_str(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string())) - .and_then(|s| { - s.parse::() - .map_err(|e| ConfigurationError::new(&key, &e.to_string())) - })?; + let dns_seeds_name_server = optional(cfg.get_str(&key)) + .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? + .unwrap_or_else(|| "1.1.1.1:853/cloudfare-dns.com".to_string()) + .parse::() + .map_err(|e| ConfigurationError::new(&key, &e.to_string()))?; let key = config_string("common", net_str, "dns_seeds_use_dnssec"); - let dns_seeds_use_dnssec = cfg - .get_bool(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))?; + let dns_seeds_use_dnssec = optional(cfg.get_bool(&key)) + .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? + .unwrap_or(true); let key = config_string("common", net_str, "dns_seeds"); let dns_seeds = match cfg.get_array(&key) { @@ -424,9 +413,9 @@ fn convert_node_config( let console_wallet_peer_db_path = data_dir.join("console_wallet_peer_db"); let key = config_string("base_node", net_str, "flood_ban_max_msg_count"); - let flood_ban_max_msg_count = cfg - .get_int(&key) - .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? as usize; + let flood_ban_max_msg_count = optional(cfg.get_int(&key)) + .map_err(|e| ConfigurationError::new(&key, &e.to_string()))? + .unwrap_or(1000) as usize; // block sync let key = config_string("base_node", net_str, "force_sync_peers"); @@ -448,7 +437,7 @@ fn convert_node_config( // blocks_behind_before_considered_lagging when a node should switch over from listening to lagging let key = config_string("base_node", net_str, "blocks_behind_before_considered_lagging"); - let blocks_behind_before_considered_lagging = optional(cfg.get_int(&key))?.unwrap_or(0) as u64; + let blocks_behind_before_considered_lagging = optional(cfg.get_int(&key))?.unwrap_or(2) as u64; // set wallet_db_file let key = "wallet.wallet_db_file".to_string(); @@ -641,23 +630,23 @@ fn convert_node_config( let key = "merge_mining_proxy.monerod_url"; let mut monerod_url: Vec = cfg .get_array(key) - .unwrap_or_default() - .into_iter() - .map(|v| { - v.into_str() - .map_err(|err| ConfigurationError::new(key, &err.to_string())) - }) - .collect::>()?; - - // default to stagenet on empty - if monerod_url.is_empty() { - monerod_url = vec![ - "http://stagenet.xmr-tw.org:38081".to_string(), - "http://singapore.node.xmr.pm:38081".to_string(), - "http://xmr-lux.boldsuck.org:38081".to_string(), - "http://monero-stagenet.exan.tech:38081".to_string(), - ]; - } + .unwrap_or_default() + .into_iter() + .map(|v| { + v.into_str() + .map_err(|err| ConfigurationError::new(key, &err.to_string())) + }) + .collect::>()?; + + // default to stagenet on empty + if monerod_url.is_empty() { + monerod_url = vec![ + "http://stagenet.xmr-tw.org:38081".to_string(), + "http://singapore.node.xmr.pm:38081".to_string(), + "http://xmr-lux.boldsuck.org:38081".to_string(), + "http://monero-stagenet.exan.tech:38081".to_string(), + ]; + } let key = "merge_mining_proxy.monerod_use_auth"; let monerod_use_auth = cfg @@ -688,7 +677,7 @@ fn convert_node_config( .get_str(key) .map_err(|e| ConfigurationError::new(key, &e.to_string())) .and_then(|addr| { - addr.parse::() + addr.parse::() .map_err(|e| ConfigurationError::new(key, &e.to_string())) })?; @@ -697,7 +686,7 @@ fn convert_node_config( .get_str(key) .map_err(|e| ConfigurationError::new(key, &e.to_string())) .and_then(|addr| { - addr.parse::() + addr.parse::() .map_err(|e| ConfigurationError::new(key, &e.to_string())) })?; @@ -751,19 +740,17 @@ fn convert_node_config( }); let key = config_string("common", net_str, "auto_update.dns_hosts"); - let autoupdate_dns_hosts = cfg - .get_array(&key) - .and_then(|arr| arr.into_iter().map(|s| s.into_str()).collect::, _>>()) - .or_else(|_| { - cfg.get_str(&key) - .map(|s| s.split(',').map(ToString::to_string).collect()) - })?; + let autoupdate_dns_hosts = optional(cfg.get_array(&key))? + .unwrap_or_default() + .into_iter() + .map(|s| s.into_str()) + .collect::, _>>()?; let key = config_string("common", net_str, "auto_update.hashes_url"); - let autoupdate_hashes_url = cfg.get_str(&key)?; + let autoupdate_hashes_url = optional(cfg.get_str(&key))?.unwrap_or_default(); let key = config_string("common", net_str, "auto_update.hashes_sig_url"); - let autoupdate_hashes_sig_url = cfg.get_str(&key)?; + let autoupdate_hashes_sig_url = optional(cfg.get_str(&key))?.unwrap_or_default(); let key = "mining_node.mining_pool_address"; let mining_pool_address = cfg.get_str(key).unwrap_or_else(|_| "".to_string()); diff --git a/common/src/configuration/merge_mining_config.rs b/common/src/configuration/merge_mining_config.rs index aff59c1cee..fbe49b1a66 100644 --- a/common/src/configuration/merge_mining_config.rs +++ b/common/src/configuration/merge_mining_config.rs @@ -22,13 +22,15 @@ use std::net::SocketAddr; +use multiaddr::Multiaddr; + #[derive(Debug, Clone)] pub struct MergeMiningConfig { - pub monerod_url: String, + pub monerod_url: Vec, pub monerod_use_auth: bool, pub monerod_username: String, pub monerod_password: String, pub proxy_host_address: SocketAddr, - pub base_node_grpc_address: SocketAddr, - pub wallet_grpc_address: SocketAddr, + pub base_node_grpc_address: Multiaddr, + pub wallet_grpc_address: Multiaddr, } diff --git a/common/src/configuration/mod.rs b/common/src/configuration/mod.rs index 9fd209bea0..a8139c09e7 100644 --- a/common/src/configuration/mod.rs +++ b/common/src/configuration/mod.rs @@ -40,9 +40,9 @@ pub mod global; pub mod loader; mod network; pub use network::Network; -pub mod name_server; mod base_node_config; mod merge_mining_config; +pub mod name_server; pub mod seconds; pub mod utils; mod validator_node_config; diff --git a/common/src/configuration/wallet_config.rs b/common/src/configuration/wallet_config.rs index 7b5ac28cd0..176ee0a19d 100644 --- a/common/src/configuration/wallet_config.rs +++ b/common/src/configuration/wallet_config.rs @@ -20,9 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::net::SocketAddr; +use multiaddr::Multiaddr; #[derive(Debug, Clone, Default)] pub struct WalletConfig { - pub grpc_address: Option, + pub grpc_address: Option, } diff --git a/comms/dht/src/storage/connection.rs b/comms/dht/src/storage/connection.rs index 9a0a73f124..94095ab5d1 100644 --- a/comms/dht/src/storage/connection.rs +++ b/comms/dht/src/storage/connection.rs @@ -31,8 +31,6 @@ use tari_common_sqlite::sqlite_connection_pool::SqliteConnectionPool; use crate::storage::error::StorageError; -use crate::storage::error::StorageError; - const LOG_TARGET: &str = "comms::dht::storage::connection"; const SQLITE_POOL_SIZE: usize = 16; diff --git a/comms/src/peer_manager/peer_query.rs b/comms/src/peer_manager/peer_query.rs index 43aeb2f9d7..9e420c5343 100644 --- a/comms/src/peer_manager/peer_query.rs +++ b/comms/src/peer_manager/peer_query.rs @@ -21,6 +21,7 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use std::cmp::{min, Ordering}; + use tari_storage::{IterationResult, KeyValueStore}; use crate::peer_manager::{peer_id::PeerId, NodeId, Peer, PeerManagerError}; diff --git a/dan_layer/core/src/services/mocks/mod.rs b/dan_layer/core/src/services/mocks/mod.rs index f2c785e0fa..d5babaf8c8 100644 --- a/dan_layer/core/src/services/mocks/mod.rs +++ b/dan_layer/core/src/services/mocks/mod.rs @@ -27,11 +27,23 @@ use std::{ }; use async_trait::async_trait; +use tari_core::transactions::transaction::TemplateParameter; use super::CommitteeManager; use crate::{ digital_assets_error::DigitalAssetError, - models::{BaseLayerMetadata, BaseLayerOutput, Committee, Event, Instruction, Payload, Signature}, + models::{ + AssetDefinition, + BaseLayerMetadata, + BaseLayerOutput, + Committee, + Event, + Instruction, + Payload, + Signature, + StateRoot, + TreeNodeHash, + }, services::{ base_node_client::BaseNodeClient, infrastructure_services::NodeAddressable, @@ -41,6 +53,7 @@ use crate::{ PayloadProvider, SigningService, }, + storage::state::StateDbUnitOfWork, types::PublicKey, }; @@ -59,17 +72,17 @@ impl MempoolService for MockMempoolService { async fn reserve_instruction_in_block( &mut self, - instruction_hash: &[u8], - block_hash: Vec, + _instruction_hash: &[u8], + _block_hash: Vec, ) -> Result<(), DigitalAssetError> { todo!() } - async fn remove_all_in_block(&mut self, block_hash: &[u8]) -> Result<(), DigitalAssetError> { + async fn remove_all_in_block(&mut self, _block_hash: &[u8]) -> Result<(), DigitalAssetError> { todo!() } - async fn release_reservations(&mut self, block_hash: &[u8]) -> Result<(), DigitalAssetError> { + async fn release_reservations(&mut self, _block_hash: &[u8]) -> Result<(), DigitalAssetError> { todo!() } @@ -213,7 +226,25 @@ pub struct MockPayloadProcessor {} #[async_trait] impl PayloadProcessor for MockPayloadProcessor { - async fn process_payload(&mut self, _payload: &TPayload) -> Result<(), DigitalAssetError> { - Ok(()) + fn init_template( + &self, + _template_parameter: &TemplateParameter, + _asset_definition: &AssetDefinition, + _state_db: &mut TUnitOfWork, + ) -> Result<(), DigitalAssetError> { + todo!() + } + + async fn process_payload( + &mut self, + _node_hash: TreeNodeHash, + _payload: &TPayload, + _unit_of_work: TUnitOfWork, + ) -> Result { + todo!() + } + + async fn remove_payload_for_node(&mut self, _node_hash: &TreeNodeHash) -> Result<(), DigitalAssetError> { + todo!() } } diff --git a/dan_layer/core/src/workers/consensus_worker.rs b/dan_layer/core/src/workers/consensus_worker.rs index adf6bbc9ef..1026edca2e 100644 --- a/dan_layer/core/src/workers/consensus_worker.rs +++ b/dan_layer/core/src/workers/consensus_worker.rs @@ -414,42 +414,25 @@ mod test { models::{Committee, ConsensusWorkerState::*}, services::{ infrastructure_services::mocks::{mock_outbound, MockInboundConnectionService, MockOutboundService}, - mocks::{ - mock_base_node_client, - mock_events_publisher, - mock_payload_processor, - mock_signing_service, - mock_static_payload_provider, - MockCommitteeManager, - MockEventsPublisher, - }, + mocks::{mock_events_publisher, MockCommitteeManager, MockEventsPublisher}, }, }; fn start_replica( - inbound: MockInboundConnectionService<&'static str, &'static str>, - outbound: MockOutboundService<&'static str, &'static str>, - committee_manager: MockCommitteeManager, - node_id: &'static str, - shutdown_signal: ShutdownSignal, - events_publisher: MockEventsPublisher, + _inbound: MockInboundConnectionService<&'static str, &'static str>, + _outbound: MockOutboundService<&'static str, &'static str>, + _committee_manager: MockCommitteeManager, + _node_id: &'static str, + _shutdown_signal: ShutdownSignal, + _events_publisher: MockEventsPublisher, ) -> JoinHandle<()> { - let mut replica_a = ConsensusWorker::new( - inbound, - outbound, - committee_manager, - node_id, - mock_static_payload_provider("Hello"), - events_publisher, - mock_signing_service(), - mock_payload_processor(), - AssetDefinition::default(), - mock_base_node_client(), - Duration::from_secs(5), - ); - tokio::spawn(async move { - let _res = replica_a.run(shutdown_signal, Some(2)).await; - }) + todo!() + // let mut replica_a = ConsensusWorker::new(inbound, outbound, committee_manager, node_id, + // mock_static_payload_provider("Hello"), events_publisher, mock_signing_service(), mock_payload_processor(), + // AssetDefinition::default(), mock_base_node_client(), Duration::from_secs(5), + // , ); tokio::spawn(async move { + // let _res = replica_a.run(shutdown_signal, Some(2)).await; + // }) } #[tokio::test] diff --git a/dan_layer/core/src/workers/states/prepare.rs b/dan_layer/core/src/workers/states/prepare.rs index fa2b108b76..35e6e4ef03 100644 --- a/dan_layer/core/src/workers/states/prepare.rs +++ b/dan_layer/core/src/workers/states/prepare.rs @@ -388,76 +388,64 @@ where #[cfg(test)] mod test { - use std::sync::Arc; - - use tokio::time::Duration; - - use super::*; - use crate::{ - models::ViewId, - services::{ - infrastructure_services::mocks::mock_outbound, - mocks::{mock_payload_processor, mock_payload_provider, mock_signing_service}, - }, - }; - #[tokio::test(flavor = "multi_thread")] #[ignore = "missing implementations"] async fn basic_test_as_leader() { - // let mut inbound = mock_inbound(); - // let mut sender = inbound.create_sender(); - let locked_qc = QuorumCertificate::genesis("Hello world"); - let mut state = Prepare::new("B", Arc::new(locked_qc)); - let view = View { - view_id: ViewId(1), - is_leader: true, - }; - let committee = Committee::new(vec!["A", "B", "C", "D"]); - let mut outbound = mock_outbound(committee.members.clone()); - let mut outbound2 = outbound.clone(); - let mut inbound = outbound.take_inbound(&"B").unwrap(); - let payload_provider = mock_payload_provider(); - let mut payload_processor = mock_payload_processor(); - let signing = mock_signing_service(); - let task = state.next_event( - &view, - Duration::from_secs(10), - &committee, - &mut inbound, - &mut outbound, - &payload_provider, - &signing, - &mut payload_processor, - ); - - outbound2 - .send( - "A", - "B", - HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), - ) - .await - .unwrap(); - - outbound2 - .send( - "C", - "B", - HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), - ) - .await - .unwrap(); - - outbound2 - .send( - "D", - "B", - HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), - ) - .await - .unwrap(); - - let event = task.await.unwrap(); - assert_eq!(event, ConsensusWorkerStateEvent::Prepared); + todo!() + // // let mut inbound = mock_inbound(); + // // let mut sender = inbound.create_sender(); + // let locked_qc = QuorumCertificate::genesis("Hello world"); + // let mut state = Prepare::new("B", Arc::new(locked_qc)); + // let view = View { + // view_id: ViewId(1), + // is_leader: true, + // }; + // let committee = Committee::new(vec!["A", "B", "C", "D"]); + // let mut outbound = mock_outbound(committee.members.clone()); + // let mut outbound2 = outbound.clone(); + // let mut inbound = outbound.take_inbound(&"B").unwrap(); + // let payload_provider = mock_payload_provider(); + // let mut payload_processor = mock_payload_processor(); + // let signing = mock_signing_service(); + // let task = state.next_event( + // &view, + // Duration::from_secs(10), + // &committee, + // &mut inbound, + // &mut outbound, + // &payload_provider, + // &signing, + // &mut payload_processor, + // ); + // + // outbound2 + // .send( + // "A", + // "B", + // HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), + // ) + // .await + // .unwrap(); + // + // outbound2 + // .send( + // "C", + // "B", + // HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), + // ) + // .await + // .unwrap(); + // + // outbound2 + // .send( + // "D", + // "B", + // HotStuffMessage::new_view(QuorumCertificate::genesis("empty"), ViewId(0)), + // ) + // .await + // .unwrap(); + // + // let event = task.await.unwrap(); + // assert_eq!(event, ConsensusWorkerStateEvent::Prepared); } } diff --git a/rustfmt.toml b/rustfmt.toml index 5792cccdfd..22ee1c3310 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -4,7 +4,6 @@ comment_width = 120 format_strings = true group_imports = "StdExternalCrate" hard_tabs = false -group_imports = "StdExternalCrate" imports_layout = "HorizontalVertical" imports_granularity = "Crate" match_block_trailing_comma = true