diff --git a/Cargo.lock b/Cargo.lock index 45a5acf..ff49a7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - [[package]] name = "aho-corasick" version = "1.1.3" @@ -88,40 +73,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "benchkit" -version = "0.2.1" +version = "0.3.0" dependencies = [ "anyhow", "clap", "env_logger", "hwloc", - "indicatif", "libc", "log", "regex", - "reqwest", "serde", "serde_json", "serde_yaml", @@ -143,18 +105,6 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - [[package]] name = "cc" version = "1.2.30" @@ -170,12 +120,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "clap" version = "4.5.41" @@ -222,19 +166,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" -[[package]] -name = "console" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "unicode-width", - "windows-sys 0.59.0", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -304,12 +235,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - [[package]] name = "env_filter" version = "0.1.3" @@ -376,12 +301,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -391,56 +310,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "getrandom" version = "0.2.16" @@ -448,10 +317,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -461,19 +328,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", - "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - [[package]] name = "hashbrown" version = "0.15.4" @@ -486,46 +345,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "http" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - [[package]] name = "hwloc" version = "0.5.0" @@ -541,66 +360,6 @@ dependencies = [ "winapi 0.2.8", ] -[[package]] -name = "hyper" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-util" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2 0.6.0", - "tokio", - "tower-service", - "tracing", -] - [[package]] name = "icu_collections" version = "2.0.0" @@ -718,46 +477,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "indicatif" -version = "0.17.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" -dependencies = [ - "console", - "number_prefix", - "portable-atomic", - "unicode-width", - "web-time", -] - -[[package]] -name = "io-uring" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "libc", -] - -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - -[[package]] -name = "iri-string" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -794,16 +513,6 @@ dependencies = [ "syn", ] -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - [[package]] name = "kernel32-sys" version = "0.2.2" @@ -848,38 +557,12 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - [[package]] name = "memchr" version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" -dependencies = [ - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", -] - [[package]] name = "ntapi" version = "0.4.1" @@ -929,21 +612,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -968,18 +636,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkg-config" version = "0.3.32" @@ -1010,15 +666,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro2" version = "1.0.95" @@ -1028,61 +675,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quinn" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2 0.5.10", - "thiserror", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" -dependencies = [ - "bytes", - "getrandom 0.3.3", - "lru-slab", - "rand", - "ring", - "rustc-hash", - "rustls", - "rustls-pki-types", - "slab", - "thiserror", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcebb1209ee276352ef14ff8732e24cc2b02bbac986cd74a4c81bcb2f9881970" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2 0.5.10", - "tracing", - "windows-sys 0.59.0", -] - [[package]] name = "quote" version = "1.0.40" @@ -1098,35 +690,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.3", -] - [[package]] name = "rayon" version = "1.10.0" @@ -1187,72 +750,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" -[[package]] -name = "reqwest" -version = "0.12.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.16", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - [[package]] name = "rustix" version = "1.0.8" @@ -1266,47 +763,6 @@ dependencies = [ "windows-sys 0.60.2", ] -[[package]] -name = "rustls" -version = "0.23.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pki-types" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - [[package]] name = "ryu" version = "1.0.20" @@ -1345,18 +801,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_yaml" version = "0.9.34+deprecated" @@ -1385,38 +829,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "slab" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" - [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "socket2" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1429,12 +847,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - [[package]] name = "syn" version = "2.0.104" @@ -1446,15 +858,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - [[package]] name = "synstructure" version = "0.13.2" @@ -1523,142 +926,18 @@ dependencies = [ "zerovec", ] -[[package]] -name = "tinyvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.47.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35" -dependencies = [ - "backtrace", - "bytes", - "io-uring", - "libc", - "mio", - "pin-project-lite", - "slab", - "socket2 0.6.0", - "windows-sys 0.59.0", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tower" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" -dependencies = [ - "bitflags 2.9.1", - "bytes", - "futures-util", - "http", - "http-body", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" -[[package]] -name = "unicode-width" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" - [[package]] name = "unsafe-libyaml" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - [[package]] name = "url" version = "2.5.4" @@ -1682,15 +961,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -1706,106 +976,6 @@ dependencies = [ "wit-bindgen-rt", ] -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" -dependencies = [ - "cfg-if", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "winapi" version = "0.2.8" @@ -1899,15 +1069,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.59.0" @@ -2094,26 +1255,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zerofrom" version = "0.1.6" @@ -2135,12 +1276,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zerotrie" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 2ff2083..836f079 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "benchkit" -version = "0.2.1" +version = "0.3.0" edition = "2021" rust-version = "1.84.1" @@ -10,10 +10,8 @@ clap = { version = "4.5.29", features = ["cargo", "derive", "env"] } env_logger = "0.11.6" hwloc = "0.5.0" regex = "1.10" -indicatif = "0.17.11" libc = "0.2" log = "0.4.26" -reqwest = { version = "0.12.14", default-features = false, features = ["blocking", "rustls-tls"] } serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.138" serde_yaml = "0.9.34" diff --git a/README.md b/README.md index 6975f68..e427cab 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ A benchmarking toolkit designed for benchmarking Bitcoin Core. - System performance tuning and monitoring - Process profiling and perf instrumentation (Linux only) - Nix flake for integrated build and run shell environment -- AssumeUTXO snapshot management ## Prerequisites @@ -32,14 +31,12 @@ git clone https://github.com/bitcoin-dev-tools/benchkit.git && cd benchkit # Optional (Recommended) nix develop -# Download a signet assumeutxo snapshot -cargo run -- snapshot download signet # Build bitcoind binaries from config cargo run -- build # Ensure you have a signet node accepting connections on 127.0.0.1:39333 e.g.: -# `bitcoind -signet -port=39333 -rpcport=39332 -daemon=1` +# `bitcoind -signet -daemon=1 -port=39333 -rpcport=39334` # Run demo benchmarks cargo run -- run --out-dir ./out @@ -100,22 +97,7 @@ benchkit system tune benchkit system reset ``` -### AssumeUTXO Snapshot Management -```bash -# Download snapshot for specific network -benchkit snapshot download [mainnet|signet] -``` - -### Patch testing - -```bash -# Test the benchcoin patches apply cleanly to all refs -benchkit patch test - -# Fetch latest benchkit patches from github -benchkit patch update -``` ## Configuration Files @@ -147,7 +129,7 @@ global: host: x86_64-linux-gnu benchmarks: - - name: "assumeutxo signet test sync" + - name: "signet test sync" network: signet connect: 127.0.0.1:39333 benchmark: diff --git a/benchmark.yml b/benchmark.yml index 7ef49f2..7a73458 100644 --- a/benchmark.yml +++ b/benchmark.yml @@ -38,7 +38,7 @@ global: scratch: $HOME/.local/state/benchkit/scratch # Commits to build binaries from (required). - commits: ["af7402ccfa", "d1b583181d"] + commits: ["e221b252465", "8f73d952214"] # A temporary datadir for Bitcoin Core to use tmp_data_dir: /tmp/benchkit @@ -46,17 +46,14 @@ global: # Local benchmark config. benchmarks: # benchmark name (required). - - name: "assumeutxo signet test sync" + - name: "signet test sync" # Bitcoin network to run on (main, test, testnet4, signet, regtest) network: signet # An optional address for bitcoind to -connect to for sync - connect: 127.0.0.1:38333 + connect: 127.0.0.1:39333 - # Hook mode to use (optional, defaults to "assumeutxo") - # Options: "assumeutxo" (uses snapshot syncing), "full_ibd" (full initial block download) - # mode: assumeutxo # Local benchmark options. # These override global benchmark options in case of conflict. @@ -67,10 +64,10 @@ benchmarks: # # {dbcache} here is an explicit (additional) parameterisation from # [parameter_lists] below. - command: "bitcoind -dbcache={dbcache} -stopatheight=180000" + command: "bitcoind -dbcache={dbcache} -stopatheight=200000" profile_interval: 1 warmup: 0 - runs: 2 + runs: 5 # A list of zero or more parameters. # These will be tried as a matrix. diff --git a/config-examples/assumeutxo.yml b/config-examples/assumeutxo.yml deleted file mode 100644 index a926b4b..0000000 --- a/config-examples/assumeutxo.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# AssumeUTXO Mode Example -# -# This example demonstrates the default AssumeUTXO mode, which uses snapshot syncing -# to quickly initialize the blockchain state before running benchmarks. - -global: - benchmark: - warmup: 1 - runs: 1 - profile: true - profile_interval: 1 - - benchmark_cores: "1-7" - runner_cores: "0" - - source: $HOME/src/core/bitcoin - scratch: $HOME/.local/state/benchkit/scratch - commits: ["af7402ccfa", "d1b583181d"] - tmp_data_dir: /tmp/benchkit - -benchmarks: - - name: "assumeutxo signet sync" - network: signet - connect: 127.0.0.1:38333 - # mode: assumeutxo # This is the default, so can be omitted - benchmark: - command: "bitcoind -stopatheight=180000" - profile: true diff --git a/config-examples/full-ibd.yml b/config-examples/full-ibd.yml index 9b645ff..3906c71 100644 --- a/config-examples/full-ibd.yml +++ b/config-examples/full-ibd.yml @@ -1,9 +1,7 @@ --- -# Full IBD Mode Example +# Bitcoin Sync Example # -# This example demonstrates the Full IBD (Initial Block Download) mode, which -# performs a complete sync from genesis without using snapshots. This is useful -# for benchmarking the full sync process. +# This example demonstrates benchmarking Bitcoin Core sync process. global: benchmark: @@ -21,18 +19,16 @@ global: tmp_data_dir: /tmp/benchkit benchmarks: - - name: "full ibd signet sync" + - name: "signet sync" network: signet connect: 127.0.0.1:38333 - mode: full_ibd # Use Full IBD mode - no assumeutxo snapshot syncing benchmark: command: "bitcoind -stopatheight=1000" profile: true - - name: "full ibd with dbcache variations" + - name: "signet sync with dbcache variations" network: signet connect: 127.0.0.1:38333 - mode: full_ibd benchmark: command: "bitcoind -dbcache={dbcache} -stopatheight=500" parameter_lists: diff --git a/config.yml b/config.yml index 0bfc8a9..00a34d9 100644 --- a/config.yml +++ b/config.yml @@ -5,8 +5,3 @@ home_dir: $HOME/.local/state/benchkit # The directory intermediate built binaries will be saved to. bin_dir: $HOME/.local/state/benchkit/binaries -# The directory containing benchkit patches -patch_dir: $HOME/.local/state/benchkit/patches - -# The directory containing assumeutxo snapshots -snapshot_dir: $HOME/.local/state/benchkit/snapshots diff --git a/flake.nix b/flake.nix index 5b808ff..749e9c2 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ ]; buildInputs = [ boost + capnproto hwloc libevent rust-bin.stable.latest.default diff --git a/patches/0001-validation-assumeutxo-benchmarking-patches.patch b/patches/0001-validation-assumeutxo-benchmarking-patches.patch deleted file mode 100644 index 31aaa3a..0000000 --- a/patches/0001-validation-assumeutxo-benchmarking-patches.patch +++ /dev/null @@ -1,193 +0,0 @@ -From e76c31658c974107121a6e51ed76e99450ebba6b Mon Sep 17 00:00:00 2001 -From: willcl-ark -Date: Fri, 21 Feb 2025 16:14:58 +0000 -Subject: [PATCH] validation: assumeutxo benchmarking patches - ---- - src/init.cpp | 59 ++++++++++++++++++++++++++++- - src/kernel/chainstatemanager_opts.h | 2 + - src/node/chainstatemanager_args.cpp | 2 + - src/node/chainstatemanager_args.h | 2 + - src/validation.cpp | 6 +++ - src/validation.h | 4 +- - 6 files changed, 71 insertions(+), 4 deletions(-) - -diff --git a/src/init.cpp b/src/init.cpp -index 3cfd301fbab..7a8a68f0bd5 100644 ---- a/src/init.cpp -+++ b/src/init.cpp -@@ -56,6 +56,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -141,6 +142,7 @@ using node::VerifyLoadedChainstate; - using util::Join; - using util::ReplaceAll; - using util::ToString; -+using node::SnapshotMetadata; - - static constexpr bool DEFAULT_PROXYRANDOMIZE{true}; - static constexpr bool DEFAULT_REST_ENABLE{false}; -@@ -159,6 +161,44 @@ static constexpr bool DEFAULT_STOPAFTERBLOCKIMPORT{false}; - static constexpr int MIN_CORE_FDS = MIN_LEVELDB_FDS + NUM_FDS_MESSAGE_CAPTURE; - static const char* DEFAULT_ASMAP_FILENAME="ip_asn.map"; - -+bool LoadUTXOSnapshot(NodeContext& node, const fs::path& snapshot_path) { -+ ChainstateManager& chainman = *node.chainman; -+ -+ FILE* file{fsbridge::fopen(snapshot_path, "rb")}; -+ AutoFile afile{file}; -+ if (afile.IsNull()) { -+ LogPrintf("Error: Couldn't open UTXO snapshot file %s for reading\n", snapshot_path.utf8string()); -+ return false; -+ } -+ -+ SnapshotMetadata metadata{chainman.GetParams().MessageStart()}; -+ try { -+ afile >> metadata; -+ } catch (const std::ios_base::failure& e) { -+ LogPrintf("Error: Unable to parse snapshot metadata: %s\n", e.what()); -+ return false; -+ } -+ -+ auto activation_result{chainman.ActivateSnapshot(afile, metadata, false)}; -+ if (!activation_result) { -+ LogPrintf("Error: Unable to load UTXO snapshot: %s\n", -+ util::ErrorString(activation_result).original); -+ return false; -+ } -+ -+ // Update services to reflect limited peer capabilities during sync -+ node.connman->RemoveLocalServices(NODE_NETWORK); -+ node.connman->AddLocalServices(NODE_NETWORK_LIMITED); -+ -+ CBlockIndex& snapshot_index{*CHECK_NONFATAL(*activation_result)}; -+ LogPrintf("Loaded UTXO snapshot: coins=%d, height=%d, hash=%s\n", -+ metadata.m_coins_count, -+ snapshot_index.nHeight, -+ snapshot_index.GetBlockHash().ToString()); -+ -+ return true; -+} -+ - /** - * The PID file facilities. - */ -@@ -498,6 +538,12 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc) - argsman.AddArg("-minimumchainwork=", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet3: %s, testnet4: %s, signet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnet4ChainParams->GetConsensus().nMinimumChainWork.GetHex(), signetChainParams->GetConsensus().nMinimumChainWork.GetHex()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); - argsman.AddArg("-par=", strprintf("Set the number of script verification threads (0 = auto, up to %d, <0 = leave that many cores free, default: %d)", - MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); -+ argsman.AddArg("-pausebackgroundsync", strprintf("When a UTXO snapshot is loaded, pause the verification of historical blocks in the background (default: %u)", DEFAULT_PAUSE_BACKGROUND_SYNC), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); -+ gArgs.AddArg("-loadutxosnapshot=", -+ "Load UTXO set from snapshot file at startup. " -+ "This allows fast synchronization by loading a pre-built UTXO " -+ "snapshot while the full chain validation happens in background.", -+ ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-persistmempool", strprintf("Whether to save the mempool on shutdown and load on restart (default: %u)", DEFAULT_PERSIST_MEMPOOL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-persistmempoolv1", - strprintf("Whether a mempool.dat file created by -persistmempool or the savemempool RPC will be written in the legacy format " -@@ -1704,6 +1750,15 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) - - ChainstateManager& chainman = *Assert(node.chainman); - -+ if (args.IsArgSet("-loadutxosnapshot")) { -+ fs::path snapshot_path = fs::u8path(args.GetArg("-loadutxosnapshot", "")); -+ snapshot_path = AbsPathForConfigVal(args, snapshot_path); -+ -+ if (!LoadUTXOSnapshot(node, snapshot_path)) { -+ LogPrintf("Failed to load UTXO snapshot from %s", snapshot_path.utf8string()); -+ } -+ } -+ - assert(!node.peerman); - node.peerman = PeerManager::make(*node.connman, *node.addrman, - node.banman.get(), chainman, -@@ -1853,7 +1908,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) - }); - } - -- if (ShutdownRequested(node)) { -+ // if loadutxosnapshot is set, we want to load the snapshot then shut down so that only -+ // syncing to chaintip is benchmarked -+ if (ShutdownRequested(node) || args.IsArgSet("-loadutxosnapshot")) { - return false; - } - -diff --git a/src/kernel/chainstatemanager_opts.h b/src/kernel/chainstatemanager_opts.h -index 15a8fbec618..50da120ea74 100644 ---- a/src/kernel/chainstatemanager_opts.h -+++ b/src/kernel/chainstatemanager_opts.h -@@ -50,6 +50,8 @@ struct ChainstateManagerOpts { - int worker_threads_num{0}; - size_t script_execution_cache_bytes{DEFAULT_SCRIPT_EXECUTION_CACHE_BYTES}; - size_t signature_cache_bytes{DEFAULT_SIGNATURE_CACHE_BYTES}; -+ //! Whether to defer syncing the background chainstate after an assumeutxo snapshot is loaded -+ bool pause_background_sync{false}; - }; - - } // namespace kernel -diff --git a/src/node/chainstatemanager_args.cpp b/src/node/chainstatemanager_args.cpp -index db36d03fd5c..6782d787238 100644 ---- a/src/node/chainstatemanager_args.cpp -+++ b/src/node/chainstatemanager_args.cpp -@@ -71,6 +71,8 @@ util::Result ApplyArgsManOptions(const ArgsManager& args, ChainstateManage - opts.signature_cache_bytes = clamped_size_each; - } - -+ opts.pause_background_sync = args.GetBoolArg("-pausebackgroundsync", DEFAULT_PAUSE_BACKGROUND_SYNC); -+ - return {}; - } - } // namespace node -diff --git a/src/node/chainstatemanager_args.h b/src/node/chainstatemanager_args.h -index af13aa8d3ce..e20b3fc799d 100644 ---- a/src/node/chainstatemanager_args.h -+++ b/src/node/chainstatemanager_args.h -@@ -12,6 +12,8 @@ class ArgsManager; - - /** -par default (number of script-checking threads, 0 = auto) */ - static constexpr int DEFAULT_SCRIPTCHECK_THREADS{0}; -+/** -pausebackgroundsync default */ -+static const bool DEFAULT_PAUSE_BACKGROUND_SYNC{false}; - - namespace node { - [[nodiscard]] util::Result ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts); -diff --git a/src/validation.cpp b/src/validation.cpp -index 93da4f326d4..c12993471b6 100644 ---- a/src/validation.cpp -+++ b/src/validation.cpp -@@ -6462,6 +6462,12 @@ void ChainstateManager::RecalculateBestHeader() - } - } - -+bool ChainstateManager::BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { -+ if (!IsUsable(m_snapshot_chainstate.get())) return false; -+ if (!IsUsable(m_ibd_chainstate.get())) return false; -+ return !m_options.pause_background_sync; -+} -+ - bool ChainstateManager::ValidatedSnapshotCleanup() - { - AssertLockHeld(::cs_main); -diff --git a/src/validation.h b/src/validation.h -index 9e4fdbe6809..0cb571910dd 100644 ---- a/src/validation.h -+++ b/src/validation.h -@@ -1113,9 +1113,7 @@ public: - CBlockIndex* ActiveTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { return ActiveChain().Tip(); } - - //! The state of a background sync (for net processing) -- bool BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { -- return IsUsable(m_snapshot_chainstate.get()) && IsUsable(m_ibd_chainstate.get()); -- } -+ bool BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()); - - //! The tip of the background sync chain - const CBlockIndex* GetBackgroundSyncTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { --- -2.43.0 - diff --git a/patches/assumeutxo.patch b/patches/assumeutxo.patch deleted file mode 100644 index 43c8361..0000000 --- a/patches/assumeutxo.patch +++ /dev/null @@ -1,224 +0,0 @@ -commit 7501589aeeebd66b618c240f937c2c6097aa6a04 -Author: josibake -Date: Tue Nov 5 13:07:51 2024 +0100 - - validation: assumeutxo benchmarking patch - - introduce two commandline options for assumeutxo, specifically for - benchmarking. these commands are: - - - pausebackgroundsync - an option lets the user pause the verification - of historical blocks in the background - -loadutxosnapshot= - load an assumeutxo snapshot on startup, - instead of needing to go through the rpc - command. the node will shutdown immediately - after the snapshot has been loaded - - this path is not meant for general use and is instead just for making it - more ergonomic to use assumeutxo for benchmarking IBD changes. the - benefits of using assumeutxo here are we can start from an arbitrary - height and sync to chaintip to collect relevant data quickly. using - assumeutxo means we can make whatever changes we need to the - chainstatedb, since it will be created fresh from the snapshot. - - note, to use the loadutxosnapshot option, you must first run: - - ./build/src/bitcoind -stopatheight=1 - - this makes the node do a header sync and then shut down. this is because - assumeutxo will not load a snapshot unless the base block is in the - header chain. we could remove this requirement, but this patch is meant - to be as minimal as possible, and this also allows us to perform heaeder - sync as a preparation commit for a benchmark, which helps keep IBD - benchmarks more focused on strictly measuring IBD. - - next, run: - - ./build/src/bitcoind -loadutxosnapshot= - - the node will shutdown after the snapshot is loaded. finally, run: - - ./build/src/bitcoind -pausebackgroundsync=1 - - for the actual benchmarking step. this ensures only the sync to chaintip - is benchmarked and the load snapshot step is not included in the - measurement. - - Co-authored-by: Sjors Provoost <10217+sjors@users.noreply.github.com> - -diff --git a/src/init.cpp b/src/init.cpp -index 10abd503fc..90af26d263 100644 ---- a/src/init.cpp -+++ b/src/init.cpp -@@ -55,6 +55,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -140,6 +141,7 @@ using node::VerifyLoadedChainstate; - using util::Join; - using util::ReplaceAll; - using util::ToString; -+using node::SnapshotMetadata; - - static constexpr bool DEFAULT_PROXYRANDOMIZE{true}; - static constexpr bool DEFAULT_REST_ENABLE{false}; -@@ -158,6 +160,44 @@ static constexpr bool DEFAULT_STOPAFTERBLOCKIMPORT{false}; - static constexpr int MIN_CORE_FDS = MIN_LEVELDB_FDS + NUM_FDS_MESSAGE_CAPTURE; - static const char* DEFAULT_ASMAP_FILENAME="ip_asn.map"; - -+bool LoadUTXOSnapshot(NodeContext& node, const fs::path& snapshot_path) { -+ ChainstateManager& chainman = *node.chainman; -+ -+ FILE* file{fsbridge::fopen(snapshot_path, "rb")}; -+ AutoFile afile{file}; -+ if (afile.IsNull()) { -+ LogPrintf("Error: Couldn't open UTXO snapshot file %s for reading\n", snapshot_path.utf8string()); -+ return false; -+ } -+ -+ SnapshotMetadata metadata{chainman.GetParams().MessageStart()}; -+ try { -+ afile >> metadata; -+ } catch (const std::ios_base::failure& e) { -+ LogPrintf("Error: Unable to parse snapshot metadata: %s\n", e.what()); -+ return false; -+ } -+ -+ auto activation_result{chainman.ActivateSnapshot(afile, metadata, false)}; -+ if (!activation_result) { -+ LogPrintf("Error: Unable to load UTXO snapshot: %s\n", -+ util::ErrorString(activation_result).original); -+ return false; -+ } -+ -+ // Update services to reflect limited peer capabilities during sync -+ node.connman->RemoveLocalServices(NODE_NETWORK); -+ node.connman->AddLocalServices(NODE_NETWORK_LIMITED); -+ -+ CBlockIndex& snapshot_index{*CHECK_NONFATAL(*activation_result)}; -+ LogPrintf("Loaded UTXO snapshot: coins=%d, height=%d, hash=%s\n", -+ metadata.m_coins_count, -+ snapshot_index.nHeight, -+ snapshot_index.GetBlockHash().ToString()); -+ -+ return true; -+} -+ - /** - * The PID file facilities. - */ -@@ -497,6 +537,12 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc) - argsman.AddArg("-minimumchainwork=", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet3: %s, testnet4: %s, signet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnet4ChainParams->GetConsensus().nMinimumChainWork.GetHex(), signetChainParams->GetConsensus().nMinimumChainWork.GetHex()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); - argsman.AddArg("-par=", strprintf("Set the number of script verification threads (0 = auto, up to %d, <0 = leave that many cores free, default: %d)", - MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); -+ argsman.AddArg("-pausebackgroundsync", strprintf("When a UTXO snapshot is loaded, pause the verification of historical blocks in the background (default: %u)", DEFAULT_PAUSE_BACKGROUND_SYNC), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); -+ gArgs.AddArg("-loadutxosnapshot=", -+ "Load UTXO set from snapshot file at startup. " -+ "This allows fast synchronization by loading a pre-built UTXO " -+ "snapshot while the full chain validation happens in background.", -+ ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-persistmempool", strprintf("Whether to save the mempool on shutdown and load on restart (default: %u)", DEFAULT_PERSIST_MEMPOOL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-persistmempoolv1", - strprintf("Whether a mempool.dat file created by -persistmempool or the savemempool RPC will be written in the legacy format " -@@ -1683,6 +1729,15 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) - - ChainstateManager& chainman = *Assert(node.chainman); - -+ if (args.IsArgSet("-loadutxosnapshot")) { -+ fs::path snapshot_path = fs::u8path(args.GetArg("-loadutxosnapshot", "")); -+ snapshot_path = AbsPathForConfigVal(args, snapshot_path); -+ -+ if (!LoadUTXOSnapshot(node, snapshot_path)) { -+ LogPrintf("Failed to load UTXO snapshot from %s", snapshot_path.utf8string()); -+ } -+ } -+ - assert(!node.peerman); - node.peerman = PeerManager::make(*node.connman, *node.addrman, - node.banman.get(), chainman, -@@ -1832,7 +1887,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) - }); - } - -- if (ShutdownRequested(node)) { -+ // if loadutxosnapshot is set, we want to load the snapshot then shut down so that only -+ // syncing to chaintip is benchmarked -+ if (ShutdownRequested(node) || args.IsArgSet("-loadutxosnapshot")) { - return false; - } - -diff --git a/src/kernel/chainstatemanager_opts.h b/src/kernel/chainstatemanager_opts.h -index 15a8fbec61..50da120ea7 100644 ---- a/src/kernel/chainstatemanager_opts.h -+++ b/src/kernel/chainstatemanager_opts.h -@@ -50,6 +50,8 @@ struct ChainstateManagerOpts { - int worker_threads_num{0}; - size_t script_execution_cache_bytes{DEFAULT_SCRIPT_EXECUTION_CACHE_BYTES}; - size_t signature_cache_bytes{DEFAULT_SIGNATURE_CACHE_BYTES}; -+ //! Whether to defer syncing the background chainstate after an assumeutxo snapshot is loaded -+ bool pause_background_sync{false}; - }; - - } // namespace kernel -diff --git a/src/node/chainstatemanager_args.cpp b/src/node/chainstatemanager_args.cpp -index db36d03fd5..6782d78723 100644 ---- a/src/node/chainstatemanager_args.cpp -+++ b/src/node/chainstatemanager_args.cpp -@@ -71,6 +71,8 @@ util::Result ApplyArgsManOptions(const ArgsManager& args, ChainstateManage - opts.signature_cache_bytes = clamped_size_each; - } - -+ opts.pause_background_sync = args.GetBoolArg("-pausebackgroundsync", DEFAULT_PAUSE_BACKGROUND_SYNC); -+ - return {}; - } - } // namespace node -diff --git a/src/node/chainstatemanager_args.h b/src/node/chainstatemanager_args.h -index af13aa8d3c..e20b3fc799 100644 ---- a/src/node/chainstatemanager_args.h -+++ b/src/node/chainstatemanager_args.h -@@ -12,6 +12,8 @@ class ArgsManager; - - /** -par default (number of script-checking threads, 0 = auto) */ - static constexpr int DEFAULT_SCRIPTCHECK_THREADS{0}; -+/** -pausebackgroundsync default */ -+static const bool DEFAULT_PAUSE_BACKGROUND_SYNC{false}; - - namespace node { - [[nodiscard]] util::Result ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts); -diff --git a/src/validation.cpp b/src/validation.cpp -index 0384018bc3..a88295e265 100644 ---- a/src/validation.cpp -+++ b/src/validation.cpp -@@ -6463,6 +6463,12 @@ void ChainstateManager::RecalculateBestHeader() - } - } - -+bool ChainstateManager::BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { -+ if (!IsUsable(m_snapshot_chainstate.get())) return false; -+ if (!IsUsable(m_ibd_chainstate.get())) return false; -+ return !m_options.pause_background_sync; -+} -+ - bool ChainstateManager::ValidatedSnapshotCleanup() - { - AssertLockHeld(::cs_main); -diff --git a/src/validation.h b/src/validation.h -index 9e4fdbe680..0cb571910d 100644 ---- a/src/validation.h -+++ b/src/validation.h -@@ -1113,9 +1113,7 @@ public: - CBlockIndex* ActiveTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { return ActiveChain().Tip(); } - - //! The state of a background sync (for net processing) -- bool BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { -- return IsUsable(m_snapshot_chainstate.get()) && IsUsable(m_ibd_chainstate.get()); -- } -+ bool BackgroundSyncInProgress() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()); - - //! The tip of the background sync chain - const CBlockIndex* GetBackgroundSyncTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { diff --git a/src/benchmarks/build.rs b/src/benchmarks/build.rs index bd81cf8..5560c60 100644 --- a/src/benchmarks/build.rs +++ b/src/benchmarks/build.rs @@ -9,7 +9,6 @@ use crate::path_utils; pub struct Builder { config: GlobalConfig, - patches: Vec, repo_manager: Option, } @@ -52,8 +51,6 @@ impl Builder { // Create RepoSource based on the corrected source let repo_source = RepoSource::new(&actual_source); - let patches = vec!["0001-validation-assumeutxo-benchmarking-patches.patch".to_string()]; - match &repo_source { RepoSource::Local(path) => { // For local repos, verify the path exists @@ -65,7 +62,6 @@ impl Builder { // We don't need a repo manager for local repos Ok(Self { config, - patches, repo_manager: None, }) } @@ -79,7 +75,6 @@ impl Builder { Ok(Self { config, - patches, repo_manager: Some(repo_manager), }) } @@ -173,37 +168,11 @@ impl Builder { fn build_commit(&self, source_dir: &PathBuf, original_commit: &str) -> Result<()> { self.checkout_commit(source_dir, original_commit)?; - let patched_commit = self.apply_patches(source_dir)?; - debug!("Commit hash after applying patches: {patched_commit}"); self.run_build(source_dir, original_commit)?; self.copy_binary(original_commit)?; Ok(()) } - pub fn test_patch_commits(&mut self) -> Result<()> { - // If we're using a remote repository, ensure it's available - let source_dir = if let Some(repo_manager) = &mut self.repo_manager { - let repo_path = repo_manager.ensure_repository_available()?; - repo_manager.validate_commits(&self.config.bench.global.commits)?; - repo_path - } else { - // For local repos, use the path directly - self.config.bench.global.source.clone() - }; - - debug!("Testing patches on repository at: {source_dir:?}"); - self.check_clean_worktree(&source_dir)?; - let initial_ref = self.get_initial_ref(&source_dir)?; - - for commit in &self.config.bench.global.commits { - self.checkout_commit(&source_dir, commit)?; - self.test_patches(&source_dir)?; - } - - self.restore_git_state(&source_dir, &initial_ref)?; - Ok(()) - } - fn checkout_commit(&self, source_dir: &PathBuf, commit: &str) -> Result<()> { let status = Command::new("git") .current_dir(source_dir) @@ -218,135 +187,6 @@ impl Builder { Ok(()) } - fn apply_patches(&self, source_dir: &PathBuf) -> Result { - self.process_patches(source_dir, false)?; - - // Get the current commit hash after applying patches - let output = Command::new("git") - .current_dir(source_dir) - .arg("rev-parse") - .arg("HEAD") - .output() - .context("Failed to get HEAD commit hash after applying patches")?; - - if !output.status.success() { - anyhow::bail!("Failed to get HEAD commit hash after applying patches"); - } - - Ok(String::from_utf8(output.stdout)?.trim().to_string()) - } - - fn test_patches(&self, source_dir: &PathBuf) -> Result<()> { - self.process_patches(source_dir, true) - } - - fn download_patch(&self, patch_name: &str, patches_dir: &PathBuf) -> Result<()> { - let client = reqwest::blocking::Client::new(); - let url = format!( - "https://raw.githubusercontent.com/bitcoin-dev-tools/benchkit/master/patches/{patch_name}" - ); - let response = client.get(&url).send()?; - - if !response.status().is_success() { - anyhow::bail!( - "Failed to download patch {}: {}", - patch_name, - response.status() - ); - } - - let content = response.bytes()?; - let patch_path = patches_dir.join(patch_name); - - // Ensure the patches directory exists - if !patches_dir.exists() { - std::fs::create_dir_all(patches_dir)?; - } - - std::fs::write(&patch_path, content)?; - info!("Successfully downloaded patch: {patch_name}"); - Ok(()) - } - - pub fn update_patches(&self, force: bool) -> Result<()> { - for patch in &self.patches { - let patch_path = &self.config.app.patch_dir.join(patch); - if !patch_path.exists() || force { - info!("Downloading patch: {patch}"); - self.download_patch(patch, &self.config.app.patch_dir)?; - } else { - info!("Patch {patch} already exists, skipping download"); - } - } - Ok(()) - } - - fn process_patches(&self, source_dir: &PathBuf, check_only: bool) -> Result<()> { - self.update_patches(false)?; - - let patches_dir = &self.config.app.patch_dir; - - // Verify all patches exist - for patch in &self.patches { - let patch_path = patches_dir.join(patch); - if !patch_path.exists() { - anyhow::bail!("Patch file not found: {}", patch_path.display()); - } - } - - // Apply each patch - for patch in &self.patches { - let patch_path = patches_dir.join(patch); - let operation = if check_only { "Testing" } else { "Applying" }; - info!("{} patch: {}", operation, patch_path.display()); - - let mut cmd = Command::new("git"); - cmd.current_dir(source_dir); - - if check_only { - cmd.arg("apply") - .arg("--check") - .arg("--verbose") - .arg("--3way") - .arg(patch_path.display().to_string()); - } else { - cmd.arg("-c") - .arg("user.name=temp") - .arg("-c") - .arg("user.email=temp@temp.com") - .arg("am") - .arg("--3way") - .arg("--no-signoff") - .arg(patch_path.display().to_string()); - } - - let status = cmd.status().with_context(|| { - let action = if check_only { "test" } else { "apply" }; - format!("Failed to {action} patch {patch}") - })?; - - if !status.success() { - if !check_only { - // If patch application fails, abort the am session - let _ = Command::new("git") - .current_dir(source_dir) - .arg("am") - .arg("--abort") - .status(); - } - anyhow::bail!( - "Failed to {} patch: {}", - if check_only { "test" } else { "apply" }, - patch - ); - } - - let action = if check_only { "tested" } else { "applied" }; - info!("Successfully {action} patch: {patch}"); - } - Ok(()) - } - fn run_build(&self, source_dir: &PathBuf, commit_hash: &str) -> Result<()> { // Make a build-dir using the commit-hash let dir = self diff --git a/src/benchmarks/hook_runner.rs b/src/benchmarks/hook_runner.rs index 12333e4..7f443b8 100644 --- a/src/benchmarks/hook_runner.rs +++ b/src/benchmarks/hook_runner.rs @@ -2,9 +2,7 @@ use anyhow::Result; use log::info; use std::path::PathBuf; -use crate::benchmarks::hooks::{ - AssumeUtxoHookExecutor, FullIbdHookExecutor, HookExecutor, HookMode, -}; +use crate::benchmarks::hooks::StandardHookExecutor; /// Represents the different hook script stages #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -26,8 +24,6 @@ pub struct HookArgs { pub network: String, /// Output directory for benchmark results pub out_dir: PathBuf, - /// Path to snapshot file - pub snapshot_path: PathBuf, /// Temporary data directory for the benchmarked process pub tmp_data_dir: PathBuf, /// Current iteration number @@ -40,7 +36,7 @@ pub struct HookArgs { /// HookRunner manages the lifecycle hooks for benchmarks pub struct HookRunner { - executor: Box, + executor: StandardHookExecutor, } impl Default for HookRunner { @@ -50,19 +46,11 @@ impl Default for HookRunner { } impl HookRunner { - /// Create a new HookRunner with default (AssumeUTXO) hooks + /// Create a new HookRunner with standard hooks pub fn new() -> Self { - Self::with_mode(HookMode::default()) - } - - /// Create a new HookRunner with the specified mode - pub fn with_mode(mode: HookMode) -> Self { - let executor: Box = match mode { - HookMode::AssumeUtxo => Box::new(AssumeUtxoHookExecutor::new()), - HookMode::FullIbd => Box::new(FullIbdHookExecutor::new()), - }; - - Self { executor } + Self { + executor: StandardHookExecutor::new(), + } } /// Run a hook for the given stage diff --git a/src/benchmarks/hooks.rs b/src/benchmarks/hooks.rs index 4696b2a..fe9baea 100644 --- a/src/benchmarks/hooks.rs +++ b/src/benchmarks/hooks.rs @@ -4,36 +4,6 @@ use std::fs; use std::path::Path; use crate::benchmarks::hook_runner::HookArgs; -use crate::command::{CommandContext, CommandExecutor}; - -/// Different modes for benchmark hook execution -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum HookMode { - /// AssumeUTXO mode - uses snapshot syncing - #[default] - AssumeUtxo, - /// Full IBD mode - no snapshot, full initial block download - FullIbd, -} - -impl HookMode { - /// Parse hook mode from string - pub fn mode_from_str(s: &str) -> Result { - match s.to_lowercase().as_str() { - "assumeutxo" => Ok(HookMode::AssumeUtxo), - "full_ibd" | "fullibd" | "full-ibd" => Ok(HookMode::FullIbd), - _ => anyhow::bail!("Unknown hook mode: {}", s), - } - } -} - -/// Trait for executing benchmark lifecycle hooks -pub trait HookExecutor { - fn setup(&self, args: &HookArgs) -> Result<()>; - fn prepare(&self, args: &HookArgs) -> Result<()>; - fn conclude(&self, args: &HookArgs) -> Result<()>; - fn cleanup(&self, args: &HookArgs) -> Result<()>; -} /// Base hook executor with common functionality struct BaseHookExecutor; @@ -81,182 +51,12 @@ impl BaseHookExecutor { } } -/// AssumeUTXO hook executor - uses snapshot syncing -pub struct AssumeUtxoHookExecutor { - base: BaseHookExecutor, -} - -impl AssumeUtxoHookExecutor { - pub fn new() -> Self { - Self { - base: BaseHookExecutor, - } - } - - fn execute_bitcoin_command(&self, binary: &str, args: &[&str]) -> Result<()> { - let command_desc = format!("{} {}", binary, args.join(" ")); - let context = CommandContext { - command_name: Some(command_desc), - allow_failure: false, - capture_output: true, - ..CommandContext::default() - }; - - let executor = CommandExecutor::with_context(context); - let status = executor - .execute_check_status(binary, args) - .with_context(|| "Failed to execute Bitcoin Core command".to_string())?; - - if !status.success() { - return Err(anyhow::anyhow!( - "Bitcoin Core command failed with status {}", - status.code().unwrap_or(-1) - )); - } - - Ok(()) - } - - /// Execute a Bitcoin Core command that may fail (like loadutxosnapshot) - fn execute_bitcoin_command_allow_failure(&self, binary: &str, args: &[&str]) -> Result<()> { - let command_desc = format!("{} {}", binary, args.join(" ")); - let context = CommandContext { - command_name: Some(command_desc), - allow_failure: true, - capture_output: true, - ..CommandContext::default() - }; - - let executor = CommandExecutor::with_context(context); - let _ = executor.execute_check_status(binary, args); - - Ok(()) - } -} - -impl Default for AssumeUtxoHookExecutor { - fn default() -> Self { - Self::new() - } -} - -impl HookExecutor for AssumeUtxoHookExecutor { - fn setup(&self, args: &HookArgs) -> Result<()> { - info!("Running AssumeUTXO setup hook"); - self.base.create_directory(&args.tmp_data_dir)?; - self.base.clear_directory(&args.tmp_data_dir)?; - - Ok(()) - } - - fn prepare(&self, args: &HookArgs) -> Result<()> { - info!("Running AssumeUTXO prepare hook"); - self.base.clear_and_recreate_directory(&args.tmp_data_dir)?; - let binary_path = args.binary.replace("{commit}", &args.commit); - info!("Syncing headers"); - let mut base_args = crate::benchmarks::utils::build_bitcoind_base_args( - &args.network, - &args.tmp_data_dir, - &args.connect_address, - ); - - base_args.extend_from_slice(&[ - "-daemon=0".to_string(), - "-stopatheight=1".to_string(), - "-printtoconsole=0".to_string(), - ]); - - // Convert to &str references for execute_bitcoin_command - let sync_args: Vec<&str> = base_args.iter().map(|s| s.as_str()).collect(); - self.execute_bitcoin_command(&binary_path, &sync_args)?; - - // Load snapshot - info!("Loading snapshot"); - let mut base_args = crate::benchmarks::utils::build_bitcoind_base_args( - &args.network, - &args.tmp_data_dir, - &args.connect_address, - ); - - // Add snapshot-specific arguments - base_args.extend_from_slice(&[ - "-daemon=0".to_string(), - "-pausebackgroundsync=1".to_string(), - format!("-loadutxosnapshot={}", args.snapshot_path.display()), - "-printtoconsole=0".to_string(), - ]); - - // Convert to &str references for execute_bitcoin_command - let snapshot_args: Vec<&str> = base_args.iter().map(|s| s.as_str()).collect(); - self.execute_bitcoin_command_allow_failure(&binary_path, &snapshot_args)?; - - Ok(()) - } - - fn conclude(&self, args: &HookArgs) -> Result<()> { - info!("Running AssumeUTXO conclude hook"); - - // Create output directory structure - let output_path = args - .out_dir - .join(&args.commit) - .join(&args.params_dir) - .join(args.iteration.to_string()); - - info!("Moving debug.log to {}", output_path.display()); - self.base.create_directory(&output_path)?; - - // Determine debug.log source path based on network - let debug_log_source = if args.network == "main" { - args.tmp_data_dir.join("debug.log") - } else { - args.tmp_data_dir.join(&args.network).join("debug.log") - }; - - let debug_log_dest = output_path.join("debug.log"); - - // Move debug.log - if debug_log_source.exists() { - fs::rename(&debug_log_source, &debug_log_dest) - .or_else(|_| -> Result<()> { - // If rename fails (e.g., cross-filesystem), fall back to copy and delete - fs::copy(&debug_log_source, &debug_log_dest)?; - fs::remove_file(&debug_log_source)?; - Ok(()) - }) - .with_context(|| { - format!( - "Failed to move debug.log from {} to {}", - debug_log_source.display(), - debug_log_dest.display() - ) - })?; - } else { - debug!("debug.log not found at {}", debug_log_source.display()); - } - - // Clean datadir contents - self.base.clear_directory(&args.tmp_data_dir)?; - - Ok(()) - } - - fn cleanup(&self, args: &HookArgs) -> Result<()> { - info!("Running AssumeUTXO cleanup hook"); - - // Final cleanup of datadir - self.base.clear_directory(&args.tmp_data_dir)?; - - Ok(()) - } -} - -/// Full IBD hook executor - no snapshot, full initial block download -pub struct FullIbdHookExecutor { +/// Standard hook executor for full initial block download +pub struct StandardHookExecutor { base: BaseHookExecutor, } -impl FullIbdHookExecutor { +impl StandardHookExecutor { pub fn new() -> Self { Self { base: BaseHookExecutor, @@ -264,23 +64,23 @@ impl FullIbdHookExecutor { } } -impl Default for FullIbdHookExecutor { +impl Default for StandardHookExecutor { fn default() -> Self { Self::new() } } -impl HookExecutor for FullIbdHookExecutor { - fn setup(&self, args: &HookArgs) -> Result<()> { - info!("Running Full IBD setup hook"); +impl StandardHookExecutor { + pub fn setup(&self, args: &HookArgs) -> Result<()> { + info!("Running setup hook"); self.base.create_directory(&args.tmp_data_dir)?; self.base.clear_directory(&args.tmp_data_dir)?; Ok(()) } - fn prepare(&self, args: &HookArgs) -> Result<()> { - info!("Running Full IBD prepare hook"); + pub fn prepare(&self, args: &HookArgs) -> Result<()> { + info!("Running prepare hook"); // Create datadir and clear contents self.base.clear_and_recreate_directory(&args.tmp_data_dir)?; @@ -288,8 +88,8 @@ impl HookExecutor for FullIbdHookExecutor { Ok(()) } - fn conclude(&self, args: &HookArgs) -> Result<()> { - info!("Running Full IBD conclude hook"); + pub fn conclude(&self, args: &HookArgs) -> Result<()> { + info!("Running conclude hook"); // Create output directory structure let output_path = args @@ -336,8 +136,8 @@ impl HookExecutor for FullIbdHookExecutor { Ok(()) } - fn cleanup(&self, args: &HookArgs) -> Result<()> { - info!("Running Full IBD cleanup hook"); + pub fn cleanup(&self, args: &HookArgs) -> Result<()> { + info!("Running cleanup hook"); // Final cleanup of datadir self.base.clear_directory(&args.tmp_data_dir)?; diff --git a/src/benchmarks/mod.rs b/src/benchmarks/mod.rs index 6e03f24..ed30206 100644 --- a/src/benchmarks/mod.rs +++ b/src/benchmarks/mod.rs @@ -24,7 +24,7 @@ mod hook_runner; pub use hook_runner::{HookArgs, HookRunner, HookStage}; mod hooks; -pub use hooks::{AssumeUtxoHookExecutor, FullIbdHookExecutor, HookExecutor, HookMode}; +pub use hooks::StandardHookExecutor; mod results; pub use results::{BenchmarkResult, InstrumentationType, RunResult, RunSummary}; diff --git a/src/benchmarks/runner.rs b/src/benchmarks/runner.rs index d487d92..59105a0 100644 --- a/src/benchmarks/runner.rs +++ b/src/benchmarks/runner.rs @@ -1,15 +1,12 @@ use anyhow::{Context, Result}; -use clap::ValueEnum; use log::{debug, info}; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use crate::benchmarks::hook_runner::HookArgs; use crate::benchmarks::parameters::ParameterList; use crate::benchmarks::utils::check_binaries_exist; use crate::config::{get_merged_options, GlobalConfig, SingleConfig}; -use crate::download::SnapshotInfo; use crate::path_utils; -use crate::types::Network; /// High-level benchmark orchestrator that coordinates benchmark execution /// @@ -95,36 +92,12 @@ impl Runner { }; for (index, bench) in benchmarks { - self.check_snapshot(bench, &self.global_config.app.snapshot_dir)?; self.run_benchmark(index, bench)?; } Ok(()) } - /// Check if required snapshot exists - fn check_snapshot(&self, bench: &SingleConfig, snapshot_dir: &Path) -> Result<()> { - // Check if we have the correct snapshot - let network = Network::from_str(&bench.network, true) - .map_err(|e| anyhow::anyhow!("{}", e)) - .with_context(|| format!("Invalid network: {:?}", bench.network))?; - - if let Some(snapshot_info) = SnapshotInfo::for_network(&network) { - let snapshot_path = snapshot_dir.join(snapshot_info.filename); - if !snapshot_path.exists() { - anyhow::bail!( - "Missing required snapshot file for network {}: {}\n -This can be downloaded with `benchkit snapshot download {}`", - bench.network, - snapshot_path.display(), - bench.network - ); - } - } - - Ok(()) - } - /// Run a specific benchmark fn run_benchmark(&self, index: usize, bench: &SingleConfig) -> Result<()> { info!("Running benchmark: {:?}", bench.name); @@ -150,13 +123,8 @@ This can be downloaded with `benchkit snapshot download {}`", }); } - // Create hook runner with appropriate mode - let mode = if let Some(mode_str) = &bench.mode { - crate::benchmarks::HookMode::mode_from_str(mode_str)? - } else { - crate::benchmarks::HookMode::default() - }; - let hook_runner = crate::benchmarks::hook_runner::HookRunner::with_mode(mode); + // Create hook runner + let hook_runner = crate::benchmarks::hook_runner::HookRunner::new(); // Create benchmark runner with optional profiling let benchmark_runner = crate::benchmarks::benchmark_runner::BenchmarkRunner::builder( @@ -171,20 +139,6 @@ This can be downloaded with `benchkit snapshot download {}`", .perf_instrumentation(options.perf_instrumentation.unwrap_or(false)) .build()?; - // Get snapshot info - let snapshot_path = if let Some(snapshot_info) = SnapshotInfo::for_network( - &Network::from_str(&bench.network, true) - .map_err(|e| anyhow::anyhow!("{}", e)) - .with_context(|| format!("Invalid network: {:?}", bench.network))?, - ) { - self.global_config - .app - .snapshot_dir - .join(snapshot_info.filename) - } else { - self.global_config.app.snapshot_dir.clone() // Fallback - }; - // Get command template let command_template = match &options.command { Some(cmd) => crate::benchmarks::utils::build_benchmark_command( @@ -210,7 +164,6 @@ This can be downloaded with `benchkit snapshot download {}`", connect_address: bench.connect.clone().unwrap_or_default(), network: bench.network.clone(), out_dir: self.out_dir.clone(), - snapshot_path, tmp_data_dir: self.global_config.bench.global.tmp_data_dir.clone(), iteration: 0, commit: "{commit}".to_string(), // Will be replaced by parameter substitution diff --git a/src/benchmarks/utils.rs b/src/benchmarks/utils.rs index 20529f8..c79e78a 100644 --- a/src/benchmarks/utils.rs +++ b/src/benchmarks/utils.rs @@ -1,10 +1,10 @@ use std::path::{Path, PathBuf}; /// Default port for Bitcoin Core P2P connections -pub const DEFAULT_P2P_PORT: u16 = 12000; +pub const DEFAULT_P2P_PORT: u16 = 22000; /// Default port for Bitcoin Core RPC connections -pub const DEFAULT_RPC_PORT: u16 = 12001; +pub const DEFAULT_RPC_PORT: u16 = 22001; /// Check if a binary exists for a given commit pub fn binary_exists(bin_dir: &Path, commit: &str) -> bool { diff --git a/src/command.rs b/src/command.rs index 08c6ba9..10bdbce 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,6 +1,4 @@ use anyhow::{Context, Result}; -#[cfg(target_os = "linux")] -use log::warn; use log::{debug, info}; use std::collections::HashMap; use std::fmt::Debug; @@ -255,17 +253,24 @@ impl CommandExecutor { if self.context.process_group { let pgid = -pid; // Negative PID means process group in Linux scheduling APIs - // Use a separate block to capture any errors but continue execution - match cpu_binder.bind_pid_to_cores(pgid, cores) { - Ok(_) => debug!( - "Successfully bound process group {} to cores {}", - pid, cores - ), - Err(err) => { - // Log the error but continue - individual process binding is already done - warn!("Process group binding failed (non-critical): {}", err); - debug!("Individual process binding was successful and should be inherited by children"); + // Check if the process group is properly established before attempting to bind + let group_exists = unsafe { libc::getpgid(pid) } == pid; + + if group_exists { + // Use a separate block to capture any errors but continue execution + match cpu_binder.bind_pid_to_cores(pgid, cores) { + Ok(_) => debug!( + "Successfully bound process group {} to cores {}", + pid, cores + ), + Err(err) => { + // Log the error but continue - individual process binding is already done + debug!("Process group binding failed (non-critical): {}", err); + debug!("Individual process binding was successful and should be inherited by children"); + } } + } else { + debug!("Process group not yet established, skipping group binding (individual binding will be inherited)"); } } } diff --git a/src/config/mod.rs b/src/config/mod.rs index 0d85ddd..685474e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -12,8 +12,6 @@ use crate::path_utils; pub struct AppConfig { pub bin_dir: PathBuf, pub home_dir: PathBuf, - pub patch_dir: PathBuf, - pub snapshot_dir: PathBuf, #[serde(default)] pub path: PathBuf, } @@ -165,8 +163,6 @@ pub struct SingleConfig { pub env: Option>, pub network: String, pub connect: Option, - #[serde(default)] - pub mode: Option, pub benchmark: HashMap, } @@ -205,17 +201,9 @@ pub fn load_app_config(app_config_path: &PathBuf) -> Result { config.path = app_config_path.to_path_buf(); // Expand any relative paths to absolute - expand_paths( - &mut [ - &mut config.bin_dir, - &mut config.home_dir, - &mut config.patch_dir, - &mut config.snapshot_dir, - ], - config_dir, - )?; - - for dir in [&config.bin_dir, &config.patch_dir, &config.snapshot_dir] { + expand_paths(&mut [&mut config.bin_dir, &mut config.home_dir], config_dir)?; + + for dir in [&config.bin_dir] { if !dir.exists() { std::fs::create_dir_all(dir) .with_context(|| format!("Failed to create directory: {}", dir.display()))?; @@ -341,11 +329,6 @@ fn validate_config(config: &BenchmarkConfig) -> Result<()> { "main" | "test" | "signet" | "regtest" => {} _ => anyhow::bail!("Invalid network type: {}", benchmark.network), } - - if let Some(mode) = &benchmark.mode { - use crate::benchmarks::HookMode; - HookMode::mode_from_str(mode)?; - } } Ok(()) @@ -427,8 +410,6 @@ mod tests { let config_content = r#" bin_dir: ./bin home_dir: ./home - patch_dir: ./patches - snapshot_dir: ./snapshots "#; let mut file = fs::File::create(&config_path).unwrap(); @@ -438,8 +419,6 @@ mod tests { assert!(config.bin_dir.is_absolute()); assert!(config.home_dir.is_absolute()); - assert!(config.patch_dir.is_absolute()); - assert!(config.snapshot_dir.is_absolute()); assert_eq!(config.path, config_path); } } diff --git a/src/download.rs b/src/download.rs deleted file mode 100644 index 31481b8..0000000 --- a/src/download.rs +++ /dev/null @@ -1,81 +0,0 @@ -use crate::path_utils; -use crate::types::Network; -use anyhow::Result; -use indicatif::{ProgressBar, ProgressStyle}; -use log::info; -use reqwest::blocking::Client; -use std::fs::File; -use std::io::{Read, Write}; -use std::path::Path; - -#[derive(Debug)] -pub struct SnapshotInfo { - pub network: Network, - pub filename: &'static str, - pub height: u32, -} - -impl SnapshotInfo { - pub fn for_network(network: &Network) -> Option { - match network { - Network::Main => Some(Self { - network: Network::Main, - filename: "utxo-880000.dat", - height: 880000, - }), - Network::Signet => Some(Self { - network: Network::Signet, - filename: "utxo-signet-160000.dat", - height: 160000, - }), - } - } -} - -const SNAPSHOT_HOST: &str = "https://utxo.download/"; - -pub fn download_snapshot(network: &Network, snapshot_dir: &Path) -> Result<()> { - // Make sure the snapshot directory exists - path_utils::ensure_directory(snapshot_dir)?; - - let snapshot_info = SnapshotInfo::for_network(network) - .ok_or_else(|| anyhow::anyhow!("No snapshot available for network {:?}", network))?; - let filename = snapshot_info.filename; - - let url = format!("{SNAPSHOT_HOST}{filename}"); - let client = Client::new(); - let filepath = snapshot_dir.join(filename); - info!("Downloading {url} to {filepath:?}"); - - // Get the content length for the progress bar - let response = client.get(&url).send()?; - let total_size = response.content_length().unwrap_or(0); - - let pb = ProgressBar::new(total_size); - pb.set_style( - ProgressStyle::default_bar() - .template("[{elapsed_precise}] [{bar:60.magenta/black}] {bytes}/{total_bytes} ({eta})") - .unwrap() - .progress_chars("⟨⟨⟨⟨⟨····· "), - ); - - let mut file = File::create(&filepath)?; - let mut downloaded = 0u64; - let mut stream = response; - - // Stream the download in chunks - let mut buffer = [0; 8192]; - loop { - let bytes_read = stream.read(&mut buffer)?; - if bytes_read == 0 { - break; - } - file.write_all(&buffer[..bytes_read])?; - downloaded += bytes_read as u64; - pb.set_position(downloaded); - } - - pb.finish(); - info!("Successfully downloaded {filepath:?}"); - Ok(()) -} diff --git a/src/lib.rs b/src/lib.rs index 05832c4..29474c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ pub mod benchmarks; pub mod command; pub mod config; pub mod cpu_binding; -pub mod download; pub mod path_utils; pub mod system; pub mod system_info; diff --git a/src/main.rs b/src/main.rs index 47dbb83..c96a34b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,9 +3,7 @@ use anyhow::Result; use benchkit::{ benchmarks, config::{load_app_config, load_bench_config, AppConfig, BenchmarkConfig, GlobalConfig}, - download::download_snapshot, system::SystemChecker, - types::Network, }; use clap::{Parser, Subcommand}; @@ -49,21 +47,11 @@ enum Commands { #[arg(short, long, required = true)] out_dir: PathBuf, }, - /// Download an assumeutxo snapshot - Snapshot { - #[command(subcommand)] - command: SnapshotCommands, - }, /// Check system performance settings System { #[command(subcommand)] command: SystemCommands, }, - /// Check patches apply cleanly - Patch { - #[command(subcommand)] - command: PatchCommands, - }, } #[derive(Subcommand, Debug)] @@ -76,24 +64,6 @@ enum SystemCommands { Reset, } -#[derive(Subcommand, Debug)] -enum SnapshotCommands { - /// Download a snapshot - Download { - /// Network (mainnet or signet) - #[arg(value_enum)] - network: Network, - }, -} - -#[derive(Subcommand, Debug)] -enum PatchCommands { - /// Download latest patches from GitHub - Update {}, - /// Test the patches will apply cleanly - Test {}, -} - fn main() -> Result<()> { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); let cli = Cli::parse(); @@ -133,21 +103,6 @@ fn main() -> Result<()> { name.as_deref().unwrap_or("All benchmarks") ); } - Commands::Snapshot { command } => match command { - SnapshotCommands::Download { network } => { - download_snapshot(network, &config.app.snapshot_dir)?; - } - }, - Commands::Patch { command } => match command { - PatchCommands::Test {} => { - let mut builder = benchmarks::Builder::new(config.clone())?; - builder.test_patch_commits()?; - } - PatchCommands::Update {} => { - let builder = benchmarks::Builder::new(config.clone())?; - builder.update_patches(true)?; - } - }, _ => {} } diff --git a/src/path_utils.rs b/src/path_utils.rs index 79d850b..93be4e0 100644 --- a/src/path_utils.rs +++ b/src/path_utils.rs @@ -100,10 +100,10 @@ mod tests { assert_eq!(expand_path_str("/tmp/test"), "/tmp/test"); // With one variable - env::set_var("TEST_PATH", "/test/path"); - let result = expand_path_str("$TEST_PATH/file"); + env::set_var("TEST_PATH_STR", "/test/path"); + let result = expand_path_str("$TEST_PATH_STR/file"); assert!(result.contains("/test/path/file")); - env::remove_var("TEST_PATH"); + env::remove_var("TEST_PATH_STR"); // With HOME variable (if available) if let Ok(home) = env::var("HOME") { @@ -120,11 +120,11 @@ mod tests { PathBuf::from("/tmp/test") ); - // with env vars - env::set_var("TEST_PATH", "/test/path"); - let result = expand_path_buf(Path::new("$TEST_PATH/file")); + // with env vars (use unique name to avoid race with parallel tests) + env::set_var("TEST_PATH_BUF", "/test/path"); + let result = expand_path_buf(Path::new("$TEST_PATH_BUF/file")); assert!(result.to_string_lossy().contains("/test/path/file")); - env::remove_var("TEST_PATH"); + env::remove_var("TEST_PATH_BUF"); } #[test]