From 94c3a17805d41a5a6c9c21edb0ef7e6598e0a030 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Tue, 5 May 2026 19:47:24 +0200 Subject: [PATCH 1/4] Upgrade rng and ruint --- Cargo.lock | 522 +++++++++++++++++++-------- Cargo.toml | 22 +- nomt/src/beatree/benches.rs | 6 +- nomt/src/beatree/leaf/node.rs | 6 +- nomt/src/beatree/ops/bit_ops.rs | 4 +- nomt/src/beatree/ops/mod.rs | 6 +- nomt/src/beatree/ops/update/tests.rs | 10 +- nomt/src/options.rs | 4 +- nomt/tests/common/mod.rs | 2 +- nomt/tests/fill_and_empty.rs | 2 +- torture/src/supervisor/config.rs | 48 +-- torture/src/supervisor/resource.rs | 6 +- torture/src/supervisor/swarm.rs | 8 +- torture/src/supervisor/workload.rs | 28 +- trickfs/src/latency.rs | 3 +- 15 files changed, 440 insertions(+), 237 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8bceec62f..9ff186dde6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", "zerocopy 0.7.34", @@ -81,17 +81,18 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", - "windows-sys", + "once_cell_polyfill", + "windows-sys 0.61.2", ] [[package]] @@ -287,6 +288,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + [[package]] name = "clap" version = "2.34.0" @@ -368,6 +380,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "criterion" version = "0.3.6" @@ -419,9 +440,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -573,16 +594,6 @@ dependencies = [ "regex", ] -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "log", - "regex", -] - [[package]] name = "env_logger" version = "0.11.6" @@ -609,7 +620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -618,6 +629,18 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "funty" version = "2.0.0" @@ -740,16 +763,17 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.1" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186014d53bc231d0090ef8d6f03e0920c54d85a5ed22f4f2f74315ec56cf83fb" +checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" dependencies = [ "cc", "cfg-if", "libc", "log", "rustversion", - "windows", + "windows-link", + "windows-result", ] [[package]] @@ -773,6 +797,20 @@ dependencies = [ "wasi", ] +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "rand_core 0.10.1", + "wasip2", + "wasip3", +] + [[package]] name = "gimli" version = "0.29.0" @@ -790,16 +828,26 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] [[package]] name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "heck" @@ -840,7 +888,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -849,6 +897,12 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "imbl" version = "3.0.0" @@ -857,7 +911,7 @@ checksum = "bc3be8d8cd36f33a46b1849f31f837c44d9fa87223baee3b4bd96b8f11df81eb" dependencies = [ "bitmaps", "imbl-sized-chunks", - "rand_core", + "rand_core 0.6.4", "rand_xoshiro", "version_check", ] @@ -879,6 +933,7 @@ checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", + "serde", ] [[package]] @@ -923,10 +978,13 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" dependencies = [ + "cfg-if", + "futures-util", + "once_cell", "wasm-bindgen", ] @@ -936,11 +994,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.169" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libfuzzer-sys" @@ -961,9 +1025,9 @@ checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "lock_api" @@ -998,11 +1062,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.3" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.17.0", ] [[package]] @@ -1031,13 +1095,13 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1159,6 +1223,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "oorandom" version = "11.1.4" @@ -1271,10 +1341,14 @@ dependencies = [ ] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "prettyplease" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] [[package]] name = "proc-macro-crate" @@ -1296,11 +1370,11 @@ dependencies = [ [[package]] name = "quickcheck" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" +checksum = "95c589f335db0f6aaa168a7cd27b1fc6920f5e1470c804f814d9cd6e62a0f70b" dependencies = [ - "env_logger 0.8.4", + "env_logger", "log", "rand", ] @@ -1314,6 +1388,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "radium" version = "0.7.0" @@ -1322,39 +1402,32 @@ checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] name = "rand" -version = "0.8.5" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rand_core" -version = "0.6.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" [[package]] name = "rand_distr" -version = "0.4.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +checksum = "4d431c2703ccf129de4d45253c03f49ebb22b97d6ad79ee3ecfc7e3f4862c1d8" dependencies = [ "num-traits", "rand", @@ -1362,11 +1435,11 @@ dependencies = [ [[package]] name = "rand_pcg" -version = "0.3.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" dependencies = [ - "rand_core", + "rand_core 0.10.1", ] [[package]] @@ -1375,7 +1448,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1409,9 +1482,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags 2.5.0", ] @@ -1462,18 +1535,18 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "ruint" -version = "1.12.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" +checksum = "0298da754d1395046b0afdc2f20ee76d29a8ae310cd30ffa84ed42acba9cb12a" dependencies = [ "ruint-macro", ] [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" @@ -1491,7 +1564,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1527,6 +1600,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.216" @@ -1575,7 +1654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.12", "digest", ] @@ -1614,12 +1693,12 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.8" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1630,9 +1709,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.90" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -1653,10 +1732,10 @@ checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", - "getrandom", + "getrandom 0.2.15", "once_cell", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1699,11 +1778,10 @@ dependencies = [ [[package]] name = "tokio" -version = "1.42.0" +version = "1.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386" dependencies = [ - "backtrace", "bytes", "libc", "mio", @@ -1712,14 +1790,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", @@ -1743,9 +1821,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -1754,9 +1832,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.13" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -1878,7 +1956,7 @@ dependencies = [ name = "trickfs" version = "0.1.0" dependencies = [ - "env_logger 0.11.6", + "env_logger", "fuser", "libc", "log", @@ -1894,7 +1972,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 4.5.23", - "env_logger 0.11.6", + "env_logger", "log", "trickfs", ] @@ -1904,9 +1982,6 @@ name = "twox-hash" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7b17f197b3050ba473acf9181f7b1d3b66d1cf7356c6cc57886662276e65908" -dependencies = [ - "rand", -] [[package]] name = "typenum" @@ -1926,6 +2001,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "utf8parse" version = "0.2.2" @@ -1961,36 +2042,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasm-bindgen" -version = "0.2.93" +name = "wasip2" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", + "wit-bindgen", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "bumpalo", - "log", + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +dependencies = [ + "cfg-if", "once_cell", - "proc-macro2", - "quote", - "syn", + "rustversion", + "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1998,28 +2084,65 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.5.0", + "hashbrown 0.15.2", + "indexmap", + "semver", +] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602" dependencies = [ "js-sys", "wasm-bindgen", @@ -2059,7 +2182,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2069,48 +2192,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.54.0" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" -dependencies = [ - "windows-core", - "windows-targets", -] +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows-core" -version = "0.54.0" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-result", - "windows-targets", + "windows-link", ] [[package]] -name = "windows-result" -version = "0.1.1" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-targets", + "windows-link", ] [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -2124,51 +2242,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -2179,6 +2297,94 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.5.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "witness_verification" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 81ae5b53f8..9d1f7188b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,40 +22,40 @@ license = "MIT/Apache-2.0" borsh = { version = "1.5.7", default-features = false, features = ["derive"] } bitvec = { version = "1", default-features = false, features = ["alloc"] } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } -ruint = { version = "1.12.1", default-features = false } +ruint = { version = "1.18.0", default-features = false } arrayvec = { version = "0.7", default-features = false } blake3 = { version = "1.5.1", default-features = false } sha2 = { version = "0.10.6", default-features = false } anyhow = { version = "1.0.81", features = ["backtrace"] } parking_lot = { version = "0.12.3", features = ["arc_lock", "send_guard"] } threadpool = "1.8.1" -twox-hash = "2.1.0" +twox-hash = { version = "2.1.0", default-features = false, features = ["std", "xxhash3_64"] } fxhash = "0.2.1" dashmap = "5.5.3" crossbeam = "0.8.4" -crossbeam-channel = "0.5.13" +crossbeam-channel = "0.5.15" slab = "0.4.9" -rand = "0.8.5" +rand = "0.10.1" ahash = "0.8.11" imbl = "3.0.0" -lru = "0.12.3" +lru = "0.18.0" libc = "0.2.155" criterion = { version = "0.3" } thread_local = "1.1.8" cfg-if = "1.0.0" io-uring = "0.6.4" loom = { version = "0.7", features = ["checkpoint"] } -rand_pcg = "0.3.1" +rand_pcg = "0.10.2" hex-literal = "0.4" tempfile = "3.8.1" lazy_static = "1.5.0" -quickcheck = "1.0.3" +quickcheck = "1.1.0" nix = { version = "0.29", features = ["process"] } serde = { version = "1.0.216", default-features = false, features = ["derive"] } bincode = "1.3.3" -tokio = { version = "1.42.0", features = ["full"] } -tokio-util = { version = "0.7.13", features = ["codec"] } -tokio-stream = "0.1.17" +tokio = { version = "1.52.2", features = ["full"] } +tokio-util = { version = "0.7.18", features = ["codec"] } +tokio-stream = "0.1.18" futures = "0.3.31" tokio-serde = { version = "0.9.0", features = ["bincode"] } tracing = { version = "0.1.41", features = ["attributes"] } @@ -65,7 +65,7 @@ clap = { version = "4.5.23", features = ["derive"] } which = "4" fuser = { version = "0.15.1", features = ["abi-7-23"] } log = "0.4.22" -rand_distr = "0.4.3" +rand_distr = "0.6.0" env_logger = "0.11.6" digest = { version = "0.10.7" } diff --git a/nomt/src/beatree/benches.rs b/nomt/src/beatree/benches.rs index ccb04a52c8..5fccaccd1a 100644 --- a/nomt/src/beatree/benches.rs +++ b/nomt/src/beatree/benches.rs @@ -4,7 +4,7 @@ use crate::beatree::{ branch::node::benches::*, leaf::node::benches::*, ops::benches::*, ops::bit_ops::benches::*, Key, }; -use rand::RngCore; +use rand::Rng as _; pub fn beatree_benchmark(c: &mut criterion::Criterion) { separate_benchmark(c); @@ -19,7 +19,7 @@ pub fn beatree_benchmark(c: &mut criterion::Criterion) { // returns two keys a and b where b > a and b shares the first n bits with a pub fn get_key_pair(shared_bytes: usize) -> (Key, Key) { - let mut rand = rand::thread_rng(); + let mut rand = rand::rng(); let mut a = [0; 32]; rand.fill_bytes(&mut a[0..shared_bytes]); @@ -32,7 +32,7 @@ pub fn get_key_pair(shared_bytes: usize) -> (Key, Key) { // Get a vector containing `n` random keys that share the first `shared_bytes` pub fn get_keys(shared_bytes: usize, n: usize) -> Vec { - let mut rand = rand::thread_rng(); + let mut rand = rand::rng(); let mut prefix = [0; 32]; rand.fill_bytes(&mut prefix[0..shared_bytes]); diff --git a/nomt/src/beatree/leaf/node.rs b/nomt/src/beatree/leaf/node.rs index a7d162f549..96dedbae24 100644 --- a/nomt/src/beatree/leaf/node.rs +++ b/nomt/src/beatree/leaf/node.rs @@ -258,11 +258,11 @@ pub mod benches { io::PagePool, }; use criterion::{BatchSize, BenchmarkId, Criterion}; - use rand::Rng; + use rand::RngExt; pub fn leaf_search_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("search_leaf"); - let mut rand = rand::thread_rng(); + let mut rand = rand::rng(); let page_pool = PagePool::new(); @@ -284,7 +284,7 @@ pub mod benches { group.bench_function(BenchmarkId::new("full_leaf", format!("{}-keys", n)), |b| { b.iter_batched( || { - let index = rand.gen_range(0..keys.len()); + let index = rand.random_range(0..keys.len()); keys[index].clone() }, |key| leaf.get(&key), diff --git a/nomt/src/beatree/ops/bit_ops.rs b/nomt/src/beatree/ops/bit_ops.rs index 7f58d16c7b..3c9dd3ea98 100644 --- a/nomt/src/beatree/ops/bit_ops.rs +++ b/nomt/src/beatree/ops/bit_ops.rs @@ -284,7 +284,7 @@ pub fn bitwise_memcpy( pub mod benches { use crate::beatree::benches::get_key_pair; use criterion::{BenchmarkId, Criterion}; - use rand::RngCore; + use rand::Rng as _; pub fn separate_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("separate"); @@ -308,7 +308,7 @@ pub mod benches { }; for prefix_bits in [0, 1, 4, 7, 8, 9, 12, 15, 18] { - let mut rand = rand::thread_rng(); + let mut rand = rand::rng(); // 50 to extract multiples of 8 bytes for the separator let mut key = [0; 50]; rand.fill_bytes(&mut key); diff --git a/nomt/src/beatree/ops/mod.rs b/nomt/src/beatree/ops/mod.rs index 876f456ab4..a15ee2da02 100644 --- a/nomt/src/beatree/ops/mod.rs +++ b/nomt/src/beatree/ops/mod.rs @@ -158,11 +158,11 @@ pub mod benches { io::{PagePool, PAGE_SIZE}, }; use criterion::{BenchmarkId, Criterion}; - use rand::Rng; + use rand::RngExt; pub fn search_branch_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("search_branch"); - let mut rand = rand::thread_rng(); + let mut rand = rand::rng(); let page_pool = PagePool::new(); for prefix_len_bytes in [1, 4, 8, 12, 16] { @@ -196,7 +196,7 @@ pub mod benches { |b| { b.iter_batched( || { - let index = rand.gen_range(0..separators.len()); + let index = rand.random_range(0..separators.len()); separators[index].1.clone() }, |separator| super::search_branch(&branch, separator), diff --git a/nomt/src/beatree/ops/update/tests.rs b/nomt/src/beatree/ops/update/tests.rs index 3e98a5dd83..30ac13582d 100644 --- a/nomt/src/beatree/ops/update/tests.rs +++ b/nomt/src/beatree/ops/update/tests.rs @@ -24,7 +24,7 @@ use crate::{ }; use lazy_static::lazy_static; use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult}; -use rand::{Rng, SeedableRng}; +use rand::{RngExt, SeedableRng}; use std::collections::BTreeMap; use std::collections::BTreeSet; use std::fs::File; @@ -119,7 +119,7 @@ fn init_beatree() -> TreeData { let initial_items: BTreeMap<[u8; 32], Vec> = KEYS .iter() .cloned() - .map(|key| (key, vec![170u8; rng.gen_range(500..MAX_LEAF_VALUE_SIZE)])) + .map(|key| (key, vec![170u8; rng.random_range(500..MAX_LEAF_VALUE_SIZE)])) .collect(); let leaf_store = Store::open(&PAGE_POOL, ln_fd.clone(), PageNumber(1), None).unwrap(); @@ -392,7 +392,7 @@ fn leaf_stage_inner(input: StageInputs) -> TestResult { fn leaf_stage() { let test_result = std::panic::catch_unwind(|| { QuickCheck::new() - .gen(Gen::new(LEAF_STAGE_CHANGESET_AVG_SIZE)) + .rng(Gen::new(LEAF_STAGE_CHANGESET_AVG_SIZE)) .max_tests(MAX_TESTS) .quickcheck(leaf_stage_inner as fn(_) -> TestResult) }); @@ -414,7 +414,7 @@ fn init_bbn_index(separators: &[[u8; 32]]) -> Index { let mut bbn_pn = 0; while used_separators < separators.len() { - let body_size_target = rng.gen_range(BRANCH_MERGE_THRESHOLD..BRANCH_NODE_BODY_SIZE); + let body_size_target = rng.random_range(BRANCH_MERGE_THRESHOLD..BRANCH_NODE_BODY_SIZE); let branch_node = make_branch_until( &mut separators[used_separators..].iter().cloned(), @@ -588,7 +588,7 @@ fn branch_stage_inner(input: StageInputs) -> TestResult { fn branch_stage() { let test_result = std::panic::catch_unwind(|| { QuickCheck::new() - .gen(Gen::new(BRANCH_STAGE_CHANGESET_AVG_SIZE)) + .rng(Gen::new(BRANCH_STAGE_CHANGESET_AVG_SIZE)) .max_tests(MAX_TESTS) .quickcheck(branch_stage_inner as fn(_) -> TestResult) }); diff --git a/nomt/src/options.rs b/nomt/src/options.rs index c39f351ae8..a44652b733 100644 --- a/nomt/src/options.rs +++ b/nomt/src/options.rs @@ -35,9 +35,7 @@ pub struct Options { impl Options { /// Create a new `Options` instance with the default values and a random bitbox seed. pub fn new() -> Self { - use rand::Rng as _; - let mut bitbox_seed = [0u8; 16]; - rand::rngs::OsRng.fill(&mut bitbox_seed); + let bitbox_seed: [u8; 16] = rand::random(); Self { path: PathBuf::from("nomt_db"), diff --git a/nomt/tests/common/mod.rs b/nomt/tests/common/mod.rs index 603209fd4a..a0cb2a2b50 100644 --- a/nomt/tests/common/mod.rs +++ b/nomt/tests/common/mod.rs @@ -13,7 +13,7 @@ use std::{ pub fn account_path(id: u64) -> KeyPath { // KeyPaths must be uniformly distributed, but we don't want to spend time on a good hash. So // the next best option is to use a PRNG seeded with the id. - use rand::{RngCore as _, SeedableRng as _}; + use rand::{Rng as _, SeedableRng as _}; let mut seed = [0; 16]; seed[0..8].copy_from_slice(&id.to_le_bytes()); let mut rng = rand_pcg::Lcg64Xsh32::from_seed(seed); diff --git a/nomt/tests/fill_and_empty.rs b/nomt/tests/fill_and_empty.rs index c61ad3324b..b7b597c0b3 100644 --- a/nomt/tests/fill_and_empty.rs +++ b/nomt/tests/fill_and_empty.rs @@ -1,6 +1,6 @@ mod common; use common::Test; -use rand::{prelude::SliceRandom, Rng, SeedableRng}; +use rand::{prelude::SliceRandom, Rng, RngExt, SeedableRng}; use std::time::{SystemTime, UNIX_EPOCH}; fn seed() -> [u8; 16] { diff --git a/torture/src/supervisor/config.rs b/torture/src/supervisor/config.rs index 263f7d034a..8f9aeb5bc2 100644 --- a/torture/src/supervisor/config.rs +++ b/torture/src/supervisor/config.rs @@ -3,7 +3,7 @@ use super::{ swarm::{self, SwarmFeatures}, ResourceExhaustion, }; -use rand::{Rng, RngCore}; +use rand::prelude::*; use std::sync::{Arc, Mutex}; /// Percentage of the assigned space to the workload that will be @@ -165,14 +165,14 @@ impl WorkloadConfiguration { preallocate_ht: false, prepopulate_page_cache: false, bitbox_seed, - avg_commit_size: rng.gen_range(1..=(MAX_COMMIT_SIZE / 2)), - avg_value_len: rng.gen_range(1..=(MAX_VALUE_LEN / 2)), - avg_overflow_value_len: rng.gen_range(MAX_VALUE_LEN..=(MAX_OVERFLOW_VALUE_LEN / 2)), - commit_concurrency: rng.gen_range(1..=MAX_COMMIT_CONCURRENCY), - io_workers: rng.gen_range(1..=MAX_IO_WORKERS), - page_cache_size: rng.gen_range(1..=MAX_IN_MEMORY_CACHE_SIZE), - leaf_cache_size: rng.gen_range(1..=MAX_IN_MEMORY_CACHE_SIZE), - page_cache_upper_levels: rng.gen_range(0..=MAX_PAGE_CACHE_UPPER_LEVELS), + avg_commit_size: rng.random_range(1..=(MAX_COMMIT_SIZE / 2)), + avg_value_len: rng.random_range(1..=(MAX_VALUE_LEN / 2)), + avg_overflow_value_len: rng.random_range(MAX_VALUE_LEN..=(MAX_OVERFLOW_VALUE_LEN / 2)), + commit_concurrency: rng.random_range(1..=MAX_COMMIT_CONCURRENCY), + io_workers: rng.random_range(1..=MAX_IO_WORKERS), + page_cache_size: rng.random_range(1..=MAX_IN_MEMORY_CACHE_SIZE), + leaf_cache_size: rng.random_range(1..=MAX_IN_MEMORY_CACHE_SIZE), + page_cache_upper_levels: rng.random_range(0..=MAX_PAGE_CACHE_UPPER_LEVELS), // To avoid reaching Bucket Exhaustion, we limit the number of iterations // with the worst case scenario of every iteration adding `avg_commit_size` new keys. hashtable_buckets: 0, @@ -296,35 +296,35 @@ impl WorkloadConfiguration { pub fn apply_swarm_feature(&mut self, rng: &mut rand_pcg::Pcg64, feature: SwarmFeatures) { match feature { SwarmFeatures::TrickfsENOSPC => { - self.enospc_on = rng.gen_range(0.01..=1.00); - self.enospc_off = rng.gen_range(0.01..=1.00); + self.enospc_on = rng.random_range(0.01..=1.00); + self.enospc_off = rng.random_range(0.01..=1.00); } SwarmFeatures::TrickfsLatencyInjection => { - self.latency_on = rng.gen_range(0.01..=1.00); - self.latency_off = rng.gen_range(0.01..=1.00); + self.latency_on = rng.random_range(0.01..=1.00); + self.latency_off = rng.random_range(0.01..=1.00); } SwarmFeatures::EnsureChangeset => self.ensure_changeset = true, SwarmFeatures::SampleSnapshot => self.sample_snapshot = true, SwarmFeatures::WarmUp => self.warm_up = true, SwarmFeatures::PreallocateHt => self.preallocate_ht = true, SwarmFeatures::Read => { - self.reads = rng.gen_range(0.01..1.00); - self.read_concurrency = rng.gen_range(1..=64); - self.read_existing_key = rng.gen_range(0.01..1.00); + self.reads = rng.random_range(0.01..1.00); + self.read_concurrency = rng.random_range(1..=64); + self.read_existing_key = rng.random_range(0.01..1.00); } SwarmFeatures::Rollback => { - self.rollback = rng.gen_range(0.01..1.00); + self.rollback = rng.random_range(0.01..1.00); // During scheduling of rollbacks the lower bound is 1 // thus max must be at least 2 to avoid creating an empty range. - self.max_rollback_commits = rng.gen_range(2..100); + self.max_rollback_commits = rng.random_range(2..100); } - SwarmFeatures::RollbackCrash => self.rollback_crash = rng.gen_range(0.01..1.00), - SwarmFeatures::CommitCrash => self.commit_crash = rng.gen_range(0.01..1.00), + SwarmFeatures::RollbackCrash => self.rollback_crash = rng.random_range(0.01..1.00), + SwarmFeatures::CommitCrash => self.commit_crash = rng.random_range(0.01..1.00), SwarmFeatures::PrepopulatePageCache => self.prepopulate_page_cache = true, - SwarmFeatures::NewKeys => self.new_key = rng.gen_range(0.01..=1.00), - SwarmFeatures::DeleteKeys => self.delete_key = rng.gen_range(0.01..=1.00), - SwarmFeatures::UpdateKeys => self.update_key = rng.gen_range(0.01..=1.00), - SwarmFeatures::OverflowValues => self.overflow = rng.gen_range(0.01..=1.00), + SwarmFeatures::NewKeys => self.new_key = rng.random_range(0.01..=1.00), + SwarmFeatures::DeleteKeys => self.delete_key = rng.random_range(0.01..=1.00), + SwarmFeatures::UpdateKeys => self.update_key = rng.random_range(0.01..=1.00), + SwarmFeatures::OverflowValues => self.overflow = rng.random_range(0.01..=1.00), } } } diff --git a/torture/src/supervisor/resource.rs b/torture/src/supervisor/resource.rs index 815d26de30..b5508e5749 100644 --- a/torture/src/supervisor/resource.rs +++ b/torture/src/supervisor/resource.rs @@ -4,7 +4,7 @@ use std::{ path::{Path, PathBuf}, }; -use rand::{Rng, SeedableRng}; +use rand::{prelude::*, SeedableRng}; /// 1GiB is the minimum amount of space that can be assigned to a workload. const MIN_ASSIGNED_SPACE: u64 = 1 * (1 << 30); @@ -82,7 +82,7 @@ impl ResourceAllocator { // Force to allocate bigger chunk of memory initially. let min = std::cmp::min(MIN_ASSIGNED_SPACE, avail_disk / 2); - let assigned_disk = self.rng.gen_range(min..avail_disk); + let assigned_disk = self.rng.random_range(min..avail_disk); // Assign memory let mut avail_memory = self.max_memory_avail - self.total_assigned_memory; @@ -114,7 +114,7 @@ impl ResourceAllocator { } avail_memory = std::cmp::min(avail_memory, MAX_ASSIGNED_ONLY_MEMORY); - let assigned_memory = self.rng.gen_range(MIN_ASSIGNED_SPACE..avail_memory); + let assigned_memory = self.rng.random_range(MIN_ASSIGNED_SPACE..avail_memory); self.total_assigned_memory += assigned_memory; self.assigned.push(( diff --git a/torture/src/supervisor/swarm.rs b/torture/src/supervisor/swarm.rs index ed651183b2..324302474b 100644 --- a/torture/src/supervisor/swarm.rs +++ b/torture/src/supervisor/swarm.rs @@ -1,4 +1,4 @@ -use rand::Rng; +use rand::RngExt; pub enum SwarmFeatures { /// Trigger on and off trickfs to return ENOSPC. @@ -59,7 +59,7 @@ pub fn new_features_set(rng: &mut rand_pcg::Pcg64) -> Vec { // Features removal mechanism -> coin tossing for almost every feature. for idx in (0..features.len()).rev() { - if rng.gen_bool(0.5) { + if rng.random_bool(0.5) { features.remove(idx); } } @@ -71,10 +71,10 @@ pub fn new_features_set(rng: &mut rand_pcg::Pcg64) -> Vec { // // The probability of using Trickfs is 10% (= p*p + 2 * (p * (1-p))). let p = 0.052; - if rng.gen_bool(p) { + if rng.random_bool(p) { features.push(SwarmFeatures::TrickfsLatencyInjection); } - if rng.gen_bool(p) { + if rng.random_bool(p) { features.push(SwarmFeatures::TrickfsENOSPC); } diff --git a/torture/src/supervisor/workload.rs b/torture/src/supervisor/workload.rs index 5b347c3aae..2fc23edbe9 100644 --- a/torture/src/supervisor/workload.rs +++ b/torture/src/supervisor/workload.rs @@ -1,6 +1,6 @@ use anyhow::Result; use imbl::OrdMap; -use rand::{distributions::WeightedIndex, prelude::*}; +use rand::{distr::weighted::WeightedIndex, prelude::*}; use std::{ collections::HashSet, path::{Path, PathBuf}, @@ -305,7 +305,7 @@ impl Workload { if self.trick_handle.is_some() { if self.enabled_enospc { - let should_turn_off = self.rng.gen_bool(self.config.enospc_off); + let should_turn_off = self.rng.random_bool(self.config.enospc_off); if should_turn_off { info!("unsetting ENOSPC"); self.enabled_enospc = false; @@ -315,7 +315,7 @@ impl Workload { .set_trigger_enospc(false); } } else { - let should_turn_on = self.rng.gen_bool(self.config.enospc_on); + let should_turn_on = self.rng.random_bool(self.config.enospc_on); if should_turn_on { info!("setting ENOSPC"); self.enabled_enospc = true; @@ -324,7 +324,7 @@ impl Workload { } if self.enabled_latency { - let should_turn_off = self.rng.gen_bool(self.config.latency_off); + let should_turn_off = self.rng.random_bool(self.config.latency_off); if should_turn_off { info!("unsetting latency injector"); self.enabled_latency = false; @@ -334,7 +334,7 @@ impl Workload { .set_trigger_latency_injector(false); } } else { - let should_turn_on = self.rng.gen_bool(self.config.latency_on); + let should_turn_on = self.rng.random_bool(self.config.latency_on); if should_turn_on { info!("setting latency injector"); self.enabled_latency = true; @@ -348,12 +348,12 @@ impl Workload { // Do not schedule new rollbacks if they are already scheduled. let is_rollback_scheduled = self.scheduled_rollback.is_some(); - if !is_rollback_scheduled && self.rng.gen_bool(self.config.rollback) { - let should_crash = self.rng.gen_bool(self.config.rollback_crash); + if !is_rollback_scheduled && self.rng.random_bool(self.config.rollback) { + let should_crash = self.rng.random_bool(self.config.rollback_crash); self.schedule_rollback(should_crash).await? } - let should_crash = self.rng.gen_bool(self.config.commit_crash); + let should_crash = self.rng.random_bool(self.config.commit_crash); self.exercise_commit(should_crash).await?; Ok(()) @@ -500,7 +500,7 @@ impl Workload { async fn schedule_rollback(&mut self, should_crash: bool) -> anyhow::Result<()> { let n_commits_to_rollback = - self.rng.gen_range(1..self.config.max_rollback_commits) as usize; + self.rng.random_range(1..self.config.max_rollback_commits) as usize; let last_snapshot = &self.committed; let rollback_sync_seqn = last_snapshot.sync_seqn + n_commits_to_rollback as u32; @@ -879,7 +879,7 @@ impl Workload { let mut snapshot = self.committed.clone(); snapshot.sync_seqn += 1; - let size = self.rng.gen_range(0..self.config.avg_commit_size * 2); + let size = self.rng.random_range(0..self.config.avg_commit_size * 2); let reads_size = (size as f64 * self.config.reads) as usize; let changeset_size = size - reads_size; @@ -931,7 +931,7 @@ impl Workload { let threshold = self.committed.state.len(); while reads.len() < size { self.rng.fill_bytes(&mut key); - if reads.len() < threshold && self.rng.gen_bool(self.config.read_existing_key) { + if reads.len() < threshold && self.rng.random_bool(self.config.read_existing_key) { if let Some((next_key, Some(_))) = self.committed.state.get_next(&key) { key.copy_from_slice(next_key); } @@ -1055,11 +1055,11 @@ impl Workload { fn gen_value(&mut self) -> Vec { // MAX_LEAF_VALUE_SIZE is 1332, // thus every value size bigger than this will create an overflow value. - let len = if self.rng.gen_bool(self.config.overflow) { + let len = if self.rng.random_bool(self.config.overflow) { self.rng - .gen_range(MAX_VALUE_LEN..(self.config.avg_overflow_value_len) * 2) + .random_range(MAX_VALUE_LEN..(self.config.avg_overflow_value_len) * 2) } else { - self.rng.gen_range(1..(self.config.avg_value_len) * 2) + self.rng.random_range(1..(self.config.avg_value_len) * 2) }; let mut value = vec![0; len]; self.rng.fill_bytes(&mut value); diff --git a/trickfs/src/latency.rs b/trickfs/src/latency.rs index 8ac0214054..512fce07bc 100644 --- a/trickfs/src/latency.rs +++ b/trickfs/src/latency.rs @@ -4,8 +4,7 @@ use std::{ time::{Duration, Instant}, }; -use rand::SeedableRng; -use rand_distr::Distribution; +use rand::{distr::Distribution, SeedableRng}; /// Max possible delay, in micros, used as injected latency. const MAX_LATENCY_MICROS: u64 = 1000; From 18e73d56cb5d5223587c55714ef3d7aa818f561b Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Tue, 5 May 2026 20:04:58 +0200 Subject: [PATCH 2/4] Remove explicit dead bincode and upgrade tracing subcsriber --- Cargo.toml | 3 +- torture/Cargo.toml | 1 - trickfs/src/lib.rs | 507 +++++++++++++++++++++++++++------------------ 3 files changed, 304 insertions(+), 207 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d1f7188b2..c760e66ce8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,14 +52,13 @@ lazy_static = "1.5.0" quickcheck = "1.1.0" nix = { version = "0.29", features = ["process"] } serde = { version = "1.0.216", default-features = false, features = ["derive"] } -bincode = "1.3.3" tokio = { version = "1.52.2", features = ["full"] } tokio-util = { version = "0.7.18", features = ["codec"] } tokio-stream = "0.1.18" futures = "0.3.31" tokio-serde = { version = "0.9.0", features = ["bincode"] } tracing = { version = "0.1.41", features = ["attributes"] } -tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } +tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } futures-util = "0.3.31" clap = { version = "4.5.23", features = ["derive"] } which = "4" diff --git a/torture/Cargo.toml b/torture/Cargo.toml index be32b11ec9..e1c47bdfd5 100644 --- a/torture/Cargo.toml +++ b/torture/Cargo.toml @@ -9,7 +9,6 @@ libc.workspace = true anyhow.workspace = true cfg-if.workspace = true serde.workspace = true -bincode.workspace = true nomt = { path = "../nomt" } tokio.workspace = true tokio-util.workspace = true diff --git a/trickfs/src/lib.rs b/trickfs/src/lib.rs index a80f04215a..a41b007779 100644 --- a/trickfs/src/lib.rs +++ b/trickfs/src/lib.rs @@ -23,7 +23,10 @@ use std::{ mod latency; -use fuser::FileAttr; +use fuser::{ + BsdFileFlags, Config, Errno, FileAttr, FileHandle, FopenFlags, Generation, INodeNo, LockOwner, + MountOption, OpenFlags, WriteFlags, +}; use latency::LatencyInjector; const DEFAULT_TTL: Duration = Duration::from_secs(1); @@ -106,6 +109,18 @@ impl Inode { const ROOT: Inode = Inode(1); } +impl From for Inode { + fn from(value: INodeNo) -> Self { + Inode(value.0) + } +} + +impl From for INodeNo { + fn from(value: Inode) -> Self { + INodeNo(value.0) + } +} + pub struct InodeData { parent: Inode, generation: u64, @@ -170,7 +185,7 @@ impl InodeData { pub fn mk_file_attrs(&self, ino: Inode) -> FileAttr { FileAttr { - ino: ino.0, + ino: ino.into(), size: self.size(), blocks: self.blocks(), atime: UNIX_EPOCH, @@ -314,47 +329,38 @@ impl Tree { } } -/// The implementation of the file system. -pub struct Trick { +struct TrickState { tree: Tree, /// Stored inodes. The first inode is the root directory. /// /// Note that inodes are 1-based and this vector is 0-based. inodes: Vec, freelist: Vec, - trigger_enospc: Arc, - trigger_latency_injector: Arc, latency_injector: LatencyInjector, } -impl Trick { - fn new(seed: u64) -> (Self, TrickHandle) { - let trigger_enospc = Arc::new(AtomicBool::new(false)); - let trigger_latency_injector = Arc::new(AtomicBool::new(false)); +/// The implementation of the file system. +pub struct Trick { + state: Mutex, + trigger_enospc: Arc, + trigger_latency_injector: Arc, +} - let tree = Tree::new(); - let inodes = Vec::new(); - let freelist = Vec::new(); - let mut fs = Trick { - tree, - inodes, - freelist, - trigger_enospc: trigger_enospc.clone(), - trigger_latency_injector: trigger_latency_injector.clone(), +impl TrickState { + fn new(seed: u64) -> Self { + let mut state = TrickState { + tree: Tree::new(), + inodes: Vec::new(), + freelist: Vec::new(), latency_injector: LatencyInjector::new(seed), }; // Initialize the root directory. Parent of the ROOT is ROOT. - fs.register_inode(InodeData::new_dir(Inode::ROOT)); - fs.tree + state.register_inode(InodeData::new_dir(Inode::ROOT)); + state + .tree .ino_to_container .insert(Inode::ROOT, Container::new()); - - let handle = TrickHandle { - bg_sess: None.into(), - trigger_enospc, - trigger_latency_injector, - }; - (fs, handle) + state } fn lookup_inode(&self, ino: Inode) -> Option<&InodeData> { @@ -415,70 +421,113 @@ impl Trick { } path } +} + +impl Trick { + fn new(seed: u64) -> (Self, TrickHandle) { + let trigger_enospc = Arc::new(AtomicBool::new(false)); + let trigger_latency_injector = Arc::new(AtomicBool::new(false)); + + let fs = Trick { + state: Mutex::new(TrickState::new(seed)), + trigger_enospc: trigger_enospc.clone(), + trigger_latency_injector: trigger_latency_injector.clone(), + }; + + let handle = TrickHandle { + bg_sess: None.into(), + trigger_enospc, + trigger_latency_injector, + }; + (fs, handle) + } /// Schedule the reply if `trigger_latency_injector` is on, otherwise reply directly. - fn schedule_reply(&mut self, reply: impl FnOnce() + Send + 'static) { + fn schedule_reply(&self, reply: impl FnOnce() + Send + 'static) { + if !self + .trigger_latency_injector + .load(std::sync::atomic::Ordering::Relaxed) + { + reply(); + } else { + self.state + .lock() + .unwrap() + .latency_injector + .schedule_reply(Box::new(reply)); + } + } + + fn schedule_reply_with_state( + &self, + state: &mut TrickState, + reply: impl FnOnce() + Send + 'static, + ) { if !self .trigger_latency_injector .load(std::sync::atomic::Ordering::Relaxed) { reply(); } else { - self.latency_injector.schedule_reply(Box::new(reply)); + state.latency_injector.schedule_reply(Box::new(reply)); } } } impl fuser::Filesystem for Trick { fn lookup( - &mut self, - _req: &fuser::Request<'_>, - parent: u64, + &self, + _req: &fuser::Request, + parent: INodeNo, name: &std::ffi::OsStr, reply: fuser::ReplyEntry, ) { log::trace!("lookup: parent={}, name={:?}", parent, name); - let Some(parent) = self.tree.ino_to_container.get(&Inode(parent)) else { + let mut state = self.state.lock().unwrap(); + let Some(parent) = state.tree.ino_to_container.get(&Inode::from(parent)) else { log::trace!("parent inode doesn't exist"); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; let Some(ino) = parent.lookup_by_name(name) else { log::trace!("file doesn't exist"); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; - let Some(inode) = self.lookup_inode(ino) else { + let Some(inode) = state.lookup_inode(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; let file_attr = inode.mk_file_attrs(ino); - let generation = inode.generation; - self.schedule_reply(move || reply.entry(&DEFAULT_TTL, &file_attr, generation)); + let generation = Generation(inode.generation); + self.schedule_reply_with_state(&mut state, move || { + reply.entry(&DEFAULT_TTL, &file_attr, generation) + }); } fn getattr( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - _fh: Option, + &self, + _req: &fuser::Request, + ino: INodeNo, + _fh: Option, reply: fuser::ReplyAttr, ) { - let ino = Inode(ino); - let Some(inode) = self.lookup_inode(ino) else { + let mut state = self.state.lock().unwrap(); + let ino = Inode::from(ino); + let Some(inode) = state.lookup_inode(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; let file_attr = inode.mk_file_attrs(ino); - self.schedule_reply(move || reply.attr(&DEFAULT_TTL, &file_attr)); + self.schedule_reply_with_state(&mut state, move || reply.attr(&DEFAULT_TTL, &file_attr)); } fn setattr( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, + &self, + _req: &fuser::Request, + ino: INodeNo, mode: Option, uid: Option, gid: Option, @@ -486,34 +535,35 @@ impl fuser::Filesystem for Trick { atime: Option, mtime: Option, ctime: Option, - fh: Option, + fh: Option, crtime: Option, chgtime: Option, bkuptime: Option, - flags: Option, + flags: Option, reply: fuser::ReplyAttr, ) { // trickfs doesn't track any times, so safely discard. let _ = (atime, mtime, ctime, crtime, chgtime, bkuptime); // discard those as well let _ = (mode, uid, gid, fh, flags); - let ino = Inode(ino); - let Some(inode) = self.lookup_inode_mut(ino) else { + let mut state = self.state.lock().unwrap(); + let ino = Inode::from(ino); + let Some(inode) = state.lookup_inode_mut(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; if let Some(new_size) = size { inode.set_size(new_size); } let file_attr = inode.mk_file_attrs(ino); - self.schedule_reply(move || reply.attr(&DEFAULT_TTL, &file_attr)); + self.schedule_reply_with_state(&mut state, move || reply.attr(&DEFAULT_TTL, &file_attr)); } fn create( - &mut self, - _req: &fuser::Request<'_>, - parent: u64, + &self, + _req: &fuser::Request, + parent: INodeNo, name: &OsStr, mode: u32, umask: u32, @@ -526,59 +576,81 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } - let Some(parent_container) = self.tree.ino_to_container.get(&Inode(parent)) else { + let mut state = self.state.lock().unwrap(); + let parent = Inode::from(parent); + let Some(parent_container) = state.tree.ino_to_container.get(&parent) else { log::trace!("parent inode doesn't exist"); - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; if parent_container.lookup_by_name(name).is_some() { log::trace!("file already exists"); - reply.error(libc::EEXIST); + reply.error(Errno::EEXIST); return; } - let ino = self.register_inode(InodeData::new_file(Inode(parent))); + let ino = state.register_inode(InodeData::new_file(parent)); // unwrap: we just checked that the parent exists. - self.tree + state + .tree .ino_to_container - .get_mut(&Inode(parent)) + .get_mut(&parent) .unwrap() .register(name.to_os_string(), ino); // unwrap: we just created this inode. - let inode = self.lookup_inode(ino).unwrap(); + let inode = state.lookup_inode(ino).unwrap(); let file_attr = inode.mk_file_attrs(ino); - let generation = inode.generation; - self.schedule_reply(move || reply.created(&DEFAULT_TTL, &file_attr, generation, 0, 0)); + let generation = Generation(inode.generation); + self.schedule_reply_with_state(&mut state, move || { + reply.created( + &DEFAULT_TTL, + &file_attr, + generation, + FileHandle(0), + FopenFlags::empty(), + ) + }); } - fn open(&mut self, _req: &fuser::Request<'_>, ino: u64, _flags: i32, reply: fuser::ReplyOpen) { - match self.lookup_inode(Inode(ino)) { - Some(_inode_data) => self.schedule_reply(move || reply.opened(0, 0)), - None => reply.error(libc::ENOENT), + fn open( + &self, + _req: &fuser::Request, + ino: INodeNo, + _flags: OpenFlags, + reply: fuser::ReplyOpen, + ) { + let mut state = self.state.lock().unwrap(); + match state.lookup_inode(Inode::from(ino)) { + Some(_inode_data) => self.schedule_reply_with_state(&mut state, move || { + reply.opened(FileHandle(0), FopenFlags::empty()) + }), + None => reply.error(Errno::ENOENT), } } fn read( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - fh: u64, - offset: i64, + &self, + _req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, + offset: u64, size: u32, - flags: i32, - lock_owner: Option, + flags: OpenFlags, + lock_owner: Option, reply: fuser::ReplyData, ) { let _ = (fh, flags, lock_owner); - let Some(inode_data) = self.lookup_inode(Inode(ino)) else { - reply.error(libc::ENOENT); + let state = self.state.lock().unwrap(); + let ino = Inode::from(ino); + let Some(inode_data) = state.lookup_inode(ino) else { + reply.error(Errno::ENOENT); return; }; log::trace!( "reading {:?} {:#?}", - self.reconstruct_full_path(Inode(ino)), + state.reconstruct_full_path(ino), inode_data ); // TODO: Check the offset. @@ -587,7 +659,7 @@ impl fuser::Filesystem for Trick { // If it is O_DIRECT we just need to serve the entire page. let size = size as usize; let Ok(offset) = usize::try_from(offset) else { - reply.error(libc::EINVAL); + reply.error(Errno::EINVAL); return; }; let end = offset + size; @@ -595,7 +667,7 @@ impl fuser::Filesystem for Trick { if content.is_empty() { // The backing buffer has not yet been created. Let's just return an empty buffer. #[cfg(target_os = "linux")] - let pageworth = has_odirect(flags); + let pageworth = has_odirect(flags.0); #[cfg(not(target_os = "linux"))] let pageworth = false; if pageworth { @@ -621,51 +693,52 @@ impl fuser::Filesystem for Trick { } fn write( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - fh: u64, - offset: i64, + &self, + _req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, + offset: u64, data: &[u8], - write_flags: u32, - flags: i32, - lock_owner: Option, + write_flags: WriteFlags, + flags: OpenFlags, + lock_owner: Option, reply: fuser::ReplyWrite, ) { let _ = (fh, flags, write_flags, lock_owner); let trigger_enospc = self .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed); - let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let Some(inode_data) = state.lookup_inode_mut(Inode::from(ino)) else { + reply.error(Errno::ENOENT); return; }; let Ok(offset) = usize::try_from(offset) else { - reply.error(libc::EINVAL); + reply.error(Errno::EINVAL); return; }; let len = data.len(); let new_file_sz = offset + len; if new_file_sz > MAX_FILE_SIZE as usize { - reply.error(libc::EFBIG); + reply.error(Errno::EFBIG); return; } // Extension: if the file size is less than the new size, we should extend the file. if inode_data.size() < new_file_sz as u64 { if trigger_enospc { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } inode_data.set_size(new_file_sz as u64); } inode_data.content_mut()[offset..offset + len].copy_from_slice(data); - self.schedule_reply(move || reply.written(len as u32)); + self.schedule_reply_with_state(&mut state, move || reply.written(len as u32)); } fn mkdir( - &mut self, - _req: &fuser::Request<'_>, - parent: u64, + &self, + _req: &fuser::Request, + parent: INodeNo, name: &OsStr, mode: u32, umask: u32, @@ -676,70 +749,76 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } - let Some(inode_data) = self.lookup_inode_mut(Inode(parent)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let parent = Inode::from(parent); + let Some(inode_data) = state.lookup_inode_mut(parent) else { + reply.error(Errno::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(libc::ENOTDIR); + reply.error(Errno::ENOTDIR); return; } - let ino = self.register_inode(InodeData::new_dir(Inode(parent))); - self.tree.ino_to_container.insert(ino, Container::new()); - self.tree + let ino = state.register_inode(InodeData::new_dir(parent)); + state.tree.ino_to_container.insert(ino, Container::new()); + state + .tree .ino_to_container - .get_mut(&Inode(parent)) + .get_mut(&parent) .unwrap() .register(name.to_os_string(), ino); // unwrap: we just created this inode. - let inode = self.lookup_inode(ino).unwrap(); + let inode = state.lookup_inode(ino).unwrap(); let file_attr = inode.mk_file_attrs(ino); - let generation = inode.generation; - self.schedule_reply(move || reply.entry(&DEFAULT_TTL, &file_attr, generation)); + let generation = Generation(inode.generation); + self.schedule_reply_with_state(&mut state, move || { + reply.entry(&DEFAULT_TTL, &file_attr, generation) + }); } fn readdir( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - fh: u64, - offset: i64, + &self, + _req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, + offset: u64, mut reply: fuser::ReplyDirectory, ) { let _ = fh; - let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let ino = Inode::from(ino); + let Some(inode_data) = state.lookup_inode_mut(ino) else { + reply.error(Errno::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(libc::ENOTDIR); + reply.error(Errno::ENOTDIR); return; } let parent = inode_data.parent(); - let container = self + let container = state .tree .ino_to_container - .get(&Inode(ino)) - .unwrap_or_else(|| panic!("ino {ino} is not in tree")); - let offset = u64::try_from(offset).unwrap(); - let standard = &[(DOT.as_os_str(), Inode(ino)), (DOTDOT.as_os_str(), parent)]; + .get(&ino) + .unwrap_or_else(|| panic!("ino {ino:?} is not in tree")); + let standard = &[(DOT.as_os_str(), ino), (DOTDOT.as_os_str(), parent)]; let mut iter = standard .iter() .copied() .chain(container.iter()) .enumerate() - .skip(offset as usize); + .skip(usize::try_from(offset).unwrap()); loop { if let Some((offset, (name, ino))) = iter.next() { - let inode = self + let inode = state .lookup_inode(ino) .unwrap_or_else(|| panic!("{ino:?} cannot be found")); let offset = offset + 1; let buf_is_filled = - reply.add(ino.0, offset.try_into().unwrap(), inode.kind(), name); + reply.add(ino.into(), offset.try_into().unwrap(), inode.kind(), name); if buf_is_filled { break; } @@ -747,36 +826,38 @@ impl fuser::Filesystem for Trick { break; } } - self.schedule_reply(move || reply.ok()); + self.schedule_reply_with_state(&mut state, move || reply.ok()); } fn rmdir( - &mut self, - _req: &fuser::Request<'_>, - parent: u64, + &self, + _req: &fuser::Request, + parent: INodeNo, name: &OsStr, reply: fuser::ReplyEmpty, ) { - let Some(container) = self.tree.ino_to_container.get(&Inode(parent)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let parent = Inode::from(parent); + let Some(container) = state.tree.ino_to_container.get(&parent) else { + reply.error(Errno::ENOENT); return; }; let Some(inode) = container.lookup_by_name(name) else { - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; - let Some(inode_data) = self.lookup_inode(inode) else { - reply.error(libc::ENOENT); + let Some(inode_data) = state.lookup_inode(inode) else { + reply.error(Errno::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(libc::ENOTDIR); + reply.error(Errno::ENOTDIR); return; } // unwrap: we checked that the dir exists above. - let container = self.tree.ino_to_container.get_mut(&Inode(parent)).unwrap(); + let container = state.tree.ino_to_container.get_mut(&parent).unwrap(); let Some(removed_ino) = container.remove(name) else { - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; if container.count() > 0 { @@ -786,51 +867,54 @@ impl fuser::Filesystem for Trick { // When you do `rm -rf` on a directory, the kernel will first remove all the // entries in the directory and then remove the directory itself. So we should // not encounter a non-empty directory here. - return reply.error(libc::ENOTEMPTY); + return reply.error(Errno::ENOTEMPTY); } // Remove the tree entry corresponding to the removed inode. - self.tree + state + .tree .ino_to_container .remove(&removed_ino) .unwrap_or_else(|| panic!("container was not present")); - self.remove_inode(removed_ino); - self.schedule_reply(move || reply.ok()); + state.remove_inode(removed_ino); + self.schedule_reply_with_state(&mut state, move || reply.ok()); } fn unlink( - &mut self, - _req: &fuser::Request<'_>, - parent: u64, + &self, + _req: &fuser::Request, + parent: INodeNo, name: &OsStr, reply: fuser::ReplyEmpty, ) { - let Some(inode_data) = self.lookup_inode_mut(Inode(parent)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let parent = Inode::from(parent); + let Some(inode_data) = state.lookup_inode_mut(parent) else { + reply.error(Errno::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(libc::ENOTDIR); + reply.error(Errno::ENOTDIR); return; } - let Some(container) = self.tree.ino_to_container.get_mut(&Inode(parent)) else { - reply.error(libc::ENOENT); + let Some(container) = state.tree.ino_to_container.get_mut(&parent) else { + reply.error(Errno::ENOENT); return; }; let Some(removed_ino) = container.remove(name) else { - reply.error(libc::ENOENT); + reply.error(Errno::ENOENT); return; }; - self.remove_inode(removed_ino); - self.schedule_reply(move || reply.ok()); + state.remove_inode(removed_ino); + self.schedule_reply_with_state(&mut state, move || reply.ok()); } fn fallocate( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - fh: u64, - offset: i64, - length: i64, + &self, + _req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, + offset: u64, + length: u64, mode: i32, reply: fuser::ReplyEmpty, ) { @@ -838,28 +922,29 @@ impl fuser::Filesystem for Trick { let trigger_enospc = self .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed); - let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { - reply.error(libc::ENOENT); + let mut state = self.state.lock().unwrap(); + let Some(inode_data) = state.lookup_inode_mut(Inode::from(ino)) else { + reply.error(Errno::ENOENT); return; }; // fallocate should preallocate stuff. We here just gon pretend that we are preallocating. // Here we should extend the file if the offset + length is greater than the current file. - let new_size = u64::try_from(offset).unwrap() + u64::try_from(length).unwrap(); + let new_size = offset + length; if inode_data.size() < new_size { if trigger_enospc { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } inode_data.set_size(new_size); } - self.schedule_reply(move || reply.ok()); + self.schedule_reply_with_state(&mut state, move || reply.ok()); } fn fsync( - &mut self, - _req: &fuser::Request<'_>, - ino: u64, - fh: u64, + &self, + _req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, datasync: bool, reply: fuser::ReplyEmpty, ) { @@ -869,17 +954,17 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } self.schedule_reply(move || reply.ok()); } fn fsyncdir( - &mut self, - req: &fuser::Request<'_>, - ino: u64, - fh: u64, + &self, + req: &fuser::Request, + ino: INodeNo, + fh: FileHandle, datasync: bool, reply: fuser::ReplyEmpty, ) { @@ -889,7 +974,7 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(libc::ENOSPC); + reply.error(Errno::ENOSPC); return; } self.schedule_reply(move || reply.ok()); @@ -901,6 +986,12 @@ fn has_odirect(flags: i32) -> bool { (flags & libc::O_DIRECT) != 0 } +fn mount_config(mount_options: Vec) -> Config { + let mut config = Config::default(); + config.mount_options = mount_options; + config +} + pub struct TrickHandle { bg_sess: Mutex>, trigger_enospc: Arc, @@ -922,7 +1013,7 @@ impl TrickHandle { pub fn unmount_and_join(self) { if let Some(bg_sess) = self.bg_sess.lock().unwrap().take() { - bg_sess.join(); + let _ = bg_sess.join(); } } } @@ -931,14 +1022,13 @@ impl TrickHandle { /// /// This allows directly depending on the libfuse API. pub fn spawn_trick>(mountpoint: P, seed: u64) -> std::io::Result { - use fuser::MountOption; - let options = &[ + let config = mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; + ]); let (fs, mut handle) = Trick::new(seed); - handle.bg_sess = Some(fuser::spawn_mount2(fs, &mountpoint, options)?).into(); + handle.bg_sess = Some(fuser::spawn_mount2(fs, &mountpoint, &config)?).into(); Ok(handle) } @@ -966,9 +1056,12 @@ mod tests { fn mount() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[MountOption::RO, MountOption::FSName("trick".to_string())]; + let config = super::mount_config(vec![ + MountOption::RO, + MountOption::FSName("trick".to_string()), + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); drop(mount_handle); } @@ -977,9 +1070,12 @@ mod tests { fn create_file() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[MountOption::RW, MountOption::FSName("trick".to_string())]; + let config = super::mount_config(vec![ + MountOption::RW, + MountOption::FSName("trick".to_string()), + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let filename = mountpoint.path().join("file"); let file = fs::File::create(&filename).unwrap(); drop(file); @@ -990,9 +1086,12 @@ mod tests { fn create_then_open_file() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[MountOption::RW, MountOption::FSName("trick".to_string())]; + let config = super::mount_config(vec![ + MountOption::RW, + MountOption::FSName("trick".to_string()), + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let filename = mountpoint.path().join("file"); let file = fs::File::create(&filename).unwrap(); drop(file); @@ -1004,12 +1103,12 @@ mod tests { fn inner_write_then_read(fs: Trick) { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[ + let config = super::mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + ]); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() .create_new(true) @@ -1049,13 +1148,13 @@ mod tests { fn many_files() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[ + let config = super::mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let mut files = Vec::new(); for i in 0..100 { let filename = mountpoint.path().join(format!("file{}", i)); @@ -1080,13 +1179,13 @@ mod tests { fn unlink() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[ + let config = super::mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); // Create a file let filename = mountpoint.path().join("file_to_unlink"); @@ -1102,13 +1201,13 @@ mod tests { fn mmap_test() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[ + let config = super::mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; + ]); let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() @@ -1144,13 +1243,13 @@ mod tests { fn out_of_space() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let options = &[ + let config = super::mount_config(vec![ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]; + ]); let (fs, handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() From f9ba84e1d5a323b07a99ff0b2d01e4fa30962e05 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Tue, 5 May 2026 20:14:47 +0200 Subject: [PATCH 3/4] Revert fuser upgrade leftovers --- Cargo.lock | 59 ++---- trickfs/src/lib.rs | 507 ++++++++++++++++++--------------------------- 2 files changed, 222 insertions(+), 344 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff186dde6..74c8894e8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1071,11 +1071,11 @@ dependencies = [ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -1180,12 +1180,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys 0.61.2", ] [[package]] @@ -1235,12 +1234,6 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "page_size" version = "0.6.0" @@ -1497,17 +1490,8 @@ checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1518,15 +1502,9 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.3" @@ -1865,7 +1843,6 @@ name = "torture" version = "0.1.0" dependencies = [ "anyhow", - "bincode", "cfg-if", "clap 4.5.23", "futures", @@ -1893,9 +1870,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -1904,9 +1881,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -1915,9 +1892,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -1936,14 +1913,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", diff --git a/trickfs/src/lib.rs b/trickfs/src/lib.rs index a41b007779..a80f04215a 100644 --- a/trickfs/src/lib.rs +++ b/trickfs/src/lib.rs @@ -23,10 +23,7 @@ use std::{ mod latency; -use fuser::{ - BsdFileFlags, Config, Errno, FileAttr, FileHandle, FopenFlags, Generation, INodeNo, LockOwner, - MountOption, OpenFlags, WriteFlags, -}; +use fuser::FileAttr; use latency::LatencyInjector; const DEFAULT_TTL: Duration = Duration::from_secs(1); @@ -109,18 +106,6 @@ impl Inode { const ROOT: Inode = Inode(1); } -impl From for Inode { - fn from(value: INodeNo) -> Self { - Inode(value.0) - } -} - -impl From for INodeNo { - fn from(value: Inode) -> Self { - INodeNo(value.0) - } -} - pub struct InodeData { parent: Inode, generation: u64, @@ -185,7 +170,7 @@ impl InodeData { pub fn mk_file_attrs(&self, ino: Inode) -> FileAttr { FileAttr { - ino: ino.into(), + ino: ino.0, size: self.size(), blocks: self.blocks(), atime: UNIX_EPOCH, @@ -329,38 +314,47 @@ impl Tree { } } -struct TrickState { +/// The implementation of the file system. +pub struct Trick { tree: Tree, /// Stored inodes. The first inode is the root directory. /// /// Note that inodes are 1-based and this vector is 0-based. inodes: Vec, freelist: Vec, - latency_injector: LatencyInjector, -} - -/// The implementation of the file system. -pub struct Trick { - state: Mutex, trigger_enospc: Arc, trigger_latency_injector: Arc, + latency_injector: LatencyInjector, } -impl TrickState { - fn new(seed: u64) -> Self { - let mut state = TrickState { - tree: Tree::new(), - inodes: Vec::new(), - freelist: Vec::new(), +impl Trick { + fn new(seed: u64) -> (Self, TrickHandle) { + let trigger_enospc = Arc::new(AtomicBool::new(false)); + let trigger_latency_injector = Arc::new(AtomicBool::new(false)); + + let tree = Tree::new(); + let inodes = Vec::new(); + let freelist = Vec::new(); + let mut fs = Trick { + tree, + inodes, + freelist, + trigger_enospc: trigger_enospc.clone(), + trigger_latency_injector: trigger_latency_injector.clone(), latency_injector: LatencyInjector::new(seed), }; // Initialize the root directory. Parent of the ROOT is ROOT. - state.register_inode(InodeData::new_dir(Inode::ROOT)); - state - .tree + fs.register_inode(InodeData::new_dir(Inode::ROOT)); + fs.tree .ino_to_container .insert(Inode::ROOT, Container::new()); - state + + let handle = TrickHandle { + bg_sess: None.into(), + trigger_enospc, + trigger_latency_injector, + }; + (fs, handle) } fn lookup_inode(&self, ino: Inode) -> Option<&InodeData> { @@ -421,113 +415,70 @@ impl TrickState { } path } -} - -impl Trick { - fn new(seed: u64) -> (Self, TrickHandle) { - let trigger_enospc = Arc::new(AtomicBool::new(false)); - let trigger_latency_injector = Arc::new(AtomicBool::new(false)); - - let fs = Trick { - state: Mutex::new(TrickState::new(seed)), - trigger_enospc: trigger_enospc.clone(), - trigger_latency_injector: trigger_latency_injector.clone(), - }; - - let handle = TrickHandle { - bg_sess: None.into(), - trigger_enospc, - trigger_latency_injector, - }; - (fs, handle) - } /// Schedule the reply if `trigger_latency_injector` is on, otherwise reply directly. - fn schedule_reply(&self, reply: impl FnOnce() + Send + 'static) { - if !self - .trigger_latency_injector - .load(std::sync::atomic::Ordering::Relaxed) - { - reply(); - } else { - self.state - .lock() - .unwrap() - .latency_injector - .schedule_reply(Box::new(reply)); - } - } - - fn schedule_reply_with_state( - &self, - state: &mut TrickState, - reply: impl FnOnce() + Send + 'static, - ) { + fn schedule_reply(&mut self, reply: impl FnOnce() + Send + 'static) { if !self .trigger_latency_injector .load(std::sync::atomic::Ordering::Relaxed) { reply(); } else { - state.latency_injector.schedule_reply(Box::new(reply)); + self.latency_injector.schedule_reply(Box::new(reply)); } } } impl fuser::Filesystem for Trick { fn lookup( - &self, - _req: &fuser::Request, - parent: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + parent: u64, name: &std::ffi::OsStr, reply: fuser::ReplyEntry, ) { log::trace!("lookup: parent={}, name={:?}", parent, name); - let mut state = self.state.lock().unwrap(); - let Some(parent) = state.tree.ino_to_container.get(&Inode::from(parent)) else { + let Some(parent) = self.tree.ino_to_container.get(&Inode(parent)) else { log::trace!("parent inode doesn't exist"); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; let Some(ino) = parent.lookup_by_name(name) else { log::trace!("file doesn't exist"); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; - let Some(inode) = state.lookup_inode(ino) else { + let Some(inode) = self.lookup_inode(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; let file_attr = inode.mk_file_attrs(ino); - let generation = Generation(inode.generation); - self.schedule_reply_with_state(&mut state, move || { - reply.entry(&DEFAULT_TTL, &file_attr, generation) - }); + let generation = inode.generation; + self.schedule_reply(move || reply.entry(&DEFAULT_TTL, &file_attr, generation)); } fn getattr( - &self, - _req: &fuser::Request, - ino: INodeNo, - _fh: Option, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + _fh: Option, reply: fuser::ReplyAttr, ) { - let mut state = self.state.lock().unwrap(); - let ino = Inode::from(ino); - let Some(inode) = state.lookup_inode(ino) else { + let ino = Inode(ino); + let Some(inode) = self.lookup_inode(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; let file_attr = inode.mk_file_attrs(ino); - self.schedule_reply_with_state(&mut state, move || reply.attr(&DEFAULT_TTL, &file_attr)); + self.schedule_reply(move || reply.attr(&DEFAULT_TTL, &file_attr)); } fn setattr( - &self, - _req: &fuser::Request, - ino: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, mode: Option, uid: Option, gid: Option, @@ -535,35 +486,34 @@ impl fuser::Filesystem for Trick { atime: Option, mtime: Option, ctime: Option, - fh: Option, + fh: Option, crtime: Option, chgtime: Option, bkuptime: Option, - flags: Option, + flags: Option, reply: fuser::ReplyAttr, ) { // trickfs doesn't track any times, so safely discard. let _ = (atime, mtime, ctime, crtime, chgtime, bkuptime); // discard those as well let _ = (mode, uid, gid, fh, flags); - let mut state = self.state.lock().unwrap(); - let ino = Inode::from(ino); - let Some(inode) = state.lookup_inode_mut(ino) else { + let ino = Inode(ino); + let Some(inode) = self.lookup_inode_mut(ino) else { log::error!("inode doesn't exist. This looks like a bug."); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; if let Some(new_size) = size { inode.set_size(new_size); } let file_attr = inode.mk_file_attrs(ino); - self.schedule_reply_with_state(&mut state, move || reply.attr(&DEFAULT_TTL, &file_attr)); + self.schedule_reply(move || reply.attr(&DEFAULT_TTL, &file_attr)); } fn create( - &self, - _req: &fuser::Request, - parent: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + parent: u64, name: &OsStr, mode: u32, umask: u32, @@ -576,81 +526,59 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } - let mut state = self.state.lock().unwrap(); - let parent = Inode::from(parent); - let Some(parent_container) = state.tree.ino_to_container.get(&parent) else { + let Some(parent_container) = self.tree.ino_to_container.get(&Inode(parent)) else { log::trace!("parent inode doesn't exist"); - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; if parent_container.lookup_by_name(name).is_some() { log::trace!("file already exists"); - reply.error(Errno::EEXIST); + reply.error(libc::EEXIST); return; } - let ino = state.register_inode(InodeData::new_file(parent)); + let ino = self.register_inode(InodeData::new_file(Inode(parent))); // unwrap: we just checked that the parent exists. - state - .tree + self.tree .ino_to_container - .get_mut(&parent) + .get_mut(&Inode(parent)) .unwrap() .register(name.to_os_string(), ino); // unwrap: we just created this inode. - let inode = state.lookup_inode(ino).unwrap(); + let inode = self.lookup_inode(ino).unwrap(); let file_attr = inode.mk_file_attrs(ino); - let generation = Generation(inode.generation); - self.schedule_reply_with_state(&mut state, move || { - reply.created( - &DEFAULT_TTL, - &file_attr, - generation, - FileHandle(0), - FopenFlags::empty(), - ) - }); + let generation = inode.generation; + self.schedule_reply(move || reply.created(&DEFAULT_TTL, &file_attr, generation, 0, 0)); } - fn open( - &self, - _req: &fuser::Request, - ino: INodeNo, - _flags: OpenFlags, - reply: fuser::ReplyOpen, - ) { - let mut state = self.state.lock().unwrap(); - match state.lookup_inode(Inode::from(ino)) { - Some(_inode_data) => self.schedule_reply_with_state(&mut state, move || { - reply.opened(FileHandle(0), FopenFlags::empty()) - }), - None => reply.error(Errno::ENOENT), + fn open(&mut self, _req: &fuser::Request<'_>, ino: u64, _flags: i32, reply: fuser::ReplyOpen) { + match self.lookup_inode(Inode(ino)) { + Some(_inode_data) => self.schedule_reply(move || reply.opened(0, 0)), + None => reply.error(libc::ENOENT), } } fn read( - &self, - _req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, - offset: u64, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + fh: u64, + offset: i64, size: u32, - flags: OpenFlags, - lock_owner: Option, + flags: i32, + lock_owner: Option, reply: fuser::ReplyData, ) { let _ = (fh, flags, lock_owner); - let state = self.state.lock().unwrap(); - let ino = Inode::from(ino); - let Some(inode_data) = state.lookup_inode(ino) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode(Inode(ino)) else { + reply.error(libc::ENOENT); return; }; log::trace!( "reading {:?} {:#?}", - state.reconstruct_full_path(ino), + self.reconstruct_full_path(Inode(ino)), inode_data ); // TODO: Check the offset. @@ -659,7 +587,7 @@ impl fuser::Filesystem for Trick { // If it is O_DIRECT we just need to serve the entire page. let size = size as usize; let Ok(offset) = usize::try_from(offset) else { - reply.error(Errno::EINVAL); + reply.error(libc::EINVAL); return; }; let end = offset + size; @@ -667,7 +595,7 @@ impl fuser::Filesystem for Trick { if content.is_empty() { // The backing buffer has not yet been created. Let's just return an empty buffer. #[cfg(target_os = "linux")] - let pageworth = has_odirect(flags.0); + let pageworth = has_odirect(flags); #[cfg(not(target_os = "linux"))] let pageworth = false; if pageworth { @@ -693,52 +621,51 @@ impl fuser::Filesystem for Trick { } fn write( - &self, - _req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, - offset: u64, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + fh: u64, + offset: i64, data: &[u8], - write_flags: WriteFlags, - flags: OpenFlags, - lock_owner: Option, + write_flags: u32, + flags: i32, + lock_owner: Option, reply: fuser::ReplyWrite, ) { let _ = (fh, flags, write_flags, lock_owner); let trigger_enospc = self .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed); - let mut state = self.state.lock().unwrap(); - let Some(inode_data) = state.lookup_inode_mut(Inode::from(ino)) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { + reply.error(libc::ENOENT); return; }; let Ok(offset) = usize::try_from(offset) else { - reply.error(Errno::EINVAL); + reply.error(libc::EINVAL); return; }; let len = data.len(); let new_file_sz = offset + len; if new_file_sz > MAX_FILE_SIZE as usize { - reply.error(Errno::EFBIG); + reply.error(libc::EFBIG); return; } // Extension: if the file size is less than the new size, we should extend the file. if inode_data.size() < new_file_sz as u64 { if trigger_enospc { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } inode_data.set_size(new_file_sz as u64); } inode_data.content_mut()[offset..offset + len].copy_from_slice(data); - self.schedule_reply_with_state(&mut state, move || reply.written(len as u32)); + self.schedule_reply(move || reply.written(len as u32)); } fn mkdir( - &self, - _req: &fuser::Request, - parent: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + parent: u64, name: &OsStr, mode: u32, umask: u32, @@ -749,76 +676,70 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } - let mut state = self.state.lock().unwrap(); - let parent = Inode::from(parent); - let Some(inode_data) = state.lookup_inode_mut(parent) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode_mut(Inode(parent)) else { + reply.error(libc::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(Errno::ENOTDIR); + reply.error(libc::ENOTDIR); return; } - let ino = state.register_inode(InodeData::new_dir(parent)); - state.tree.ino_to_container.insert(ino, Container::new()); - state - .tree + let ino = self.register_inode(InodeData::new_dir(Inode(parent))); + self.tree.ino_to_container.insert(ino, Container::new()); + self.tree .ino_to_container - .get_mut(&parent) + .get_mut(&Inode(parent)) .unwrap() .register(name.to_os_string(), ino); // unwrap: we just created this inode. - let inode = state.lookup_inode(ino).unwrap(); + let inode = self.lookup_inode(ino).unwrap(); let file_attr = inode.mk_file_attrs(ino); - let generation = Generation(inode.generation); - self.schedule_reply_with_state(&mut state, move || { - reply.entry(&DEFAULT_TTL, &file_attr, generation) - }); + let generation = inode.generation; + self.schedule_reply(move || reply.entry(&DEFAULT_TTL, &file_attr, generation)); } fn readdir( - &self, - _req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, - offset: u64, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + fh: u64, + offset: i64, mut reply: fuser::ReplyDirectory, ) { let _ = fh; - let mut state = self.state.lock().unwrap(); - let ino = Inode::from(ino); - let Some(inode_data) = state.lookup_inode_mut(ino) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { + reply.error(libc::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(Errno::ENOTDIR); + reply.error(libc::ENOTDIR); return; } let parent = inode_data.parent(); - let container = state + let container = self .tree .ino_to_container - .get(&ino) - .unwrap_or_else(|| panic!("ino {ino:?} is not in tree")); - let standard = &[(DOT.as_os_str(), ino), (DOTDOT.as_os_str(), parent)]; + .get(&Inode(ino)) + .unwrap_or_else(|| panic!("ino {ino} is not in tree")); + let offset = u64::try_from(offset).unwrap(); + let standard = &[(DOT.as_os_str(), Inode(ino)), (DOTDOT.as_os_str(), parent)]; let mut iter = standard .iter() .copied() .chain(container.iter()) .enumerate() - .skip(usize::try_from(offset).unwrap()); + .skip(offset as usize); loop { if let Some((offset, (name, ino))) = iter.next() { - let inode = state + let inode = self .lookup_inode(ino) .unwrap_or_else(|| panic!("{ino:?} cannot be found")); let offset = offset + 1; let buf_is_filled = - reply.add(ino.into(), offset.try_into().unwrap(), inode.kind(), name); + reply.add(ino.0, offset.try_into().unwrap(), inode.kind(), name); if buf_is_filled { break; } @@ -826,38 +747,36 @@ impl fuser::Filesystem for Trick { break; } } - self.schedule_reply_with_state(&mut state, move || reply.ok()); + self.schedule_reply(move || reply.ok()); } fn rmdir( - &self, - _req: &fuser::Request, - parent: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + parent: u64, name: &OsStr, reply: fuser::ReplyEmpty, ) { - let mut state = self.state.lock().unwrap(); - let parent = Inode::from(parent); - let Some(container) = state.tree.ino_to_container.get(&parent) else { - reply.error(Errno::ENOENT); + let Some(container) = self.tree.ino_to_container.get(&Inode(parent)) else { + reply.error(libc::ENOENT); return; }; let Some(inode) = container.lookup_by_name(name) else { - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; - let Some(inode_data) = state.lookup_inode(inode) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode(inode) else { + reply.error(libc::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(Errno::ENOTDIR); + reply.error(libc::ENOTDIR); return; } // unwrap: we checked that the dir exists above. - let container = state.tree.ino_to_container.get_mut(&parent).unwrap(); + let container = self.tree.ino_to_container.get_mut(&Inode(parent)).unwrap(); let Some(removed_ino) = container.remove(name) else { - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; if container.count() > 0 { @@ -867,54 +786,51 @@ impl fuser::Filesystem for Trick { // When you do `rm -rf` on a directory, the kernel will first remove all the // entries in the directory and then remove the directory itself. So we should // not encounter a non-empty directory here. - return reply.error(Errno::ENOTEMPTY); + return reply.error(libc::ENOTEMPTY); } // Remove the tree entry corresponding to the removed inode. - state - .tree + self.tree .ino_to_container .remove(&removed_ino) .unwrap_or_else(|| panic!("container was not present")); - state.remove_inode(removed_ino); - self.schedule_reply_with_state(&mut state, move || reply.ok()); + self.remove_inode(removed_ino); + self.schedule_reply(move || reply.ok()); } fn unlink( - &self, - _req: &fuser::Request, - parent: INodeNo, + &mut self, + _req: &fuser::Request<'_>, + parent: u64, name: &OsStr, reply: fuser::ReplyEmpty, ) { - let mut state = self.state.lock().unwrap(); - let parent = Inode::from(parent); - let Some(inode_data) = state.lookup_inode_mut(parent) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode_mut(Inode(parent)) else { + reply.error(libc::ENOENT); return; }; if !inode_data.is_dir() { - reply.error(Errno::ENOTDIR); + reply.error(libc::ENOTDIR); return; } - let Some(container) = state.tree.ino_to_container.get_mut(&parent) else { - reply.error(Errno::ENOENT); + let Some(container) = self.tree.ino_to_container.get_mut(&Inode(parent)) else { + reply.error(libc::ENOENT); return; }; let Some(removed_ino) = container.remove(name) else { - reply.error(Errno::ENOENT); + reply.error(libc::ENOENT); return; }; - state.remove_inode(removed_ino); - self.schedule_reply_with_state(&mut state, move || reply.ok()); + self.remove_inode(removed_ino); + self.schedule_reply(move || reply.ok()); } fn fallocate( - &self, - _req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, - offset: u64, - length: u64, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + fh: u64, + offset: i64, + length: i64, mode: i32, reply: fuser::ReplyEmpty, ) { @@ -922,29 +838,28 @@ impl fuser::Filesystem for Trick { let trigger_enospc = self .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed); - let mut state = self.state.lock().unwrap(); - let Some(inode_data) = state.lookup_inode_mut(Inode::from(ino)) else { - reply.error(Errno::ENOENT); + let Some(inode_data) = self.lookup_inode_mut(Inode(ino)) else { + reply.error(libc::ENOENT); return; }; // fallocate should preallocate stuff. We here just gon pretend that we are preallocating. // Here we should extend the file if the offset + length is greater than the current file. - let new_size = offset + length; + let new_size = u64::try_from(offset).unwrap() + u64::try_from(length).unwrap(); if inode_data.size() < new_size { if trigger_enospc { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } inode_data.set_size(new_size); } - self.schedule_reply_with_state(&mut state, move || reply.ok()); + self.schedule_reply(move || reply.ok()); } fn fsync( - &self, - _req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, + &mut self, + _req: &fuser::Request<'_>, + ino: u64, + fh: u64, datasync: bool, reply: fuser::ReplyEmpty, ) { @@ -954,17 +869,17 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } self.schedule_reply(move || reply.ok()); } fn fsyncdir( - &self, - req: &fuser::Request, - ino: INodeNo, - fh: FileHandle, + &mut self, + req: &fuser::Request<'_>, + ino: u64, + fh: u64, datasync: bool, reply: fuser::ReplyEmpty, ) { @@ -974,7 +889,7 @@ impl fuser::Filesystem for Trick { .trigger_enospc .load(std::sync::atomic::Ordering::Relaxed) { - reply.error(Errno::ENOSPC); + reply.error(libc::ENOSPC); return; } self.schedule_reply(move || reply.ok()); @@ -986,12 +901,6 @@ fn has_odirect(flags: i32) -> bool { (flags & libc::O_DIRECT) != 0 } -fn mount_config(mount_options: Vec) -> Config { - let mut config = Config::default(); - config.mount_options = mount_options; - config -} - pub struct TrickHandle { bg_sess: Mutex>, trigger_enospc: Arc, @@ -1013,7 +922,7 @@ impl TrickHandle { pub fn unmount_and_join(self) { if let Some(bg_sess) = self.bg_sess.lock().unwrap().take() { - let _ = bg_sess.join(); + bg_sess.join(); } } } @@ -1022,13 +931,14 @@ impl TrickHandle { /// /// This allows directly depending on the libfuse API. pub fn spawn_trick>(mountpoint: P, seed: u64) -> std::io::Result { - let config = mount_config(vec![ + use fuser::MountOption; + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); + ]; let (fs, mut handle) = Trick::new(seed); - handle.bg_sess = Some(fuser::spawn_mount2(fs, &mountpoint, &config)?).into(); + handle.bg_sess = Some(fuser::spawn_mount2(fs, &mountpoint, options)?).into(); Ok(handle) } @@ -1056,12 +966,9 @@ mod tests { fn mount() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ - MountOption::RO, - MountOption::FSName("trick".to_string()), - ]); + let options = &[MountOption::RO, MountOption::FSName("trick".to_string())]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); drop(mount_handle); } @@ -1070,12 +977,9 @@ mod tests { fn create_file() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ - MountOption::RW, - MountOption::FSName("trick".to_string()), - ]); + let options = &[MountOption::RW, MountOption::FSName("trick".to_string())]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let filename = mountpoint.path().join("file"); let file = fs::File::create(&filename).unwrap(); drop(file); @@ -1086,12 +990,9 @@ mod tests { fn create_then_open_file() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ - MountOption::RW, - MountOption::FSName("trick".to_string()), - ]); + let options = &[MountOption::RW, MountOption::FSName("trick".to_string())]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let filename = mountpoint.path().join("file"); let file = fs::File::create(&filename).unwrap(); drop(file); @@ -1103,12 +1004,12 @@ mod tests { fn inner_write_then_read(fs: Trick) { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + ]; + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() .create_new(true) @@ -1148,13 +1049,13 @@ mod tests { fn many_files() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); + ]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let mut files = Vec::new(); for i in 0..100 { let filename = mountpoint.path().join(format!("file{}", i)); @@ -1179,13 +1080,13 @@ mod tests { fn unlink() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); + ]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); // Create a file let filename = mountpoint.path().join("file_to_unlink"); @@ -1201,13 +1102,13 @@ mod tests { fn mmap_test() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); + ]; let (fs, _handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() @@ -1243,13 +1144,13 @@ mod tests { fn out_of_space() { init_log(); let mountpoint = tempfile::tempdir().unwrap(); - let config = super::mount_config(vec![ + let options = &[ MountOption::RW, MountOption::AutoUnmount, MountOption::FSName("trick".to_string()), - ]); + ]; let (fs, handle) = Trick::new(0); - let mount_handle = fuser::spawn_mount2(fs, &mountpoint, &config).unwrap(); + let mount_handle = fuser::spawn_mount2(fs, &mountpoint, options).unwrap(); let filename = mountpoint.path().join("file"); let mut file = fs::File::options() From 0b6ca9206deab4aafd898493f11365a2fdaa1504 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Tue, 12 May 2026 12:12:17 +0200 Subject: [PATCH 4/4] update benchtop Cargo.lock Regenerate against the workspace dep upgrades (rand, ruint, lru, tokio, tracing-subscriber, etc.) so `cargo check --locked` succeeds. Co-Authored-By: Claude Opus 4.7 (1M context) --- benchtop/Cargo.lock | 625 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 521 insertions(+), 104 deletions(-) diff --git a/benchtop/Cargo.lock b/benchtop/Cargo.lock index 2413cd152b..845d93b5a6 100644 --- a/benchtop/Cargo.lock +++ b/benchtop/Cargo.lock @@ -52,7 +52,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom", + "getrandom 0.2.14", "once_cell", "version_check", ] @@ -64,7 +64,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.2.14", "once_cell", "version_check", "zerocopy", @@ -254,6 +254,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "educe", + "itertools 0.13.0", + "num-bigint", + "num-traits", + "paste", + "zeroize", +] + [[package]] name = "ark-ff-asm" version = "0.3.0" @@ -274,6 +294,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.117", +] + [[package]] name = "ark-ff-macros" version = "0.3.0" @@ -299,6 +329,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "ark-poly" version = "0.4.2" @@ -334,6 +377,18 @@ dependencies = [ "num-bigint", ] +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "num-bigint", +] + [[package]] name = "ark-serialize-derive" version = "0.4.2" @@ -352,7 +407,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] @@ -362,7 +417,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", ] [[package]] @@ -391,7 +456,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -402,7 +467,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -481,9 +546,9 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "libc", - "lru", + "lru 0.12.5", "nomt", - "rand", + "rand 0.8.5", "rand_distr", "rayon", "ruint", @@ -526,7 +591,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -536,7 +601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes 0.11.0", - "rand", + "rand 0.8.5", "rand_core 0.6.4", "serde", "unicode-normalization", @@ -544,18 +609,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitcoin-internals" @@ -587,9 +652,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "bitmaps" @@ -704,7 +769,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -828,6 +893,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + [[package]] name = "chrono" version = "0.4.38" @@ -882,7 +958,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -945,6 +1021,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "cranelift-entity" version = "0.95.1" @@ -978,9 +1063,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -1078,7 +1163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.12", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", @@ -1096,7 +1181,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -1223,6 +1308,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "either" version = "1.11.0" @@ -1249,6 +1346,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "environmental" version = "1.1.4" @@ -1282,7 +1399,7 @@ dependencies = [ "prettier-please", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -1308,6 +1425,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.0" @@ -1331,7 +1459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -1358,6 +1486,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1439,7 +1573,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -1517,13 +1651,39 @@ dependencies = [ "wasi", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", +] + [[package]] name = "getrandom_or_panic" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" dependencies = [ - "rand", + "rand 0.8.5", "rand_core 0.6.4", ] @@ -1602,13 +1762,24 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.1.3", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.2.0", ] [[package]] @@ -1719,6 +1890,12 @@ dependencies = [ "sha3", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "0.5.0" @@ -1793,12 +1970,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.17.1", + "serde", + "serde_core", ] [[package]] @@ -1850,6 +2029,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1915,7 +2103,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.12", ] [[package]] @@ -1953,6 +2141,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" version = "0.2.155" @@ -2004,7 +2198,7 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand", + "rand 0.8.5", "serde", "sha2 0.9.9", ] @@ -2098,7 +2292,16 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.0", + "hashbrown 0.15.5", +] + +[[package]] +name = "lru" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9" +dependencies = [ + "hashbrown 0.17.1", ] [[package]] @@ -2247,10 +2450,10 @@ dependencies = [ "io-uring", "libc", "loom", - "lru", + "lru 0.18.0", "nomt-core", "parking_lot", - "rand", + "rand 0.10.1", "slab", "thread_local", "threadpool", @@ -2389,7 +2592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" dependencies = [ "bitcoin_hashes 0.13.0", - "rand", + "rand 0.8.5", "rand_core 0.6.4", "serde", "unicode-normalization", @@ -2562,7 +2765,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -2572,7 +2775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ "polkavm-derive-impl", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -2588,17 +2791,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] name = "prettyplease" -version = "0.2.19" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -2676,17 +2879,16 @@ dependencies = [ [[package]] name = "proptest" -version = "1.4.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", - "lazy_static", + "bitflags 2.11.1", "num-traits", - "rand", - "rand_chacha", + "rand 0.9.4", + "rand_chacha 0.9.0", "rand_xorshift", "regex-syntax 0.8.3", "rusty-fork", @@ -2714,7 +2916,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -2741,6 +2943,18 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "radium" version = "0.7.0" @@ -2754,10 +2968,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -2768,6 +3003,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[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 0.9.5", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -2780,9 +3025,24 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.14", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "rand_distr" version = "0.4.3" @@ -2790,16 +3050,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] name = "rand_xorshift" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ - "rand_core 0.6.4", + "rand_core 0.9.5", ] [[package]] @@ -2857,7 +3117,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -2945,33 +3205,37 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" +checksum = "0298da754d1395046b0afdc2f20ee76d29a8ae310cd30ffa84ed42acba9cb12a" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", + "ark-ff 0.5.0", "bytes", - "fastrlp", + "fastrlp 0.3.1", + "fastrlp 0.4.0", "num-bigint", + "num-integer", "num-traits", "parity-scale-codec", "primitive-types", "proptest", - "rand", + "rand 0.8.5", + "rand 0.9.4", "rlp", "ruint-macro", - "serde", + "serde_core", "valuable", "zeroize", ] [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" @@ -3029,7 +3293,7 @@ version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.11.1", "errno", "libc", "linux-raw-sys 0.4.13", @@ -3220,10 +3484,11 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ + "serde_core", "serde_derive", ] @@ -3236,15 +3501,24 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -3296,7 +3570,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", - "cpufeatures", + "cpufeatures 0.2.12", "digest 0.9.0", "opaque-debug", ] @@ -3308,7 +3582,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.12", "digest 0.10.7", ] @@ -3507,7 +3781,7 @@ dependencies = [ "parking_lot", "paste", "primitive-types", - "rand", + "rand 0.8.5", "scale-info", "schnorrkel", "secp256k1", @@ -3554,7 +3828,7 @@ dependencies = [ "parking_lot", "paste", "primitive-types", - "rand", + "rand 0.8.5", "scale-info", "schnorrkel", "secp256k1", @@ -3610,7 +3884,7 @@ checksum = "48d09fa0a5f7299fb81ee25ae3853d26200f7a348148aed6de76be905c007dbe" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -3698,7 +3972,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -3712,7 +3986,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -3725,7 +3999,7 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot", - "rand", + "rand 0.8.5", "smallvec", "sp-core 28.0.0", "sp-externalities 0.25.0", @@ -3797,7 +4071,7 @@ dependencies = [ "nohash-hasher", "parity-scale-codec", "parking_lot", - "rand", + "rand 0.8.5", "scale-info", "schnellru", "sp-core 28.0.0", @@ -3822,7 +4096,7 @@ dependencies = [ "nohash-hasher", "parity-scale-codec", "parking_lot", - "rand", + "rand 0.8.5", "scale-info", "schnellru", "sp-core 31.0.0", @@ -3936,9 +4210,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -3986,7 +4260,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -4060,7 +4334,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -4099,7 +4373,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.14.0", "toml_datetime", "winnow 0.5.40", ] @@ -4110,7 +4384,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.14.0", "toml_datetime", "winnow 0.5.40", ] @@ -4121,7 +4395,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.14.0", "toml_datetime", "winnow 0.5.40", ] @@ -4132,7 +4406,7 @@ version = "0.22.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.14.0", "serde", "serde_spanned", "toml_datetime", @@ -4158,7 +4432,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -4273,7 +4547,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand", + "rand 0.8.5", "static_assertions", ] @@ -4282,9 +4556,6 @@ name = "twox-hash" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7b17f197b3050ba473acf9181f7b1d3b66d1cf7356c6cc57886662276e65908" -dependencies = [ - "rand", -] [[package]] name = "typenum" @@ -4393,8 +4664,8 @@ dependencies = [ "arrayref", "constcat", "digest 0.10.7", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "rand_core 0.6.4", "sha2 0.10.8", "sha3", @@ -4417,6 +4688,24 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -4438,7 +4727,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", "wasm-bindgen-shared", ] @@ -4460,7 +4749,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4471,6 +4760,28 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser 0.244.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.14.0", + "wasm-encoder", + "wasmparser 0.244.0", +] + [[package]] name = "wasmparser" version = "0.102.0" @@ -4481,6 +4792,18 @@ dependencies = [ "url", ] +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.1", + "hashbrown 0.15.5", + "indexmap 2.14.0", + "semver 1.0.22", +] + [[package]] name = "wasmtime" version = "8.0.1" @@ -4499,7 +4822,7 @@ dependencies = [ "psm", "serde", "target-lexicon", - "wasmparser", + "wasmparser 0.102.0", "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", @@ -4530,7 +4853,7 @@ dependencies = [ "serde", "target-lexicon", "thiserror", - "wasmparser", + "wasmparser 0.102.0", "wasmtime-types", ] @@ -4593,7 +4916,7 @@ dependencies = [ "memfd", "memoffset", "paste", - "rand", + "rand 0.8.5", "rustix 0.36.17", "wasmtime-asm-macros", "wasmtime-environ", @@ -4610,7 +4933,7 @@ dependencies = [ "cranelift-entity", "serde", "thiserror", - "wasmparser", + "wasmparser 0.102.0", ] [[package]] @@ -4896,6 +5219,100 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.14.0", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.1", + "indexmap 2.14.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser 0.244.0", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.14.0", + "log", + "semver 1.0.22", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.244.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -4922,7 +5339,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]] @@ -4942,7 +5359,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.117", ] [[package]]