diff --git a/Cargo.lock b/Cargo.lock index f2553db..6a498ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -24,6 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -40,15 +41,15 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba1c79677c9ce51c8d45e20845b05e6fb070ea2c863fba03ad6af2c778474bd" +checksum = "59febb24956a41c29bb5f450978fbe825bd6456b3f80586c8bd558dc882e7b6a" dependencies = [ "alloy-consensus", "alloy-core", @@ -64,45 +65,64 @@ dependencies = [ [[package]] name = "alloy-chains" -version = "0.1.31" +version = "0.1.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68b94c159bcc2ca5f758b8663d7b00fc7c5e40569984595ddf2221b0f7f7f6e" +checksum = "830045a4421ee38d3ab570d36d4d2b5152c066e72797139224da8de5d5981fd0" dependencies = [ + "alloy-primitives", "num_enum", "strum", ] [[package]] name = "alloy-consensus" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da374e868f54c7f4ad2ad56829827badca388efd645f8cf5fccc61c2b5343504" +checksum = "e88e1edea70787c33e11197d3f32ae380f3db19e6e061e539a5bcf8184a6b326" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", "alloy-serde", + "alloy-trie", + "auto_impl", "c-kzg", + "derive_more", + "serde", +] + +[[package]] +name = "alloy-consensus-any" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b1bb53f40c0273cd1975573cd457b39213e68584e36d1401d25fd0398a1d65" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", "serde", ] [[package]] name = "alloy-core" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529fc6310dc1126c8de51c376cbc59c79c7f662bd742be7dc67055d5421a81b4" +checksum = "c618bd382f0bc2ac26a7e4bfae01c9b015ca8f21b37ca40059ae35a7e62b3dc6" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", "alloy-primitives", + "alloy-rlp", "alloy-sol-types", ] [[package]] name = "alloy-dyn-abi" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" +checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -115,16 +135,42 @@ dependencies = [ "winnow", ] +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c986539255fb839d1533c128e190e557e52ff652c9ef62939e233a81dd93f7e" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "derive_more", + "serde", +] + [[package]] name = "alloy-eips" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" +checksum = "5f9fadfe089e9ccc0650473f2d4ef0a28bc015bbca5631d9f0f09e49b557fdb3" dependencies = [ + "alloy-eip2930", + "alloy-eip7702", "alloy-primitives", "alloy-rlp", "alloy-serde", "c-kzg", + "derive_more", "once_cell", "serde", "sha2", @@ -132,20 +178,21 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca15afde1b6d15e3fc1c97421262b1bbb37aee45752e3c8b6d6f13f776554ff" +checksum = "2b2a4cf7b70f3495788e74ce1c765260ffe38820a2a774ff4aacb62e31ea73f9" dependencies = [ "alloy-primitives", "alloy-serde", + "alloy-trie", "serde", ] [[package]] name = "alloy-json-abi" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" +checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -155,27 +202,31 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d6f34930b7e3e2744bcc79056c217f00cb2abb33bc5d4ff88da7623c5bb078b" +checksum = "e29040b9d5fe2fb70415531882685b64f8efd08dfbd6cc907120650504821105" dependencies = [ "alloy-primitives", + "alloy-sol-types", "serde", "serde_json", - "thiserror", + "thiserror 2.0.9", "tracing", ] [[package]] name = "alloy-network" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f6895fc31b48fa12306ef9b4f78b7764f8bd6d7d91cdb0a40e233704a0f23f" +checksum = "510cc00b318db0dfccfdd2d032411cfae64fc144aef9679409e014145d3dacc4" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", + "alloy-network-primitives", "alloy-primitives", + "alloy-rpc-types-any", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -183,42 +234,64 @@ dependencies = [ "async-trait", "auto_impl", "futures-utils-wasm", - "thiserror", + "serde", + "serde_json", + "thiserror 2.0.9", +] + +[[package]] +name = "alloy-network-primitives" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9081c099e798b8a2bba2145eb82a9a146f01fc7a35e9ab6e7b43305051f97550" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "serde", ] [[package]] name = "alloy-primitives" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" +checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", "derive_more", + "foldhash", + "hashbrown 0.15.2", "hex-literal", + "indexmap", "itoa", "k256", "keccak-asm", + "paste", "proptest", "rand", "ruint", + "rustc-hash", "serde", + "sha3", "tiny-keccak", ] [[package]] name = "alloy-provider" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c538bfa893d07e27cb4f3c1ab5f451592b7c526d511d62b576a2ce59e146e4a" +checksum = "dc2dfaddd9a30aa870a78a4e1316e3e115ec1e12e552cbc881310456b85c1f24" dependencies = [ "alloy-chains", "alloy-consensus", "alloy-eips", "alloy-json-rpc", "alloy-network", + "alloy-network-primitives", "alloy-primitives", "alloy-rpc-client", "alloy-rpc-types-eth", @@ -231,20 +304,24 @@ dependencies = [ "futures", "futures-utils-wasm", "lru", + "parking_lot", "pin-project", "reqwest", + "schnellru", "serde", "serde_json", + "thiserror 2.0.9", "tokio", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-rlp" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" +checksum = "f542548a609dca89fcd72b3b9f355928cf844d4363c5eed9c5273a3dd225e097" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -253,22 +330,23 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "alloy-rpc-client" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba31bae67773fd5a60020bea900231f8396202b7feca4d0c70c6b59308ab4a8" +checksum = "531137b283547d5b9a5cafc96b006c64ef76810c681d606f28be9781955293b6" dependencies = [ "alloy-json-rpc", + "alloy-primitives", "alloy-transport", "alloy-transport-http", "futures", @@ -281,41 +359,57 @@ dependencies = [ "tower", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-rpc-types" -version = "0.1.4" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3410a472ce26c457e9780f708ee6bd540b30f88f1f31fdab7a11d00bd6aa1aee" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-rpc-types-any" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" +checksum = "ed98e1af55a7d856bfa385f30f63d8d56be2513593655c904a8f4a7ec963aa3e" dependencies = [ + "alloy-consensus-any", "alloy-rpc-types-eth", "alloy-serde", ] [[package]] name = "alloy-rpc-types-eth" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4123ee21f99ba4bd31bfa36ba89112a18a500f8b452f02b35708b1b951e2b9" +checksum = "8737d7a6e37ca7bba9c23e9495c6534caec6760eb24abc9d5ffbaaba147818e1" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", + "alloy-network-primitives", "alloy-primitives", "alloy-rlp", "alloy-serde", "alloy-sol-types", + "derive_more", "itertools 0.13.0", "serde", "serde_json", - "thiserror", ] [[package]] name = "alloy-serde" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9416c52959e66ead795a11f4a86c248410e9e368a0765710e57055b8a1774dd6" +checksum = "5851bf8d5ad33014bd0c45153c603303e730acc8a209450a7ae6b4a12c2789e2" dependencies = [ "alloy-primitives", "serde", @@ -324,70 +418,70 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b33753c09fa1ad85e5b092b8dc2372f1e337a42e84b9b4cff9fede75ba4adb32" +checksum = "7e10ca565da6500cca015ba35ee424d59798f2e1b85bc0dd8f81dafd401f029a" dependencies = [ "alloy-primitives", "async-trait", "auto_impl", "elliptic-curve", "k256", - "thiserror", + "thiserror 2.0.9", ] [[package]] name = "alloy-sol-macro" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" +checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" +checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" dependencies = [ "alloy-sol-macro-input", "const-hex", - "heck 0.5.0", + "heck", "indexmap", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" +checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" dependencies = [ "const-hex", "dunce", - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" +checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" dependencies = [ "serde", "winnow", @@ -395,10 +489,11 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" +checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" dependencies = [ + "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", @@ -407,9 +502,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b51a291f949f755e6165c3ed562883175c97423703703355f4faa4b7d0a57c" +checksum = "538a04a37221469cac0ce231b737fd174de2fdfcdd843bdd068cb39ed3e066ad" dependencies = [ "alloy-json-rpc", "base64", @@ -417,18 +512,19 @@ dependencies = [ "futures-utils-wasm", "serde", "serde_json", - "thiserror", + "thiserror 2.0.9", "tokio", "tower", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-transport-http" -version = "0.1.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d65871f9f1cafe1ed25cde2f1303be83e6473e995a2d56c275ae4fcce6119c" +checksum = "2ed40eb1e1265b2911512f6aa1dcece9702d078f5a646730c45e39e2be00ac1c" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -439,11 +535,27 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-trie" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e428104b2445a4f929030891b3dbf8c94433a8349ba6480946bf6af7975c2f6" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "arrayvec", + "derive_more", + "nybbles", + "serde", + "smallvec", + "tracing", +] + [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "ark-ff" @@ -574,12 +686,15 @@ name = "arrayvec" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +dependencies = [ + "serde", +] [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -588,24 +703,24 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] @@ -616,14 +731,14 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -741,9 +856,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -765,9 +880,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.20" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bcde016d64c21da4be18b655631e5ab6d3107607e71a73a9f53eb48aae23fb" +checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" dependencies = [ "shlex", ] @@ -807,9 +922,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.12.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" dependencies = [ "cfg-if", "cpufeatures", @@ -824,12 +939,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" version = "0.9.4" @@ -848,13 +957,19 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.2" @@ -885,12 +1000,13 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.5.3" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ "cfg-if", - "hashbrown", + "crossbeam-utils", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -919,15 +1035,23 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.18" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.1", - "syn 2.0.77", + "syn 2.0.91", + "unicode-xid", ] [[package]] @@ -951,6 +1075,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + [[package]] name = "dunce" version = "1.0.5" @@ -1004,12 +1139,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1024,9 +1159,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fastrlp" @@ -1039,6 +1174,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.0" @@ -1067,6 +1213,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1099,9 +1251,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1114,9 +1266,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1124,15 +1276,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1141,38 +1293,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1237,6 +1389,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1244,16 +1402,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", - "allocator-api2", ] [[package]] -name = "heck" -version = "0.4.1" +name = "hashbrown" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "unicode-segmentation", + "allocator-api2", + "equivalent", + "foldhash", + "serde", ] [[package]] @@ -1294,9 +1454,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -1328,15 +1488,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -1369,9 +1529,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", @@ -1382,11 +1542,128 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "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 2.0.91", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -1395,12 +1672,23 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1414,13 +1702,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.91", ] [[package]] @@ -1431,20 +1719,20 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.5.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", "serde", ] [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "itertools" @@ -1466,24 +1754,25 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -1492,6 +1781,15 @@ dependencies = [ "sha2", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "keccak-asm" version = "0.1.4" @@ -1504,7 +1802,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.9.7" +version = "0.10.0" dependencies = [ "alloy", "alloy-primitives", @@ -1519,7 +1817,7 @@ dependencies = [ "rmp-serde", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tracing", "tracing-error", "tracing-subscriber", @@ -1541,15 +1839,15 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "linux-raw-sys" @@ -1557,6 +1855,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -1575,11 +1879,11 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -1624,11 +1928,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -1717,7 +2020,20 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", +] + +[[package]] +name = "nybbles" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a62e678a89501192cc5ebf47dcbc656b608ae5e1c61c9251fe35230f119fe3" +dependencies = [ + "alloy-rlp", + "const-hex", + "proptest", + "serde", + "smallvec", ] [[package]] @@ -1731,15 +2047,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags", "cfg-if", @@ -1758,7 +2074,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] @@ -1769,9 +2085,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -1817,6 +2133,16 @@ dependencies = [ "syn 1.0.109", ] +[[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" @@ -1844,40 +2170,40 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.12" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror", + "thiserror 2.0.9", "ucd-trie", ] [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1897,9 +2223,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "ppv-lite86" @@ -1910,6 +2236,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn 2.0.91", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -1931,34 +2267,32 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn 2.0.91", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -1977,7 +2311,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "rusty-fork", "tempfile", "unarray", @@ -2013,6 +2347,7 @@ dependencies = [ "libc", "rand_chacha", "rand_core", + "serde", ] [[package]] @@ -2045,23 +2380,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -2075,13 +2410,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2092,15 +2427,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -2179,16 +2514,18 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.3" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +checksum = "f5ef8fb1dd8de3870cb8400d51b4c2023854bbafd5431a3ac7e7317243e22d2f" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", - "fastrlp", + "fastrlp 0.3.1", + "fastrlp 0.4.0", "num-bigint", + "num-integer", "num-traits", "parity-scale-codec", "primitive-types", @@ -2213,6 +2550,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -2234,43 +2577,42 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.23", + "semver 1.0.24", ] [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rusty-fork" @@ -2292,13 +2634,24 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "schnellru" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +dependencies = [ + "ahash", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2334,9 +2687,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" dependencies = [ "core-foundation-sys", "libc", @@ -2353,44 +2706,44 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "semver-parser" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" dependencies = [ "pest", ] [[package]] name = "serde" -version = "1.0.210" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ "itoa", "memchr", @@ -2421,6 +2774,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "sha3-asm" version = "0.1.4" @@ -2470,12 +2833,15 @@ name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -2483,9 +2849,9 @@ dependencies = [ [[package]] name = "spdx" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47317bbaf63785b53861e1ae2d11b80d6b624211d42cb20efcd210ee6f8a14bc" +checksum = "bae30cc7bfe3656d60ee99bf6836f472b0c53dddcbf335e253329abb16e535a2" dependencies = [ "smallvec", ] @@ -2500,6 +2866,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2521,11 +2893,11 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] @@ -2547,9 +2919,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" dependencies = [ "proc-macro2", "quote", @@ -2558,25 +2930,36 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.7" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" +checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + [[package]] name = "tap" version = "1.0.1" @@ -2585,9 +2968,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -2598,22 +2981,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +dependencies = [ + "thiserror-impl 2.0.9", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "thiserror-impl", + "proc-macro2", + "quote", + "syn 2.0.91", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] @@ -2645,25 +3048,20 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.40.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -2683,7 +3081,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] @@ -2698,9 +3096,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -2710,9 +3108,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -2729,9 +3127,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.21" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", @@ -2740,18 +3138,16 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.13" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "pin-project", "pin-project-lite", - "tokio", + "sync_wrapper", "tower-layer", "tower-service", - "tracing", ] [[package]] @@ -2768,11 +3164,10 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2780,20 +3175,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -2801,9 +3196,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ "tracing", "tracing-subscriber", @@ -2822,9 +3217,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -2832,9 +3227,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -2865,9 +3260,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "uint" @@ -2889,57 +3284,45 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.12.0" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "valuable" version = "0.1.0" @@ -2984,9 +3367,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -2995,36 +3378,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3032,37 +3415,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-encoder" -version = "0.202.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd106365a7f5f7aa3c1916a98cbb3ad477f5ff96ddb130285a91c6e7429e67a" +checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" dependencies = [ "leb128", + "wasmparser", ] [[package]] name = "wasm-metadata" -version = "0.202.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "094aea3cb90e09f16ee25a4c0e324b3e8c934e7fd838bfa039aef5352f44a917" +checksum = "3f3e5f5920c5abfc45573c89b07b38efdaae1515ef86f83dad12d60e50ecd62b" dependencies = [ "anyhow", "indexmap", @@ -3076,20 +3460,36 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.202.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" +checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" dependencies = [ + "ahash", "bitflags", + "hashbrown 0.14.5", "indexmap", - "semver 1.0.23", + "semver 1.0.24", +] + +[[package]] +name = "wasmtimer" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "slab", + "wasm-bindgen", ] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -3231,18 +3631,18 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] [[package]] name = "wit-bindgen" -version = "0.24.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb4e7653763780be47e38f479e9aa83c768aa6a3b2ed086dc2826fdbbb7e7f5" +checksum = "6a2b3e15cd6068f233926e7d8c7c588b2ec4fb7cc7bf3824115e7c7e2a8485a3" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -3250,32 +3650,35 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.24.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b67e11c950041849a10828c7600ea62a4077c01e8af72e8593253575428f91b" +checksum = "b632a5a0fa2409489bd49c9e6d99fcc61bb3d4ce9d1907d44662e75a28c71172" dependencies = [ "anyhow", + "heck", "wit-parser", ] [[package]] name = "wit-bindgen-rt" -version = "0.24.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0780cf7046630ed70f689a098cd8d56c5c3b22f2a7379bbdb088879963ff96" +checksum = "7947d0131c7c9da3f01dfde0ab8bd4c4cf3c5bd49b6dba0ae640f1fa752572ea" dependencies = [ "bitflags", ] [[package]] name = "wit-bindgen-rust" -version = "0.24.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30acbe8fb708c3a830a33c4cb705df82659bf831b492ec6ca1a17a369cfeeafb" +checksum = "4329de4186ee30e2ef30a0533f9b3c123c019a237a7c82d692807bf1b3ee2697" dependencies = [ "anyhow", - "heck 0.4.1", + "heck", "indexmap", + "prettyplease", + "syn 2.0.91", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -3283,23 +3686,24 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.24.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b1b06eae85feaecdf9f2854f7cac124e00d5a6e5014bfb02eb1ecdeb5f265b9" +checksum = "177fb7ee1484d113b4792cc480b1ba57664bbc951b42a4beebe573502135b1fc" dependencies = [ "anyhow", + "prettyplease", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", "wit-bindgen-core", "wit-bindgen-rust", ] [[package]] name = "wit-component" -version = "0.202.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c836b1fd9932de0431c1758d8be08212071b6bba0151f7bac826dbc4312a2a9" +checksum = "73ccedf54cc65f287da268d64d2bf4f7530d2cfb2296ffbe3ad5f65567e4cf53" dependencies = [ "anyhow", "bitflags", @@ -3316,15 +3720,15 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.202.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744237b488352f4f27bca05a10acb79474415951c450e52ebd0da784c1df2bcc" +checksum = "5b7117ce3adc0b4354b46dc1cf3190b00b333e65243d244c613ffcc58bdec84d" dependencies = [ "anyhow", "id-arena", "indexmap", "log", - "semver 1.0.23", + "semver 1.0.24", "serde", "serde_derive", "serde_json", @@ -3332,6 +3736,18 @@ dependencies = [ "wasmparser", ] +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -3341,6 +3757,30 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -3359,7 +3799,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", + "synstructure", ] [[package]] @@ -3379,5 +3840,27 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.91", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", ] diff --git a/Cargo.toml b/Cargo.toml index 2c761d8..0a1324c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,21 @@ [package] name = "kinode_process_lib" -description = "A library for writing Kinode processes in Rust." -version = "0.9.7" +authors = ["Sybil Technologies AG"] +version = "0.10.0" edition = "2021" -license-file = "LICENSE" +description = "A library for writing Kinode processes in Rust." homepage = "https://kinode.org" repository = "https://github.com/kinode-dao/process_lib" +license = "Apache-2.0" [features] logging = ["dep:color-eyre", "dep:tracing", "dep:tracing-error", "dep:tracing-subscriber"] [dependencies] -alloy-primitives = "0.7.6" -alloy-sol-macro = "0.7.6" -alloy-sol-types = "0.7.6" -alloy = { version = "0.1.3", features = [ +alloy-primitives = "0.8.15" +alloy-sol-macro = "0.8.15" +alloy-sol-types = "0.8.15" +alloy = { version = "0.8.1", features = [ "json-rpc", "rpc-types", ] } @@ -32,4 +33,4 @@ tracing = { version = "0.1", optional = true } tracing-error = { version = "0.2", optional = true } tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "std"], optional = true } url = "2.4.1" -wit-bindgen = "0.24.0" +wit-bindgen = "0.36.0" diff --git a/kinode-wit/kinode.wit b/kinode-wit/kinode.wit index 1f75b8a..adbfd97 100644 --- a/kinode-wit/kinode.wit +++ b/kinode-wit/kinode.wit @@ -1,23 +1,26 @@ // -// kinode.wit, copied from https://github.com/kinode-dao/kinode-wit/tree/v0.8 +// kinode.wit, copied from https://github.com/kinode-dao/kinode-wit +// https://raw.githubusercontent.com/kinode-dao/kinode-wit/v1.0.0/kinode.wit // -package kinode:process@0.8.0; +package kinode:process@1.0.0; interface standard { - // - // System types: - // - // JSON is passed over WASM boundary as a string. + // ˗ˏˋ ♡ ˎˊ˗ + // System Types + // ˗ˏˋ ♡ ˎˊ˗ + + /// JSON is passed over Wasm boundary as a string. type json = string; + /// In types passed from kernel, node-id will be a valid Kimap entry. type node-id = string; - // Context, like a message body, is a protocol-defined serialized byte - // array. It is used when building a Request to save information that - // will not be part of a Response, in order to more easily handle - // ("contextualize") that Response. + /// Context, like a message body, is a protocol-defined serialized byte + /// array. It is used when building a Request to save information that + /// will not be part of a Response, in order to more easily handle + /// ("contextualize") that Response. type context = list; record process-id { @@ -45,7 +48,8 @@ interface standard { // set in order to inherit lazy-load-blob from parent message, and if // expects-response is none, direct response to source of parent. // also carries forward certain aspects of parent message in kernel, - // see documentation for formal spec and examples. + // see documentation for formal spec and examples: + // https://docs.rs/kinode_process_lib/latest/kinode_process_lib/struct.Request.html inherit: bool, // if some, request expects a response in the given number of seconds expects-response: option, @@ -63,10 +67,10 @@ interface standard { // to grab lazy-load-blob, use get_blob() } - // A message can be a request or a response. within a response, there is - // a result which surfaces any error that happened because of a request. - // A successful response will contain the context of the request it - // matches, if any was set. + /// A message can be a request or a response. Within a response, there is + /// a result which surfaces any error that happened because of a request. + /// A successful response will contain the context of the request it + /// matches, if any was set. variant message { request(request), response(tuple>), @@ -77,21 +81,24 @@ interface standard { params: json, } - // On-exit is a setting that determines what happens when a process - // panics, completes, or otherwise "ends". NOTE: requests should have - // expects-response set to false, will always be set to that by kernel. + /// On-exit is a setting that determines what happens when a process + /// panics, completes, or otherwise "ends". + /// NOTE: requests will always have expects-response set to false by kernel. variant on-exit { none, restart, requests(list>>), } - // Network errors come from trying to send a message to another node. - // A message can fail by timing out, or by the node being entirely - // unreachable (offline). In either case, the message is not delivered - // and the process that sent it receives that message along with any - // assigned context and/or lazy-load-blob, and is free to handle it as it - // sees fit. + /// Send errors come from trying to send a message to another process, + /// either locally or on another node. + /// A message can fail by timing out, or by the node being entirely + /// unreachable (offline or can't be found in PKI). In either case, + /// the message is not delivered and the process that sent it receives + /// that message back along with any assigned context and/or lazy-load-blob, + /// and is free to handle it as it sees fit. + /// In the local case, only timeout errors are possible and also cover the case + /// in which a process is not running or does not exist. record send-error { kind: send-error-kind, target: address, @@ -109,20 +116,26 @@ interface standard { no-file-at-path, } - // - // System utils: - // + // ˗ˏˋ ♡ ˎˊ˗ + // System Utils + // ˗ˏˋ ♡ ˎˊ˗ + /// Prints to the terminal at a given verbosity level. + /// Higher verbosity levels print more information. + /// Level 0 is always printed -- use sparingly. print-to-terminal: func(verbosity: u8, message: string); - // - // Process management: - // + /// Returns the address of the process. + our: func() -> address; - set-on-exit: func(on-exit: on-exit); + // ˗ˏˋ ♡ ˎˊ˗ + // Process Management + // ˗ˏˋ ♡ ˎˊ˗ get-on-exit: func() -> on-exit; + set-on-exit: func(on-exit: on-exit); + get-state: func() -> option>; set-state: func(bytes: list); @@ -130,42 +143,51 @@ interface standard { clear-state: func(); spawn: func( + // name is optional. if not provided, name will be a random u64. name: option, - wasm-path: string, // must be located within package's drive + // wasm-path must be located within package's drive + wasm-path: string, on-exit: on-exit, + // requested capabilities must be owned by the caller request-capabilities: list, - // note that we are restricting granting to just messaging the - // newly spawned process - grant-capabilities: list, + // granted capabilities will be generated by the child process + // and handed out to the indicated process-id. + grant-capabilities: list>, public: bool ) -> result; - // - // Capabilities management: - // + // ˗ˏˋ ♡ ˎˊ˗ + // Capabilities Management + // ˗ˏˋ ♡ ˎˊ˗ - // Saves the capabilities to persisted process state. + /// Saves the capabilities to persisted process state. save-capabilities: func(caps: list); - // Deletes the capabilities from persisted process state. + /// Deletes the capabilities from persisted process state. drop-capabilities: func(caps: list); - // Gets all capabilities from persisted process state. + /// Gets all capabilities from persisted process state. our-capabilities: func() -> list; - // - // Message I/O: - // + // ˗ˏˋ ♡ ˎˊ˗ + // Message I/O + // ˗ˏˋ ♡ ˎˊ˗ - // Ingest next message when it arrives along with its source. - // Almost all long-running processes will call this in a loop. + /// Ingest next message when it arrives along with its source. + /// Almost all long-running processes will call this in a loop. receive: func() -> result, tuple>>; - // Gets lazy-load-blob, if any, of the message we most recently received. + /// Returns whether or not the current message has a blob. + has-blob: func() -> bool; + + /// Returns the blob of the current message, if any. get-blob: func() -> option; - // Send message(s) to target(s). + /// Returns the last blob this process received. + last-blob: func() -> option; + + /// Send request to target. send-request: func( target: address, request: request, @@ -173,6 +195,7 @@ interface standard { lazy-load-blob: option ); + /// Send requests to targets. send-requests: func( requests: list>> ); + /// Send response to the request currently being handled. send-response: func( response: response, lazy-load-blob: option ); - // Send a single request, then block (internally) until its response. The - // type returned is Message but will always contain Response. + /// Send a single request, then block (internally) until its response. The + /// type returned is Message but will always contain Response. send-and-await-response: func( target: address, request: request, @@ -198,7 +222,7 @@ world lib { import standard; } -world process-v0 { +world process-v1 { include lib; export init: func(our: string); diff --git a/src/eth.rs b/src/eth.rs index b98d0bb..f0fe7ac 100644 --- a/src/eth.rs +++ b/src/eth.rs @@ -1,6 +1,7 @@ use crate::{Message, Request as KiRequest}; -use alloy::rpc::json_rpc::ErrorPayload; -pub use alloy::rpc::types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; +pub use alloy::rpc::json_rpc::ErrorPayload; +pub use alloy::rpc::types::eth::pubsub::SubscriptionResult; +pub use alloy::rpc::types::pubsub::Params; pub use alloy::rpc::types::{ request::{TransactionInput, TransactionRequest}, Block, BlockId, BlockNumberOrTag, FeeHistory, Filter, FilterBlockOption, Log, Transaction, @@ -10,6 +11,44 @@ pub use alloy_primitives::{Address, BlockHash, BlockNumber, Bytes, TxHash, U128, use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; +/// Subscription kind. Pulled directly from alloy (https://github.com/alloy-rs/alloy). +/// Why? Because alloy is not yet 1.0 and the types in this interface must be stable. +/// If alloy SubscriptionKind changes, we can implement a transition function in runtime +/// for this type. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +#[serde(rename_all = "camelCase")] +pub enum SubscriptionKind { + /// New block headers subscription. + /// + /// Fires a notification each time a new header is appended to the chain, including chain + /// reorganizations. In case of a chain reorganization the subscription will emit all new + /// headers for the new chain. Therefore the subscription can emit multiple headers on the same + /// height. + NewHeads, + /// Logs subscription. + /// + /// Returns logs that are included in new imported blocks and match the given filter criteria. + /// In case of a chain reorganization previous sent logs that are on the old chain will be + /// resent with the removed property set to true. Logs from transactions that ended up in the + /// new chain are emitted. Therefore, a subscription can emit logs for the same transaction + /// multiple times. + Logs, + /// New Pending Transactions subscription. + /// + /// Returns the hash or full tx for all transactions that are added to the pending state and + /// are signed with a key that is available in the node. When a transaction that was + /// previously part of the canonical chain isn't part of the new canonical chain after a + /// reorganization its again emitted. + NewPendingTransactions, + /// Node syncing status subscription. + /// + /// Indicates when the node starts or stops synchronizing. The result can either be a boolean + /// indicating that the synchronization has started (true), finished (false) or an object with + /// various progress indicators. + Syncing, +} + /// The Action and Request type that can be made to eth:distro:sys. Any process with messaging /// capabilities can send this action to the eth provider. /// @@ -17,12 +56,12 @@ use std::collections::{HashMap, HashSet}; #[derive(Clone, Debug, Serialize, Deserialize)] pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. - /// Logs come in as alloy_rpc_types::pubsub::SubscriptionResults + /// Logs come in as JSON value which can be parsed to [`alloy::rpc::types::eth::pubsub::SubscriptionResult`] SubscribeLogs { sub_id: u64, chain_id: u64, kind: SubscriptionKind, - params: Params, + params: serde_json::Value, }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), @@ -41,36 +80,38 @@ pub enum EthAction { pub type EthSubResult = Result; /// Incoming type for successful subscription updates. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct EthSub { pub id: u64, - pub result: SubscriptionResult, + /// can be parsed to [`alloy::rpc::types::eth::pubsub::SubscriptionResult`] + pub result: serde_json::Value, } /// If your subscription is closed unexpectedly, you will receive this. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct EthSubError { pub id: u64, pub error: String, } -/// The [`crate::Response`] type which a process will get from requesting with an [`EthAction`] will be -/// of this type, serialized and deserialized using `serde_json::to_vec` -/// and `serde_json::from_slice`. +/// The [`crate::Response`] body type which a process will get from requesting +/// with an [`EthAction`] will be of this type, serialized and deserialized +/// using [`serde_json::to_vec`] and [`serde_json::from_slice`]. /// /// In the case of an [`EthAction::SubscribeLogs`] request, the response will indicate if /// the subscription was successfully created or not. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum EthResponse { Ok, - Response { value: serde_json::Value }, + Response(serde_json::Value), Err(EthError), } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum EthError { - /// RPC provider returned an error - RpcError(ErrorPayload), + /// RPC provider returned an error. + /// Can be parsed to [`alloy::rpc::json_rpc::ErrorPayload`] + RpcError(serde_json::Value), /// provider module cannot parse message MalformedRequest, /// No RPC provider for the chain @@ -91,7 +132,7 @@ pub enum EthError { /// The action type used for configuring eth:distro:sys. Only processes which have the "root" /// [`crate::Capability`] from eth:distro:sys can successfully send this action. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum EthConfigAction { /// Add a new provider to the list of providers. AddProvider(ProviderConfig), @@ -122,7 +163,7 @@ pub enum EthConfigAction { } /// Response type from an [`EthConfigAction`] request. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum EthConfigResponse { Ok, /// Response from a GetProviders request. @@ -213,7 +254,7 @@ impl Provider { match resp { Message::Response { body, .. } => match serde_json::from_slice::(&body) { - Ok(EthResponse::Response { value }) => { + Ok(EthResponse::Response(value)) => { serde_json::from_value::(value).map_err(|_| EthError::RpcMalformedResponse) } Ok(EthResponse::Err(e)) => Err(e), @@ -596,7 +637,8 @@ impl Provider { sub_id, chain_id: self.chain_id, kind: SubscriptionKind::Logs, - params: Params::Logs(Box::new(filter)), + params: serde_json::to_value(Params::Logs(Box::new(filter))) + .map_err(|_| EthError::InvalidParams)?, }; let Ok(body) = serde_json::to_vec(&action) else { @@ -624,13 +666,19 @@ impl Provider { } /// Subscribe in a loop until successful - pub fn subscribe_loop(&self, sub_id: u64, filter: Filter) { + pub fn subscribe_loop( + &self, + sub_id: u64, + filter: Filter, + print_verbosity_success: u8, + print_verbosity_error: u8, + ) { loop { match self.subscribe(sub_id, filter.clone()) { Ok(()) => break, Err(_) => { crate::print_to_terminal( - 0, + print_verbosity_error, "failed to subscribe to chain! trying again in 5s...", ); std::thread::sleep(std::time::Duration::from_secs(5)); @@ -638,7 +686,7 @@ impl Provider { } } } - crate::print_to_terminal(0, "subscribed to logs successfully"); + crate::print_to_terminal(print_verbosity_success, "subscribed to logs successfully"); } /// Unsubscribes from a previously created subscription. diff --git a/src/http/client.rs b/src/http/client.rs index 8812a87..a0a8c4e 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use std::str::FromStr; use thiserror::Error; -/// [`crate::Request`] type sent to the `http_client:distro:sys` service in order to open a +/// [`crate::Request`] type sent to the `http-client:distro:sys` service in order to open a /// WebSocket connection, send a WebSocket message on an existing connection, or /// send an HTTP request. /// @@ -31,7 +31,7 @@ pub enum HttpClientAction { } /// HTTP Request type that can be shared over Wasm boundary to apps. -/// This is the one you send to the `http_client:distro:sys` service. +/// This is the one you send to the `http-client:distro:sys` service. /// /// BODY is stored in the lazy_load_blob, as bytes /// @@ -48,7 +48,7 @@ pub struct OutgoingHttpRequest { } /// [`crate::Request`] that comes from an open WebSocket client connection in the -/// `http_client:distro:sys` service. Be prepared to receive these after +/// `http-client:distro:sys` service. Be prepared to receive these after /// using a [`HttpClientAction::WebSocketOpen`] to open a connection. #[derive(Clone, Copy, Debug, Serialize, Deserialize)] pub enum HttpClientRequest { @@ -61,7 +61,7 @@ pub enum HttpClientRequest { }, } -/// [`crate::Response`] type received from the `http_client:distro:sys` service after +/// [`crate::Response`] type received from the `http-client:distro:sys` service after /// sending a successful [`HttpClientAction`] to it. #[derive(Debug, Serialize, Deserialize)] pub enum HttpClientResponse { @@ -72,15 +72,15 @@ pub enum HttpClientResponse { #[derive(Error, Debug, Serialize, Deserialize)] pub enum HttpClientError { // HTTP errors - #[error("http_client: request is not valid HttpClientRequest: {req}.")] + #[error("http-client: request is not valid HttpClientRequest: {req}.")] BadRequest { req: String }, - #[error("http_client: http method not supported: {method}.")] + #[error("http-client: http method not supported: {method}.")] BadMethod { method: String }, - #[error("http_client: url could not be parsed: {url}.")] + #[error("http-client: url could not be parsed: {url}.")] BadUrl { url: String }, - #[error("http_client: http version not supported: {version}.")] + #[error("http-client: http version not supported: {version}.")] BadVersion { version: String }, - #[error("http_client: failed to execute request {error}.")] + #[error("http-client: failed to execute request {error}.")] RequestFailed { error: String }, // WebSocket errors @@ -105,7 +105,7 @@ pub fn send_request( timeout: Option, body: Vec, ) { - let req = KiRequest::to(("our", "http_client", "distro", "sys")) + let req = KiRequest::to(("our", "http-client", "distro", "sys")) .body( serde_json::to_vec(&HttpClientAction::Http(OutgoingHttpRequest { method: method.to_string(), @@ -123,7 +123,7 @@ pub fn send_request( } } -/// Make an HTTP request using http_client and await its response. +/// Make an HTTP request using http-client and await its response. /// /// Returns HTTP response from the `http` crate if successful, with the body type as bytes. pub fn send_request_await_response( @@ -133,7 +133,7 @@ pub fn send_request_await_response( timeout: u64, body: Vec, ) -> std::result::Result>, HttpClientError> { - let res = KiRequest::to(("our", "http_client", "distro", "sys")) + let res = KiRequest::to(("our", "http-client", "distro", "sys")) .body( serde_json::to_vec(&HttpClientAction::Http(OutgoingHttpRequest { method: method.to_string(), @@ -150,7 +150,7 @@ pub fn send_request_await_response( .unwrap(); let Ok(Message::Response { body, .. }) = res else { return Err(HttpClientError::RequestFailed { - error: "http_client timed out".to_string(), + error: "http-client timed out".to_string(), }); }; let resp = match serde_json::from_slice::< @@ -160,13 +160,13 @@ pub fn send_request_await_response( Ok(Ok(HttpClientResponse::Http(resp))) => resp, Ok(Ok(HttpClientResponse::WebSocketAck)) => { return Err(HttpClientError::RequestFailed { - error: "http_client gave unexpected response".to_string(), + error: "http-client gave unexpected response".to_string(), }) } Ok(Err(e)) => return Err(e), Err(e) => { return Err(HttpClientError::RequestFailed { - error: format!("http_client gave invalid response: {e:?}"), + error: format!("http-client gave invalid response: {e:?}"), }) } }; @@ -176,12 +176,12 @@ pub fn send_request_await_response( for (key, value) in &resp.headers { let Ok(key) = http::header::HeaderName::from_str(key) else { return Err(HttpClientError::RequestFailed { - error: format!("http_client gave invalid header key: {key}"), + error: format!("http-client gave invalid header key: {key}"), }); }; let Ok(value) = http::header::HeaderValue::from_str(value) else { return Err(HttpClientError::RequestFailed { - error: format!("http_client gave invalid header value: {value}"), + error: format!("http-client gave invalid header value: {value}"), }); }; headers.insert(key, value); @@ -197,7 +197,7 @@ pub fn open_ws_connection( channel_id: u32, ) -> std::result::Result<(), HttpClientError> { let Ok(Ok(Message::Response { body, .. })) = - KiRequest::to(("our", "http_client", "distro", "sys")) + KiRequest::to(("our", "http-client", "distro", "sys")) .body( serde_json::to_vec(&HttpClientAction::WebSocketOpen { url: url.clone(), @@ -219,7 +219,7 @@ pub fn open_ws_connection( /// Send a WebSocket push message on an open WebSocket channel. pub fn send_ws_client_push(channel_id: u32, message_type: WsMessageType, blob: KiBlob) { - KiRequest::to(("our", "http_client", "distro", "sys")) + KiRequest::to(("our", "http-client", "distro", "sys")) .body( serde_json::to_vec(&HttpClientAction::WebSocketPush { channel_id, @@ -235,7 +235,7 @@ pub fn send_ws_client_push(channel_id: u32, message_type: WsMessageType, blob: K /// Close a WebSocket connection. pub fn close_ws_connection(channel_id: u32) -> std::result::Result<(), HttpClientError> { let Ok(Ok(Message::Response { body, .. })) = - KiRequest::to(("our", "http_client", "distro", "sys")) + KiRequest::to(("our", "http-client", "distro", "sys")) .body( serde_json::json!(HttpClientAction::WebSocketClose { channel_id }) .to_string() diff --git a/src/http/server.rs b/src/http/server.rs index b636451..872675b 100644 --- a/src/http/server.rs +++ b/src/http/server.rs @@ -1,6 +1,6 @@ use crate::vfs::{FileType, VfsAction, VfsRequest, VfsResponse}; use crate::{ - get_blob, Address, LazyLoadBlob as KiBlob, Message, Request as KiRequest, + get_blob, last_blob, Address, LazyLoadBlob as KiBlob, Message, Request as KiRequest, Response as KiResponse, }; pub use http::StatusCode; @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use thiserror::Error; -/// [`crate::Request`] received from the `http_server:distro:sys` service as a +/// [`crate::Request`] received from the `http-server:distro:sys` service as a /// result of either an HTTP or WebSocket binding, created via [`HttpServerAction`]. #[derive(Clone, Debug, Serialize, Deserialize)] pub enum HttpServerRequest { @@ -145,7 +145,7 @@ pub enum WsMessageType { Close, } -/// [`crate::Request`] type sent to `http_server:distro:sys` in order to configure it. +/// [`crate::Request`] type sent to `http-server:distro:sys` in order to configure it. /// /// If a [`crate::Response`] is expected, all actions will return a [`crate::Response`] /// with the shape `Result<(), HttpServerActionError>` serialized to JSON. @@ -186,18 +186,13 @@ pub enum HttpServerAction { WebSocketBind { path: String, authenticated: bool, - encrypted: bool, extension: bool, }, /// SecureBind is the same as Bind, except that it forces new connections to be made /// from the unique subdomain of the process that bound the path. These are *always* /// authenticated. Since the subdomain is unique, it will require the user to be /// logged in separately to the general domain authentication. - WebSocketSecureBind { - path: String, - encrypted: bool, - extension: bool, - }, + WebSocketSecureBind { path: String, extension: bool }, /// Unbind a previously-bound WebSocket path WebSocketUnbind { path: String }, /// When sent, expects a [`crate::LazyLoadBlob`] containing the WebSocket message bytes to send. @@ -214,8 +209,8 @@ pub enum HttpServerAction { desired_reply_type: MessageType, }, /// For communicating with the ext. - /// Kinode's http_server sends this to the ext after receiving [`HttpServerAction::WebSocketExtPushOutgoing`]. - /// Upon receiving reply with this type from ext, http_server parses, setting: + /// Kinode's http-server sends this to the ext after receiving [`HttpServerAction::WebSocketExtPushOutgoing`]. + /// Upon receiving reply with this type from ext, http-server parses, setting: /// * id as given, /// * message type as given ([`crate::Request`] or [`crate::Response`]), /// * body as [`HttpServerRequest::WebSocketPush`], @@ -270,7 +265,7 @@ impl HttpResponse { } } -/// Part of the [`crate::Response`] type issued by http_server +/// Part of the [`crate::Response`] type issued by http-server #[derive(Clone, Debug, Error, Serialize, Deserialize)] pub enum HttpServerError { #[error("request could not be parsed to HttpServerAction: {req}.")] @@ -281,11 +276,11 @@ pub enum HttpServerError { PathBindError { error: String }, #[error("WebSocket error: {error}")] WebSocketPushError { error: String }, - /// Not actually issued by `http_server:distro:sys`, just this library + /// Not actually issued by `http-server:distro:sys`, just this library #[error("timeout")] Timeout, - /// Not actually issued by `http_server:distro:sys`, just this library - #[error("unexpected response from http_server")] + /// Not actually issued by `http-server:distro:sys`, just this library + #[error("unexpected response from http-server")] UnexpectedResponse, } @@ -303,7 +298,7 @@ pub struct HttpServer { ws_paths: HashMap, /// A mapping of WebSocket paths to the channels that are open on them. ws_channels: HashMap>, - /// The timeout given for `http_server:distro:sys` to respond to a configuration request. + /// The timeout given for `http-server:distro:sys` to respond to a configuration request. pub timeout: u64, } @@ -398,43 +393,32 @@ impl HttpBindingConfig { /// `authenticated` is set to true by default and means that the WebSocket server will /// require a valid login cookie to access this path. /// -/// `encrypted` is set to false by default and means that the WebSocket server will -/// not apply a custom encryption to the WebSocket connection using the login cookie. -/// /// `extension` is set to false by default and means that the WebSocket will /// not use the WebSocket extension protocol to connect with a runtime extension. #[derive(Clone, Copy, Debug)] pub struct WsBindingConfig { authenticated: bool, secure_subdomain: bool, - encrypted: bool, extension: bool, } impl WsBindingConfig { /// Create a new WsBindingConfig with default values. /// - /// Authenticated, not encrypted, not an extension. + /// Authenticated, not a secure subdomain, not an extension. pub fn default() -> Self { Self { authenticated: true, secure_subdomain: false, - encrypted: false, extension: false, } } /// Create a new WsBindingConfig with the given values. - pub fn new( - authenticated: bool, - secure_subdomain: bool, - encrypted: bool, - extension: bool, - ) -> Self { + pub fn new(authenticated: bool, secure_subdomain: bool, extension: bool) -> Self { Self { authenticated, secure_subdomain, - encrypted, extension, } } @@ -451,13 +435,6 @@ impl WsBindingConfig { self } - /// Set whether the WebSocket server will apply a custom encryption to the WebSocket - /// connection using the login cookie. - pub fn encrypted(mut self, encrypted: bool) -> Self { - self.encrypted = encrypted; - self - } - /// Set whether the WebSocket server will be used for a runtime extension. pub fn extension(mut self, extension: bool) -> Self { self.extension = extension; @@ -487,7 +464,7 @@ impl HttpServer { { let path: String = path.into(); let cache = config.static_content.is_some(); - let req = KiRequest::to(("our", "http_server", "distro", "sys")).body( + let req = KiRequest::to(("our", "http-server", "distro", "sys")).body( serde_json::to_vec(&if config.secure_subdomain { HttpServerAction::SecureBind { path: path.clone(), @@ -531,11 +508,10 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body(if config.secure_subdomain { serde_json::to_vec(&HttpServerAction::WebSocketSecureBind { path: path.clone(), - encrypted: config.encrypted, extension: config.extension, }) .unwrap() @@ -543,7 +519,6 @@ impl HttpServer { serde_json::to_vec(&HttpServerAction::WebSocketBind { path: path.clone(), authenticated: config.authenticated, - encrypted: config.encrypted, extension: config.extension, }) .unwrap() @@ -575,7 +550,7 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerAction::Bind { path: path.clone(), @@ -626,7 +601,7 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerAction::SecureBind { path: path.clone(), @@ -668,11 +643,10 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerAction::WebSocketSecureBind { path: path.clone(), - encrypted: false, extension: false, }) .unwrap(), @@ -690,7 +664,6 @@ impl HttpServer { WsBindingConfig { authenticated: true, secure_subdomain: true, - encrypted: false, extension: false, }, ); @@ -713,7 +686,7 @@ impl HttpServer { .ok_or(HttpServerError::PathBindError { error: "path not found".to_string(), })?; - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerAction::Bind { path: path.to_string(), @@ -752,11 +725,10 @@ impl HttpServer { .ok_or(HttpServerError::PathBindError { error: "path not found".to_string(), })?; - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body(if entry.secure_subdomain { serde_json::to_vec(&HttpServerAction::WebSocketSecureBind { path: path.to_string(), - encrypted: config.encrypted, extension: config.extension, }) .unwrap() @@ -764,7 +736,6 @@ impl HttpServer { serde_json::to_vec(&HttpServerAction::WebSocketBind { path: path.to_string(), authenticated: config.authenticated, - encrypted: config.encrypted, extension: config.extension, }) .unwrap() @@ -780,7 +751,6 @@ impl HttpServer { if resp.is_ok() { entry.authenticated = config.authenticated; entry.secure_subdomain = config.secure_subdomain; - entry.encrypted = config.encrypted; entry.extension = config.extension; } resp @@ -792,7 +762,7 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body(serde_json::to_vec(&HttpServerAction::Unbind { path: path.clone() }).unwrap()) .send_and_await_response(self.timeout) .unwrap(); @@ -814,7 +784,7 @@ impl HttpServer { T: Into, { let path: String = path.into(); - let res = KiRequest::to(("our", "http_server", "distro", "sys")) + let res = KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerAction::WebSocketUnbind { path: path.clone() }) .unwrap(), @@ -911,7 +881,7 @@ impl HttpServer { } /// Serve static files from a given directory by binding all of them - /// in http_server to their filesystem path. + /// in http-server to their filesystem path. /// /// The directory is relative to the `pkg` folder within this package's drive. /// @@ -1030,7 +1000,7 @@ impl HttpServer { HttpServerRequest::WebSocketPush { channel_id, message_type, - } => ws_handler(channel_id, message_type, get_blob().unwrap_or_default()), + } => ws_handler(channel_id, message_type, last_blob().unwrap_or_default()), HttpServerRequest::WebSocketOpen { path, channel_id } => { self.handle_websocket_open(&path, channel_id); } @@ -1102,7 +1072,7 @@ pub fn send_response(status: StatusCode, headers: Option /// Send a WebSocket push message on an open WebSocket channel. pub fn send_ws_push(channel_id: u32, message_type: WsMessageType, blob: KiBlob) { - KiRequest::to(("our", "http_server", "distro", "sys")) + KiRequest::to(("our", "http-server", "distro", "sys")) .body( serde_json::to_vec(&HttpServerRequest::WebSocketPush { channel_id, diff --git a/src/kimap.rs b/src/kimap.rs index a2f96d6..19923c3 100644 --- a/src/kimap.rs +++ b/src/kimap.rs @@ -220,7 +220,7 @@ pub mod contract { } /// A mint log from the kimap, converted to a 'resolved' format using -/// namespace data saved in the kns_indexer. +/// namespace data saved in the kns-indexer. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Mint { pub name: String, @@ -228,7 +228,7 @@ pub struct Mint { } /// A note log from the kimap, converted to a 'resolved' format using -/// namespace data saved in the kns_indexer +/// namespace data saved in the kns-indexer #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Note { pub note: String, @@ -237,7 +237,7 @@ pub struct Note { } /// A fact log from the kimap, converted to a 'resolved' format using -/// namespace data saved in the kns_indexer +/// namespace data saved in the kns-indexer #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Fact { pub fact: String, @@ -255,7 +255,7 @@ pub enum DecodeLogError { InvalidName(String), /// An error occurred while decoding the log. DecodeError(String), - /// The parent name could not be resolved with `kns_indexer`. + /// The parent name could not be resolved with `kns-indexer`. UnresolvedParent(String), } diff --git a/src/kv.rs b/src/kv.rs index 516880c..71611b4 100644 --- a/src/kv.rs +++ b/src/kv.rs @@ -3,58 +3,154 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use std::marker::PhantomData; use thiserror::Error; -/// Actions are sent to a specific key value database, `db` is the name, -/// `package_id` is the [`PackageId`]. Capabilities are checked, you can access another process's -/// database if it has given you the [`crate::Capability`]. -#[derive(Debug, Serialize, Deserialize)] +/// Actions are sent to a specific key value database. `db` is the name, +/// `package_id` is the [`PackageId`] that created the database. Capabilities +/// are checked: you can access another process's database if it has given +/// you the read and/or write capability to do so. +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct KvRequest { pub package_id: PackageId, pub db: String, pub action: KvAction, } -#[derive(Debug, Serialize, Deserialize, Clone)] +/// IPC Action format representing operations that can be performed on the +/// key-value runtime module. These actions are included in a [`KvRequest`] +/// sent to the `kv:distro:sys` runtime module. +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum KvAction { + /// Opens an existing key-value database or creates a new one if it doesn't exist. + /// Requires `package_id` in [`KvRequest`] to match the package ID of the sender. + /// The sender will own the database and can remove it with [`KvAction::RemoveDb`]. + /// + /// A successful open will respond with [`KvResponse::Ok`]. Any error will be + /// contained in the [`KvResponse::Err`] variant. Open, + /// Permanently deletes the entire key-value database. + /// Requires `package_id` in [`KvRequest`] to match the package ID of the sender. + /// Only the owner can remove the database. + /// + /// A successful remove will respond with [`KvResponse::Ok`]. Any error will be + /// contained in the [`KvResponse::Err`] variant. RemoveDb, + /// Sets a value for the specified key in the database. + /// + /// # Parameters + /// * `key` - The key as a byte vector + /// * `tx_id` - Optional transaction ID if this operation is part of a transaction + /// * blob: [`Vec`] - Byte vector to store for the key + /// + /// Using this action requires the sender to have the write capability + /// for the database. + /// + /// A successful set will respond with [`KvResponse::Ok`]. Any error will be + /// contained in the [`KvResponse::Err`] variant. Set { key: Vec, tx_id: Option }, + /// Deletes a key-value pair from the database. + /// + /// # Parameters + /// * `key` - The key to delete as a byte vector + /// * `tx_id` - Optional transaction ID if this operation is part of a transaction + /// + /// Using this action requires the sender to have the write capability + /// for the database. + /// + /// A successful delete will respond with [`KvResponse::Ok`]. Any error will be + /// contained in the [`KvResponse::Err`] variant. Delete { key: Vec, tx_id: Option }, - Get { key: Vec }, + /// Retrieves the value associated with the specified key. + /// + /// # Parameters + /// * The key to look up as a byte vector + /// + /// Using this action requires the sender to have the read capability + /// for the database. + /// + /// A successful get will respond with [`KvResponse::Get`], where the response blob + /// contains the value associated with the key if any. Any error will be + /// contained in the [`KvResponse::Err`] variant. + Get(Vec), + /// Begins a new transaction for atomic operations. + /// + /// Sending this will prompt a [`KvResponse::BeginTx`] response with the + /// transaction ID. Any error will be contained in the [`KvResponse::Err`] variant. BeginTx, + /// Commits all operations in the specified transaction. + /// + /// # Parameters + /// * `tx_id` - The ID of the transaction to commit + /// + /// A successful commit will respond with [`KvResponse::Ok`]. Any error will be + /// contained in the [`KvResponse::Err`] variant. Commit { tx_id: u64 }, - Backup, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum KvResponse { + /// Indicates successful completion of an operation. + /// Sent in response to actions Open, RemoveDb, Set, Delete, and Commit. Ok, + /// Returns the transaction ID for a newly created transaction. + /// + /// # Fields + /// * `tx_id` - The ID of the newly created transaction BeginTx { tx_id: u64 }, - Get { key: Vec }, - Err { error: KvError }, + /// Returns the value for the key that was retrieved from the database. + /// + /// # Parameters + /// * The retrieved key as a byte vector + /// * blob: [`Vec`] - Byte vector associated with the key + Get(Vec), + /// Indicates an error occurred during the operation. + Err(KvError), } -#[derive(Debug, Serialize, Deserialize, Error)] +#[derive(Clone, Debug, Serialize, Deserialize, Error)] pub enum KvError { - #[error("kv: DbDoesNotExist")] - NoDb, - #[error("kv: KeyNotFound")] + #[error("db [{0}, {1}] does not exist")] + NoDb(PackageId, String), + #[error("key not found")] KeyNotFound, - #[error("kv: no Tx found")] - NoTx, - #[error("kv: No capability: {error}")] - NoCap { error: String }, - #[error("kv: rocksdb internal error: {error}")] - RocksDBError { action: String, error: String }, - #[error("kv: input bytes/json/key error: {error}")] - InputError { error: String }, - #[error("kv: IO error: {error}")] - IOError { error: String }, + #[error("no transaction {0} found")] + NoTx(u64), + #[error("no write capability for requested DB")] + NoWriteCap, + #[error("no read capability for requested DB")] + NoReadCap, + #[error("request to open or remove DB with mismatching package ID")] + MismatchingPackageId, + #[error("failed to generate capability for new DB")] + AddCapFailed, + #[error("kv got a malformed request that either failed to deserialize or was missing a required blob")] + MalformedRequest, + #[error("RocksDB internal error: {0}")] + RocksDBError(String), + #[error("IO error: {0}")] + IOError(String), +} + +/// The JSON parameters contained in all capabilities issued by `kv:distro:sys`. +/// +/// # Fields +/// * `kind` - The kind of capability, either [`KvCapabilityKind::Read`] or [`KvCapabilityKind::Write`] +/// * `db_key` - The database key, a tuple of the [`PackageId`] that created the database and the database name +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct KvCapabilityParams { + pub kind: KvCapabilityKind, + pub db_key: (PackageId, String), +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum KvCapabilityKind { + Read, + Write, } /// Kv helper struct for a db. /// Opening or creating a kv will give you a `Result`. /// You can call it's impl functions to interact with it. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct Kv { pub package_id: PackageId, pub db: String, @@ -75,7 +171,7 @@ where .body(serde_json::to_vec(&KvRequest { package_id: self.package_id.clone(), db: self.db.clone(), - action: KvAction::Get { key }, + action: KvAction::Get(key), })?) .send_and_await_response(self.timeout)?; @@ -93,7 +189,44 @@ where .map_err(|e| anyhow::anyhow!("Failed to deserialize value: {}", e))?; Ok(value) } - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } + + /// Get a value as a different type T + pub fn get_as(&self, key: &K) -> anyhow::Result + where + T: DeserializeOwned, + { + let key = serde_json::to_vec(key)?; + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Get(key), + })?) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Get { .. } => { + let bytes = match get_blob() { + Some(bytes) => bytes.bytes, + None => return Err(anyhow::anyhow!("kv: no blob")), + }; + let value = serde_json::from_slice::(&bytes) + .map_err(|e| anyhow::anyhow!("Failed to deserialize value: {}", e))?; + Ok(value) + } + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -122,7 +255,39 @@ where match response { KvResponse::Ok => Ok(()), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } + + /// Set a value as a different type T + pub fn set_as(&self, key: &K, value: &T, tx_id: Option) -> anyhow::Result<()> + where + T: Serialize, + { + let key = serde_json::to_vec(key)?; + let value = serde_json::to_vec(value)?; + + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Set { key, tx_id }, + })?) + .blob_bytes(value) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Ok => Ok(()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -148,7 +313,37 @@ where match response { KvResponse::Ok => Ok(()), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } + + /// Delete a value with a different key type + pub fn delete_as(&self, key: &T, tx_id: Option) -> anyhow::Result<()> + where + T: Serialize, + { + let key = serde_json::to_vec(key)?; + + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Delete { key, tx_id }, + })?) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Ok => Ok(()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -173,7 +368,7 @@ where match response { KvResponse::BeginTx { tx_id } => Ok(tx_id), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -198,7 +393,7 @@ where match response { KvResponse::Ok => Ok(()), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -207,6 +402,105 @@ where } } +impl Kv, Vec> { + /// Get raw bytes directly + pub fn get_raw(&self, key: &[u8]) -> anyhow::Result> { + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Get(key.to_vec()), + })?) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Get { .. } => { + let bytes = match get_blob() { + Some(bytes) => bytes.bytes, + None => return Err(anyhow::anyhow!("kv: no blob")), + }; + Ok(bytes) + } + KvResponse::Err { 0: error } => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } + + /// Set raw bytes directly + pub fn set_raw(&self, key: &[u8], value: &[u8], tx_id: Option) -> anyhow::Result<()> { + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Set { + key: key.to_vec(), + tx_id, + }, + })?) + .blob_bytes(value.to_vec()) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Ok => Ok(()), + KvResponse::Err { 0: error } => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } + + /// Delete raw bytes directly + pub fn delete_raw(&self, key: &[u8], tx_id: Option) -> anyhow::Result<()> { + let res = Request::new() + .target(("our", "kv", "distro", "sys")) + .body(serde_json::to_vec(&KvRequest { + package_id: self.package_id.clone(), + db: self.db.clone(), + action: KvAction::Delete { + key: key.to_vec(), + tx_id, + }, + })?) + .send_and_await_response(self.timeout)?; + + match res { + Ok(Message::Response { body, .. }) => { + let response = serde_json::from_slice::(&body)?; + + match response { + KvResponse::Ok => Ok(()), + KvResponse::Err { 0: error } => Err(error.into()), + _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), + } + } + _ => Err(anyhow::anyhow!("kv: unexpected message: {:?}", res)), + } + } +} + +/// Helper function to open a raw bytes key-value store +pub fn open_raw( + package_id: PackageId, + db: &str, + timeout: Option, +) -> anyhow::Result, Vec>> { + open(package_id, db, timeout) +} + /// Opens or creates a kv db. pub fn open(package_id: PackageId, db: &str, timeout: Option) -> anyhow::Result> where @@ -235,7 +529,7 @@ where timeout, _marker: PhantomData, }), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } @@ -262,7 +556,7 @@ pub fn remove_db(package_id: PackageId, db: &str, timeout: Option) -> anyho match response { KvResponse::Ok => Ok(()), - KvResponse::Err { error } => Err(error.into()), + KvResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!("kv: unexpected response {:?}", response)), } } diff --git a/src/lib.rs b/src/lib.rs index 0bc679a..d64c769 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,7 +33,7 @@ pub mod homepage; /// Contains types from the `http` crate to use as well. /// /// Your process must have the [`Capability`] to message and receive messages from -/// `http_server:distro:sys` and/or `http_client:distro:sys` to use this module. +/// `http-server:distro:sys` and/or `http-client:distro:sys` to use this module. pub mod http; /// The types that the kernel itself uses -- warning -- these will /// be incompatible with WIT types in some cases, leading to annoying errors. @@ -129,6 +129,24 @@ macro_rules! kiprintln { }}; } +/// Uses the `print_to_terminal` function from the WIT interface on maximally-verbose +/// mode, i.e., this print will always show up in the terminal. To control +/// the verbosity, use the `print_to_terminal` function directly. +/// +/// This version of println prepends the name of the process, so developers can see +/// which process within a package is generating the print. +#[macro_export] +macro_rules! process_println { + () => { + let our = $crate::our(); + $crate::print_to_terminal(0, format!("{}: ", our.process()).as_str()); + }; + ($($arg:tt)*) => {{ + let our = $crate::our(); + $crate::print_to_terminal(0, format!("{}: {}", our.process(), format!($($arg)*)).as_str()); + }}; +} + /// Await the next message sent to this process. The runtime will handle the /// queueing of incoming messages, and calling this function will provide the next one. /// Interwoven with incoming messages are errors from the network. If your process @@ -173,7 +191,7 @@ pub fn spawn( wasm_path: &str, on_exit: OnExit, request_capabilities: Vec, - grant_capabilities: Vec, + grant_capabilities: Vec<(ProcessId, Json)>, public: bool, ) -> Result { crate::kinode::process::standard::spawn( diff --git a/src/net.rs b/src/net.rs index c8ab253..231320d 100644 --- a/src/net.rs +++ b/src/net.rs @@ -108,7 +108,7 @@ pub enum NetResponse { Verified(bool), } -/// Request performed to `kns_indexer:kns_indexer:sys`, a userspace process +/// Request performed to `kns-indexer:kns-indexer:sys`, a userspace process /// installed by default. /// /// Other requests exist but are only used internally. @@ -131,7 +131,7 @@ pub struct NamehashToNameRequest { pub block: Option, } -/// Response from `kns_indexer:kns_indexer:sys`. +/// Response from `kns-indexer:kns-indexer:sys`. #[derive(Debug, Serialize, Deserialize)] pub enum IndexerResponses { /// Response to [`IndexerRequests::NamehashToName`]. @@ -222,7 +222,7 @@ pub fn get_name(namehash: T, block: Option, timeout: Option) -> Opt where T: Into, { - let res = Request::to(("our", "kns_indexer", "kns_indexer", "sys")) + let res = Request::to(("our", "kns-indexer", "kns-indexer", "sys")) .body( serde_json::to_vec(&IndexerRequests::NamehashToName(NamehashToNameRequest { hash: namehash.into(), diff --git a/src/sqlite.rs b/src/sqlite.rs index 4a88a5e..30c5bdd 100644 --- a/src/sqlite.rs +++ b/src/sqlite.rs @@ -3,43 +3,115 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; use thiserror::Error; -/// Actions are sent to a specific sqlite database, `db` is the name, -/// `package_id` is the [`PackageId`]. Capabilities are checked, you can access another process's -/// database if it has given you the [`crate::Capability`]. -#[derive(Debug, Serialize, Deserialize)] +/// Actions are sent to a specific SQLite database. `db` is the name, +/// `package_id` is the [`PackageId`] that created the database. Capabilities +/// are checked: you can access another process's database if it has given +/// you the read and/or write capability to do so. +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct SqliteRequest { pub package_id: PackageId, pub db: String, pub action: SqliteAction, } -#[derive(Debug, Serialize, Deserialize)] +/// IPC Action format representing operations that can be performed on the +/// SQLite runtime module. These actions are included in a [`SqliteRequest`] +/// sent to the `sqlite:distro:sys` runtime module. +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum SqliteAction { + /// Opens an existing key-value database or creates a new one if it doesn't exist. + /// Requires `package_id` in [`SqliteRequest`] to match the package ID of the sender. + /// The sender will own the database and can remove it with [`SqliteAction::RemoveDb`]. + /// + /// A successful open will respond with [`SqliteResponse::Ok`]. Any error will be + /// contained in the [`SqliteResponse::Err`] variant. Open, + /// Permanently deletes the entire key-value database. + /// Requires `package_id` in [`SqliteRequest`] to match the package ID of the sender. + /// Only the owner can remove the database. + /// + /// A successful remove will respond with [`SqliteResponse::Ok`]. Any error will be + /// contained in the [`SqliteResponse::Err`] variant. RemoveDb, + /// Executes a write statement (INSERT/UPDATE/DELETE) + /// + /// * `statement` - SQL statement to execute + /// * `tx_id` - Optional transaction ID + /// * blob: Vec - Parameters for the SQL statement, where SqlValue can be: + /// - null + /// - boolean + /// - i64 + /// - f64 + /// - String + /// - Vec (binary data) + /// + /// Using this action requires the sender to have the write capability + /// for the database. + /// + /// A successful write will respond with [`SqliteResponse::Ok`]. Any error will be + /// contained in the [`SqliteResponse::Err`] variant. Write { statement: String, tx_id: Option, }, - Read { - query: String, - }, + /// Executes a read query (SELECT) + /// + /// * blob: Vec - Parameters for the SQL query, where SqlValue can be: + /// - null + /// - boolean + /// - i64 + /// - f64 + /// - String + /// - Vec (binary data) + /// + /// Using this action requires the sender to have the read capability + /// for the database. + /// + /// A successful query will respond with [`SqliteResponse::Query`], where the + /// response blob contains the results of the query. Any error will be contained + /// in the [`SqliteResponse::Err`] variant. + Query(String), + /// Begins a new transaction for atomic operations. + /// + /// Sending this will prompt a [`SqliteResponse::BeginTx`] response with the + /// transaction ID. Any error will be contained in the [`SqliteResponse::Err`] variant. BeginTx, - Commit { - tx_id: u64, - }, - Backup, + /// Commits all operations in the specified transaction. + /// + /// # Parameters + /// * `tx_id` - The ID of the transaction to commit + /// + /// A successful commit will respond with [`SqliteResponse::Ok`]. Any error will be + /// contained in the [`SqliteResponse::Err`] variant. + Commit { tx_id: u64 }, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum SqliteResponse { + /// Indicates successful completion of an operation. + /// Sent in response to actions Open, RemoveDb, Write, Query, BeginTx, and Commit. Ok, + /// Returns the results of a query. + /// + /// * blob: Vec> - Array of rows, where each row contains SqlValue types: + /// - null + /// - boolean + /// - i64 + /// - f64 + /// - String + /// - Vec (binary data) Read, + /// Returns the transaction ID for a newly created transaction. + /// + /// # Fields + /// * `tx_id` - The ID of the newly created transaction BeginTx { tx_id: u64 }, - Err { error: SqliteError }, + /// Indicates an error occurred during the operation. + Err(SqliteError), } -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +/// Used in blobs to represent array row values in SQLite. +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] pub enum SqlValue { Integer(i64), Real(f64), @@ -49,28 +121,50 @@ pub enum SqlValue { Null, } -#[derive(Debug, Serialize, Deserialize, Error)] +#[derive(Clone, Debug, Serialize, Deserialize, Error)] pub enum SqliteError { - #[error("sqlite: DbDoesNotExist")] - NoDb, - #[error("sqlite: NoTx")] - NoTx, - #[error("sqlite: No capability: {error}")] - NoCap { error: String }, - #[error("sqlite: UnexpectedResponse")] - UnexpectedResponse, - #[error("sqlite: NotAWriteKeyword")] + #[error("db [{0}, {1}] does not exist")] + NoDb(PackageId, String), + #[error("no transaction {0} found")] + NoTx(u64), + #[error("no write capability for requested DB")] + NoWriteCap, + #[error("no read capability for requested DB")] + NoReadCap, + #[error("request to open or remove DB with mismatching package ID")] + MismatchingPackageId, + #[error("failed to generate capability for new DB")] + AddCapFailed, + #[error("write statement started with non-existent write keyword")] NotAWriteKeyword, - #[error("sqlite: NotAReadKeyword")] + #[error("read query started with non-existent read keyword")] NotAReadKeyword, - #[error("sqlite: Invalid Parameters")] + #[error("parameters blob in read/write was misshapen or contained invalid JSON objects")] InvalidParameters, - #[error("sqlite: IO error: {error}")] - IOError { error: String }, - #[error("sqlite: rusqlite error: {error}")] - RusqliteError { error: String }, - #[error("sqlite: input bytes/json/key error: {error}")] - InputError { error: String }, + #[error("sqlite got a malformed request that failed to deserialize")] + MalformedRequest, + #[error("rusqlite error: {0}")] + RusqliteError(String), + #[error("IO error: {0}")] + IOError(String), +} + +/// The JSON parameters contained in all capabilities issued by `sqlite:distro:sys`. +/// +/// # Fields +/// * `kind` - The kind of capability, either [`SqliteCapabilityKind::Read`] or [`SqliteCapabilityKind::Write`] +/// * `db_key` - The database key, a tuple of the [`PackageId`] that created the database and the database name +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct SqliteCapabilityParams { + pub kind: SqliteCapabilityKind, + pub db_key: (PackageId, String), +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum SqliteCapabilityKind { + Read, + Write, } /// Sqlite helper struct for a db. @@ -95,7 +189,7 @@ impl Sqlite { .body(serde_json::to_vec(&SqliteRequest { package_id: self.package_id.clone(), db: self.db.clone(), - action: SqliteAction::Read { query }, + action: SqliteAction::Query(query), })?) .blob_bytes(serde_json::to_vec(¶ms)?) .send_and_await_response(self.timeout)?; @@ -106,18 +200,14 @@ impl Sqlite { match response { SqliteResponse::Read => { - let blob = get_blob().ok_or_else(|| SqliteError::InputError { - error: "sqlite: no blob".to_string(), - })?; + let blob = get_blob().ok_or_else(|| SqliteError::MalformedRequest)?; let values = serde_json::from_slice::< Vec>, >(&blob.bytes) - .map_err(|e| SqliteError::InputError { - error: format!("sqlite: gave unparsable response: {}", e), - })?; + .map_err(|_| SqliteError::MalformedRequest)?; Ok(values) } - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response @@ -151,7 +241,7 @@ impl Sqlite { match response { SqliteResponse::Ok => Ok(()), - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response @@ -179,7 +269,7 @@ impl Sqlite { match response { SqliteResponse::BeginTx { tx_id } => Ok(tx_id), - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response @@ -207,7 +297,7 @@ impl Sqlite { match response { SqliteResponse::Ok => Ok(()), - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response @@ -242,7 +332,7 @@ pub fn open(package_id: PackageId, db: &str, timeout: Option) -> anyhow::Re db: db.to_string(), timeout, }), - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response @@ -272,7 +362,7 @@ pub fn remove_db(package_id: PackageId, db: &str, timeout: Option) -> anyho match response { SqliteResponse::Ok => Ok(()), - SqliteResponse::Err { error } => Err(error.into()), + SqliteResponse::Err(error) => Err(error.into()), _ => Err(anyhow::anyhow!( "sqlite: unexpected response {:?}", response diff --git a/src/types/message.rs b/src/types/message.rs index 5faa55c..e58cf57 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -1,5 +1,6 @@ use crate::{Address, Capability, LazyLoadBlob, ProcessId}; use serde::{Deserialize, Serialize}; +use thiserror::Error; /// The basic `Message` type. /// A `Message` is either a [`crate::Request`] or a [`crate::Response`]. @@ -26,23 +27,14 @@ pub enum Message { }, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Error, Serialize, Deserialize)] pub enum BuildError { + #[error("no body set for message")] NoBody, + #[error("no target set for message")] NoTarget, } -impl std::fmt::Display for BuildError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - BuildError::NoBody => write!(f, "no body set for message"), - BuildError::NoTarget => write!(f, "no target set for message"), - } - } -} - -impl std::error::Error for BuildError {} - impl Message { /// Get the `source` [`Address`] of a `Message`. pub fn source(&self) -> &Address { diff --git a/src/types/request.rs b/src/types/request.rs index aafd242..f937955 100644 --- a/src/types/request.rs +++ b/src/types/request.rs @@ -1,6 +1,6 @@ use crate::{ - Address, Capability, LazyLoadBlob, Message, SendError, _wit_message_to_message, - _wit_send_error_to_send_error, types::message::BuildError, + our_capabilities, Address, Capability, LazyLoadBlob, Message, SendError, + _wit_message_to_message, _wit_send_error_to_send_error, types::message::BuildError, }; /// `Request` builder. Use [`Request::new()`] or [`Request::to()`] to start a request, @@ -34,7 +34,7 @@ impl Request { capabilities: vec![], } } - /// Start building a new Request with the `target` [`Address`]. In order + /// Start building a new `Request` with the `target` [`Address`]. In order /// to successfully send, you must still fill out at least the `body` field /// by calling [`Request::body()`] or [`Request::try_body()`] next. pub fn to(target: T) -> Self @@ -52,7 +52,7 @@ impl Request { capabilities: vec![], } } - /// Set the target [`Address`] that this request will go to. + /// Set the `target` [`Address`] that this `Request` will go to. pub fn target(mut self, target: T) -> Self where T: Into
, @@ -235,11 +235,31 @@ impl Request { self } /// Attach the [`Capability`] to message this process to the next message. - pub fn attach_messaging(mut self, our: &Address) { + pub fn attach_messaging(mut self, our: &Address) -> Self { self.capabilities.extend(vec![Capability { issuer: our.clone(), params: "\"messaging\"".to_string(), }]); + self + } + /// Attach all capabilities we have that were issued by `target` (if set) to the next message. + pub fn try_attach_all(self) -> Result { + let Some(ref target) = self.target else { + return Err(BuildError::NoTarget); + }; + let target = target.clone(); + Ok(self.attach_all(&target)) + } + /// Attach all capabilities we have that were issued by `target` to the next message. + pub fn attach_all(mut self, target: &Address) -> Self { + let target = target.clone(); + self.capabilities.extend( + our_capabilities() + .into_iter() + .filter(|cap| cap.issuer == target) + .collect::>(), + ); + self } /// Attempt to send the `Request`. This will only fail if the `target` or `body` /// fields have not been set. diff --git a/src/types/response.rs b/src/types/response.rs index 9554e98..fe8a035 100644 --- a/src/types/response.rs +++ b/src/types/response.rs @@ -1,4 +1,4 @@ -use crate::{types::message::BuildError, Capability, LazyLoadBlob}; +use crate::{our_capabilities, types::message::BuildError, Address, Capability, LazyLoadBlob}; /// `Response` builder. Use [`Response::new()`] to start a `Response`, then build it, /// then call [`Response::send()`] on it to fire. @@ -150,6 +150,17 @@ impl Response { self.capabilities = capabilities; self } + /// Attach all capabilities we have that were issued by `target` to the next message. + pub fn attach_all(mut self, target: &Address) -> Self { + let target = target.clone(); + self.capabilities.extend( + our_capabilities() + .into_iter() + .filter(|cap| cap.issuer == target) + .collect::>(), + ); + self + } /// Attempt to send the `Response`. This will only fail if the IPC body field of /// the `Response` has not yet been set using `body()` or `try_body()`. pub fn send(self) -> Result<(), BuildError> { diff --git a/src/vfs/file.rs b/src/vfs/file.rs index e73c071..8a6ad07 100644 --- a/src/vfs/file.rs +++ b/src/vfs/file.rs @@ -81,9 +81,9 @@ impl File { /// Read into buffer from current cursor position /// Returns the amount of bytes read. pub fn read_at(&self, buffer: &mut [u8]) -> Result { - let length = buffer.len(); + let length = buffer.len() as u64; - let message = vfs_request(&self.path, VfsAction::ReadExact(length as u64)) + let message = vfs_request(&self.path, VfsAction::ReadExact { length }) .send_and_await_response(self.timeout) .unwrap() .map_err(|e| VfsError::IOError { @@ -216,7 +216,7 @@ impl File { /// Seek file to position. /// Returns the new position. pub fn seek(&mut self, pos: SeekFrom) -> Result { - let message = vfs_request(&self.path, VfsAction::Seek { seek_from: pos }) + let message = vfs_request(&self.path, VfsAction::Seek(pos)) .send_and_await_response(self.timeout) .unwrap() .map_err(|e| VfsError::IOError { @@ -225,7 +225,9 @@ impl File { })?; match parse_response(message.body())? { - VfsResponse::SeekFrom(new_pos) => Ok(new_pos), + VfsResponse::SeekFrom { + new_offset: new_pos, + } => Ok(new_pos), VfsResponse::Err(e) => Err(e), _ => Err(VfsError::ParseError { error: "unexpected response".to_string(), diff --git a/src/vfs/mod.rs b/src/vfs/mod.rs index 6fdd5b7..f6b6319 100644 --- a/src/vfs/mod.rs +++ b/src/vfs/mod.rs @@ -32,9 +32,9 @@ pub enum VfsAction { Read, ReadDir, ReadToEnd, - ReadExact(u64), + ReadExact { length: u64 }, ReadToString, - Seek { seek_from: SeekFrom }, + Seek(SeekFrom), RemoveFile, RemoveDir, RemoveDirAll, @@ -79,7 +79,7 @@ pub enum VfsResponse { Ok, Err(VfsError), Read, - SeekFrom(u64), + SeekFrom { new_offset: u64 }, ReadDir(Vec), ReadToString(String), Metadata(FileMetadata),