diff --git a/Cargo.lock b/Cargo.lock index 8456daacc..54a37d370 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arbitrary" @@ -112,14 +112,14 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "assert_cmd" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" +checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" dependencies = [ "anstyle", "bstr", "doc-comment", - "predicates 3.0.4", + "predicates 3.1.0", "predicates-core", "predicates-tree", "wait-timeout", @@ -127,14 +127,14 @@ dependencies = [ [[package]] name = "assert_fs" -version = "1.0.13" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f070617a68e5c2ed5d06ee8dd620ee18fb72b99f6c094bed34cf8ab07c875b48" +checksum = "2cd762e110c8ed629b11b6cde59458cc1c71de78ebbcc30099fc8e0403a2a2ec" dependencies = [ "anstyle", "doc-comment", "globwalk", - "predicates 3.0.4", + "predicates 3.1.0", "predicates-core", "predicates-tree", "tempfile", @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" dependencies = [ "proc-macro2", "quote", @@ -192,9 +192,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -219,9 +219,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -243,12 +243,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "serde", ] @@ -302,9 +302,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -341,9 +341,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", @@ -351,14 +351,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.11" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -387,9 +387,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.4" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" +checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106" dependencies = [ "clap", ] @@ -436,9 +436,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" @@ -458,9 +458,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -498,45 +498,37 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-bigint" @@ -644,9 +636,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" +checksum = "58ab30434ea0ff6aa640a08dda5284026a366d47565496fd40b6cbfbdd7e31a2" dependencies = [ "cc", "cxxbridge-flags", @@ -656,9 +648,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" +checksum = "b649d7dfae8268450d53d109388b337b9352c7cba1fc10db4a1bc23c3dc189fb" dependencies = [ "cc", "codespan-reporting", @@ -671,15 +663,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" +checksum = "42281b20eba5218c539295c667c18e2f50211bb11902419194c6ed1ae808e547" [[package]] name = "cxxbridge-macro" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" +checksum = "b45506e3c66512b0a65d291a6b452128b7b1dd9841e20d1e151addbd2c00ea50" dependencies = [ "proc-macro2", "quote", @@ -739,9 +731,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -1077,18 +1069,18 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-io" @@ -1098,21 +1090,21 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", @@ -1277,7 +1269,7 @@ dependencies = [ "gix-chunk", "gix-features", "gix-hash", - "memmap2 0.9.3", + "memmap2 0.9.4", "thiserror", ] @@ -1304,11 +1296,11 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" +checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-path", "libc", @@ -1423,7 +1415,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-features", "gix-path", @@ -1468,7 +1460,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c83a4fcc121b2f2e109088f677f89f85e7a8ebf39e8e6659c0ae54d4283b1650" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "btoi", "filetime", @@ -1513,7 +1505,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a5cdcf491ecc9ce39dcc227216c540355fe0024ae7c38e94557752ca5ebb67f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "gix-commitgraph", "gix-date", "gix-hash", @@ -1605,9 +1597,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" +checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" dependencies = [ "bstr", "gix-trace", @@ -1622,7 +1614,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dbbb92f75a38ef043c8bb830b339b38d0698d7f3746968b5fcbade7a880494d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-attributes", "gix-config-value", @@ -1741,14 +1733,14 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" +checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "gix-path", "libc", - "windows", + "windows-sys 0.52.0", ] [[package]] @@ -1781,9 +1773,9 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e1127ede0475b58f4fe9c0aaa0d9bb0bad2af90bbd93ccd307c8632b863d89" +checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" [[package]] name = "gix-transport" @@ -1791,7 +1783,7 @@ version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f209a93364e24f20319751bc11092272e2f3fe82bb72592b2822679cf5be752" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bstr", "gix-command", "gix-credentials", @@ -1836,11 +1828,12 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" +checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" dependencies = [ "fastrand", + "unicode-normalization", ] [[package]] @@ -1906,17 +1899,17 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] [[package]] name = "globwalk" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "ignore", "walkdir", ] @@ -1934,16 +1927,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", "indexmap 2.1.0", "slab", "tokio", @@ -1971,9 +1964,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2011,11 +2004,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2040,6 +2033,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -2047,7 +2051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", "pin-project-lite", ] @@ -2065,22 +2069,22 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", "h2", - "http", + "http 0.2.11", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -2094,7 +2098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", + "http 0.2.11", "hyper", "log", "rustls", @@ -2118,16 +2122,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.51.1", + "windows-core", ] [[package]] @@ -2167,15 +2171,15 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "same-file", "walkdir", "winapi-util", @@ -2245,7 +2249,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.5", + "socket2", "widestring", "windows-sys 0.48.0", "winreg", @@ -2292,9 +2296,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -2368,9 +2372,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -2392,9 +2396,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libm" @@ -2408,7 +2412,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "redox_syscall", ] @@ -2430,9 +2434,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2487,9 +2491,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memmap2" @@ -2502,22 +2506,13 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.17" @@ -2640,9 +2635,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2661,11 +2656,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.61" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -2702,9 +2697,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.97" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -2771,18 +2766,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -2813,15 +2808,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "powerfmt" @@ -2851,13 +2846,12 @@ dependencies = [ [[package]] name = "predicates" -version = "3.0.4" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfc28575c2e3f19cb3c73b93af36460ae898d426eba6fc15b9bd2a5220758a0" +checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" dependencies = [ "anstyle", "difflib", - "itertools 0.11.0", "predicates-core", ] @@ -2881,7 +2875,7 @@ dependencies = [ name = "preflight" version = "20.2.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "libc", "sha2 0.10.8", "soroban-env-host", @@ -2996,13 +2990,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -3017,9 +3011,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -3044,13 +3038,13 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http", + "http 0.2.11", "http-body", "hyper", "hyper-rustls", @@ -3157,11 +3151,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -3198,7 +3192,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -3234,11 +3228,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3332,9 +3326,9 @@ dependencies = [ [[package]] name = "serde-aux" -version = "4.3.1" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184eba62ebddb71658697c8b08822edee89970bf318c5362189f0de27f85b498" +checksum = "a86348501c129f3ad50c2f4635a01971f76974cd8a3f335988a0f1581c082765" dependencies = [ "chrono", "serde", @@ -3377,11 +3371,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -3394,9 +3388,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "dbff351eb4b33600a2e138dfa0b10b65a238ea8ff8fb2387c422c5022a3e8298" dependencies = [ "darling", "proc-macro2", @@ -3455,9 +3449,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -3506,19 +3500,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -3547,7 +3531,7 @@ version = "20.2.0" dependencies = [ "assert_cmd", "assert_fs", - "base64 0.21.5", + "base64 0.21.7", "cargo_metadata", "chrono", "clap", @@ -3562,7 +3546,7 @@ dependencies = [ "gix", "heck", "hex", - "http", + "http 0.2.11", "hyper", "hyper-tls", "itertools 0.10.5", @@ -3584,6 +3568,7 @@ dependencies = [ "shlex", "soroban-env-host", "soroban-ledger-snapshot", + "soroban-rpc", "soroban-sdk", "soroban-spec", "soroban-spec-json", @@ -3691,6 +3676,38 @@ dependencies = [ "thiserror", ] +[[package]] +name = "soroban-rpc" +version = "20.3.0" +dependencies = [ + "base64 0.21.7", + "clap", + "ed25519-dalek 2.0.0", + "ethnum", + "hex", + "http 1.0.0", + "itertools 0.10.5", + "jsonrpsee-core", + "jsonrpsee-http-client", + "serde", + "serde-aux", + "serde_json", + "sha2 0.10.8", + "soroban-env-host", + "soroban-sdk", + "soroban-spec", + "soroban-spec-tools", + "stellar-strkey 0.0.7", + "stellar-xdr", + "termcolor", + "termcolor_output", + "thiserror", + "tokio", + "tracing", + "wasmparser 0.90.0", + "which", +] + [[package]] name = "soroban-sdk" version = "20.3.0" @@ -3785,11 +3802,12 @@ dependencies = [ name = "soroban-spec-tools" version = "20.3.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "ethnum", "hex", "itertools 0.10.5", "serde_json", + "soroban-env-host", "soroban-spec", "stellar-strkey 0.0.7", "stellar-xdr", @@ -3803,7 +3821,7 @@ dependencies = [ name = "soroban-spec-typescript" version = "20.3.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "heck", "include_dir", "itertools 0.10.5", @@ -4001,28 +4019,28 @@ dependencies = [ [[package]] name = "temp-dir" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab" +checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -4087,18 +4105,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" dependencies = [ "proc-macro2", "quote", @@ -4117,9 +4135,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -4139,9 +4157,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -4182,9 +4200,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -4194,7 +4212,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -4431,9 +4449,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-bom" @@ -4539,9 +4557,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4549,9 +4567,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -4564,9 +4582,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -4576,9 +4594,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4586,9 +4604,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -4599,9 +4617,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-opt" @@ -4688,9 +4706,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -4752,25 +4770,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-core" version = "0.52.0" @@ -4914,9 +4913,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 8ba86ea28..aa19bda95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,27 +69,49 @@ rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" version = "20.2.0" path = "cmd/soroban-cli" +[workspace.dependencies.soroban-rpc] +version = "20.2.0" +path = "cmd/crates/soroban-rpc" + [workspace.dependencies.stellar-xdr] version = "=20.1.0" default-features = true [workspace.dependencies] +stellar-strkey = "0.0.7" +sep5 = "0.0.2" base64 = "0.21.2" thiserror = "1.0.46" sha2 = "0.10.7" ethnum = "1.3.2" hex = "0.4.3" itertools = "0.10.0" -sep5 = "0.0.2" + +serde-aux = "4.1.2" serde_json = "1.0.82" serde = "1.0.82" -stellar-strkey = "0.0.7" + +clap = { version = "4.1.8", features = [ + "derive", + "env", + "deprecated", + "string", +] } +clap_complete = "4.1.4" tracing = "0.1.37" tracing-subscriber = "0.3.16" tracing-appender = "0.2.2" which = "4.4.0" wasmparser = "0.90.0" - +termcolor = "1.1.3" +termcolor_output = "1.0.1" +ed25519-dalek = "2.0.0" + +# networking +http = "1.0.0" +jsonrpsee-http-client = "0.20.1" +jsonrpsee-core = "0.20.1" +tokio = "1.28.1" # [patch."https://github.com/stellar/rs-soroban-env"] # soroban-env-host = { path = "../rs-soroban-env/soroban-env-host/" } diff --git a/cmd/crates/soroban-rpc/Cargo.toml b/cmd/crates/soroban-rpc/Cargo.toml new file mode 100644 index 000000000..966597a22 --- /dev/null +++ b/cmd/crates/soroban-rpc/Cargo.toml @@ -0,0 +1,51 @@ +[package] +name = "soroban-rpc" +description = "Soroban RPC client for rust" +homepage = "https://github.com/stellar/soroban-tools" +repository = "https://github.com/stellar/soroban-tools" +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +readme = "README.md" +version.workspace = true +edition = "2021" +rust-version.workspace = true +autobins = false + + +[lib] +crate-type = ["rlib"] + + +[dependencies] +soroban-sdk = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } +soroban-spec-tools = { version = "20.2.0", path = "../soroban-spec-tools" } +soroban-env-host = { version = "=20.2.0", git = "https://github.com/stellar/rs-soroban-env", rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" } +stellar-strkey = "0.0.7" +stellar-xdr = { version = "=20.1.0", default-features = true, features = ["curr", "std", "serde"] } +soroban-spec = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } + +termcolor = "1.1.3" +termcolor_output = "1.0.1" +clap = { version = "4.1.8", features = ["derive", "env", "deprecated", "string"] } +serde_json = "1.0.82" +serde-aux = "4.1.2" +itertools = "0.10.0" +ethnum = "1.3.2" +hex = "0.4.3" +wasmparser = "0.90.0" +base64 = "0.21.2" +thiserror = "1.0.46" +serde = "1.0.82" +tokio = "1.28.1" +sha2 = "0.10.7" +ed25519-dalek = "2.0.0" +tracing = "0.1.40" + +# networking +jsonrpsee-http-client = "0.20.1" +jsonrpsee-core = "0.20.1" +http = "1.0.0" + + +[dev-dependencies] +which = "4.4.0" diff --git a/cmd/crates/soroban-rpc/README.md b/cmd/crates/soroban-rpc/README.md new file mode 100644 index 000000000..9185b7fd0 --- /dev/null +++ b/cmd/crates/soroban-rpc/README.md @@ -0,0 +1,3 @@ +# soroban-rpc + +Tools and utilities for soroban rpc. diff --git a/cmd/soroban-cli/src/rpc/fixtures/event_response.json b/cmd/crates/soroban-rpc/src/fixtures/event_response.json similarity index 100% rename from cmd/soroban-cli/src/rpc/fixtures/event_response.json rename to cmd/crates/soroban-rpc/src/fixtures/event_response.json diff --git a/cmd/soroban-cli/src/rpc/mod.rs b/cmd/crates/soroban-rpc/src/lib.rs similarity index 92% rename from cmd/soroban-cli/src/rpc/mod.rs rename to cmd/crates/soroban-rpc/src/lib.rs index 535426292..95c3692e1 100644 --- a/cmd/soroban-cli/src/rpc/mod.rs +++ b/cmd/crates/soroban-rpc/src/lib.rs @@ -21,15 +21,20 @@ use std::{ str::FromStr, time::{Duration, Instant}, }; +use stellar_xdr::curr::ContractEventType; use termcolor::{Color, ColorChoice, StandardStream, WriteColor}; use termcolor_output::colored; use tokio::time::sleep; -use crate::utils::contract_spec; - +pub mod log; mod txn; +pub use txn::Assembled; + +use soroban_spec_tools::contract; + const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION"); +pub(crate) const DEFAULT_TRANSACTION_FEES: u32 = 100; pub type LogEvents = fn( footprint: &LedgerFootprint, @@ -88,7 +93,7 @@ pub enum Error { #[error("unexpected contract code data type: {0:?}")] UnexpectedContractCodeDataType(LedgerEntryData), #[error(transparent)] - CouldNotParseContractSpec(#[from] contract_spec::Error), + CouldNotParseContractSpec(#[from] contract::Error), #[error("unexpected contract code got token")] UnexpectedToken(ContractDataEntry), #[error(transparent)] @@ -99,6 +104,9 @@ pub enum Error { LargeFee(u64), #[error("Cannot authorize raw transactions")] CannotAuthorizeRawTransaction, + + #[error("Missing result for tnx")] + MissingOp, } #[derive(serde::Deserialize, serde::Serialize, Debug)] @@ -170,6 +178,41 @@ impl TryInto for GetTransactionResponseRaw { } } +impl GetTransactionResponse { + /// + /// # Errors + pub fn return_value(&self) -> Result { + if let Some(xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { + soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), + .. + })) = &self.result_meta + { + Ok(return_value.clone()) + } else { + Err(Error::MissingOp) + } + } + + /// + /// # Errors + pub fn events(&self) -> Result, Error> { + self.result_meta + .as_ref() + .map(extract_events) + .ok_or(Error::MissingOp) + } + + /// + /// # Errors + pub fn contract_events(&self) -> Result, Error> { + Ok(self + .events()? + .into_iter() + .filter(|e| matches!(e.event.type_, ContractEventType::Contract)) + .collect::>()) + } +} + #[derive(serde::Deserialize, serde::Serialize, Debug)] pub struct LedgerEntryResult { pub key: String, @@ -273,6 +316,8 @@ pub struct SimulateTransactionResponse { } impl SimulateTransactionResponse { + /// + /// # Errors pub fn results(&self) -> Result, Error> { self.results .iter() @@ -294,6 +339,8 @@ impl SimulateTransactionResponse { .collect() } + /// + /// # Errors pub fn events(&self) -> Result, Error> { self.events .iter() @@ -301,6 +348,8 @@ impl SimulateTransactionResponse { .collect() } + /// + /// # Errors pub fn transaction_data(&self) -> Result { Ok(SorobanTransactionData::from_xdr_base64( &self.transaction_data, @@ -343,6 +392,7 @@ pub struct GetEventsResponse { // Reference](https://docs.google.com/document/d/1TZUDgo_3zPz7TiPMMHVW_mtogjLyPL0plvzGMsxSz6A/edit#bookmark=id.35t97rnag3tx) // [Code // Reference](https://github.com/stellar/soroban-tools/blob/bac1be79e8c2590c9c35ad8a0168aab0ae2b4171/cmd/soroban-rpc/internal/methods/get_events.go#L182-L203) +#[must_use] pub fn does_topic_match(topic: &[String], filter: &[String]) -> bool { filter.len() == topic.len() && filter @@ -397,10 +447,13 @@ impl Display for Event { } impl Event { + /// + /// # Errors pub fn parse_cursor(&self) -> Result<(u64, i32), Error> { parse_cursor(&self.id) } - + /// + /// # Errors pub fn pretty_print(&self) -> Result<(), Box> { let mut stdout = StandardStream::stdout(ColorChoice::Auto); if !stdout.supports_color() { @@ -502,6 +555,8 @@ pub struct Client { } impl Client { + /// + /// # Errors pub fn new(base_url: &str) -> Result { // Add the port to the base URL if there is no port explicitly included // in the URL and the scheme allows us to infer a default port. @@ -532,6 +587,8 @@ impl Client { }) } + /// + /// # Errors fn client(&self) -> Result { let url = self.base_url.clone(); let mut headers = HeaderMap::new(); @@ -543,6 +600,8 @@ impl Client { .build(url)?) } + /// + /// # Errors pub async fn friendbot_url(&self) -> Result { let network = self.get_network().await?; tracing::trace!("{network:#?}"); @@ -553,7 +612,8 @@ impl Client { ) }) } - + /// + /// # Errors pub async fn verify_network_passphrase(&self, expected: Option<&str>) -> Result { let server = self.get_network().await?.passphrase; if let Some(expected) = expected { @@ -567,11 +627,15 @@ impl Client { Ok(server) } + /// + /// # Errors pub async fn get_network(&self) -> Result { tracing::trace!("Getting network"); Ok(self.client()?.request("getNetwork", rpc_params![]).await?) } + /// + /// # Errors pub async fn get_latest_ledger(&self) -> Result { tracing::trace!("Getting latest ledger"); Ok(self @@ -580,6 +644,8 @@ impl Client { .await?) } + /// + /// # Errors pub async fn get_account(&self, address: &str) -> Result { tracing::trace!("Getting address {}", address); let key = LedgerKey::Account(LedgerKeyAccount { @@ -611,10 +677,12 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn send_transaction( &self, tx: &TransactionEnvelope, - ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { + ) -> Result { let client = self.client()?; tracing::trace!("Sending:\n{tx:#?}"); let SendTransactionResponse { @@ -656,14 +724,8 @@ soroban config identity fund {address} --helper-url "# "SUCCESS" => { // TODO: the caller should probably be printing this tracing::trace!("{response:#?}"); - let GetTransactionResponse { - result, - result_meta, - .. - } = response; - let meta = result_meta.ok_or(Error::MissingResult)?; - let events = extract_events(&meta); - return Ok((result.ok_or(Error::MissingResult)?, meta, events)); + + return Ok(response); } "FAILED" => { tracing::error!("{response:#?}"); @@ -687,6 +749,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn simulate_transaction( &self, tx: &TransactionEnvelope, @@ -703,33 +767,69 @@ soroban config identity fund {address} --helper-url "# match response.error { None => Ok(response), Some(e) => { - crate::log::diagnostic_events(&response.events, tracing::Level::ERROR); + log::diagnostic_events(&response.events, tracing::Level::ERROR); Err(Error::TransactionSimulationFailed(e)) } } } - pub async fn prepare_and_send_transaction( + /// + /// # Errors + pub async fn send_assembled_transaction( &self, - tx_without_preflight: &Transaction, + txn: txn::Assembled, source_key: &ed25519_dalek::SigningKey, signers: &[ed25519_dalek::SigningKey], network_passphrase: &str, log_events: Option, log_resources: Option, - ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { - let txn = txn::Assembled::new(tx_without_preflight, self).await?; - let seq_num = txn.sim_res().latest_ledger + 60; //5 min; + ) -> Result { + let seq_num = txn.sim_response().latest_ledger + 60; //5 min; let authorized = txn .handle_restore(self, source_key, network_passphrase) .await? .authorize(self, source_key, signers, seq_num, network_passphrase) .await?; authorized.log(log_events, log_resources)?; + let tx = authorized.sign(source_key, network_passphrase)?; self.send_transaction(&tx).await } + /// + /// # Errors + pub async fn prepare_and_send_transaction( + &self, + tx_without_preflight: &Transaction, + source_key: &ed25519_dalek::SigningKey, + signers: &[ed25519_dalek::SigningKey], + network_passphrase: &str, + log_events: Option, + log_resources: Option, + ) -> Result { + let txn = txn::Assembled::new(tx_without_preflight, self).await?; + self.send_assembled_transaction( + txn, + source_key, + signers, + network_passphrase, + log_events, + log_resources, + ) + .await + } + + /// + /// # Errors + pub async fn create_assembled_transaction( + &self, + txn: &Transaction, + ) -> Result { + txn::Assembled::new(txn, self).await + } + + /// + /// # Errors pub async fn get_transaction(&self, tx_id: &str) -> Result { Ok(self .client()? @@ -737,6 +837,8 @@ soroban config identity fund {address} --helper-url "# .await?) } + /// + /// # Errors pub async fn get_ledger_entries( &self, keys: &[LedgerKey], @@ -747,7 +849,7 @@ soroban config identity fund {address} --helper-url "# if base64_result.is_err() { return Err(Error::Xdr(XdrError::Invalid)); } - base64_keys.push(k.to_xdr_base64(Limits::none()).unwrap()); + base64_keys.push(k.to_xdr_base64(Limits::none())?); } Ok(self .client()? @@ -755,6 +857,8 @@ soroban config identity fund {address} --helper-url "# .await?) } + /// + /// # Errors pub async fn get_full_ledger_entries( &self, ledger_keys: &[LedgerKey], @@ -795,7 +899,8 @@ soroban config identity fund {address} --helper-url "# latest_ledger, }) } - + /// + /// # Errors pub async fn get_events( &self, start: EventStart, @@ -835,6 +940,8 @@ soroban config identity fund {address} --helper-url "# Ok(self.client()?.request("getEvents", oparams).await?) } + /// + /// # Errors pub async fn get_contract_data( &self, contract_id: &[u8; 32], @@ -858,6 +965,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn get_remote_wasm(&self, contract_id: &[u8; 32]) -> Result, Error> { match self.get_contract_data(contract_id).await? { xdr::ContractDataEntry { @@ -872,6 +981,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn get_remote_wasm_from_hash(&self, hash: xdr::Hash) -> Result, Error> { let code_key = LedgerKey::ContractCode(xdr::LedgerKeyContractCode { hash: hash.clone() }); let contract_data = self.get_ledger_entries(&[code_key]).await?; @@ -888,7 +999,8 @@ soroban config identity fund {address} --helper-url "# scval => Err(Error::UnexpectedContractCodeDataType(scval)), } } - + /// + /// # Errors pub async fn get_remote_contract_spec( &self, contract_id: &[u8; 32], @@ -898,11 +1010,11 @@ soroban config identity fund {address} --helper-url "# xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::Wasm(hash), .. - }) => Ok(contract_spec::ContractSpec::new( - &self.get_remote_wasm_from_hash(hash).await?, - ) - .map_err(Error::CouldNotParseContractSpec)? - .spec), + }) => Ok( + contract::Spec::new(&self.get_remote_wasm_from_hash(hash).await?) + .map_err(Error::CouldNotParseContractSpec)? + .spec, + ), xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::StellarAsset, .. @@ -939,7 +1051,7 @@ fn extract_events(tx_meta: &TransactionMeta) -> Vec { } } -pub fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { +pub(crate) fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { let (toid_part, event_index) = c.split('-').collect_tuple().ok_or(Error::InvalidCursor)?; let toid_part: u64 = toid_part.parse().map_err(|_| Error::InvalidCursor)?; let start_index: i32 = event_index.parse().map_err(|_| Error::InvalidCursor)?; diff --git a/cmd/crates/soroban-rpc/src/log.rs b/cmd/crates/soroban-rpc/src/log.rs new file mode 100644 index 000000000..361268148 --- /dev/null +++ b/cmd/crates/soroban-rpc/src/log.rs @@ -0,0 +1,2 @@ +pub mod diagnostic_events; +pub use diagnostic_events::*; diff --git a/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs b/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs new file mode 100644 index 000000000..68af67a4e --- /dev/null +++ b/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs @@ -0,0 +1,11 @@ +pub fn diagnostic_events(events: &[impl std::fmt::Debug], level: tracing::Level) { + for (i, event) in events.iter().enumerate() { + if level == tracing::Level::TRACE { + tracing::trace!("{i}: {event:#?}"); + } else if level == tracing::Level::INFO { + tracing::info!("{i}: {event:#?}"); + } else if level == tracing::Level::ERROR { + tracing::error!("{i}: {event:#?}"); + } + } +} diff --git a/cmd/soroban-cli/src/rpc/txn.rs b/cmd/crates/soroban-rpc/src/txn.rs similarity index 82% rename from cmd/soroban-cli/src/rpc/txn.rs rename to cmd/crates/soroban-rpc/src/txn.rs index 9e36938dd..35b0c7192 100644 --- a/cmd/soroban-cli/src/rpc/txn.rs +++ b/cmd/crates/soroban-rpc/src/txn.rs @@ -2,16 +2,16 @@ use ed25519_dalek::Signer; use sha2::{Digest, Sha256}; use soroban_env_host::xdr::{ self, AccountId, DecoratedSignature, ExtensionPoint, Hash, HashIdPreimage, - HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, Limits, Memo, Operation, - OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, ScMap, - ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, + HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, LedgerFootprint, Limits, Memo, + Operation, OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, + ScMap, ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, SorobanAuthorizationEntry, SorobanAuthorizedFunction, SorobanCredentials, SorobanResources, SorobanTransactionData, Transaction, TransactionEnvelope, TransactionExt, TransactionSignaturePayload, TransactionSignaturePayloadTaggedTransaction, TransactionV1Envelope, Uint256, VecM, WriteXdr, }; -use crate::rpc::{Client, Error, RestorePreamble, SimulateTransactionResponse}; +use super::{Client, Error, RestorePreamble, SimulateTransactionResponse}; use super::{LogEvents, LogResources}; @@ -20,13 +20,35 @@ pub struct Assembled { sim_res: SimulateTransactionResponse, } +/// Represents an assembled transaction ready to be signed and submitted to the network. impl Assembled { + /// + /// Creates a new `Assembled` transaction. + /// + /// # Arguments + /// + /// * `txn` - The original transaction. + /// * `client` - The client used for simulation and submission. + /// + /// # Errors + /// + /// Returns an error if simulation fails or if assembling the transaction fails. pub async fn new(txn: &Transaction, client: &Client) -> Result { let sim_res = Self::simulate(txn, client).await?; let txn = assemble(txn, &sim_res)?; Ok(Self { txn, sim_res }) } + /// + /// Calculates the hash of the assembled transaction. + /// + /// # Arguments + /// + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if generating the hash fails. pub fn hash(&self, network_passphrase: &str) -> Result<[u8; 32], xdr::Error> { let signature_payload = TransactionSignaturePayload { network_id: Hash(Sha256::digest(network_passphrase).into()), @@ -35,12 +57,23 @@ impl Assembled { Ok(Sha256::digest(signature_payload.to_xdr(Limits::none())?).into()) } + /// + /// Signs the assembled transaction. + /// + /// # Arguments + /// + /// * `key` - The signing key. + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if signing the transaction fails. pub fn sign( self, key: &ed25519_dalek::SigningKey, network_passphrase: &str, ) -> Result { - let tx = self.txn(); + let tx = self.transaction(); let tx_hash = self.hash(network_passphrase)?; let tx_signature = key.sign(&tx_hash); @@ -55,6 +88,17 @@ impl Assembled { })) } + /// + /// Simulates the assembled transaction. + /// + /// # Arguments + /// + /// * `tx` - The original transaction. + /// * `client` - The client used for simulation. + /// + /// # Errors + /// + /// Returns an error if simulation fails. pub async fn simulate( tx: &Transaction, client: &Client, @@ -67,6 +111,18 @@ impl Assembled { .await } + /// + /// Handles the restore process for the assembled transaction. + /// + /// # Arguments + /// + /// * `client` - The client used for submission. + /// * `source_key` - The signing key of the source account. + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if the restore process fails. pub async fn handle_restore( self, client: &Client, @@ -77,7 +133,7 @@ impl Assembled { // Build and submit the restore transaction client .send_transaction( - &Assembled::new(&restore(self.txn(), restore_preamble)?, client) + &Assembled::new(&restore(self.transaction(), restore_preamble)?, client) .await? .sign(source_key, network_passphrase)?, ) @@ -88,14 +144,20 @@ impl Assembled { } } - pub fn txn(&self) -> &Transaction { + /// Returns a reference to the original transaction. + #[must_use] + pub fn transaction(&self) -> &Transaction { &self.txn } - pub fn sim_res(&self) -> &SimulateTransactionResponse { + /// Returns a reference to the simulation response. + #[must_use] + pub fn sim_response(&self) -> &SimulateTransactionResponse { &self.sim_res } + /// + /// # Errors pub async fn authorize( self, client: &Client, @@ -105,7 +167,7 @@ impl Assembled { network_passphrase: &str, ) -> Result { if let Some(txn) = sign_soroban_authorizations( - self.txn(), + self.transaction(), source_key, signers, seq_num, @@ -117,12 +179,16 @@ impl Assembled { } } + #[must_use] pub fn bump_seq_num(mut self) -> Self { self.txn.seq_num.0 += 1; self } - pub fn auth(&self) -> VecM { + /// + /// # Errors + #[must_use] + pub fn auth_entries(&self) -> VecM { self.txn .operations .first() @@ -137,6 +203,8 @@ impl Assembled { .unwrap_or_default() } + /// + /// # Errors pub fn log( &self, log_events: Option, @@ -151,15 +219,55 @@ impl Assembled { log(resources); } if let Some(log) = log_events { - log(footprint, &[self.auth()], &self.sim_res.events()?); + log(footprint, &[self.auth_entries()], &self.sim_res.events()?); }; } Ok(()) } + + #[must_use] + pub fn requires_auth(&self) -> bool { + requires_auth(&self.txn).is_some() + } + + #[must_use] + pub fn is_view(&self) -> bool { + let TransactionExt::V1(SorobanTransactionData { + resources: + SorobanResources { + footprint: LedgerFootprint { read_write, .. }, + .. + }, + .. + }) = &self.txn.ext + else { + return false; + }; + read_write.is_empty() + } + + #[must_use] + pub fn set_max_instructions(mut self, instructions: u32) -> Self { + if let TransactionExt::V1(SorobanTransactionData { + resources: + SorobanResources { + instructions: ref mut i, + .. + }, + .. + }) = &mut self.txn.ext + { + tracing::trace!("setting max instructions to {instructions} from {i}"); + *i = instructions; + } + self + } } // Apply the result of a simulateTransaction onto a transaction envelope, preparing it for // submission to the network. +/// +/// # Errors pub fn assemble( raw: &Transaction, simulation: &SimulateTransactionResponse, @@ -206,7 +314,7 @@ pub fn assemble( } // update the fees of the actual transaction to meet the minimum resource fees. - let classic_transaction_fees = crate::fee::Args::default().fee; + let classic_transaction_fees = crate::DEFAULT_TRANSACTION_FEES; // Pad the fees up by 15% for a bit of wiggle room. tx.fee = (tx.fee.max( classic_transaction_fees @@ -220,6 +328,21 @@ pub fn assemble( Ok(tx) } +fn requires_auth(txn: &Transaction) -> Option { + let [op @ Operation { + body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), + .. + }] = txn.operations.as_slice() + else { + return None; + }; + matches!( + auth.first().map(|x| &x.root_invocation.function), + Some(&SorobanAuthorizedFunction::ContractFn(_)) + ) + .then(move || op.clone()) +} + // Use the given source_key and signers, to sign all SorobanAuthorizationEntry's in the given // transaction. If unable to sign, return an error. fn sign_soroban_authorizations( @@ -230,18 +353,8 @@ fn sign_soroban_authorizations( network_passphrase: &str, ) -> Result, Error> { let mut tx = raw.clone(); - let mut op = match tx.operations.as_slice() { - [op @ Operation { - body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), - .. - }] if matches!( - auth.first().map(|x| &x.root_invocation.function), - Some(&SorobanAuthorizedFunction::ContractFn(_)) - ) => - { - op.clone() - } - _ => return Ok(None), + let Some(mut op) = requires_auth(&tx) else { + return Ok(None); }; let Operation { @@ -378,6 +491,8 @@ fn sign_soroban_authorization_entry( Ok(auth) } +/// +/// # Errors pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result { let transaction_data = SorobanTransactionData::from_xdr_base64(&restore.transaction_data, Limits::none())?; @@ -398,8 +513,7 @@ pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result, pub env_meta: Vec, pub meta_base64: Option, @@ -38,7 +38,7 @@ pub enum Error { Parser(#[from] wasmparser::BinaryReaderError), } -impl ContractSpec { +impl Spec { pub fn new(bytes: &[u8]) -> Result { let mut env_meta: Option<&[u8]> = None; let mut meta: Option<&[u8]> = None; @@ -87,7 +87,7 @@ impl ContractSpec { vec![] }; - Ok(ContractSpec { + Ok(Spec { env_meta_base64, env_meta, meta_base64, @@ -108,7 +108,7 @@ impl ContractSpec { } } -impl Display for ContractSpec { +impl Display for Spec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let Some(env_meta) = &self.env_meta_base64 { writeln!(f, "Env Meta: {env_meta}")?; diff --git a/cmd/crates/soroban-spec-tools/src/lib.rs b/cmd/crates/soroban-spec-tools/src/lib.rs index 7f310fd99..bc3c2a386 100644 --- a/cmd/crates/soroban-spec-tools/src/lib.rs +++ b/cmd/crates/soroban-spec-tools/src/lib.rs @@ -13,6 +13,7 @@ use stellar_xdr::curr::{ UInt128Parts, UInt256Parts, Uint256, VecM, }; +pub mod contract; pub mod utils; #[derive(thiserror::Error, Debug)] diff --git a/cmd/crates/soroban-test/tests/it/help.rs b/cmd/crates/soroban-test/tests/it/help.rs index 6d4680e77..a66c449ed 100644 --- a/cmd/crates/soroban-test/tests/it/help.rs +++ b/cmd/crates/soroban-test/tests/it/help.rs @@ -1,11 +1,11 @@ use soroban_cli::commands::contract; use soroban_test::TestEnv; -use crate::util::{invoke_custom as invoke, CUSTOM_TYPES}; +use crate::util::{invoke_custom as invoke, CUSTOM_TYPES, DEFAULT_CONTRACT_ID}; async fn invoke_custom(func: &str, args: &str) -> Result { let e = &TestEnv::default(); - invoke(e, "1", func, args, &CUSTOM_TYPES.path()).await + invoke(e, DEFAULT_CONTRACT_ID, func, args, &CUSTOM_TYPES.path()).await } #[tokio::test] diff --git a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs index d7d56aaf3..7c0f25b3f 100644 --- a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs +++ b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs @@ -35,7 +35,7 @@ fn current_env_not_overwritten() { write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env("SOROBAN_CONTRACT_ID", "2") + .env("SOROBAN_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4") .arg("invoke") .arg("--") .arg("hello") @@ -51,7 +51,10 @@ fn cli_args_have_priority() { deploy_hello(e); write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env("SOROBAN_CONTRACT_ID", "2") + .env( + "SOROBAN_CONTRACT_ID", + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + ) .arg("invoke") .arg("--id") .arg(TEST_CONTRACT_ID) diff --git a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs index 7714f70dd..7bd8d596a 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -1,3 +1,4 @@ +use predicates::boolean::PredicateBooleanExt; use soroban_cli::commands::{ contract::{self, fetch}, keys, @@ -19,7 +20,23 @@ async fn invoke() { extend_contract(sandbox, id, HELLO_WORLD).await; // Note that all functions tested here have no state invoke_hello_world(sandbox, id); + sandbox + .new_assert_cmd("events") + .arg("--start-ledger=20") + .arg("--id") + .arg(id) + .assert() + .stdout(predicates::str::contains(id).not()) + .success(); invoke_hello_world_with_lib(sandbox, id).await; + sandbox + .new_assert_cmd("events") + .arg("--start-ledger=20") + .arg("--id") + .arg(id) + .assert() + .stdout(predicates::str::contains(id)) + .success(); invoke_hello_world_with_lib_two(sandbox, id).await; invoke_auth(sandbox, id); invoke_auth_with_identity(sandbox, id).await; @@ -39,6 +56,7 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) { sandbox .new_assert_cmd("contract") .arg("invoke") + .arg("--is-view") .arg("--id") .arg(id) .arg("--") diff --git a/cmd/crates/soroban-test/tests/it/util.rs b/cmd/crates/soroban-test/tests/it/util.rs index 6d6251012..112d5f841 100644 --- a/cmd/crates/soroban-test/tests/it/util.rs +++ b/cmd/crates/soroban-test/tests/it/util.rs @@ -68,3 +68,5 @@ pub async fn invoke_custom( i.invoke(&soroban_cli::commands::global::Args::default()) .await } + +pub const DEFAULT_CONTRACT_ID: &str = "CDR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OO5Z"; diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index f402b5ba3..ea936d941 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -45,24 +45,27 @@ soroban-spec-typescript = { workspace = true } soroban-ledger-snapshot = { workspace = true } stellar-strkey = { workspace = true } soroban-sdk = { workspace = true } -clap = { version = "4.1.8", features = [ +soroban-rpc = { workspace = true } + +clap = { workspace = true, features = [ "derive", "env", "deprecated", "string", ] } +clap_complete = {workspace = true} + base64 = { workspace = true } thiserror = { workspace = true } serde = "1.0.82" serde_derive = "1.0.82" serde_json = "1.0.82" -serde-aux = "4.1.2" +serde-aux = { workspace = true } hex = { workspace = true } num-bigint = "0.4" tokio = { version = "1", features = ["full"] } -termcolor = "1.1.3" -termcolor_output = "1.0.1" -clap_complete = "4.1.4" +termcolor = { workspace = true } +termcolor_output = { workspace = true } rand = "0.8.5" wasmparser = { workspace = true } sha2 = { workspace = true } @@ -70,7 +73,7 @@ csv = "1.1.6" ed25519-dalek = "=2.0.0" jsonrpsee-http-client = "0.20.1" jsonrpsee-core = "0.20.1" -hyper = "0.14.27" +hyper = "0.14.27" hyper-tls = "0.5" http = "0.2.9" regex = "1.6.0" diff --git a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs index 19c7eecd6..091f8255a 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs @@ -1,17 +1,15 @@ use std::{ffi::OsString, fmt::Debug, path::PathBuf}; use clap::{command, Parser}; +use soroban_spec_tools::contract as contract_spec; use soroban_spec_typescript::{self as typescript, boilerplate::Project}; -use crate::wasm; -use crate::{ - commands::{ - config::locator, - contract::{self, fetch}, - network::{self, Network}, - }, - utils::contract_spec::{self, ContractSpec}, +use crate::commands::{ + config::locator, + contract::{self, fetch}, + network::{self, Network}, }; +use crate::wasm; #[derive(Parser, Debug, Clone)] #[group(skip)] @@ -78,7 +76,7 @@ impl Cmd { network: self.network.clone(), }; let bytes = fetch.get_bytes().await?; - ContractSpec::new(&bytes)?.spec + contract_spec::Spec::new(&bytes)?.spec }; if self.output_dir.is_file() { return Err(Error::IsFile(self.output_dir.clone())); diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 7e9f1e98c..86ea23b55 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -144,15 +144,18 @@ impl Cmd { }), }; - let (result, meta, events) = client + let res = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - tracing::trace!(?result); - tracing::trace!(?meta); + let events = res.events()?; if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); } + let meta = res + .result_meta + .as_ref() + .ok_or(Error::MissingOperationResult)?; // The transaction from core will succeed regardless of whether it actually found & extended // the entry, so we have to inspect the result meta to tell if it worked or not. diff --git a/cmd/soroban-cli/src/commands/contract/inspect.rs b/cmd/soroban-cli/src/commands/contract/inspect.rs index 355c18ca8..e66bf83fd 100644 --- a/cmd/soroban-cli/src/commands/contract/inspect.rs +++ b/cmd/soroban-cli/src/commands/contract/inspect.rs @@ -1,5 +1,6 @@ use clap::{command, Parser}; use soroban_env_host::xdr; +use soroban_spec_tools::contract; use std::{fmt::Debug, path::PathBuf}; use tracing::debug; @@ -28,7 +29,7 @@ pub enum Error { #[error(transparent)] Xdr(#[from] xdr::Error), #[error(transparent)] - Spec(#[from] crate::utils::contract_spec::Error), + Spec(#[from] contract::Error), } impl Cmd { diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index 905775298..c2fa6d889 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -112,14 +112,10 @@ impl Cmd { build_install_contract_code_tx(contract, sequence + 1, self.fee.fee, &key)?; // Currently internal errors are not returned if the contract code is expired - if let ( - TransactionResult { - result: TransactionResultResult::TxInternalError, - .. - }, - _, - _, - ) = client + if let Some(TransactionResult { + result: TransactionResultResult::TxInternalError, + .. + }) = client .prepare_and_send_transaction( &tx_without_preflight, &key, @@ -129,6 +125,8 @@ impl Cmd { None, ) .await? + .result + .as_ref() { // Now just need to restore it and don't have to install again restore::Cmd { @@ -153,7 +151,7 @@ impl Cmd { } } -fn get_contract_meta_sdk_version(wasm_spec: &utils::contract_spec::ContractSpec) -> Option { +fn get_contract_meta_sdk_version(wasm_spec: &soroban_spec_tools::contract::Spec) -> Option { let rs_sdk_version_option = if let Some(_meta) = &wasm_spec.meta_base64 { wasm_spec.meta.iter().find(|entry| match entry { ScMetaEntry::ScMetaV0(ScMetaV0 { key, .. }) => { diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 669342b06..720c3c6f8 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -28,13 +28,8 @@ use super::super::{ config::{self, locator}, events, }; -use crate::{ - commands::global, - rpc::{self, Client}, - utils::{self, contract_spec}, - Pwd, -}; -use soroban_spec_tools::Spec; +use crate::{commands::global, rpc, Pwd}; +use soroban_spec_tools::{contract, Spec}; #[derive(Parser, Debug, Default, Clone)] #[allow(clippy::struct_excessive_bools)] @@ -49,6 +44,12 @@ pub struct Cmd { /// Output the cost execution to stderr #[arg(long = "cost")] pub cost: bool, + /// Number of instructions to simulate + #[arg(long)] + pub instructions: Option, + /// Do not sign and submit transaction + #[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")] + pub is_view: bool, /// Function name as subcommand, then arguments for that function as `--arg-name value` #[arg(last = true, id = "CONTRACT_FN_AND_ARGS")] pub slop: Vec, @@ -140,7 +141,7 @@ pub enum Error { #[error(transparent)] StrKey(#[from] stellar_strkey::DecodeError), #[error(transparent)] - ContractSpec(#[from] contract_spec::Error), + ContractSpec(#[from] contract::Error), #[error("")] MissingFileArg(PathBuf), } @@ -275,7 +276,7 @@ impl Cmd { // For testing wasm arg parsing let _ = self.build_host_function_parameters(contract_id, spec_entries)?; } - let client = Client::new(&network.rpc_url)?; + let client = rpc::Client::new(&network.rpc_url)?; client .verify_network_passphrase(Some(&network.network_passphrase)) .await?; @@ -299,29 +300,31 @@ impl Cmd { self.fee.fee, &key, )?; - - let (result, meta, events) = client - .prepare_and_send_transaction( - &tx, - &key, - &signers, - &network.network_passphrase, - Some(log_events), - (global_args.verbose || global_args.very_verbose || self.cost) - .then_some(log_resources), + let mut txn = client.create_assembled_transaction(&tx).await?; + if let Some(instructions) = self.instructions { + txn = txn.set_max_instructions(instructions); + } + let (return_value, events) = if self.is_view { + ( + txn.sim_response().results()?[0].xdr.clone(), + txn.sim_response().events()?, ) - .await?; - - tracing::debug!(?result); - crate::log::diagnostic_events(&events, tracing::Level::INFO); - let xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { - soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), - .. - }) = meta - else { - return Err(Error::MissingOperationResult); + } else { + let res = client + .send_assembled_transaction( + txn, + &key, + &signers, + &network.network_passphrase, + Some(log_events), + (global_args.verbose || global_args.very_verbose || self.cost) + .then_some(log_resources), + ) + .await?; + (res.return_value()?, res.contract_events()?) }; + crate::log::diagnostic_events(&events, tracing::Level::INFO); output_to_string(&spec, &return_value, &function) } @@ -344,7 +347,7 @@ impl Cmd { impl Cmd { fn contract_id(&self) -> Result<[u8; 32], Error> { - utils::contract_id_from_str(&self.contract_id) + soroban_spec_tools::utils::contract_id_from_str(&self.contract_id) .map_err(|e| Error::CannotParseContractId(self.contract_id.clone(), e)) } } diff --git a/cmd/soroban-cli/src/commands/contract/read.rs b/cmd/soroban-cli/src/commands/contract/read.rs index 842832d5f..f25b6c2c0 100644 --- a/cmd/soroban-cli/src/commands/contract/read.rs +++ b/cmd/soroban-cli/src/commands/contract/read.rs @@ -120,7 +120,7 @@ impl Cmd { let ( LedgerKey::ContractData(LedgerKeyContractData { key, .. }), LedgerEntryData::ContractData(ContractDataEntry { val, .. }), - ) = (key, val) + ) = &(key, val) else { return Err(Error::OnlyDataAllowed); }; diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index 38b8a84a1..6ed39f892 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -148,11 +148,15 @@ impl Cmd { }), }; - let (result, meta, events) = client + let res = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - tracing::trace!(?result); + let meta = res + .result_meta + .as_ref() + .ok_or(Error::MissingOperationResult)?; + let events = res.events()?; tracing::trace!(?meta); if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); @@ -177,7 +181,7 @@ impl Cmd { operations[0].changes.len() ); } - parse_operations(&operations).ok_or(Error::MissingOperationResult) + parse_operations(operations).ok_or(Error::MissingOperationResult) } } diff --git a/cmd/soroban-cli/src/key.rs b/cmd/soroban-cli/src/key.rs index e9901abd2..2290e857e 100644 --- a/cmd/soroban-cli/src/key.rs +++ b/cmd/soroban-cli/src/key.rs @@ -59,7 +59,7 @@ pub struct Args { )] pub wasm_hash: Option, /// Storage entry durability - #[arg(long, value_enum, required = true)] + #[arg(long, value_enum, required = true, default_value = "persistent")] pub durability: Durability, } @@ -83,7 +83,7 @@ impl Args { } else if let Some(wasm_hash) = &self.wasm_hash { return Ok(vec![LedgerKey::ContractCode(LedgerKeyContractCode { hash: xdr::Hash( - utils::contract_id_from_str(wasm_hash) + soroban_spec_tools::utils::contract_id_from_str(wasm_hash) .map_err(|e| Error::CannotParseContractId(wasm_hash.clone(), e))?, ), })]); diff --git a/cmd/soroban-cli/src/lib.rs b/cmd/soroban-cli/src/lib.rs index 3aad487c8..ef443853b 100644 --- a/cmd/soroban-cli/src/lib.rs +++ b/cmd/soroban-cli/src/lib.rs @@ -3,17 +3,17 @@ clippy::must_use_candidate, clippy::missing_panics_doc )] +pub(crate) use soroban_rpc as rpc; +use std::path::Path; + pub mod commands; pub mod fee; pub mod key; pub mod log; -pub mod rpc; pub mod toid; pub mod utils; pub mod wasm; -use std::path::Path; - pub use commands::Root; pub fn parse_cmd(s: &str) -> Result diff --git a/cmd/soroban-cli/src/utils.rs b/cmd/soroban-cli/src/utils.rs index ff0018a94..97fc9bfcc 100644 --- a/cmd/soroban-cli/src/utils.rs +++ b/cmd/soroban-cli/src/utils.rs @@ -9,7 +9,7 @@ use soroban_env_host::xdr::{ TransactionV1Envelope, WriteXdr, }; -pub mod contract_spec; +pub use soroban_spec_tools::contract as contract_spec; /// # Errors /// @@ -55,16 +55,17 @@ pub fn sign_transaction( /// /// Might return an error pub fn contract_id_from_str(contract_id: &str) -> Result<[u8; 32], stellar_strkey::DecodeError> { - stellar_strkey::Contract::from_string(contract_id) - .map(|strkey| strkey.0) - .or_else(|_| { + Ok( + if let Ok(strkey) = stellar_strkey::Contract::from_string(contract_id) { + strkey.0 + } else { // strkey failed, try to parse it as a hex string, for backwards compatibility. soroban_spec_tools::utils::padded_hex_from_str(contract_id, 32) .map_err(|_| stellar_strkey::DecodeError::Invalid)? .try_into() - .map_err(|_| stellar_strkey::DecodeError::Invalid) - }) - .map_err(|_| stellar_strkey::DecodeError::Invalid) + .map_err(|_| stellar_strkey::DecodeError::Invalid)? + }, + ) } /// # Errors @@ -198,47 +199,5 @@ mod tests { ), Err(err) => panic!("Failed to parse contract id: {err}"), } - - // hex - match contract_id_from_str( - "363eaa3867841fbad0f4ed88c779e4fe66e56a2470dc98c0ec9c073d05c7b103", - ) { - Ok(contract_id) => assert_eq!( - contract_id, - [ - 0x36, 0x3e, 0xaa, 0x38, 0x67, 0x84, 0x1f, 0xba, 0xd0, 0xf4, 0xed, 0x88, 0xc7, - 0x79, 0xe4, 0xfe, 0x66, 0xe5, 0x6a, 0x24, 0x70, 0xdc, 0x98, 0xc0, 0xec, 0x9c, - 0x07, 0x3d, 0x05, 0xc7, 0xb1, 0x03, - ] - ), - Err(err) => panic!("Failed to parse contract id: {err}"), - } - - // unpadded-hex - match contract_id_from_str("1") { - Ok(contract_id) => assert_eq!( - contract_id, - [ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - ] - ), - Err(err) => panic!("Failed to parse contract id: {err}"), - } - - // invalid hex - match contract_id_from_str("foobar") { - Ok(_) => panic!("Expected parsing to fail"), - Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), - } - - // hex too long (33 bytes) - match contract_id_from_str( - "000000000000000000000000000000000000000000000000000000000000000000", - ) { - Ok(_) => panic!("Expected parsing to fail"), - Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), - } } } diff --git a/cmd/soroban-cli/src/wasm.rs b/cmd/soroban-cli/src/wasm.rs index fce44c7c5..4b8a7f8ca 100644 --- a/cmd/soroban-cli/src/wasm.rs +++ b/cmd/soroban-cli/src/wasm.rs @@ -1,11 +1,12 @@ use clap::arg; use soroban_env_host::xdr::{self, LedgerKey, LedgerKeyContractCode}; +use soroban_spec_tools::contract::{self, Spec}; use std::{ fs, io, path::{Path, PathBuf}, }; -use crate::utils::{self, contract_spec::ContractSpec}; +use crate::utils::{self}; #[derive(thiserror::Error, Debug)] pub enum Error { @@ -25,7 +26,7 @@ pub enum Error { #[error(transparent)] Parser(#[from] wasmparser::BinaryReaderError), #[error(transparent)] - ContractSpec(#[from] crate::utils::contract_spec::Error), + ContractSpec(#[from] contract::Error), } #[derive(Debug, clap::Args, Clone)] @@ -60,9 +61,9 @@ impl Args { /// # Errors /// May fail to read wasm file or parse xdr section - pub fn parse(&self) -> Result { + pub fn parse(&self) -> Result { let contents = self.read()?; - Ok(ContractSpec::new(&contents)?) + Ok(Spec::new(&contents)?) } } diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 34ab0caa2..e33794a22 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -110,13 +110,28 @@ Full CLI reference: https://github.com/stellar/soroban-tools/tree/main/docs/soro ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-f`, `--filter-logs ` — Filter logs output. To turn on "soroban_cli::log::footprint=debug" or off "=off". Can also use env var `RUST_LOG` * `-q`, `--quiet` — Do not write logs to stderr including `INFO` + + Possible values: `true`, `false` + * `-v`, `--verbose` — Log DEBUG events + + Possible values: `true`, `false` + * `--very-verbose` — Log DEBUG and TRACE events + + Possible values: `true`, `false` + * `--list` — List installed plugins. E.g. `soroban-hello` + Possible values: `true`, `false` + + ## `soroban completion` @@ -185,6 +200,9 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -202,6 +220,9 @@ Remove a network ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -215,9 +236,15 @@ List networks ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks + Possible values: `true`, `false` + + ## `soroban config identity` @@ -251,8 +278,17 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY + + Possible values: `true`, `false` + * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -271,6 +307,9 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -292,6 +331,9 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -309,12 +351,24 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address + + Possible values: `true`, `false` + * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -330,9 +384,15 @@ List identities ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` + Possible values: `true`, `false` + + ## `soroban config identity rm` @@ -348,6 +408,9 @@ Remove an identity ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -366,6 +429,9 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -423,6 +489,9 @@ Get Id of builtin Soroban Asset Contract. Deprecated, use `soroban contract id a * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -442,6 +511,9 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -498,8 +570,14 @@ Generate a TypeScript / JavaScript package * `--wasm ` — Path to optional wasm binary * `--output-dir ` — Where to place generated project * `--overwrite` — Whether to overwrite output directory if it already exists + + Possible values: `true`, `false` + * `--contract-id ` — The contract ID/address on the network * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -528,10 +606,19 @@ To view the commands that will be executed, without executing them, use the --pr Default value: `release` * `--features ` — Build with the list of features activated, space or comma separated * `--all-features` — Build with the all features activated + + Possible values: `true`, `false` + * `--no-default-features` — Build with the default feature not activated + + Possible values: `true`, `false` + * `--out-dir ` — Directory to copy wasm files to * `--print-commands-only` — Print commands to build without executing them + Possible values: `true`, `false` + + ## `soroban contract extend` @@ -546,6 +633,9 @@ If no keys are specified the contract itself is extended. * `--ledgers-to-extend ` — Number of ledgers to extend the entries * `--ttl-ledger-only` — Only print the new Time To Live ledger + + Possible values: `true`, `false` + * `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended * `--key ` — Storage key (symbols only) * `--key-xdr ` — Storage key (base64-encoded XDR) @@ -553,6 +643,8 @@ If no keys are specified the contract itself is extended. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -565,6 +657,9 @@ If no keys are specified the contract itself is extended. * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -589,6 +684,9 @@ Deploy a wasm contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -597,6 +695,9 @@ Deploy a wasm contract Default value: `false` + Possible values: `true`, `false` + + ## `soroban contract fetch` @@ -610,6 +711,9 @@ Fetch a contract's Wasm binary * `--id ` — Contract ID to fetch * `-o`, `--out-file ` — Where to write output otherwise stdout is used * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -645,6 +749,9 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -664,6 +771,9 @@ Deploy normal Wasm Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -709,6 +819,9 @@ Inspect a WASM file listing contract functions, meta, etc Pretty print of contract spec entries * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -727,6 +840,9 @@ Install a WASM file to the ledger without creating a contract instance * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -736,6 +852,9 @@ Install a WASM file to the ledger without creating a contract instance Default value: `false` + Possible values: `true`, `false` + + ## `soroban contract invoke` @@ -756,12 +875,23 @@ soroban contract invoke ... -- --help * `--id ` — Contract ID to invoke * `--cost` — Output the cost execution to stderr + + Possible values: `true`, `false` + +* `--instructions ` — Number of instructions to simulate +* `--is-view` — Do not sign and submit transaction + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -809,6 +939,8 @@ Print the current value of a contract-data ledger entry * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -821,6 +953,9 @@ Print the current value of a contract-data ledger entry * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -842,6 +977,8 @@ If no keys are specificed the contract itself is restored. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -850,12 +987,18 @@ If no keys are specificed the contract itself is restored. * `--ledgers-to-extend ` — Number of ledgers to extend the entry * `--ttl-ledger-only` — Only print the new Time To Live ledger + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -897,6 +1040,9 @@ Watch the network for contract events Possible values: `all`, `contract`, `system` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -935,8 +1081,17 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY + + Possible values: `true`, `false` + * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -955,6 +1110,9 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -976,6 +1134,9 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -993,12 +1154,24 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address + + Possible values: `true`, `false` + * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -1014,9 +1187,15 @@ List identities ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` + Possible values: `true`, `false` + + ## `soroban keys rm` @@ -1032,6 +1211,9 @@ Remove an identity ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1050,6 +1232,9 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1095,6 +1280,9 @@ Deploy a token contract to wrap an existing Stellar classic asset for smart cont * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -1117,6 +1305,9 @@ Compute the expected contract id for the given asset Deprecated, use `soroban co * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1296,6 +1487,9 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1313,6 +1507,9 @@ Remove a network ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1326,9 +1523,15 @@ List networks ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks + Possible values: `true`, `false` + + ## `soroban version`