From 9dad1a6b4de8f39a746bc9e1c98e4156247fb8a3 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 May 2025 23:05:27 -0700 Subject: [PATCH 1/9] validation: update deps --- Cargo.lock | 425 ++++++++++++++++++++++-------------- validation/Cargo.toml | 10 +- validation/src/rbx_util.rs | 6 +- validation/src/validator.rs | 9 +- 4 files changed, 282 insertions(+), 168 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c26c440..62a90d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,19 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.3", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -103,9 +116,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", "cfg-if", @@ -148,9 +161,9 @@ checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "blake3" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389a099b34312839e16420d499a9cad9650541715937ffbdd40d36f49e77eeb3" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" dependencies = [ "arrayref", "arrayvec", @@ -191,10 +204,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.18" +version = "1.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c" +checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -206,9 +221,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -303,15 +318,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "der" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", "pem-rfc7468", @@ -549,9 +564,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -560,9 +575,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", @@ -578,9 +593,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "h2" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" dependencies = [ "atomic-waker", "bytes", @@ -597,9 +612,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "heck" @@ -746,21 +761,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -769,31 +785,11 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - [[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -801,67 +797,54 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" +checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "idna" version = "1.0.3" @@ -875,9 +858,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -905,6 +888,16 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jobserver" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -946,9 +939,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "linux-raw-sys" @@ -958,9 +951,19 @@ checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] [[package]] name = "log" @@ -1075,7 +1078,7 @@ dependencies = [ "data-encoding", "ed25519", "ed25519-dalek", - "getrandom 0.2.15", + "getrandom 0.2.16", "log", "rand", "signatory", @@ -1154,9 +1157,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.107" +version = "0.9.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" +checksum = "e145e1651e858e820e4860f7b9c5e169bc1d8ce1c86043be79fa7b7634821847" dependencies = [ "cc", "libc", @@ -1164,6 +1167,29 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + [[package]] name = "paste" version = "1.0.15" @@ -1239,6 +1265,15 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -1256,9 +1291,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -1324,14 +1359,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] name = "rbx_asset" -version = "0.4.4-pre2" +version = "0.4.5" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "a32b98d3f303002faae783b5c1087e35c36a260b56470fd14a0606f35169ab35" +checksum = "b448bf22f70748215c2a937158f83790bf3f4df81e2af8521a089bc821155360" dependencies = [ "bytes", "chrono", @@ -1344,10 +1379,11 @@ dependencies = [ [[package]] name = "rbx_binary" -version = "0.7.4" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "18b401155b93f7151217bf51e36bdfa7bddcaf5f0d26b563c9ac3b08a3701c27" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9573fee5e073d7b303f475c285197fdc8179468de66ca60ee115a58fbac99296" dependencies = [ + "ahash", "log", "lz4", "profiling", @@ -1355,23 +1391,26 @@ dependencies = [ "rbx_reflection", "rbx_reflection_database", "thiserror", + "zstd", ] [[package]] name = "rbx_dom_weak" -version = "2.9.0" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "2a6b916687c98aaea36f9c03e80906bfafab057bebee248628c8c04def807f43" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04425cf6e9376e5486f4fb35906c120d1b1b45618a490318cf563fab1fa230a9" dependencies = [ + "ahash", "rbx_types", "serde", + "ustr", ] [[package]] name = "rbx_reflection" -version = "4.7.0" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "c1b43fe592a4ce6fe54eb215fb82735efbb516d2cc045a94e3dc0234ff293620" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6d0d62baa613556b058a5f94a53b01cf0ccde0ea327ce03056e335b982e77e" dependencies = [ "rbx_types", "serde", @@ -1380,9 +1419,9 @@ dependencies = [ [[package]] name = "rbx_reflection_database" -version = "0.2.12+roblox-638" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "2e772bb9e1bc0ebe65d338f876d1bb1ea22e15a8f9a82e8245028010c2fea3c9" +version = "1.0.3+roblox-670" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22c05ef92528c0fb0cc580592a65ca178d3ea9beb07a1d9ca0a2503c4f3721c" dependencies = [ "lazy_static", "rbx_reflection", @@ -1392,9 +1431,9 @@ dependencies = [ [[package]] name = "rbx_types" -version = "1.10.0" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "d7a390c44034fa448c53bd0983dfc2d70d8d6b2f65be4f164d4bec8b6a2a2d09" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78e4fdde46493def107e5f923d82e813dec9b3eef52c2f75fbad3a716023eda2" dependencies = [ "base64 0.13.1", "bitflags 1.3.2", @@ -1407,10 +1446,11 @@ dependencies = [ [[package]] name = "rbx_xml" -version = "0.13.3" -source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "d6d1a15f58a1e4b4f578abe6eb5e1461cb16eea82fb4a147d5995c9b79f08d1f" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb623833c31cc43bbdaeb32f5e91db8ecd63fc46e438d0d268baf9e61539cf1c" dependencies = [ + "ahash", "base64 0.13.1", "log", "rbx_dom_weak", @@ -1419,6 +1459,15 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "redox_syscall" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +dependencies = [ + "bitflags 2.9.0", +] + [[package]] name = "regex" version = "1.11.1" @@ -1501,7 +1550,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -1546,9 +1595,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags 2.9.0", "errno", @@ -1559,14 +1608,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.26" +version = "0.23.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.1", + "rustls-webpki 0.103.3", "subtle", "zeroize", ] @@ -1595,9 +1644,12 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] [[package]] name = "rustls-webpki" @@ -1611,9 +1663,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.1" +version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ "ring", "rustls-pki-types", @@ -1641,6 +1693,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "security-framework" version = "2.11.1" @@ -1736,9 +1794,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -1753,9 +1811,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" dependencies = [ "libc", ] @@ -1848,9 +1906,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -1868,9 +1926,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", @@ -1900,12 +1958,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.19.1" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "rustix", "windows-sys 0.59.0", @@ -1964,9 +2022,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", @@ -1974,9 +2032,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.44.2" +version = "1.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" dependencies = [ "backtrace", "bytes", @@ -2022,9 +2080,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", @@ -2051,7 +2109,7 @@ dependencies = [ "tokio", "tokio-rustls", "tokio-util", - "webpki-roots", + "webpki-roots 0.26.11", ] [[package]] @@ -2165,10 +2223,17 @@ dependencies = [ ] [[package]] -name = "utf16_iter" -version = "1.0.5" +name = "ustr" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" +checksum = "18b19e258aa08450f93369cf56dd78063586adf19e92a75b338a800f799a0208" +dependencies = [ + "ahash", + "byteorder", + "lazy_static", + "parking_lot", + "serde", +] [[package]] name = "utf8_iter" @@ -2295,9 +2360,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.8" +version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.0", +] + +[[package]] +name = "webpki-roots" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2853738d1cc4f2da3a225c18ec6c3721abb31961096e9dbf5ab35fa88b19cfdb" dependencies = [ "rustls-pki-types", ] @@ -2536,17 +2610,11 @@ dependencies = [ "bitflags 2.9.0", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "xml-rs" @@ -2556,9 +2624,9 @@ checksum = "a62ce76d9b56901b19a74f19431b0d8b3bc7ca4ad685a746dfd78ca8f4fc6bda" [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -2568,9 +2636,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -2580,18 +2648,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", @@ -2626,10 +2694,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] -name = "zerovec" -version = "0.10.4" +name = "zerotrie" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -2638,11 +2717,39 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", "syn", ] + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.15+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 52cd553..1025aaf 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" submissions-api = { path = "api", features = ["internal"], default-features = false, registry = "strafesnet" } async-nats = "0.40.0" futures = "0.3.31" -rbx_asset = { version = "0.4.4-pre2", registry = "strafesnet" } -rbx_binary = { version = "0.7.4", registry = "strafesnet"} -rbx_dom_weak = { version = "2.9.0", registry = "strafesnet"} -rbx_reflection_database = { version = "0.2.12", registry = "strafesnet"} -rbx_xml = { version = "0.13.3", registry = "strafesnet"} +rbx_asset = { version = "0.4.5", registry = "strafesnet" } +rbx_binary = "1.0.0" +rbx_dom_weak = "3.0.0" +rbx_reflection_database = "1.0.3" +rbx_xml = "1.0.0" serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" siphasher = "1.0.1" diff --git a/validation/src/rbx_util.rs b/validation/src/rbx_util.rs index db50048..94129d0 100644 --- a/validation/src/rbx_util.rs +++ b/validation/src/rbx_util.rs @@ -24,6 +24,10 @@ pub fn read_dom(input:R)->Resultrbx_dom_weak::Ustr{ + rbx_dom_weak::ustr(s) +} + pub fn class_is_a(class:&str,superclass:&str)->bool{ if class==superclass{ return true @@ -98,7 +102,7 @@ pub enum StringValueError{ fn string_value(instance:Option<&rbx_dom_weak::Instance>)->Result<&str,StringValueError>{ let instance=instance.ok_or(StringValueError::ObjectNotFound)?; - let value=instance.properties.get("Value").ok_or(StringValueError::ValueNotSet)?; + let value=instance.properties.get(&static_ustr("Value")).ok_or(StringValueError::ValueNotSet)?; match value{ rbx_dom_weak::types::Variant::String(value)=>Ok(value), _=>Err(StringValueError::NonStringValue), diff --git a/validation/src/validator.rs b/validation/src/validator.rs index 28cda8b..0653c47 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -2,7 +2,7 @@ use futures::TryStreamExt; use submissions_api::types::ResourceType; use crate::download::download_asset_version; -use crate::rbx_util::{class_is_a,read_dom,ReadDomError}; +use crate::rbx_util::{class_is_a,read_dom,static_ustr,ReadDomError}; use crate::types::ResourceID; const SCRIPT_CONCURRENCY:usize=16; @@ -101,12 +101,15 @@ impl crate::message_handler::MessageHandler{ /* VALIDATE MAP */ + // stupid ustr thing + let source_property=static_ustr("Source"); + // collect unique scripts let script_refs=get_script_refs(&dom); let mut script_map=std::collections::HashMap::::new(); for &script_ref in &script_refs{ if let Some(script)=dom.get_by_ref(script_ref){ - if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get("Source"){ + if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get(&source_property){ // check the source for illegal keywords if source_has_illegal_keywords(source){ // immediately abort @@ -179,7 +182,7 @@ impl crate::message_handler::MessageHandler{ let mut modified=false; for &script_ref in &script_refs{ if let Some(script)=dom.get_by_ref_mut(script_ref){ - if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get_mut("Source"){ + if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get_mut(&source_property){ match script_map.get(source.as_str()).map(|p|&p.policy){ Some(Policy::Blocked)=>{ let hash=hash_source(source.as_str()); -- 2.49.1 From a11a0d2fd530d71e8882a376bc96c1dff678f520 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 May 2025 23:12:00 -0700 Subject: [PATCH 2/9] validation: clippy fixes --- validation/src/check.rs | 36 ++++++++++++++++++------------------ validation/src/main.rs | 2 +- validation/src/rbx_util.rs | 4 ++-- validation/src/validator.rs | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/validation/src/check.rs b/validation/src/check.rs index bf0e27a..8ab33bc 100644 --- a/validation/src/check.rs +++ b/validation/src/check.rs @@ -152,7 +152,7 @@ pub struct ModelInfo<'a>{ pub fn get_model_info<'a>(dom:&'a rbx_dom_weak::WeakDom,model_instance:&'a rbx_dom_weak::Instance)->ModelInfo<'a>{ // extract model info - let map_info=get_mapinfo(&dom,model_instance); + let map_info=get_mapinfo(dom,model_instance); // count objects (default count is 0) let mut counts=Counts::default(); @@ -206,7 +206,7 @@ impl<'a,Str> StringCheckContext<'a,Str> } } } -impl<'a,Str:std::fmt::Display> std::fmt::Display for StringCheckContext<'a,Str>{ +impl std::fmt::Display for StringCheckContext<'_,Str>{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ write!(f,"expected: {}, observed: {}",self.expected,self.observed) } @@ -259,7 +259,7 @@ impl SetDifferenceCheckContextAllowNone{ impl SetDifferenceCheckContextAllowNone{ fn check(mut self,reference_set:&HashMap)->SetDifferenceCheck{ // remove correct entries - for (id,_) in reference_set{ + for id in reference_set.keys(){ self.extra.remove(id); } // if any entries remain, they are incorrect @@ -281,7 +281,7 @@ impl SetDifferenceCheckContextAtLeastOne{ impl SetDifferenceCheckContextAtLeastOne{ fn check(mut self,reference_set:&HashMap)->SetDifferenceCheck{ // remove correct entries - for (id,_) in reference_set{ + for id in reference_set.keys(){ if self.extra.remove(id).is_none(){ // the set did not contain a required item. This is a fail self.missing.insert(*id); @@ -370,14 +370,14 @@ impl<'a> ModelInfo<'a>{ let game_id=self.map_info.game_id; // MapStart must exist - let mapstart=if self.counts.mode_start_counts.get(&ModeID::MAIN).is_some(){ + let mapstart=if self.counts.mode_start_counts.contains_key(&ModeID::MAIN){ Ok(()) }else{ Err(()) }; // Spawn1 must exist - let spawn1=if self.counts.spawn_counts.get(&SpawnID::FIRST).is_some(){ + let spawn1=if self.counts.spawn_counts.contains_key(&SpawnID::FIRST){ Ok(()) }else{ Err(()) @@ -431,7 +431,7 @@ impl<'a> ModelInfo<'a>{ } } -impl<'a> MapCheck<'a>{ +impl MapCheck<'_>{ fn pass(self)->Result{ match self{ MapCheck{ @@ -485,7 +485,7 @@ macro_rules! write_zone{ } }; } -impl<'a> std::fmt::Display for MapCheck<'a>{ +impl std::fmt::Display for MapCheck<'_>{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ if let StringCheck(Err(context))=&self.model_class{ writeln!(f,"Invalid model class: {context}")?; @@ -521,7 +521,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write!(f," ({} duplicates)",names.len())?; Ok(()) })?; - writeln!(f,"")?; + writeln!(f)?; } if let SetDifferenceCheck(Err(context))=&self.mode_finish_counts{ if !context.extra.is_empty(){ @@ -530,7 +530,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)| write_zone!(f,mode_id,"Finish") )?; - writeln!(f,"")?; + writeln!(f)?; } if !context.missing.is_empty(){ let plural=if context.missing.len()==1{"zone"}else{"zones"}; @@ -538,7 +538,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.missing.iter(),|f,mode_id| write_zone!(f,mode_id,"Finish") )?; - writeln!(f,"")?; + writeln!(f)?; } } if let SetDifferenceCheck(Err(context))=&self.mode_anticheat_counts{ @@ -548,20 +548,20 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)| write_zone!(f,mode_id,"Anticheat") )?; - writeln!(f,"")?; + writeln!(f)?; } } if let Err(())=&self.spawn1{ writeln!(f,"Model has no Spawn1")?; } if let SetDifferenceCheck(Err(context))=&self.teleport_counts{ - for (_,names) in &context.extra{ + for names in context.extra.values(){ let plural=if names.len()==1{"object"}else{"objects"}; write!(f,"No matching Spawn for {plural}: ")?; write_comma_separated(f,names.iter(),|f,&name|{ write!(f,"{name}") })?; - writeln!(f,"")?; + writeln!(f)?; } } if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.spawn_counts{ @@ -569,7 +569,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.iter(),|f,(SpawnID(spawn_id),count)| write!(f,"Spawn{spawn_id} ({count} duplicates)") )?; - writeln!(f,"")?; + writeln!(f)?; } if let SetDifferenceCheck(Err(context))=&self.wormhole_in_counts{ if !context.extra.is_empty(){ @@ -577,7 +577,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.extra.iter(),|f,(WormholeID(wormhole_id),_count)| write!(f,"WormholeIn{wormhole_id}") )?; - writeln!(f,"")?; + writeln!(f)?; } if !context.missing.is_empty(){ // This counts WormholeIn objects, but @@ -586,7 +586,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.missing.iter(),|f,WormholeID(wormhole_id)| write!(f,"WormholeOut{wormhole_id}") )?; - writeln!(f,"")?; + writeln!(f)?; } } if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.wormhole_out_counts{ @@ -594,7 +594,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{ write_comma_separated(f,context.iter(),|f,(WormholeID(wormhole_id),count)| write!(f,"WormholeOut{wormhole_id} ({count} duplicates)") )?; - writeln!(f,"")?; + writeln!(f)?; } Ok(()) } diff --git a/validation/src/main.rs b/validation/src/main.rs index 801ea3f..69ea99a 100644 --- a/validation/src/main.rs +++ b/validation/src/main.rs @@ -43,7 +43,7 @@ async fn main()->Result<(),StartupError>{ "None"=>None, _=>Some(s.parse().expect("ROBLOX_GROUP_ID int parse")), }, - Err(e)=>Err(e).expect("ROBLOX_GROUP_ID env required"), + Err(e)=>panic!("{e}: ROBLOX_GROUP_ID env required"), }; // create / upload models through STRAFESNET_CI2 account diff --git a/validation/src/rbx_util.rs b/validation/src/rbx_util.rs index 94129d0..4ce2f28 100644 --- a/validation/src/rbx_util.rs +++ b/validation/src/rbx_util.rs @@ -35,7 +35,7 @@ pub fn class_is_a(class:&str,superclass:&str)->bool{ let class_descriptor=rbx_reflection_database::get().classes.get(class); if let Some(descriptor)=&class_descriptor{ if let Some(class_super)=&descriptor.superclass{ - return class_is_a(&class_super,superclass) + return class_is_a(class_super,superclass) } } false @@ -71,7 +71,7 @@ impl std::str::FromStr for GameID{ if s.starts_with("flytrials_"){ return Ok(GameID::FlyTrials); } - return Err(ParseGameIDError); + Err(ParseGameIDError) } } pub struct GameIDError; diff --git a/validation/src/validator.rs b/validation/src/validator.rs index 0653c47..05ff04a 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -21,7 +21,7 @@ struct NamePolicy{ } fn source_has_illegal_keywords(source:&str)->bool{ - source.find("getfenv").is_some()||source.find("require").is_some() + source.contains("getfenv")||source.contains("require") } fn hash_source(source:&str)->String{ -- 2.49.1 From fc9aae4235df3ee9443c1db3f3fadcd924e76d71 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 May 2025 23:15:18 -0700 Subject: [PATCH 3/9] submissions-api: appease clippy --- validation/api/src/external.rs | 10 +++++----- validation/api/src/internal.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/validation/api/src/external.rs b/validation/api/src/external.rs index 8aa00d2..58f93fa 100644 --- a/validation/api/src/external.rs +++ b/validation/api/src/external.rs @@ -16,7 +16,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_scripts<'a>(&self,config:GetScriptsRequest<'a>)->Result,Error>{ + pub async fn get_scripts(&self,config:GetScriptsRequest<'_>)->Result,Error>{ let url_raw=format!("{}/scripts",self.0.base_url); let mut url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -46,7 +46,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_from_hash<'a>(&self,config:HashRequest<'a>)->Result,SingleItemError>{ + pub async fn get_script_from_hash(&self,config:HashRequest<'_>)->Result,SingleItemError>{ let scripts=self.get_scripts(GetScriptsRequest{ Page:1, Limit:2, @@ -61,7 +61,7 @@ impl Context{ } Ok(scripts.into_iter().next()) } - pub async fn create_script<'a>(&self,config:CreateScriptRequest<'a>)->Result{ + pub async fn create_script(&self,config:CreateScriptRequest<'_>)->Result{ let url_raw=format!("{}/scripts",self.0.base_url); let url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -72,7 +72,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_policies<'a>(&self,config:GetScriptPoliciesRequest<'a>)->Result,Error>{ + pub async fn get_script_policies(&self,config:GetScriptPoliciesRequest<'_>)->Result,Error>{ let url_raw=format!("{}/script-policy",self.0.base_url); let mut url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -96,7 +96,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_policy_from_hash<'a>(&self,config:HashRequest<'a>)->Result,SingleItemError>{ + pub async fn get_script_policy_from_hash(&self,config:HashRequest<'_>)->Result,SingleItemError>{ let policies=self.get_script_policies(GetScriptPoliciesRequest{ Page:1, Limit:2, diff --git a/validation/api/src/internal.rs b/validation/api/src/internal.rs index fb418f6..79faa4a 100644 --- a/validation/api/src/internal.rs +++ b/validation/api/src/internal.rs @@ -46,7 +46,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_scripts<'a>(&self,config:GetScriptsRequest<'a>)->Result,Error>{ + pub async fn get_scripts(&self,config:GetScriptsRequest<'_>)->Result,Error>{ let url_raw=format!("{}/scripts",self.0.base_url); let mut url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -76,7 +76,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_from_hash<'a>(&self,config:HashRequest<'a>)->Result,SingleItemError>{ + pub async fn get_script_from_hash(&self,config:HashRequest<'_>)->Result,SingleItemError>{ let scripts=self.get_scripts(GetScriptsRequest{ Page:1, Limit:2, @@ -91,7 +91,7 @@ impl Context{ } Ok(scripts.into_iter().next()) } - pub async fn create_script<'a>(&self,config:CreateScriptRequest<'a>)->Result{ + pub async fn create_script(&self,config:CreateScriptRequest<'_>)->Result{ let url_raw=format!("{}/scripts",self.0.base_url); let url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -102,7 +102,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_policies<'a>(&self,config:GetScriptPoliciesRequest<'a>)->Result,Error>{ + pub async fn get_script_policies(&self,config:GetScriptPoliciesRequest<'_>)->Result,Error>{ let url_raw=format!("{}/script-policy",self.0.base_url); let mut url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -126,7 +126,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn get_script_policy_from_hash<'a>(&self,config:HashRequest<'a>)->Result,SingleItemError>{ + pub async fn get_script_policy_from_hash(&self,config:HashRequest<'_>)->Result,SingleItemError>{ let policies=self.get_script_policies(GetScriptPoliciesRequest{ Page:1, Limit:2, @@ -150,7 +150,7 @@ impl Context{ ).await.map_err(Error::Response)? .json().await.map_err(Error::ReqwestJson) } - pub async fn create_submission<'a>(&self,config:CreateSubmissionRequest<'a>)->Result{ + pub async fn create_submission(&self,config:CreateSubmissionRequest<'_>)->Result{ let url_raw=format!("{}/submissions",self.0.base_url); let url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; @@ -182,7 +182,7 @@ impl Context{ action!("submissions",action_submission_accepted,config,ActionSubmissionAcceptedRequest,"status/validator-failed",config.SubmissionID, ("ErrorMessage",config.ErrorMessage.as_str()) ); - pub async fn create_mapfix<'a>(&self,config:CreateMapfixRequest<'a>)->Result{ + pub async fn create_mapfix(&self,config:CreateMapfixRequest<'_>)->Result{ let url_raw=format!("{}/mapfixes",self.0.base_url); let url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?; -- 2.49.1 From 9dd7156f383ec2ff556680c2f331d3f7f91be1cf Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 May 2025 23:34:02 -0700 Subject: [PATCH 4/9] validation: avoid passing large struct in Err --- validation/src/check.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/validation/src/check.rs b/validation/src/check.rs index 8ab33bc..c1751b3 100644 --- a/validation/src/check.rs +++ b/validation/src/check.rs @@ -432,7 +432,7 @@ impl<'a> ModelInfo<'a>{ } impl MapCheck<'_>{ - fn pass(self)->Result{ + fn result(self)->Result{ match self{ MapCheck{ model_class:StringCheck(Ok(())), @@ -456,7 +456,7 @@ impl MapCheck<'_>{ game_id, }) }, - other=>Err(other), + other=>Err(other.to_string()), } } } @@ -638,7 +638,7 @@ impl crate::message_handler::MessageHandler{ let map_check=model_info.check(); // check the report, generate an error message if it fails the check - let status=map_check.pass().map_err(|e|e.to_string()); + let status=map_check.result(); Ok(CheckReportAndVersion{status,version}) } -- 2.49.1 From e30fb5f91626318fe6b201078a4c0683d4659a5f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 May 2025 23:56:45 -0700 Subject: [PATCH 5/9] validation: checks: named dummy types for readability --- validation/src/check.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/validation/src/check.rs b/validation/src/check.rs index c1751b3..a846f3d 100644 --- a/validation/src/check.rs +++ b/validation/src/check.rs @@ -302,8 +302,12 @@ pub struct MapInfoOwned{ pub game_id:GameID, } +// Named dummy types for readability +struct Exists; +struct Absent; + // crazy! -pub struct MapCheck<'a>{ +struct MapCheck<'a>{ // === METADATA CHECKS === // The root must be of class Model model_class:StringCheck<'a,(),&'static str>, @@ -321,7 +325,7 @@ pub struct MapCheck<'a>{ // === MODE CHECKS === // MapStart must exist - mapstart:Result<(),()>, + mapstart:Result, // No duplicate map starts (including bonuses) mode_start_counts:DuplicateCheck>, // At least one finish zone for each start zone, and no finishes with no start @@ -329,7 +333,7 @@ pub struct MapCheck<'a>{ // Check for dangling MapAnticheat zones (no associated MapStart) mode_anticheat_counts:SetDifferenceCheck>>, // Spawn1 must exist - spawn1:Result<(),()>, + spawn1:Result, // Check for dangling Teleport# (no associated Spawn#) teleport_counts:SetDifferenceCheck>>, // No duplicate Spawn# @@ -371,16 +375,16 @@ impl<'a> ModelInfo<'a>{ // MapStart must exist let mapstart=if self.counts.mode_start_counts.contains_key(&ModeID::MAIN){ - Ok(()) + Ok(Exists) }else{ - Err(()) + Err(Absent) }; // Spawn1 must exist let spawn1=if self.counts.spawn_counts.contains_key(&SpawnID::FIRST){ - Ok(()) + Ok(Exists) }else{ - Err(()) + Err(Absent) }; // Check that at least one finish zone exists for each start zone. @@ -440,11 +444,11 @@ impl MapCheck<'_>{ display_name:Ok(Ok(StringCheck(Ok(display_name)))), creator:Ok(Ok(creator)), game_id:Ok(game_id), - mapstart:Ok(()), + mapstart:Ok(Exists), mode_start_counts:DuplicateCheck(Ok(())), mode_finish_counts:SetDifferenceCheck(Ok(())), mode_anticheat_counts:SetDifferenceCheck(Ok(())), - spawn1:Ok(()), + spawn1:Ok(Exists), teleport_counts:SetDifferenceCheck(Ok(())), spawn_counts:DuplicateCheck(Ok(())), wormhole_in_counts:SetDifferenceCheck(Ok(())), @@ -511,7 +515,7 @@ impl std::fmt::Display for MapCheck<'_>{ if let Err(_parse_game_id_error)=&self.game_id{ writeln!(f,"Model name must be prefixed with bhop_ surf_ or flytrials_")?; } - if let Err(())=&self.mapstart{ + if let Err(Absent)=&self.mapstart{ writeln!(f,"Model has no MapStart")?; } if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.mode_start_counts{ @@ -551,7 +555,7 @@ impl std::fmt::Display for MapCheck<'_>{ writeln!(f)?; } } - if let Err(())=&self.spawn1{ + if let Err(Absent)=&self.spawn1{ writeln!(f,"Model has no Spawn1")?; } if let SetDifferenceCheck(Err(context))=&self.teleport_counts{ -- 2.49.1 From 0dff4645615dbba3fb6e50e0d08e13ebb55d31ee Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 May 2025 00:21:05 -0700 Subject: [PATCH 6/9] validation: checks: write many documentation --- validation/src/check.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/validation/src/check.rs b/validation/src/check.rs index a846f3d..5ba1c64 100644 --- a/validation/src/check.rs +++ b/validation/src/check.rs @@ -56,6 +56,7 @@ pub enum IDParseError{ NoCaptures, ParseInt(core::num::ParseIntError) } +// Parse a Zone from a part name impl std::str::FromStr for Zone{ type Err=IDParseError; fn from_str(s:&str)->Result{ @@ -94,6 +95,7 @@ enum SpawnTeleport{ Teleport(SpawnID), Spawn(SpawnID), } +// Parse a SpawnTeleport from a part name impl std::str::FromStr for SpawnTeleport{ type Err=IDParseError; fn from_str(s:&str)->Result{ @@ -117,6 +119,7 @@ enum Wormhole{ In(WormholeID), Out(WormholeID), } +// Parse a Wormhole from a part name impl std::str::FromStr for Wormhole{ type Err=IDParseError; fn from_str(s:&str)->Result{ @@ -132,6 +135,7 @@ impl std::str::FromStr for Wormhole{ } } +/// Count various map elements #[derive(Default)] struct Counts<'a>{ mode_start_counts:HashMap>, @@ -198,6 +202,7 @@ impl<'a,Str> StringCheckContext<'a,Str> where &'a str:PartialEq, { + /// Compute the StringCheck, passing through the provided value on success. fn check(self,value:T)->StringCheck<'a,T,Str>{ if self.observed==self.expected{ StringCheck(Ok(value)) @@ -227,6 +232,7 @@ fn check_empty(value:&str)->Result<&str,StringEmpty>{ pub struct DuplicateCheckContext(HashMap); pub struct DuplicateCheck(Result<(),DuplicateCheckContext>); impl DuplicateCheckContext{ + /// Compute the DuplicateCheck using the contents predicate. fn check(self,f:impl Fn(&T)->bool)->DuplicateCheck{ let Self(mut set)=self; // remove correct entries @@ -240,10 +246,11 @@ impl DuplicateCheckContext{ } } -// check that there is at least one matching item for each item in a reference set, and no extra items +// Check that there are no items which do not have a matching item in a reference set pub struct SetDifferenceCheckContextAllowNone{ extra:HashMap, } +// Check that there is at least one matching item for each item in a reference set, and no extra items pub struct SetDifferenceCheckContextAtLeastOne{ extra:HashMap, missing:HashSet, @@ -257,6 +264,7 @@ impl SetDifferenceCheckContextAllowNone{ } } impl SetDifferenceCheckContextAllowNone{ + /// Compute the SetDifferenceCheck result for the specified reference set. fn check(mut self,reference_set:&HashMap)->SetDifferenceCheck{ // remove correct entries for id in reference_set.keys(){ @@ -279,6 +287,7 @@ impl SetDifferenceCheckContextAtLeastOne{ } } impl SetDifferenceCheckContextAtLeastOne{ + /// Compute the SetDifferenceCheck result for the specified reference set. fn check(mut self,reference_set:&HashMap)->SetDifferenceCheck{ // remove correct entries for id in reference_set.keys(){ @@ -296,6 +305,7 @@ impl SetDifferenceCheckContextAtLeastOne{ } } +/// Info lifted out of a fully compliant map pub struct MapInfoOwned{ pub display_name:String, pub creator:String, @@ -306,7 +316,7 @@ pub struct MapInfoOwned{ struct Exists; struct Absent; -// crazy! +/// The result of every map check. struct MapCheck<'a>{ // === METADATA CHECKS === // The root must be of class Model @@ -480,6 +490,7 @@ fn write_comma_separated( Ok(()) } +/// Write a zone string such as BonusStart macro_rules! write_zone{ ($f:expr,$mode:expr,$zone:expr)=>{ match $mode{ @@ -489,6 +500,9 @@ macro_rules! write_zone{ } }; } + +// Generate an error message for each observed issue separated by newlines. +// This defines MapCheck.to_string() which is used in MapCheck.result() impl std::fmt::Display for MapCheck<'_>{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ if let StringCheck(Err(context))=&self.model_class{ -- 2.49.1 From e3667fec0c3a6ef338f49dd591ff2a0dcdd3006a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 May 2025 00:41:17 -0700 Subject: [PATCH 7/9] validation: refactor some goofy roblox functions --- validation/src/rbx_util.rs | 30 +++++++++--------------------- validation/src/validator.rs | 23 ++++++++--------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/validation/src/rbx_util.rs b/validation/src/rbx_util.rs index 4ce2f28..fdff4d5 100644 --- a/validation/src/rbx_util.rs +++ b/validation/src/rbx_util.rs @@ -29,27 +29,15 @@ pub fn static_ustr(s:&'static str)->rbx_dom_weak::Ustr{ } pub fn class_is_a(class:&str,superclass:&str)->bool{ - if class==superclass{ - return true - } - let class_descriptor=rbx_reflection_database::get().classes.get(class); - if let Some(descriptor)=&class_descriptor{ - if let Some(class_super)=&descriptor.superclass{ - return class_is_a(class_super,superclass) - } - } - false + let db=rbx_reflection_database::get(); + let (Some(class),Some(superclass))=(db.classes.get(class),db.classes.get(superclass))else{ + return false; + }; + db.has_superclass(class,superclass) } -pub fn find_first_child_class<'a>(dom:&'a rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance,name:&str,class:&str)->Option<&'a rbx_dom_weak::Instance>{ - for &referent in instance.children(){ - if let Some(c)=dom.get_by_ref(referent){ - if c.name==name&&class_is_a(c.class.as_str(),class) { - return Some(c); - } - } - } - None +fn find_first_child_name_and_class<'a>(dom:&'a rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance,name:&str,class:&str)->Option<&'a rbx_dom_weak::Instance>{ + instance.children().iter().filter_map(|&r|dom.get_by_ref(r)).find(|inst|inst.name==name&&inst.class==class) } pub enum GameID{ @@ -126,8 +114,8 @@ pub fn get_root_instance(dom:&rbx_dom_weak::WeakDom)->Result<&rbx_dom_weak::Inst pub fn get_mapinfo<'a>(dom:&'a rbx_dom_weak::WeakDom,model_instance:&rbx_dom_weak::Instance)->MapInfo<'a>{ MapInfo{ - display_name:string_value(find_first_child_class(dom,model_instance,"DisplayName","StringValue")), - creator:string_value(find_first_child_class(dom,model_instance,"Creator","StringValue")), + display_name:string_value(find_first_child_name_and_class(dom,model_instance,"DisplayName","StringValue")), + creator:string_value(find_first_child_name_and_class(dom,model_instance,"Creator","StringValue")), game_id:model_instance.name.parse(), } } diff --git a/validation/src/validator.rs b/validation/src/validator.rs index 05ff04a..26ac08c 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -2,7 +2,7 @@ use futures::TryStreamExt; use submissions_api::types::ResourceType; use crate::download::download_asset_version; -use crate::rbx_util::{class_is_a,read_dom,static_ustr,ReadDomError}; +use crate::rbx_util::{read_dom,static_ustr,ReadDomError}; use crate::types::ResourceID; const SCRIPT_CONCURRENCY:usize=16; @@ -280,17 +280,6 @@ impl crate::message_handler::MessageHandler{ } } -fn recursive_collect_superclass(objects:&mut std::vec::Vec,dom:&rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance,superclass:&str){ - for &referent in instance.children(){ - if let Some(c)=dom.get_by_ref(referent){ - if class_is_a(c.class.as_str(),superclass){ - objects.push(c.referent());//copy ref - } - recursive_collect_superclass(objects,dom,c,superclass); - } - } -} - fn get_partial_path(dom:&rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance)->String{ let mut names:Vec<_>=core::iter::successors( Some(instance), @@ -305,7 +294,11 @@ fn get_partial_path(dom:&rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance) } fn get_script_refs(dom:&rbx_dom_weak::WeakDom)->Vec{ - let mut scripts=std::vec::Vec::new(); - recursive_collect_superclass(&mut scripts,dom,dom.root(),"LuaSourceContainer"); - scripts + let db=rbx_reflection_database::get(); + let superclass=&db.classes["LuaSourceContainer"]; + dom.descendants().filter_map(|inst|{ + let class=db.classes.get(inst.class.as_str())?; + db.has_superclass(class,superclass) + .then_some(inst.referent()) + }).collect() } -- 2.49.1 From 636282b9939de00531290a474cea3113a19ddbb9 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 May 2025 00:49:12 -0700 Subject: [PATCH 8/9] submissions-api: make error type smaller --- validation/api/src/types.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/validation/api/src/types.rs b/validation/api/src/types.rs index c5a1988..1e4ffe2 100644 --- a/validation/api/src/types.rs +++ b/validation/api/src/types.rs @@ -27,8 +27,7 @@ impl std::error::Error for SingleItemError{} #[allow(dead_code)] #[derive(Debug)] -pub struct StatusCodeWithUrlAndBody{ - pub status_code:reqwest::StatusCode, +pub struct UrlAndBody{ pub url:url::Url, pub body:String, } @@ -36,7 +35,10 @@ pub struct StatusCodeWithUrlAndBody{ #[derive(Debug)] pub enum ResponseError{ Reqwest(reqwest::Error), - StatusCodeWithUrlAndBody(StatusCodeWithUrlAndBody), + Details{ + status_code:reqwest::StatusCode, + url_and_body:Box, + }, } impl std::fmt::Display for ResponseError{ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -53,11 +55,10 @@ pub async fn response_ok(response:reqwest::Response)->Result Date: Wed, 14 May 2025 00:49:31 -0700 Subject: [PATCH 9/9] submissions-api v0.7.1 make error type smaller --- Cargo.lock | 2 +- validation/api/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62a90d4..96674a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1889,7 +1889,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "submissions-api" -version = "0.7.0" +version = "0.7.1" dependencies = [ "reqwest", "serde", diff --git a/validation/api/Cargo.toml b/validation/api/Cargo.toml index 0945e07..42321bc 100644 --- a/validation/api/Cargo.toml +++ b/validation/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "submissions-api" -version = "0.7.0" +version = "0.7.1" edition = "2021" publish = ["strafesnet"] repository = "https://git.itzana.me/StrafesNET/maps-service" -- 2.49.1