diff --git a/.vscode/settings.json b/.vscode/settings.json index fe73865..0363b5c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,8 @@ "__locale": "c", "__config": "c", "unistd.h": "c" - } + }, + "rust-analyzer.linkedProjects": [ + "./Cargo.toml" + ] } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 8bd759e..efb7acb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -283,7 +283,7 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.1.1", "async-executor", - "async-io 2.3.0", + "async-io 2.3.1", "async-lock 3.3.0", "blocking", "futures-lite 2.2.0", @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" +checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" dependencies = [ "async-lock 3.3.0", "cfg-if", @@ -476,14 +476,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -783,9 +782,9 @@ dependencies = [ [[package]] name = "cairo-lang-casm" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3085455fa119efc82b887950b56d4d34a10348ae8a29f422101f2b199438ca6" +checksum = "07a30d11844a5376f4d785508f83da4ac9db71fb757da598916ff7c58c856610" dependencies = [ "cairo-lang-utils", "hashbrown 0.14.3", @@ -798,9 +797,9 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "470c388cd2a281788c4dfec42821ba313a4e49e304fd2d2c9e66bf4300aa9f34" +checksum = "8c13fe3c368ef1d652099bc74713e8fbea1c09fb10f2ae5bb0445e0ce04df1c9" dependencies = [ "anyhow", "cairo-lang-defs", @@ -820,18 +819,18 @@ dependencies = [ [[package]] name = "cairo-lang-debug" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab648e172102fc4a6c45d99b56d440684dbe89c9e707f3cfb32adb711818834" +checksum = "a6bd81d0031a4044db8816294cec4145ca7c5620b949e25d350874d56f57154f" dependencies = [ "cairo-lang-utils", ] [[package]] name = "cairo-lang-defs" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0772c941cce18e5ebc64b138db5579fdd4ce776d8afb9d8d310df42e01d367a4" +checksum = "b4f8ac0354159eaaff013bed20d9cf28d351d17a9b9b18ecf300bdbb4b24e04b" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -846,9 +845,9 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d641d9b6200c1d79c2da92ab14dcfad211676cd7775d67028f1132581da2b" +checksum = "e400b77e35a4de62562a1c4307f2dac3a9b99de55f9e2cc0759104842c0b0e98" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -858,9 +857,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "860afc2931051a91866c64058b1f682ab3b1d6bd67d07153261de63536659542" +checksum = "8506294b7e1b6dc7f6236ce8506b0879f49b27cfe2b61489aba83d80a42f81a9" dependencies = [ "cairo-lang-utils", "good_lp", @@ -868,9 +867,9 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fe3c207886492581816d744a81f2ee81d2fee6f7326b62caa7c5f99fd658887" +checksum = "f96a8a04c10006821fbe3eab969cd35829414bae81c09901c448a60e2c21e828" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -882,9 +881,9 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff23dfe3e4de8613a7044cb0a313826b049cc8b8a89aa6dffed326b3d0c6405" +checksum = "2a436006d9a729386bd7eba30bf7ab00747b25e474f671eb2d69766488e00333" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -907,9 +906,9 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5ad088b73ec17360766e1149de6a09f43cfd610ff54f19c6c02bb39b05a725" +checksum = "6550788dece0a5cad2b01959a16c6802a7006db1f0e27f5081fd68010b3c7a37" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -927,9 +926,9 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22353bef64e394ffe12d21d6c1aa61894af1faa8cf511c6675cbce0c8cc3065e" +checksum = "e751f2861fea91f3a9180a1a89c1fc6c92e036c7dc7112409857dd0e601d88aa" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -946,9 +945,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49bc7b990207a91e756c2045015cd94ba366ed9fea467ab45358b4ed9e046326" +checksum = "f52c5ccd1aaa6a3bcec87315fd28f0bc2b62427ae45d03db46d9aeac8fc1ae2f" dependencies = [ "cairo-lang-debug", "quote", @@ -957,9 +956,9 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa408032bab9d665d02e5a5b60a5fe3414abb4ea49f7de4cdf606fec008b31e8" +checksum = "808d117ffeb652acff54b3ceaa53e17e871f1fc4035ec3689d44da8db287dac8" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -971,9 +970,9 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea038491d2d6a46f4cbc053713c2a0a4aeffeb76d97ccea18f7260e459b4dc19" +checksum = "7103052d7b7dc83a90658b7b51a7bcebb9faf7f22e54081cb6cdce900ed70da9" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -996,9 +995,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba35ff92b43872a8f89a8745e6fa911d964b47c145011d96b2d8ebf1aad8fa3" +checksum = "c55276cb67cc547e72ab4cee555770f486bab1c8f19aff2455cc9495dd28115f" dependencies = [ "anyhow", "cairo-felt", @@ -1022,9 +1021,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac25af35be8ee9b47d8db4d39b2c9359fc8013acb8ed933cc751bbb54e8fa78e" +checksum = "39970d91c3fc20cd350c8a76d82f528e80e531bb5ad98a330dfb02a09128cda3" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -1037,9 +1036,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e510821a12693b8486614d0a43b3e776163bc9dbeedcd9a9d949124a6789271c" +checksum = "06844f90a83cb1fa922f6f88d7db6ae93ec0e4e82f04bf246172c1590de79231" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -1052,9 +1051,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5b905f46390e4d5d26bfb632cdb747e8a2fc31866b39a082289d2cc7fa348c" +checksum = "d6694b763489ea0d796d5cc22c787b315b6fe03190734a8b24f65d7506129f1e" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -1075,9 +1074,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa4bdbacf02bf4b13c2b891e2396567ad733f20d7e59526255e07c897a14405" +checksum = "c8591a3131e62f7bb744cc6f27165acb739e71b94739919fbfcd1886f62fa0bf" dependencies = [ "assert_matches", "cairo-felt", @@ -1096,9 +1095,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854d43c5e1c0cf7e24cc58e665b60f1bb3d603615c72e13aad872a9548b44359" +checksum = "154bf40391f856f86e028422fedd073d17a1510903aeb479bfda4d04f9d4089c" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -1106,9 +1105,9 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fe48d254ffdce63c5f6eb001d663d4d9b77c3f30a4bcb0124be6ac8177830f" +checksum = "cf4e8f9903899c2f1344e6ac5ee71f5c2f3846311d25dbe2e2bd5b566a278dd3" dependencies = [ "anyhow", "cairo-felt", @@ -1118,6 +1117,7 @@ dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", "cairo-lang-lowering", + "cairo-lang-plugins", "cairo-lang-semantic", "cairo-lang-sierra", "cairo-lang-sierra-generator", @@ -1143,9 +1143,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983fa8cc3d92ac4d80cba2a6a1511a03f71384a953464ccf7809cddcb1714e86" +checksum = "eafc3a24ddb3449119cc172c1a5f35ac910f2125a156899041f40163e3164752" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -1159,9 +1159,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa5e57952da2c330df7e63181d57b80e639096e061dff2c30730b7f7a124dda" +checksum = "0f87394080ae908a035805b009759e505e98181d8b01d5203516dae64afcbe47" dependencies = [ "genco", "xshell", @@ -1169,12 +1169,12 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fa45c5e537470c11f620576e80d1f3a8d0096e7d7070fcc3248fa960a186b6" +checksum = "d3fff10b24d068c6378904a5d926e0ef3e2150881ea75ca513122dbeb2183bc4" dependencies = [ "hashbrown 0.14.3", - "indexmap 2.1.0", + "indexmap 2.2.1", "itertools 0.11.0", "num-bigint", "num-traits 0.2.17", @@ -1549,9 +1549,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "da01daa5f6d41c91358398e8db4dde38e292378da1f28300b59ef4732b879454" dependencies = [ "darling_core", "darling_macro", @@ -1559,9 +1559,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "f44f6238b948a3c6c3073cdf53bb0c2d5e024ee27e0f35bfe9d556a12395808a" dependencies = [ "fnv", "ident_case", @@ -1573,9 +1573,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "0d2d88bd93979b1feb760a6b5c531ac5ba06bd63e74894c377af02faee07b9cd" dependencies = [ "darling_core", "quote", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "dojo-types" version = "0.5.1-alpha.1" -source = "git+https://github.com/dojoengine/dojo#68e21992da4a1d038be316801b30eee98c4fc5ce" +source = "git+https://github.com/Larkooo/dojo?branch=fix-borrow#32ff50b2647dc863cb2719c2ef12fa04223daf46" dependencies = [ "crypto-bigint", "hex", @@ -1750,7 +1750,7 @@ dependencies = [ [[package]] name = "dojo-world" version = "0.5.1-alpha.1" -source = "git+https://github.com/dojoengine/dojo#68e21992da4a1d038be316801b30eee98c4fc5ce" +source = "git+https://github.com/Larkooo/dojo?branch=fix-borrow#32ff50b2647dc863cb2719c2ef12fa04223daf46" dependencies = [ "anyhow", "async-trait", @@ -2108,7 +2108,7 @@ dependencies = [ [[package]] name = "futures-bounded" version = "0.2.3" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures-timer", "futures-util", @@ -2379,7 +2379,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.1", "slab", "tokio", "tokio-util", @@ -2702,7 +2702,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" dependencies = [ - "async-io 2.3.0", + "async-io 2.3.1", "core-foundation", "fnv", "futures", @@ -2791,9 +2791,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2907,9 +2907,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -3003,7 +3003,7 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libp2p" version = "0.53.2" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "bytes", "either", @@ -3037,7 +3037,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -3048,7 +3048,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", "libp2p-identity", @@ -3087,7 +3087,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.41.2" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "either", "fnv", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.41.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "async-trait", "futures", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.46.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "base64 0.21.7", @@ -3190,7 +3190,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "either", @@ -3230,7 +3230,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "data-encoding", "futures", @@ -3250,7 +3250,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.14.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures", "instant", @@ -3268,7 +3268,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "bytes", @@ -3293,7 +3293,7 @@ dependencies = [ [[package]] name = "libp2p-ping" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "either", "futures", @@ -3310,7 +3310,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.10.2" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "bytes", "futures", @@ -3333,7 +3333,7 @@ dependencies = [ [[package]] name = "libp2p-relay" version = "0.17.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "bytes", @@ -3378,7 +3378,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.44.2" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "either", "fnv", @@ -3403,7 +3403,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.34.3" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -3414,7 +3414,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures", "futures-timer", @@ -3430,7 +3430,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures", "futures-rustls", @@ -3448,7 +3448,7 @@ dependencies = [ [[package]] name = "libp2p-upnp" version = "0.2.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures", "futures-timer", @@ -3463,7 +3463,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.7.1-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "async-trait", "bytes", @@ -3491,7 +3491,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-utils" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "bytes", @@ -3513,7 +3513,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-websys" version = "0.3.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "bytes", "futures", @@ -3534,7 +3534,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.45.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "either", "futures", @@ -3606,9 +3606,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" +checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22" dependencies = [ "hashbrown 0.14.3", ] @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "bytes", "futures", @@ -4232,7 +4232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.1", ] [[package]] @@ -4448,30 +4448,6 @@ dependencies = [ "toml_edit 0.20.7", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.78" @@ -4643,7 +4619,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.3.1" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "asynchronous-codec", "bytes", @@ -5141,7 +5117,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p#1139f1c170c36d7223bb8c52c667b111ea5c5fbc" +source = "git+https://github.com/libp2p/rust-libp2p#fe29beee77d09f727b3e901798e9162dece50532" dependencies = [ "futures", "pin-project", @@ -5300,9 +5276,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] @@ -5320,9 +5296,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -5353,9 +5329,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -5524,9 +5500,9 @@ dependencies = [ [[package]] name = "snow" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e87c18a6608909007e75a60e04d03eda77b601c94de1c74d9a9dc2c04ab789a" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ "aes-gcm", "blake2", @@ -5601,7 +5577,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ - "itertools 0.12.0", + "itertools 0.12.1", "nom", "unicode_categories", ] @@ -5644,7 +5620,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.1.0", + "indexmap 2.2.1", "log", "memchr", "once_cell", @@ -6397,7 +6373,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.1", "toml_datetime", "winnow", ] @@ -6408,7 +6384,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.1", "serde", "serde_spanned", "toml_datetime", @@ -6551,7 +6527,7 @@ dependencies = [ [[package]] name = "torii-client" version = "0.5.1-alpha.1" -source = "git+https://github.com/dojoengine/dojo#68e21992da4a1d038be316801b30eee98c4fc5ce" +source = "git+https://github.com/Larkooo/dojo?branch=fix-borrow#32ff50b2647dc863cb2719c2ef12fa04223daf46" dependencies = [ "async-trait", "crypto-bigint", @@ -6579,7 +6555,7 @@ dependencies = [ [[package]] name = "torii-grpc" version = "0.5.1-alpha.1" -source = "git+https://github.com/dojoengine/dojo#68e21992da4a1d038be316801b30eee98c4fc5ce" +source = "git+https://github.com/Larkooo/dojo?branch=fix-borrow#32ff50b2647dc863cb2719c2ef12fa04223daf46" dependencies = [ "bytes", "crypto-bigint", @@ -6618,7 +6594,7 @@ dependencies = [ [[package]] name = "torii-relay" version = "0.5.1-alpha.1" -source = "git+https://github.com/dojoengine/dojo#68e21992da4a1d038be316801b30eee98c4fc5ce" +source = "git+https://github.com/Larkooo/dojo?branch=fix-borrow#32ff50b2647dc863cb2719c2ef12fa04223daf46" dependencies = [ "anyhow", "async-trait", @@ -7567,9 +7543,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index f58a521..59c9b5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,12 +4,12 @@ name = "dojo-c" version = "0.1.1" [lib] -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] [dependencies] -dojo-types = { git = "https://github.com/dojoengine/dojo" } -torii-client = { git = "https://github.com/dojoengine/dojo" } -torii-grpc = { git = "https://github.com/dojoengine/dojo", features = [ +dojo-types = { git = "https://github.com/Larkooo/dojo", branch = "fix-borrow" } +torii-client = { git = "https://github.com/Larkooo/dojo", branch = "fix-borrow" } +torii-grpc = { git = "https://github.com/Larkooo/dojo", branch = "fix-borrow", features = [ "client", ] } diff --git a/dojo.h b/dojo.h index 7add880..d4c1f18 100644 --- a/dojo.h +++ b/dojo.h @@ -81,6 +81,23 @@ typedef struct CArrayu8 { uintptr_t data_len; } CArrayu8; +typedef enum ResultCArrayu8_Tag { + OkCArrayu8, + ErrCArrayu8, +} ResultCArrayu8_Tag; + +typedef struct ResultCArrayu8 { + ResultCArrayu8_Tag tag; + union { + struct { + struct CArrayu8 ok; + }; + struct { + struct Error err; + }; + }; +} ResultCArrayu8; + typedef struct FieldElement { uint8_t data[32]; } FieldElement; @@ -530,7 +547,7 @@ struct ResultToriiClient client_new(const char *torii_url, const struct KeysClause *entities, uintptr_t entities_len); -void client_run_libp2p(struct ToriiClient *client); +void client_run_relay(struct ToriiClient *client); struct Resultbool client_on_message(struct ToriiClient *client, void (*callback)(const char *propagation_source, @@ -543,9 +560,9 @@ struct Resultbool client_subscribe_topic(struct ToriiClient *client, const char struct Resultbool client_unsubscribe_topic(struct ToriiClient *client, const char *topic); -struct Resultbool client_publish_message(struct ToriiClient *client, - const char *topic, - struct CArrayu8 data); +struct ResultCArrayu8 client_publish_message(struct ToriiClient *client, + const char *topic, + struct CArrayu8 data); struct ResultCOptionTy client_model(struct ToriiClient *client, const struct KeysClause *keys); diff --git a/src/libc.rs b/src/libc.rs index 5e109da..8c49ec1 100644 --- a/src/libc.rs +++ b/src/libc.rs @@ -76,11 +76,11 @@ pub unsafe extern "C" fn client_new( #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn client_run_libp2p(client: *mut ToriiClient) { - let libp2p_runner = (*client).inner.run_libp2p(); +pub unsafe extern "C" fn client_run_relay(client: *mut ToriiClient) { + let relay_runner = (*client).inner.relay_client_runner(); (*client).runtime.spawn(async move { - libp2p_runner.await; + relay_runner.lock().await.run().await; }); } @@ -96,7 +96,7 @@ pub unsafe extern "C" fn client_on_message( data: CArray, ), ) -> Result { - let stream = (*client).inner.libp2p_message_stream(); + let stream = (*client).inner.relay_client_stream(); (*client).runtime.spawn(async move { while let Some(msg) = stream.lock().await.next().await { @@ -161,7 +161,7 @@ pub unsafe extern "C" fn client_publish_message( client: *mut ToriiClient, topic: *const c_char, data: CArray, -) -> Result { +) -> Result> { let topic = unsafe { CStr::from_ptr(topic).to_string_lossy().to_string() }; let data = unsafe { std::slice::from_raw_parts(data.data, data.data_len) }; @@ -170,7 +170,7 @@ pub unsafe extern "C" fn client_publish_message( let result = (*client).runtime.block_on(client_future); match result { - Ok(_) => Result::Ok(true), + Ok(_) => Result::Ok(result.unwrap().into()), Err(e) => Result::Err(Error { message: CString::new(e.to_string()).unwrap().into_raw(), }), diff --git a/src/libwasm.rs b/src/libwasm.rs index a4ef94d..770d084 100644 --- a/src/libwasm.rs +++ b/src/libwasm.rs @@ -1,5 +1,6 @@ //! Minimal JS bindings for the torii client. +use std::cell::{OnceCell, RefCell}; use std::str::FromStr; use std::sync::Arc; @@ -164,7 +165,7 @@ extern "C" { #[wasm_bindgen] pub struct Client { - inner: Arc>, + inner: torii_client::client::Client, } #[derive(Tsify, Serialize, Deserialize)] @@ -485,8 +486,6 @@ impl Client { let results = self .inner - .lock() - .await .entities(Query { clause: None, limit, @@ -521,8 +520,6 @@ impl Client { let results = self .inner - .lock() - .await .entities(Query { clause: Some(Clause::Keys(KeysClause { model: model.to_string(), @@ -559,8 +556,6 @@ impl Client { match self .inner - .lock() - .await .model(&KeysClause { model: model.to_string(), keys, @@ -591,8 +586,6 @@ impl Client { .collect::, _>>()?; self.inner - .lock() - .await .add_models_to_sync(models) .await .map_err(|err| JsValue::from(err.to_string())) @@ -615,8 +608,6 @@ impl Client { .collect::, _>>()?; self.inner - .lock() - .await .remove_models_to_sync(models) .await .map_err(|err| JsValue::from(err.to_string())) @@ -636,8 +627,6 @@ impl Client { let name = cairo_short_string_to_felt(&model.model).expect("invalid model name"); let mut rcv = self .inner - .lock() - .await .storage() .add_listener(name, &model.keys) .unwrap(); @@ -669,13 +658,7 @@ impl Client { }) .collect::, _>>()?; - let mut stream = self - .inner - .lock() - .await - .on_entity_updated(ids) - .await - .unwrap(); + let mut stream = self.inner.on_entity_updated(ids).await.unwrap(); wasm_bindgen_futures::spawn_local(async move { while let Some(update) = stream.next().await { @@ -692,18 +675,12 @@ impl Client { } #[wasm_bindgen(js_name = subscribeTopic)] - pub async fn subscribe_topic( - &self, - topic: String, - callback: js_sys::Function, - ) -> Result { + pub async fn subscribe_topic(&mut self, topic: String) -> Result { #[cfg(feature = "console-error-panic")] console_error_panic_hook::set_once(); let sub = self .inner - .lock() - .await .subscribe_topic(topic) .await .map_err(|err| JsValue::from(err.to_string()))?; @@ -712,14 +689,12 @@ impl Client { } #[wasm_bindgen(js_name = unsubscribeTopic)] - pub async fn unsubscribe_topic(&self, topic: String) -> Result { + pub async fn unsubscribe_topic(&mut self, topic: String) -> Result { #[cfg(feature = "console-error-panic")] console_error_panic_hook::set_once(); let sub = self .inner - .lock() - .await .unsubscribe_topic(topic) .await .map_err(|err| JsValue::from(err.to_string()))?; @@ -729,7 +704,7 @@ impl Client { #[wasm_bindgen(js_name = publishMessage)] pub async fn publish_message( - &self, + &mut self, topic: &str, message: &[u8], ) -> Result { @@ -738,8 +713,6 @@ impl Client { let message_id = self .inner - .lock() - .await .publish_message(topic, message) .await .map_err(|err| JsValue::from(err.to_string()))?; @@ -752,7 +725,7 @@ impl Client { #[cfg(feature = "console-error-panic")] console_error_panic_hook::set_once(); - let stream = self.inner.lock().await.libp2p_message_stream(); + let stream = self.inner.relay_client_stream(); wasm_bindgen_futures::spawn_local(async move { while let Some(message) = stream.lock().await.next().await { @@ -802,35 +775,25 @@ pub async fn create_client( let world_address = FieldElement::from_str(&world_address) .map_err(|err| JsValue::from(format!("failed to parse world address: {err}")))?; - let client = Arc::new(Mutex::new( - torii_client::client::Client::new( - torii_url, - rpc_url, - relay_url, - world_address, - Some(models), - ) - .await - .map_err(|err| JsValue::from(format!("failed to build client: {err}")))?, - )); - - let client_subscription = client.clone(); - wasm_bindgen_futures::spawn_local( - client_subscription - .lock() - .await - .start_subscription() - .await - .map_err(|err| { - JsValue::from(format!( - "failed to start torii client subscription service: {err}" - )) - })?, - ); - - let client_libp2p = client.clone(); + let client = torii_client::client::Client::new( + torii_url, + rpc_url, + relay_url, + world_address, + Some(models), + ) + .await + .map_err(|err| JsValue::from(format!("failed to build client: {err}")))?; + + wasm_bindgen_futures::spawn_local(client.start_subscription().await.map_err(|err| { + JsValue::from(format!( + "failed to start torii client subscription service: {err}" + )) + })?); + + let relay_client_runner = client.relay_client_runner(); wasm_bindgen_futures::spawn_local(async move { - client_libp2p.lock().await.run_libp2p().await; + relay_client_runner.lock().await.run().await; }); Ok(Client { inner: client })