diff --git a/Cargo.lock b/Cargo.lock index 444b2995..ad96419b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,15 +108,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "approx" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" -dependencies = [ - "num-traits", -] - [[package]] name = "async-trait" version = "0.1.83" @@ -125,7 +116,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -333,9 +324,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cast" @@ -345,9 +336,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -464,18 +455,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -492,14 +483,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "color-eyre" @@ -769,7 +760,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -792,29 +783,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" -[[package]] -name = "daumtils" -version = "0.2.0" -source = "git+https://github.com/rdaum/daumtils.git#24026dd193c2dd7679389858222f7fb97512da61" -dependencies = [ - "bytes", - "num-traits", - "yoke", - "yoke-derive", -] - -[[package]] -name = "decorum" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "281759d3c8a14f5c3f0c49363be56810fcd7f910422f97f2db850c2920fde5cf" -dependencies = [ - "approx", - "num-traits", - "serde", - "serde_derive", -] - [[package]] name = "der" version = "0.7.9" @@ -947,7 +915,7 @@ checksum = "ba7795da175654fe16979af73f81f26a8ea27638d8d9823d317016888a63dc4c" dependencies = [ "num-traits", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -959,7 +927,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -980,12 +948,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1024,9 +992,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "fjall" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e33c3128fbd83d9d70ebcf093f3f91d8c20016af0aac545f80afbadd9dcd098" +checksum = "a6980a53d82b216c201998d1e0ca660ccf31328107d1a19d8ac565a44f03537c" dependencies = [ "byteorder", "dashmap", @@ -1109,7 +1077,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1202,9 +1170,9 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -1212,12 +1180,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hermit-abi" version = "0.4.0" @@ -1242,9 +1204,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -1366,12 +1328,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -1392,19 +1354,13 @@ dependencies = [ "serde", ] -[[package]] -name = "inventory" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" - [[package]] name = "is-terminal" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi 0.4.0", + "hermit-abi", "libc", "windows-sys 0.52.0", ] @@ -1444,9 +1400,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -1459,10 +1415,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1506,7 +1463,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1517,9 +1474,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "linux-raw-sys" @@ -1565,15 +1522,6 @@ dependencies = [ "xxhash-rust", ] -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "matchit" version = "0.7.3" @@ -1645,11 +1593,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "log", "wasi", @@ -1662,8 +1609,6 @@ version = "0.1.0" dependencies = [ "bincode", "bytes", - "daumtils", - "itertools 0.13.0", "lazy_static", "moor-values", "pest", @@ -1671,9 +1616,8 @@ dependencies = [ "pretty_assertions", "strum", "test-case", - "thiserror 2.0.3", + "thiserror 2.0.4", "tracing", - "tracing-test", "unindent", ] @@ -1686,7 +1630,6 @@ dependencies = [ "clap", "clap_derive", "color-eyre", - "daumtils", "ed25519-dalek", "eyre", "fjall", @@ -1700,7 +1643,6 @@ dependencies = [ "rusty_paseto", "serde_json", "signal-hook", - "strum", "tempfile", "tracing", "tracing-subscriber", @@ -1714,17 +1656,13 @@ version = "0.1.0" dependencies = [ "bytes", "crossbeam-channel", - "daumtils", "fjall", - "im", "lazy_static", "moor-values", "oneshot", - "strum", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.4", "tracing", - "tracing-test", "uuid 1.11.0", ] @@ -1738,12 +1676,9 @@ dependencies = [ "chrono-tz", "criterion", "crossbeam-channel", - "daumtils", - "decorum", "encoding_rs", "eyre", "iana-time-zone", - "inventory", "lazy_static", "libc", "md-5 0.10.6", @@ -1758,16 +1693,12 @@ dependencies = [ "pwhash", "rand", "strum", - "tempfile", "test-case", "test_each_file", "text-diff", "text_io", - "thiserror 2.0.3", + "thiserror 2.0.4", "tracing", - "tracing-subscriber", - "tracing-test", - "unindent", "uuid 1.11.0", ] @@ -1778,20 +1709,15 @@ dependencies = [ "clap", "clap_derive", "color-eyre", - "ed25519-dalek", "edn-format", "eyre", "futures", "moor-values", - "pem", - "pretty_assertions", "rand", "rpc-async-client", "rpc-common", - "rusty_paseto", "tmq", "tokio", - "tokio-util", "tracing", "tracing-subscriber", "uuid 1.11.0", @@ -1815,17 +1741,14 @@ dependencies = [ "clap", "clap_derive", "color-eyre", - "ed25519-dalek", "escargot", "eyre", "futures-util", "moor-compiler", "moor-moot", "moor-values", - "pem", "rpc-async-client", "rpc-common", - "rusty_paseto", "serial_test", "tempfile", "termimad", @@ -1844,8 +1767,6 @@ dependencies = [ "binary-layout", "bincode", "bytes", - "daumtils", - "decorum", "enum-primitive-derive", "im", "itertools 0.13.0", @@ -1854,7 +1775,7 @@ dependencies = [ "paste", "serde", "strum", - "thiserror 2.0.3", + "thiserror 2.0.4", "ustr", "uuid 1.11.0", ] @@ -1875,7 +1796,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.4", "tmq", "tokio", "tracing", @@ -2116,7 +2037,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2368,17 +2289,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[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]] @@ -2389,15 +2301,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "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.5" @@ -2428,7 +2334,7 @@ dependencies = [ "moor-values", "rpc-common", "rusty_paseto", - "thiserror 2.0.3", + "thiserror 2.0.4", "tmq", "tokio", "tracing", @@ -2440,11 +2346,10 @@ name = "rpc-common" version = "0.1.0" dependencies = [ "bincode", - "ed25519-dalek", "moor-values", "pem", "rusty_paseto", - "thiserror 2.0.3", + "thiserror 2.0.4", ] [[package]] @@ -2466,9 +2371,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" @@ -2559,9 +2464,9 @@ checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "self_cell" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" +checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" [[package]] name = "semver" @@ -2586,7 +2491,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2654,7 +2559,7 @@ checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2792,9 +2697,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -2816,12 +2721,6 @@ dependencies = [ "der", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "std-semaphore" version = "0.1.0" @@ -2859,7 +2758,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2881,9 +2780,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -2902,17 +2801,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "system-deps" version = "6.2.2" @@ -2989,7 +2877,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3000,7 +2888,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "test-case-core", ] @@ -3012,7 +2900,7 @@ checksum = "5c87c84c1e2198f924fb928d5c775e40aa508e5d6aa62d608f234c0270493d14" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "unicode-ident", ] @@ -3043,11 +2931,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.4", ] [[package]] @@ -3058,18 +2946,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3084,9 +2972,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -3105,9 +2993,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -3138,9 +3026,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -3162,7 +3050,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3179,9 +3067,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -3258,9 +3146,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -3270,20 +3158,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -3291,9 +3179,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ "tracing", "tracing-subscriber", @@ -3312,43 +3200,18 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ - "matchers", "nu-ansi-term", - "once_cell", - "regex", "sharded-slab", "smallvec", "thread_local", - "tracing", "tracing-core", "tracing-log", ] -[[package]] -name = "tracing-test" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557b891436fe0d5e0e363427fc7f217abf9ccd510d5136549847bdcbcd011d68" -dependencies = [ - "tracing-core", - "tracing-subscriber", - "tracing-test-macro", -] - -[[package]] -name = "tracing-test-macro" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" -dependencies = [ - "quote", - "syn 2.0.89", -] - [[package]] name = "tungstenite" version = "0.24.0" @@ -3459,9 +3322,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-log" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7c4b687fea1a6fe681fabdcc3e21cd01ce6df68d92c037ef2f3dacdd1daf4d" +checksum = "7abc2af068c21c0b0531624fbdb5b2c950cf8e7dc72cedf77a9ec10bb677450f" dependencies = [ "byteorder", "bytes", @@ -3516,9 +3379,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -3527,24 +3390,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3552,28 +3415,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", @@ -3734,29 +3597,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.7.35" @@ -3775,15 +3615,9 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] -[[package]] -name = "zerofrom" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" - [[package]] name = "zeroize" version = "1.8.1" @@ -3801,7 +3635,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 75e99210..2717fd94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,18 +61,15 @@ clap_derive = "4.5" ## HTTP/websockets front-end axum = { version = "0.7", features = ["ws"] } -axum-extra = "0.9" serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" -tower-http = { version = "0.5.2", features = ["add-extension", "auth", "compression-full", "trace"] } ## Asynchronous transaction processing & networking, used in web-host and telnet-host. ## the daemon itself uses its own threading futures = "0.3" futures-util = { version = "0.3", features = ["sink", "std"] } tokio = { version = "1.37", features = ["full"] } -tokio-test = "0.4" tokio-util = { version = "0.7", features = ["full"] } # Used for RPC daemon/client @@ -82,29 +79,21 @@ zmq = "0.10" ## Logging & tracing tracing = "0.1" tracing-subscriber = "0.3" -tracing-test = "0.2" # General usefulness binary-layout = "4.0" bincode = "2.0.0-rc.3" -bindgen = "0.70" bytes = "1.7" chrono = "0.4" -cmake = "0.1" criterion = { version = "0.5", features = ["async_tokio"] } crossbeam-channel = "0.5" -daumtils = { git = "https://github.com/rdaum/daumtils.git", version = "0.2.0" } -decorum = "0.3" # For ordering & comparing our floats encoding_rs = "0.8.34" enum-primitive-derive = "0.3" im = "15.1" -inventory = "0.3" itertools = "0.13" lazy_static = "1.5" num-traits = "0.2" oneshot = { version = "0.1", default-features = false, features = ["std"] } -owo-colors = "3.5" -rustyline = "14.0" strum = { version = "0.26", features = ["derive"] } text-diff = "0.4" ustr = "1.0" @@ -131,7 +120,7 @@ thiserror = "2.0" paste = "1.0" # For the DB & values layer. -fjall = { version = "2.3.2", default-features = false, features = ["ssi_tx", "bytes"] } +fjall = { version = "2.4", default-features = false, features = ["ssi_tx", "bytes"] } libc = "0.2" text_io = "0.1" # Used for reading text dumps. diff --git a/crates/README.md b/crates/README.md index 861e827b..1f7a8919 100644 --- a/crates/README.md +++ b/crates/README.md @@ -10,16 +10,19 @@ Binaries: network `host`s - `web-host` - like the above, but hosts an HTTP server which provides a websocket interface to the system. as well as various web APIs. -- `console-host` - console host which connects as a user to the `daemon` and provides a readline-type interface to the - system. +- `model-checker` - a tool for using the `elle` tool from Jepsen for verifying transactional properties of the\ + database +- `moot` - a comprensive test suite for verifying the correctness of the MOO implementation, including a battery of + tests ported from ToastStunt. Libraries: - `values` - crate that implements the core MOO discriminated union (`Var`) value type, plus all associated types and traits. -- `rdb` - implementation of a custom in-memory quasi-relational MVCC database system - `db` - implementation of the `WorldState` object database overtop of `rdb` - `compiler` - the MOO language grammar, parser, AST, and codegen, as well as the decompiler & unparser - `kernel` - the kernel of the MOO driver: virtual machine, task scheduler, implementations of all builtin\ functions - `rpc-common` - provides types & functions used by both `daemon` and each host binary, for the RPC interface +- `rpc-async-client` - provides an async RPC client for the `daemon`'s RPC interface +- `rpc-sync-client` - provides a synchronous RPC client for the `daemon`'s RPC interface diff --git a/crates/compiler/Cargo.toml b/crates/compiler/Cargo.toml index eb3523ff..453a3fec 100644 --- a/crates/compiler/Cargo.toml +++ b/crates/compiler/Cargo.toml @@ -14,7 +14,6 @@ description = "Functions and structures for compilation and decompilation of MOO [dev-dependencies] pretty_assertions.workspace = true test-case.workspace = true -tracing-test.workspace = true unindent.workspace = true [dependencies] @@ -24,8 +23,6 @@ moor-values = { path = "../values" } ## General usefulness bincode.workspace = true bytes.workspace = true -daumtils.workspace = true -itertools.workspace = true lazy_static.workspace = true strum.workspace = true diff --git a/crates/daemon/Cargo.toml b/crates/daemon/Cargo.toml index 8a2ad4a8..d0eb014a 100644 --- a/crates/daemon/Cargo.toml +++ b/crates/daemon/Cargo.toml @@ -20,13 +20,11 @@ rpc-common = { path = "../rpc-common" } ## Command line arguments parsing. clap.workspace = true clap_derive.workspace = true -strum.workspace = true # General. bincode.workspace = true bytes.workspace = true color-eyre.workspace = true -daumtils.workspace = true eyre.workspace = true fjall.workspace = true oneshot.workspace = true diff --git a/crates/db/Cargo.toml b/crates/db/Cargo.toml index 2985d584..f04caf99 100644 --- a/crates/db/Cargo.toml +++ b/crates/db/Cargo.toml @@ -13,7 +13,6 @@ description = "Interfaces for describing the worldstate of a moor database" [dev-dependencies] tempfile.workspace = true -tracing-test.workspace = true [dependencies] ## Own @@ -22,12 +21,9 @@ moor-values = { path = "../values" } ## Error declaration/ handling bytes.workspace = true crossbeam-channel.workspace = true -daumtils.workspace = true fjall.workspace = true -im.workspace = true lazy_static.workspace = true oneshot.workspace = true -strum.workspace = true tempfile.workspace = true thiserror.workspace = true tracing.workspace = true diff --git a/crates/db/src/lib.rs b/crates/db/src/lib.rs index a055e6e3..3b964340 100644 --- a/crates/db/src/lib.rs +++ b/crates/db/src/lib.rs @@ -43,6 +43,7 @@ pub trait Database: Send + WorldStateSource { fn loader_client(&self) -> Result, WorldStateError>; } +#[derive(Clone)] pub struct TxDB { storage: Arc, } diff --git a/crates/db/src/tx/global_cache.rs b/crates/db/src/tx/global_cache.rs index bc331c8e..3bf9967a 100644 --- a/crates/db/src/tx/global_cache.rs +++ b/crates/db/src/tx/global_cache.rs @@ -169,9 +169,7 @@ where }, ); - self.source - .put(op.write_ts, domain.clone(), codomain) - .unwrap(); + self.source.put(op.write_ts, domain.clone(), codomain).ok(); } OpType::Delete => { inner.index.insert( diff --git a/crates/kernel/Cargo.toml b/crates/kernel/Cargo.toml index 4de4f267..4d50aeaa 100644 --- a/crates/kernel/Cargo.toml +++ b/crates/kernel/Cargo.toml @@ -17,16 +17,11 @@ moor-db = { path = "../db" } criterion.workspace = true eyre.workspace = true -inventory.workspace = true pretty_assertions.workspace = true -tempfile.workspace = true test-case.workspace = true test_each_file.workspace = true text-diff.workspace = true tracing.workspace = true -tracing-subscriber.workspace = true -tracing-test.workspace = true -unindent.workspace = true [[test]] name = "regression-suite" @@ -51,8 +46,6 @@ moor-values = { path = "../values" } bytes.workspace = true chrono.workspace = true crossbeam-channel.workspace = true -daumtils.workspace = true -decorum.workspace = true encoding_rs.workspace = true lazy_static.workspace = true libc.workspace = true diff --git a/crates/kernel/benches/vm_benches.rs b/crates/kernel/benches/vm_benches.rs index 6917f3fc..f7cd042d 100644 --- a/crates/kernel/benches/vm_benches.rs +++ b/crates/kernel/benches/vm_benches.rs @@ -38,7 +38,7 @@ use moor_values::util::BitEnum; use moor_values::Symbol; use moor_values::{AsByteBuffer, Var, NOTHING, SYSTEM_OBJECT}; -fn create_worldstate() -> TxDB { +fn create_db() -> TxDB { let (ws_source, _) = TxDB::open(None); let mut tx = ws_source.new_world_state().unwrap(); let _sysobj = tx @@ -78,7 +78,7 @@ pub fn prepare_call_verb( } fn prepare_vm_execution( - ws_source: &mut dyn WorldStateSource, + ws_source: &dyn WorldStateSource, program: &str, max_ticks: usize, ) -> VmHost { @@ -156,11 +156,10 @@ fn execute( } } -fn do_program(program: &str, max_ticks: usize, iters: u64) -> Duration { +fn do_program(state_source: TxDB, program: &str, max_ticks: usize, iters: u64) -> Duration { let mut cumulative = Duration::new(0, 0); - let mut state_source = create_worldstate(); - let mut vm_host = prepare_vm_execution(&mut state_source, program, max_ticks); + let mut vm_host = prepare_vm_execution(&state_source, program, max_ticks); let mut tx = state_source.new_world_state().unwrap(); let session = Arc::new(NoopClientSession::new()); let (scs_tx, _scs_rx) = crossbeam_channel::unbounded(); @@ -184,21 +183,31 @@ fn do_program(program: &str, max_ticks: usize, iters: u64) -> Duration { } fn opcode_throughput(c: &mut Criterion) { + let db = create_db(); + let mut group = c.benchmark_group("opcode_throughput"); - group.sample_size(300); + group.sample_size(50); group.measurement_time(Duration::from_secs(10)); let num_ticks = 300000; group.throughput(criterion::Throughput::Elements(num_ticks as u64)); group.bench_function("while_loop", |b| { - b.iter_custom(|iters| do_program("while (1) endwhile", num_ticks, iters)); + b.iter_custom(|iters| do_program(db.clone(), "while (1) endwhile", num_ticks, iters)); }); group.bench_function("while_increment_var_loop", |b| { - b.iter_custom(|iters| do_program("i = 0; while(1) i=i+1; endwhile", num_ticks, iters)); + b.iter_custom(|iters| { + do_program( + db.clone(), + "i = 0; while(1) i=i+1; endwhile", + num_ticks, + iters, + ) + }); }); group.bench_function("for_in_range_loop", |b| { b.iter_custom(|iters| { do_program( + db.clone(), "while(1) for i in [1..1000000] endfor endwhile", num_ticks, iters, @@ -206,10 +215,11 @@ fn opcode_throughput(c: &mut Criterion) { }); }); // Measure range iteration over a static list + group.bench_function("for_in_static_list_loop", |b| { b.iter_custom(|iters| { - do_program( - r#"while(1) + do_program(db.clone(), + r#"while(1) for i in ({1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10}) endfor endwhile"#, @@ -222,6 +232,7 @@ fn opcode_throughput(c: &mut Criterion) { group.bench_function("list_append_loop", |b| { b.iter_custom(|iters| { do_program( + db.clone(), r#"while(1) base_list = {}; for i in [0..1000] @@ -237,7 +248,8 @@ fn opcode_throughput(c: &mut Criterion) { group.bench_function("list_set", |b| { b.iter_custom(|iters| { do_program( - r#"while(1) + db.clone(), + r#"while(1) list = {1}; for i in [0..10000] list[1] = i; diff --git a/crates/kernel/src/builtins/bf_num.rs b/crates/kernel/src/builtins/bf_num.rs index 9a4cc3f1..8370a56c 100644 --- a/crates/kernel/src/builtins/bf_num.rs +++ b/crates/kernel/src/builtins/bf_num.rs @@ -12,7 +12,6 @@ // this program. If not, see . // -use decorum::R64; use rand::Rng; use moor_compiler::offset_for_builtin; @@ -45,8 +44,8 @@ fn bf_min(bf_args: &mut BfCallState<'_>) -> Result { match (&bf_args.args[0].variant(), &bf_args.args[1].variant()) { (Variant::Int(a), Variant::Int(b)) => Ok(Ret(v_int(*a.min(b)))), (Variant::Float(a), Variant::Float(b)) => { - let m = R64::from(*a).min(R64::from(*b)); - Ok(Ret(v_float(m.into()))) + let m = a.min(*b); + Ok(Ret(v_float(m))) } _ => Err(BfErr::Code(E_TYPE)), } @@ -61,8 +60,8 @@ fn bf_max(bf_args: &mut BfCallState<'_>) -> Result { match (&bf_args.args[0].variant(), &bf_args.args[1].variant()) { (Variant::Int(a), Variant::Int(b)) => Ok(Ret(v_int(*a.max(b)))), (Variant::Float(a), Variant::Float(b)) => { - let m = R64::from(*a).max(R64::from(*b)); - Ok(Ret(v_float(m.into()))) + let m = a.max(*b); + Ok(Ret(v_float(m))) } _ => Err(BfErr::Code(E_TYPE)), } diff --git a/crates/kernel/src/lib.rs b/crates/kernel/src/lib.rs index 51690df0..a1561708 100644 --- a/crates/kernel/src/lib.rs +++ b/crates/kernel/src/lib.rs @@ -17,9 +17,14 @@ pub use crate::tasks::suspension::{SuspendedTask, WakeCondition}; pub use crate::tasks::task::Task; pub use crate::tasks::ServerOptions; pub use moor_values::tasks::TaskId; +use std::cell::Cell; +use std::marker::PhantomData; pub mod builtins; pub mod config; pub mod tasks; pub mod textdump; pub mod vm; + +/// A phantom type for explicitly marking types as !Sync +type PhantomUnsync = PhantomData>; diff --git a/crates/kernel/src/tasks/vm_host.rs b/crates/kernel/src/tasks/vm_host.rs index 5122670c..2f9eda88 100644 --- a/crates/kernel/src/tasks/vm_host.rs +++ b/crates/kernel/src/tasks/vm_host.rs @@ -21,7 +21,6 @@ use bincode::enc::Encoder; use bincode::error::{DecodeError, EncodeError}; use bincode::{BorrowDecode, Decode, Encode}; use bytes::Bytes; -use daumtils::PhantomUnsync; use tracing::{debug, error, trace, warn}; use moor_compiler::Name; @@ -48,6 +47,7 @@ use crate::vm::vm_call::VerbProgram; use crate::vm::VmExecParams; use crate::vm::{ExecutionResult, Fork, VerbExecutionRequest}; use crate::vm::{FinallyReason, VMExecState}; +use crate::PhantomUnsync; use moor_values::matching::command_parse::ParsedCommand; /// Return values from exec_interpreter back to the Task scheduler loop diff --git a/crates/kernel/src/vm/exec_state.rs b/crates/kernel/src/vm/exec_state.rs index bb517fb1..c7dc8a04 100644 --- a/crates/kernel/src/vm/exec_state.rs +++ b/crates/kernel/src/vm/exec_state.rs @@ -15,13 +15,13 @@ use std::time::{Duration, SystemTime}; use bincode::{Decode, Encode}; -use daumtils::PhantomUnsync; use moor_values::Var; use moor_values::NOTHING; use moor_values::{Obj, Symbol}; use crate::vm::activation::{Activation, Frame}; +use crate::PhantomUnsync; use moor_values::tasks::TaskId; // {this, verb-name, programmer, verb-loc, player, line-number} diff --git a/crates/kernel/src/vm/moo_frame.rs b/crates/kernel/src/vm/moo_frame.rs index fa570e36..b980e66f 100644 --- a/crates/kernel/src/vm/moo_frame.rs +++ b/crates/kernel/src/vm/moo_frame.rs @@ -12,15 +12,14 @@ // this program. If not, see . // +use crate::vm::FinallyReason; use bincode::de::{BorrowDecoder, Decoder}; use bincode::enc::Encoder; use bincode::error::{DecodeError, EncodeError}; use bincode::{BorrowDecode, Decode, Encode}; -use daumtils::{BitArray, Bitset16}; - -use crate::vm::FinallyReason; use moor_compiler::Name; use moor_compiler::{GlobalName, Label, Op, Program}; +use moor_values::util::{BitArray, Bitset16}; use moor_values::Error::E_VARNF; use moor_values::{v_none, Error, Var}; diff --git a/crates/model-checker/Cargo.toml b/crates/model-checker/Cargo.toml index 7fdab3b9..0061f6e5 100644 --- a/crates/model-checker/Cargo.toml +++ b/crates/model-checker/Cargo.toml @@ -20,15 +20,9 @@ clap.workspace = true clap_derive.workspace = true color-eyre.workspace = true eyre.workspace = true -pretty_assertions.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -# Auth/Auth -ed25519-dalek.workspace = true -pem.workspace = true -rusty_paseto.workspace = true - ## ZMQ / RPC tmq.workspace = true uuid.workspace = true @@ -36,7 +30,6 @@ uuid.workspace = true ## Asynchronous transaction processing & networking futures.workspace = true tokio.workspace = true -tokio-util.workspace = true edn-format.workspace = true rand.workspace = true diff --git a/crates/rpc-common/Cargo.toml b/crates/rpc-common/Cargo.toml index 9eed9129..749ba010 100644 --- a/crates/rpc-common/Cargo.toml +++ b/crates/rpc-common/Cargo.toml @@ -19,6 +19,5 @@ bincode.workspace = true thiserror.workspace = true # Auth/Auth -ed25519-dalek.workspace = true pem.workspace = true rusty_paseto.workspace = true diff --git a/crates/telnet-host/Cargo.toml b/crates/telnet-host/Cargo.toml index 1e047aa0..27dc032a 100644 --- a/crates/telnet-host/Cargo.toml +++ b/crates/telnet-host/Cargo.toml @@ -42,11 +42,6 @@ uuid.workspace = true ## Rich content termimad.workspace = true -# Auth/Auth -ed25519-dalek.workspace = true -pem.workspace = true -rusty_paseto.workspace = true - # Testing [dev-dependencies] escargot.workspace = true diff --git a/crates/values/Cargo.toml b/crates/values/Cargo.toml index faa9d103..e170712e 100644 --- a/crates/values/Cargo.toml +++ b/crates/values/Cargo.toml @@ -15,8 +15,6 @@ description = "The set of values, and model/entities used across the system" binary-layout.workspace = true bincode.workspace = true bytes.workspace = true -daumtils.workspace = true -decorum.workspace = true enum-primitive-derive.workspace = true im.workspace = true itertools.workspace = true diff --git a/crates/values/src/util/bitarray.rs b/crates/values/src/util/bitarray.rs new file mode 100644 index 00000000..34666fbb --- /dev/null +++ b/crates/values/src/util/bitarray.rs @@ -0,0 +1,317 @@ +// Copyright (C) 2024 Ryan Daum +// +// This program is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// this program. If not, see . +// + +use crate::util::BitsetTrait; +use std::fmt::{Debug, Formatter}; +use std::mem::MaybeUninit; +use std::ops::Index; + +// BITSET_WIDTH must be RANGE_WIDTH / 16 +// Once generic_const_exprs is stabilized, we can use that to calculate this from a RANGE_WIDTH. +// Until then, don't mess up. +pub struct BitArray +where + BitsetType: BitsetTrait + Default, +{ + pub(crate) bitset: BitsetType, + storage: [MaybeUninit; RANGE_WIDTH], +} + +impl BitArray +where + BitsetType: BitsetTrait + Default, +{ + pub fn new() -> Self { + Self { + bitset: Default::default(), + storage: unsafe { MaybeUninit::uninit().assume_init() }, + } + } + + #[inline] + pub fn push(&mut self, x: X) -> Option { + let pos = self.bitset.first_empty()?; + assert!(pos < RANGE_WIDTH); + self.bitset.set(pos); + unsafe { + self.storage[pos].as_mut_ptr().write(x); + } + Some(pos) + } + + #[inline] + pub fn pop(&mut self) -> Option { + let pos = self.bitset.last()?; + self.bitset.unset(pos); + let old = std::mem::replace(&mut self.storage[pos], MaybeUninit::uninit()); + Some(unsafe { old.assume_init() }) + } + + #[inline] + pub fn last(&self) -> Option<&X> { + self.bitset + .last() + .map(|pos| unsafe { self.storage[pos].assume_init_ref() }) + } + + #[inline] + pub fn last_used_pos(&self) -> Option { + self.bitset.last() + } + + #[inline] + pub fn first_used(&self) -> Option { + self.bitset.first_set() + } + + #[inline] + pub fn first_empty(&mut self) -> Option { + // Storage size of the bitset can be larger than the range width. + // For example: we have a RANGE_WIDTH of 48 and a bitset of 64x1 or 32x2. + // So we need to check that the first empty bit is within the range width, or people could + // get the idea they could append beyond our permitted range. + let first_empty = self.bitset.first_empty()?; + if first_empty > RANGE_WIDTH { + return None; + } + Some(first_empty) + } + + #[inline] + pub fn check(&self, pos: usize) -> bool { + self.bitset.check(pos) + } + + #[inline] + pub fn get(&self, pos: usize) -> Option<&X> { + if self.bitset.check(pos) { + Some(unsafe { self.storage[pos].assume_init_ref() }) + } else { + None + } + } + + #[inline] + pub fn get_mut(&mut self, pos: usize) -> Option<&mut X> { + if self.bitset.check(pos) { + Some(unsafe { self.storage[pos].assume_init_mut() }) + } else { + None + } + } + + #[inline] + pub fn set(&mut self, pos: usize, x: X) { + unsafe { + // Drop old value if it exists + if self.bitset.check(pos) { + self.storage[pos].assume_init_drop(); + } + self.storage[pos].as_mut_ptr().write(x); + }; + self.bitset.set(pos); + } + + #[inline] + pub fn update(&mut self, pos: usize, x: X) -> Option { + let old = self.take_internal(pos); + unsafe { + self.storage[pos].as_mut_ptr().write(x); + }; + self.bitset.set(pos); + old + } + + #[inline] + pub fn erase(&mut self, pos: usize) -> Option { + let old = self.take_internal(pos)?; + self.bitset.unset(pos); + Some(old) + } + + // Erase without updating index, used by update and erase + #[inline] + fn take_internal(&mut self, pos: usize) -> Option { + if self.bitset.check(pos) { + let old = std::mem::replace(&mut self.storage[pos], MaybeUninit::uninit()); + Some(unsafe { old.assume_init() }) + } else { + None + } + } + + #[inline] + pub fn clear(&mut self) { + for i in 0..RANGE_WIDTH { + if self.bitset.check(i) { + unsafe { self.storage[i].assume_init_drop() } + } + } + self.bitset.clear(); + } + + #[inline] + pub fn is_empty(&self) -> bool { + self.bitset.is_empty() + } + + #[inline] + pub fn len(&self) -> usize { + self.bitset.size() + } + + pub fn iter_keys(&self) -> impl DoubleEndedIterator + '_ { + self.storage.iter().enumerate().filter_map(|x| { + if !self.bitset.check(x.0) { + None + } else { + Some(x.0) + } + }) + } + + pub fn take_all(mut self) -> Vec<(usize, X)> { + let mut vec = Vec::new(); + for i in 0..RANGE_WIDTH { + if self.bitset.check(i) { + let old = std::mem::replace(&mut self.storage[i], MaybeUninit::uninit()); + vec.push((i, unsafe { old.assume_init() })); + } + } + self.bitset.clear(); + vec + } + pub fn iter(&self) -> impl DoubleEndedIterator { + self.storage.iter().enumerate().filter_map(|x| { + if !self.bitset.check(x.0) { + None + } else { + Some((x.0, unsafe { x.1.assume_init_ref() })) + } + }) + } + + pub fn iter_mut(&mut self) -> impl DoubleEndedIterator { + self.storage.iter_mut().enumerate().filter_map(|x| { + if !self.bitset.check(x.0) { + None + } else { + Some((x.0, unsafe { x.1.assume_init_mut() })) + } + }) + } +} + +impl PartialEq for BitArray +where + BitsetType: BitsetTrait + Default, + X: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.iter().eq(other.iter()) + } +} + +impl Eq for BitArray +where + BitsetType: BitsetTrait + Default, + X: Eq, +{ +} + +impl Default for BitArray +where + BitsetType: BitsetTrait + Default, +{ + fn default() -> Self { + Self::new() + } +} + +impl Index for BitArray +where + BitsetType: BitsetTrait + Default, +{ + type Output = X; + + fn index(&self, index: usize) -> &Self::Output { + self.get(index).unwrap() + } +} + +impl Drop for BitArray +where + BitsetType: BitsetTrait + Default, +{ + fn drop(&mut self) { + for i in 0..RANGE_WIDTH { + if self.bitset.check(i) { + unsafe { self.storage[i].assume_init_drop() } + } + } + self.bitset.clear(); + } +} + +impl Debug for BitArray +where + BitsetType: BitsetTrait + Default, +{ + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "BitArray({}) = {{", self.bitset.size()) + } +} + +impl Clone for BitArray +where + BitsetType: BitsetTrait + Default, + X: Clone, +{ + fn clone(&self) -> Self { + let mut new = Self::new(); + for (idx, v) in self.iter() { + let v = v.clone(); + new.set(idx, v); + } + new + } +} + +#[cfg(test)] +mod test { + use crate::util::{BitArray, Bitset16}; + + #[test] + fn u8_vector() { + let mut vec: BitArray> = BitArray::new(); + assert_eq!(vec.first_empty(), Some(0)); + assert_eq!(vec.last_used_pos(), None); + assert_eq!(vec.push(123).unwrap(), 0); + assert_eq!(vec.first_empty(), Some(1)); + assert_eq!(vec.last_used_pos(), Some(0)); + assert_eq!(vec.get(0), Some(&123)); + assert_eq!(vec.push(124).unwrap(), 1); + assert_eq!(vec.push(55).unwrap(), 2); + assert_eq!(vec.push(126).unwrap(), 3); + assert_eq!(vec.pop(), Some(126)); + assert_eq!(vec.first_empty(), Some(3)); + vec.erase(0); + assert_eq!(vec.first_empty(), Some(0)); + assert_eq!(vec.last_used_pos(), Some(2)); + assert_eq!(vec.len(), 2); + vec.set(0, 126); + assert_eq!(vec.get(0), Some(&126)); + assert_eq!(vec.update(0, 123), Some(126)); + } +} diff --git a/crates/values/src/util/bitset.rs b/crates/values/src/util/bitset.rs new file mode 100644 index 00000000..54b08d72 --- /dev/null +++ b/crates/values/src/util/bitset.rs @@ -0,0 +1,313 @@ +// Copyright (C) 2024 Ryan Daum +// +// This program is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// this program. If not, see . +// + +use std::cmp::min; +use std::ops::Index; + +use num_traits::PrimInt; + +pub trait BitsetTrait: Default { + // Total size of the bitset in bits. + const BITSET_WIDTH: usize; + // Total size of the bitset in bytes. + const STORAGE_WIDTH_BYTES: usize; + // Bit shift factor -- e.g. 3 for 8, 4 for 16, etc. + const BIT_SHIFT: usize; + // Bit width of each storage unit. + const STORAGE_BIT_WIDTH: usize; + // Total size of storage in its internal storage width (e.g. u16, u32, etc.) + const STORAGE_WIDTH: usize; + + fn first_empty(&self) -> Option; + fn first_set(&self) -> Option; + fn set(&mut self, pos: usize); + fn unset(&mut self, pos: usize); + fn check(&self, pos: usize) -> bool; + fn clear(&mut self); + fn last(&self) -> Option; + fn is_empty(&self) -> bool; + fn size(&self) -> usize; + fn bit_width(&self) -> usize; + fn capacity(&self) -> usize; + fn storage_width(&self) -> usize; + fn as_bitmask(&self) -> u128; +} + +pub struct Bitset +where + StorageType: PrimInt, +{ + bitset: [StorageType; STORAGE_WIDTH], +} + +impl Bitset +where + StorageType: PrimInt, +{ + pub fn new() -> Self { + Self { + bitset: [StorageType::min_value(); STORAGE_WIDTH], + } + } + + pub fn iter(&self) -> impl Iterator + '_ { + self.bitset.iter().enumerate().flat_map(|(i, b)| { + (0..Self::STORAGE_BIT_WIDTH).filter_map(move |j| { + let b: u64 = b.to_u64().unwrap(); + if (b) & (1 << j) != 0 { + Some((i << Self::BIT_SHIFT) + j) + } else { + None + } + }) + }) + } +} + +impl BitsetTrait for Bitset +where + StorageType: PrimInt, +{ + const BITSET_WIDTH: usize = Self::STORAGE_BIT_WIDTH * STORAGE_WIDTH; + const STORAGE_WIDTH_BYTES: usize = Self::BITSET_WIDTH / 8; + const BIT_SHIFT: usize = Self::STORAGE_BIT_WIDTH.trailing_zeros() as usize; + const STORAGE_BIT_WIDTH: usize = std::mem::size_of::() * 8; + const STORAGE_WIDTH: usize = STORAGE_WIDTH; + + fn first_empty(&self) -> Option { + for (i, b) in self.bitset.iter().enumerate() { + if b.is_zero() { + return Some(i << Self::BIT_SHIFT); + } + if *b != StorageType::max_value() { + return Some((i << Self::BIT_SHIFT) + b.trailing_ones() as usize); + } + } + None + } + + fn first_set(&self) -> Option { + for (i, b) in self.bitset.iter().enumerate() { + if !b.is_zero() { + return Some((i << Self::BIT_SHIFT) + b.trailing_zeros() as usize); + } + } + None + } + + #[inline] + fn set(&mut self, pos: usize) { + assert!(pos < Self::BITSET_WIDTH); + let v = self.bitset[pos >> Self::BIT_SHIFT]; + let shift: StorageType = StorageType::one() << (pos % Self::STORAGE_BIT_WIDTH); + let v = v.bitor(shift); + self.bitset[pos >> Self::BIT_SHIFT] = v; + } + + #[inline] + fn unset(&mut self, pos: usize) { + assert!(pos < Self::BITSET_WIDTH); + let v = self.bitset[pos >> Self::BIT_SHIFT]; + let shift = StorageType::one() << (pos % Self::STORAGE_BIT_WIDTH); + let v = v & shift.not(); + self.bitset[pos >> Self::BIT_SHIFT] = v; + } + + #[inline] + fn check(&self, pos: usize) -> bool { + assert!(pos < Self::BITSET_WIDTH); + let shift: StorageType = StorageType::one() << (pos % Self::STORAGE_BIT_WIDTH); + !(self.bitset[pos >> Self::BIT_SHIFT] & shift).is_zero() + } + + #[inline] + fn clear(&mut self) { + self.bitset.fill(StorageType::zero()); + } + + #[inline] + fn last(&self) -> Option { + for (i, b) in self.bitset.iter().enumerate() { + if !b.is_zero() { + return Some( + (i << Self::BIT_SHIFT) + (Self::STORAGE_BIT_WIDTH - 1) + - b.leading_zeros() as usize, + ); + } + } + None + } + + #[inline] + fn is_empty(&self) -> bool { + self.bitset.iter().all(|x| x.is_zero()) + } + + #[inline] + fn size(&self) -> usize { + self.bitset.iter().map(|x| x.count_ones() as usize).sum() + } + + #[inline] + fn bit_width(&self) -> usize { + Self::STORAGE_BIT_WIDTH + } + + #[inline] + fn capacity(&self) -> usize { + Self::BITSET_WIDTH + } + + #[inline] + fn storage_width(&self) -> usize { + Self::STORAGE_WIDTH + } + + fn as_bitmask(&self) -> u128 { + assert!(Self::STORAGE_BIT_WIDTH <= 128); + let mut mask = 0u128; + // copy bit-level representation, unsafe ptr copy + unsafe { + std::ptr::copy_nonoverlapping( + self.bitset.as_ptr() as *const u8, + &mut mask as *mut u128 as *mut u8, + min(16, Self::STORAGE_WIDTH_BYTES), + ); + } + mask + } +} + +impl Default for Bitset +where + StorageType: PrimInt, +{ + fn default() -> Self { + Self::new() + } +} + +impl Index for Bitset +where + StorageType: PrimInt, +{ + type Output = bool; + + #[inline] + fn index(&self, pos: usize) -> &Self::Output { + if self.check(pos) { + &true + } else { + &false + } + } +} + +pub type Bitset64 = Bitset; +pub type Bitset32 = Bitset; +pub type Bitset16 = Bitset; +pub type Bitset8 = Bitset; + +#[cfg(test)] +mod tests { + use crate::util::BitsetTrait; + + #[test] + fn test_first_free_8s() { + let mut bs = super::Bitset8::<4>::new(); + bs.set(1); + bs.set(3); + assert_eq!(bs.first_empty(), Some(0)); + bs.set(0); + assert_eq!(bs.first_empty(), Some(2)); + + // Now fill it up and verify none. + for i in 0..bs.capacity() { + bs.set(i); + } + assert_eq!(bs.first_empty(), None); + } + + #[test] + fn test_first_free_8_2() { + let mut bs = super::Bitset8::<2>::new(); + bs.set(1); + bs.set(3); + assert_eq!(bs.first_empty(), Some(0)); + bs.set(0); + assert_eq!(bs.first_empty(), Some(2)); + + // Now fill it up and verify none. + for i in 0..bs.capacity() { + bs.set(i); + } + assert_eq!(bs.first_empty(), None); + } + + #[test] + fn test_first_free_32s() { + let mut bs = super::Bitset32::<1>::new(); + bs.set(1); + bs.set(3); + assert_eq!(bs.first_empty(), Some(0)); + bs.set(0); + assert_eq!(bs.first_empty(), Some(2)); + + for i in 0..bs.capacity() { + bs.set(i); + } + assert_eq!(bs.first_empty(), None); + } + + #[test] + fn test_iter_16s() { + let mut bs = super::Bitset16::<4>::new(); + bs.set(0); + bs.set(1); + bs.set(2); + bs.set(4); + bs.set(8); + bs.set(16); + let v: Vec = bs.iter().collect(); + assert_eq!(v, vec![0, 1, 2, 4, 8, 16]); + } + + #[test] + fn test_first_free_64s() { + let mut bs = super::Bitset64::<4>::new(); + bs.set(1); + bs.set(3); + assert_eq!(bs.first_empty(), Some(0)); + bs.set(0); + assert_eq!(bs.first_empty(), Some(2)); + } + + #[test] + fn test_iter_64s() { + let mut bs = super::Bitset64::<4>::new(); + bs.set(0); + bs.set(1); + bs.set(2); + bs.set(4); + bs.set(8); + bs.set(16); + bs.set(32); + bs.set(47); + bs.set(48); + bs.set(49); + bs.set(127); + let v: Vec = bs.iter().collect(); + assert_eq!(v, vec![0, 1, 2, 4, 8, 16, 32, 47, 48, 49, 127]); + } +} diff --git a/crates/values/src/util/mod.rs b/crates/values/src/util/mod.rs index 9fdd5fd7..48b96a8e 100644 --- a/crates/values/src/util/mod.rs +++ b/crates/values/src/util/mod.rs @@ -12,9 +12,13 @@ // this program. If not, see . // +mod bitarray; mod bitenum; +mod bitset; +pub use bitarray::BitArray; pub use bitenum::BitEnum; +pub use bitset::*; /// Check `names` for matches with wildcard prefixes. /// e.g. "dname*c" will match for any of 'dname', 'dnamec' diff --git a/crates/values/src/var/variant.rs b/crates/values/src/var/variant.rs index d994897c..10da004d 100644 --- a/crates/values/src/var/variant.rs +++ b/crates/values/src/var/variant.rs @@ -17,8 +17,6 @@ use crate::var::Associative; use crate::var::{map, string, Sequence}; use crate::var::{Error, Obj}; use bincode::{Decode, Encode}; -use decorum::R64; -use num_traits::ToPrimitive; use std::cmp::Ordering; use std::fmt::{Debug, Formatter}; use std::hash::{Hash, Hasher}; @@ -42,7 +40,7 @@ impl Hash for Variant { Variant::None => 0.hash(state), Variant::Obj(o) => o.hash(state), Variant::Int(i) => i.hash(state), - Variant::Float(f) => f.to_f64().unwrap().to_bits().hash(state), + Variant::Float(f) => f.to_bits().hash(state), Variant::List(l) => l.hash(state), Variant::Str(s) => s.hash(state), Variant::Map(m) => m.hash(state), @@ -57,12 +55,7 @@ impl Ord for Variant { (Variant::None, Variant::None) => Ordering::Equal, (Variant::Obj(l), Variant::Obj(r)) => l.cmp(r), (Variant::Int(l), Variant::Int(r)) => l.cmp(r), - (Variant::Float(l), Variant::Float(r)) => { - // For floats, we wrap in decorum first. - let l = R64::from(l.to_f64().unwrap()); - let r = R64::from(r.to_f64().unwrap()); - l.cmp(&r) - } + (Variant::Float(l), Variant::Float(r)) => l.total_cmp(r), (Variant::List(l), Variant::List(r)) => l.cmp(r), (Variant::Str(l), Variant::Str(r)) => l.cmp(r), (Variant::Map(l), Variant::Map(r)) => l.cmp(r),