From 82651a91373abf40af86b5b4207abc6dbf827b94 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Wed, 5 Jul 2023 23:36:15 +0300 Subject: [PATCH] stratum: test new tokio --- Cargo.lock | 191 ++++++++++++++++++++++++++++------------- Cargo.toml | 11 ++- src/node/mine_block.rs | 2 + 3 files changed, 138 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 039a622..443d99a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -922,7 +922,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" dependencies = [ "cfg-if 0.1.10", - "dirs-sys", + "dirs-sys 0.3.7", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys 0.4.1", ] [[package]] @@ -936,6 +945,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -1073,19 +1094,6 @@ dependencies = [ "winit", ] -[[package]] -name = "egui_demo_lib" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b191e5870e6cff885cf56d4e6c3a10ce0c66d9d855a92c1eaca96b0f1111c0aa" -dependencies = [ - "egui", - "egui_extras", - "enum-map", - "tracing", - "unicode_names2", -] - [[package]] name = "egui_extras" version = "0.20.0" @@ -1126,27 +1134,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "enum-map" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" -dependencies = [ - "enum-map-derive", - "serde", -] - -[[package]] -name = "enum-map-derive" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" -dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 1.0.109", -] - [[package]] name = "enum_primitive" version = "0.1.1" @@ -1710,10 +1697,9 @@ dependencies = [ "android_logger", "built", "chrono", - "dirs", + "dirs 5.0.1", "eframe", "egui", - "egui_demo_lib", "egui_extras", "env_logger 0.10.0", "futures 0.3.28", @@ -1732,14 +1718,14 @@ dependencies = [ "openssl-sys", "pnet", "pollster 0.3.0", - "rand 0.6.5", + "rand 0.8.5", "rust-i18n", "serde", "serde_derive", "serde_json", "sys-locale", - "tokio", - "tokio-util 0.2.0", + "tokio 1.29.1", + "tokio-util 0.7.8", "toml 0.7.4", "wgpu", "winit", @@ -1771,7 +1757,7 @@ dependencies = [ "serde_derive", "serde_json", "thiserror", - "tokio", + "tokio 0.2.25", "tokio-rustls", "url", ] @@ -1802,7 +1788,7 @@ dependencies = [ name = "grin_config" version = "5.2.0-beta.1" dependencies = [ - "dirs", + "dirs 2.0.2", "grin_core", "grin_p2p", "grin_servers", @@ -1936,7 +1922,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "tokio", + "tokio 0.2.25", "tokio-util 0.2.0", "walkdir", ] @@ -1993,7 +1979,7 @@ dependencies = [ "http", "indexmap", "slab", - "tokio", + "tokio 0.2.25", "tokio-util 0.3.1", "tracing", "tracing-futures", @@ -2131,8 +2117,8 @@ dependencies = [ "httpdate", "itoa 0.4.8", "pin-project", - "socket2", - "tokio", + "socket2 0.3.19", + "tokio 0.2.25", "tower-service", "tracing", "want", @@ -2151,7 +2137,7 @@ dependencies = [ "log", "rustls", "rustls-native-certs", - "tokio", + "tokio 0.2.25", "tokio-rustls", "webpki", ] @@ -2164,7 +2150,7 @@ checksum = "0d1f9b0b8258e3ef8f45928021d3ef14096c2b93b99e4b8cfcabf1f58ec84b0a" dependencies = [ "bytes 0.5.6", "hyper", - "tokio", + "tokio 0.2.25", "tokio-io-timeout", ] @@ -3078,6 +3064,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ordered-float" version = "1.1.1" @@ -3345,6 +3337,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -3424,7 +3422,7 @@ checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ "autocfg 0.1.8", "libc", - "rand_chacha", + "rand_chacha 0.1.1", "rand_core 0.4.2", "rand_hc", "rand_isaac", @@ -3435,6 +3433,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -3445,6 +3454,16 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -3465,6 +3484,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "rand_hc" @@ -4056,6 +4078,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "spin" version = "0.5.2" @@ -4289,10 +4321,30 @@ dependencies = [ "pin-project-lite 0.1.12", "signal-hook-registry", "slab", - "tokio-macros", + "tokio-macros 0.2.6", "winapi 0.3.9", ] +[[package]] +name = "tokio" +version = "1.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +dependencies = [ + "autocfg 1.1.0", + "backtrace", + "bytes 1.4.0", + "libc", + "mio 0.8.8", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite 0.2.9", + "signal-hook-registry", + "socket2 0.4.9", + "tokio-macros 2.1.0", + "windows-sys 0.48.0", +] + [[package]] name = "tokio-io-timeout" version = "0.4.0" @@ -4300,7 +4352,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9390a43272c8a6ac912ed1d1e2b6abeafd5047e05530a2fa304deee041a06215" dependencies = [ "bytes 0.5.6", - "tokio", + "tokio 0.2.25", ] [[package]] @@ -4314,6 +4366,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2 1.0.60", + "quote 1.0.28", + "syn 2.0.18", +] + [[package]] name = "tokio-rustls" version = "0.13.1" @@ -4322,7 +4385,7 @@ checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" dependencies = [ "futures-core", "rustls", - "tokio", + "tokio 0.2.25", "webpki", ] @@ -4337,7 +4400,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.1.12", - "tokio", + "tokio 0.2.25", ] [[package]] @@ -4351,7 +4414,21 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.1.12", - "tokio", + "tokio 0.2.25", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes 1.4.0", + "futures-core", + "futures-sink", + "pin-project-lite 0.2.9", + "tokio 1.29.1", + "tracing", ] [[package]] @@ -4521,12 +4598,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "unicode_names2" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446c96c6dd42604779487f0a981060717156648c1706aa1f464677f03c6cc059" - [[package]] name = "unsafe-any" version = "0.4.2" diff --git a/Cargo.toml b/Cargo.toml index c33fabc..a86f4d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,11 +35,10 @@ wgpu = "0.14.0" egui = { version = "0.20.1", default-features = false } egui_extras = { version = "0.20.0" } eframe = { version = "0.20.1", features = [ "wgpu" ] } -egui_demo_lib = "0.20.0" ## grin_servers futures = "0.3" -dirs = "2.0" +dirs = "5.0.1" ## other once_cell = "1.10.0" @@ -48,15 +47,15 @@ sys-locale = "0.3.0" chrono = "0.4.23" lazy_static = "1.4.0" toml = "0.7.4" -serde = "1.0.164" +serde = "1" pnet = "0.33.0" # stratum server serde_derive = "1" serde_json = "1" -tokio = {version = "0.2", features = ["full"] } -tokio-util = { version = "0.2", features = ["codec"] } -rand = "0.6" +tokio = {version = "1.29.1", features = ["full"] } +tokio-util = { version = "0.7.8", features = ["codec"] } +rand = "0.8.5" [patch.crates-io] winit = { git = "https://github.com/rib/winit", branch = "android-activity" } diff --git a/src/node/mine_block.rs b/src/node/mine_block.rs index 01ed940..8e2ca01 100644 --- a/src/node/mine_block.rs +++ b/src/node/mine_block.rs @@ -141,6 +141,7 @@ fn build_block( // If this fails for *any* reason then fallback to an empty vec of txs. // This will allow us to mine an "empty" block if the txpool is in an // invalid (and unexpected) state. + println!("12345 prepare_mineable_transactions"); let txs = match tx_pool.read().prepare_mineable_transactions() { Ok(txs) => txs, Err(e) => { @@ -152,6 +153,7 @@ fn build_block( vec![] } }; + println!("12345 after prepare_mineable_transactions"); // build the coinbase and the block itself let fees = txs.iter().map(|tx| tx.fee()).sum();