diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 5a3f69c..3fed621 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -9,7 +9,7 @@ on: jobs: build_and_test: runs-on: ubicloud - container: rust:1.87.0 + container: rust:1.94.0 timeout-minutes: 10 strategy: matrix: diff --git a/Cargo.lock b/Cargo.lock index 3b4efc2..eca0f83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,6 +368,15 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.21" @@ -424,6 +433,15 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "arc-swap" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f3647c145568cec02c42054e07bdf9a5a698e15b466fb2341bfc393cd24aa5" +dependencies = [ + "rustversion", +] + [[package]] name = "ark-bn254" version = "0.4.0" @@ -595,6 +613,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atomicwrites" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef1bb8d1b645fe38d51dfc331d720fb5fc2c94b440c76cc79c80ff265ca33e3" +dependencies = [ + "rustix 0.38.44", + "tempfile", + "windows-sys 0.52.0", +] + [[package]] name = "atty" version = "0.2.14" @@ -675,6 +704,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "futures-core", + "getrandom 0.2.16", + "instant", + "pin-project-lite", + "rand 0.8.5", + "tokio", +] + [[package]] name = "base64" version = "0.12.3" @@ -964,7 +1007,12 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ + "iana-time-zone", + "js-sys", "num-traits", + "serde", + "wasm-bindgen", + "windows-link 0.2.1", ] [[package]] @@ -1284,9 +1332,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ "darling_core", "darling_macro", @@ -1294,11 +1342,10 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "fnv", "ident_case", "proc-macro2", "quote", @@ -1308,9 +1355,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", @@ -1337,6 +1384,16 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", + "serde_core", +] + [[package]] name = "derivation-path" version = "0.2.0" @@ -1484,6 +1541,12 @@ dependencies = [ "yellowstone-grpc-proto", ] +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "ed25519" version = "1.5.3" @@ -1695,6 +1758,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-err" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fde052dbfc920003cfd2c8e2c6e6d4cc7c1091538c3a24226cec0665ab08c0" +dependencies = [ + "autocfg", +] + [[package]] name = "funty" version = "2.0.0" @@ -1876,7 +1948,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.3.1", - "indexmap", + "indexmap 2.11.4", "slab", "tokio", "tokio-util", @@ -1976,6 +2048,15 @@ dependencies = [ "hmac 0.8.1", ] +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "http" version = "0.2.12" @@ -2039,6 +2120,16 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" +[[package]] +name = "humantime-serde" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" +dependencies = [ + "humantime", + "serde", +] + [[package]] name = "hyper" version = "1.7.0" @@ -2134,6 +2225,30 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.0.0" @@ -2253,6 +2368,17 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9007da9cacbd3e6343da136e98b0d2df013f553d35bdec8b518f07bea768e19c" +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.11.4" @@ -2261,6 +2387,8 @@ checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown 0.16.0", + "serde", + "serde_core", ] [[package]] @@ -2285,6 +2413,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -2543,6 +2680,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -2633,6 +2782,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -2710,6 +2869,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + [[package]] name = "num-derive" version = "0.4.2" @@ -2902,7 +3067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 2.11.4", ] [[package]] @@ -2979,6 +3144,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -3105,6 +3276,48 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "protobuf-codegen" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d3976825c0014bbd2f3b34f0001876604fe87e0c86cd8fa54251530f1544ace" +dependencies = [ + "anyhow", + "once_cell", + "protobuf", + "protobuf-parse", + "regex", + "tempfile", + "thiserror 1.0.69", +] + +[[package]] +name = "protobuf-json-mapping" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d6e4be637b310d8a5c02fa195243328e2d97fa7df1127a27281ef1187fcb1d" +dependencies = [ + "protobuf", + "protobuf-support", + "thiserror 1.0.69", +] + +[[package]] +name = "protobuf-parse" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4aeaa1f2460f1d348eeaeed86aea999ce98c1bded6f089ff8514c9d9dbdc973" +dependencies = [ + "anyhow", + "indexmap 2.11.4", + "log", + "protobuf", + "protobuf-support", + "tempfile", + "thiserror 1.0.69", + "which", +] + [[package]] name = "protobuf-src" version = "1.1.0+21.5" @@ -3165,38 +3378,70 @@ dependencies = [ [[package]] name = "pyth-lazer-client" -version = "0.1.3" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5b95001b63b629226862bc79737439563654edcb72e85017a2c0827bfbf1da" +checksum = "1907704795856be386127fbe700b226b4798dbf384d274f3392eb050b98208f1" dependencies = [ "anyhow", + "arc-swap", + "async-trait", + "atomicwrites", + "backoff", "base64 0.22.1", "derive_more", + "fs-err", + "futures", "futures-util", + "humantime-serde", + "protobuf-json-mapping", "pyth-lazer-protocol", + "pyth-lazer-publisher-sdk", + "reqwest", "serde", "serde_json", + "serde_with", "tokio", + "tokio-stream", "tokio-tungstenite 0.20.1", "tracing", + "ttl_cache", "url", ] [[package]] name = "pyth-lazer-protocol" -version = "0.7.3" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6445dc5d2f7fff7c677fb8edc5a080a82ef7583c1bdb39daa95421788c23f695" +checksum = "856ae095d54dfc95add233f98ccdf80d50bfa26f1babb74d4969b3ecc37d17d8" dependencies = [ "anyhow", - "base64 0.22.1", "byteorder", + "chrono", "derive_more", + "hex", + "humantime", + "humantime-serde", "itertools 0.13.0", "protobuf", "rust_decimal", "serde", "serde_json", + "thiserror 2.0.17", + "utoipa", +] + +[[package]] +name = "pyth-lazer-publisher-sdk" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe54922998c4b4931d26366f04e1d27982be03f316d7b6caf1c42c131edac8" +dependencies = [ + "anyhow", + "fs-err", + "protobuf", + "protobuf-codegen", + "pyth-lazer-protocol", + "serde_json", ] [[package]] @@ -3412,6 +3657,26 @@ dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "regex" version = "1.11.3" @@ -3483,6 +3748,7 @@ dependencies = [ "js-sys", "log", "mime", + "mime_guess", "native-tls", "percent-encoding", "pin-project-lite", @@ -3618,6 +3884,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + [[package]] name = "rustix" version = "1.1.2" @@ -3627,7 +3906,7 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.11.0", "windows-sys 0.61.2", ] @@ -3700,6 +3979,30 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -3852,19 +4155,28 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.15.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093cd8c01b25262b84927e0f7151692158fab02d961e04c979d3903eba7ecc5" +checksum = "dd5414fad8e6907dbdd5bc441a50ae8d6e26151a03b1de04d89a5576de61d01f" dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.4", + "schemars 0.9.0", + "schemars 1.2.1", "serde_core", + "serde_json", "serde_with_macros", + "time", ] [[package]] name = "serde_with_macros" -version = "3.15.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e6c180db0816026a61afa1cff5344fb7ebded7e4d3062772179f2501481c27" +checksum = "d3db8978e608f1fe7357e211969fd9abdcae80bac1ba7a3369bb7eb6b404eb65" dependencies = [ "darling", "proc-macro2", @@ -6217,7 +6529,7 @@ dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix", + "rustix 1.1.2", "windows-sys 0.61.2", ] @@ -6270,6 +6582,37 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.1" @@ -6434,7 +6777,7 @@ version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b" dependencies = [ - "indexmap", + "indexmap 2.11.4", "toml_datetime", "toml_parser", "winnow", @@ -6542,7 +6885,7 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 2.11.4", "pin-project-lite", "slab", "sync_wrapper", @@ -6636,6 +6979,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" +[[package]] +name = "ttl_cache" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4189890526f0168710b6ee65ceaedf1460c48a14318ceec933cb26baa492096a" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "tungstenite" version = "0.20.1" @@ -6772,6 +7124,30 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "utoipa" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993" +dependencies = [ + "indexmap 2.11.4", + "serde", + "serde_json", + "utoipa-gen", +] + +[[package]] +name = "utoipa-gen" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.106", +] + [[package]] name = "uuid" version = "1.18.1" @@ -6934,6 +7310,18 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + [[package]] name = "winapi" version = "0.3.9" @@ -6965,6 +7353,41 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "windows-link" version = "0.1.3" @@ -6984,8 +7407,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" dependencies = [ "windows-link 0.1.3", - "windows-result", - "windows-strings", + "windows-result 0.3.4", + "windows-strings 0.4.2", ] [[package]] @@ -6997,6 +7420,15 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-strings" version = "0.4.2" @@ -7006,6 +7438,15 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-sys" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index f46603a..ffb556f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,8 +21,8 @@ log = { version = "0.4", features = ["max_level_trace"] } futures-util = "0.3.31" mimalloc = "0.1.47" prometheus = "*" -pyth-lazer-client = "0.1.3" -pyth-lazer-protocol = "0.7.3" +pyth-lazer-client = "18.0.0" +pyth-lazer-protocol = "0.29.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" solana-account-decoder-client-types = "2.3" diff --git a/src/filler.rs b/src/filler.rs index 19c2d7e..24625b5 100644 --- a/src/filler.rs +++ b/src/filler.rs @@ -118,11 +118,10 @@ impl FillerBot { // pyth disabled for now let pyth_access_token = std::env::var("PYTH_LAZER_TOKEN").expect("pyth access token"); - let pyth_feed_cli = pyth_lazer_client::LazerClient::new( - "wss://pyth-lazer.dourolabs.app/v1/stream", - pyth_access_token.as_str(), - ) - .expect("pyth price feed connects"); + let pyth_feed_cli = + pyth_lazer_client::stream_client::PythLazerStreamClientBuilder::new(pyth_access_token) + .build() + .expect("pyth price feed connects"); let pyth_price_feed = crate::util::subscribe_price_feeds(pyth_feed_cli, &market_ids, &[]); log::info!(target: TARGET, "subscribed pyth price feeds"); diff --git a/src/liquidator.rs b/src/liquidator.rs index c9e6019..099a3e8 100644 --- a/src/liquidator.rs +++ b/src/liquidator.rs @@ -146,8 +146,7 @@ fn validate_data_freshness( /// Validate Pyth price freshness fn validate_pyth_price_freshness(pyth_update: &PythPriceUpdate) -> Result<(), StalenessError> { let now_ms = current_time_millis(); - // Pyth timestamp is in microseconds, convert to milliseconds - let pyth_ts_ms = pyth_update.ts.0 / 1000; + let pyth_ts_ms = pyth_update.ts.as_millis(); let age_ms = now_ms.saturating_sub(pyth_ts_ms); if age_ms > MAX_PYTH_AGE_MS { @@ -483,11 +482,10 @@ impl LiquidatorBot { Box::leak(Box::new(MarketState::new(market_state))); let pyth_access_token = std::env::var("PYTH_LAZER_TOKEN").expect("pyth access token"); - let pyth_feed_cli = pyth_lazer_client::LazerClient::new( - "wss://pyth-lazer.dourolabs.app/v1/stream", - pyth_access_token.as_str(), - ) - .expect("pyth price feed connects"); + let pyth_feed_cli = + pyth_lazer_client::stream_client::PythLazerStreamClientBuilder::new(pyth_access_token) + .build() + .expect("pyth price feed connects"); let pyth_price_feed: tokio::sync::mpsc::Receiver<_> = if config.use_spot_liquidation { crate::util::subscribe_price_feeds(pyth_feed_cli, &perp_market_ids, &spot_market_ids) diff --git a/src/util.rs b/src/util.rs index 4c01523..1941931 100644 --- a/src/util.rs +++ b/src/util.rs @@ -12,16 +12,16 @@ use drift_rs::{ types::{MarketId, MarketType}, Pubkey, }; -use futures_util::StreamExt; -use pyth_lazer_client::AnyResponse; +use pyth_lazer_client::ws_connection::AnyResponse; use pyth_lazer_protocol::{ + api::{ + Channel, DeliveryFormat, Format, JsonBinaryEncoding, MarketSession, SubscribeRequest, + SubscriptionId, SubscriptionParams, SubscriptionParamsRepr, + }, message::Message, payload::{PayloadData, PayloadPropertyValue}, - router::{ - Channel, DeliveryFormat, FixedRate, Format, JsonBinaryEncoding, PriceFeedId, - PriceFeedProperty, SubscriptionParams, SubscriptionParamsRepr, TimestampUs, - }, - subscription::{SubscribeRequest, SubscriptionId}, + time::{FixedRate, TimestampUs}, + PriceFeedId, PriceFeedProperty, }; use solana_sdk::signature::Signature; @@ -291,8 +291,8 @@ pub struct PythPriceUpdate { fn fixed_rate(feed_id: u32) -> FixedRate { match feed_id { 1 | 2 | 6 => FixedRate::MIN, - 10 => FixedRate::from_ms(50).unwrap(), - _ => FixedRate::from_ms(200).unwrap(), + 10 => FixedRate::RATE_50_MS, + _ => FixedRate::RATE_200_MS, } } @@ -317,7 +317,7 @@ fn to_price_precision(price: u64, feed_id: u32, market_type: MarketType) -> u64 } pub fn subscribe_price_feeds( - mut cli: pyth_lazer_client::LazerClient, + mut cli: pyth_lazer_client::stream_client::PythLazerStreamClient, perp_market_ids: &[MarketId], spot_market_ids: &[MarketId], ) -> tokio::sync::mpsc::Receiver { @@ -362,30 +362,31 @@ pub fn subscribe_price_feeds( }; // sub per feed - let mut sub_id = 0; + let mut sub_id = 0u64; for feed_id in feed_ids.iter() { let subscribe_request = SubscribeRequest { subscription_id: SubscriptionId(sub_id), params: SubscriptionParams::new(SubscriptionParamsRepr { - price_feed_ids: vec![*feed_id], + price_feed_ids: Some(vec![*feed_id]), + symbols: None, // drift program requires exponent field to verify the message - properties: vec![PriceFeedProperty::Price, PriceFeedProperty::Exponent], + properties: vec![ + PriceFeedProperty::Price, + PriceFeedProperty::Exponent, + PriceFeedProperty::FeedUpdateTimestamp, + ], delivery_format: DeliveryFormat::Binary, json_binary_encoding: JsonBinaryEncoding::Hex, parsed: false, channel: Channel::FixedRate(fixed_rate(feed_id.0)), formats: vec![Format::Solana], - ignore_invalid_feed_ids: false, + ignore_invalid_feeds: false, + market_sessions: vec![MarketSession::Regular], }) .expect("invalid subscription params"), }; sub_id += 1; - if let Err(err) = cli - .subscribe(pyth_lazer_protocol::subscription::Request::Subscribe( - subscribe_request, - )) - .await - { + if let Err(err) = cli.subscribe(subscribe_request).await { log::error!(target: "filler", "pyth feed subscribe failed: {err:?}"); tokio::time::sleep(Duration::from_secs(1)).await; continue; @@ -394,10 +395,10 @@ pub fn subscribe_price_feeds( retries = 0u32; // retry on successful connect - let mut stream = pyth_lazer_stream.boxed(); - while let Some(update) = stream.next().await { + let mut stream = pyth_lazer_stream; + while let Some(update) = stream.recv().await { match update { - Ok(AnyResponse::Binary(outer)) => { + AnyResponse::Binary(outer) => { for message in outer.messages { match message { Message::Solana(solana) => { @@ -413,7 +414,8 @@ pub fn subscribe_price_feeds( { // TODO: bulk msg to avoid bouncing around tokio, bucket in some way, one message updates multiple markets... let feed_id = f.feed_id.0; - let price: u64 = new_price.0.unsigned_abs().into(); + let price: u64 = + new_price.mantissa_i64().unsigned_abs(); if let Some(market_id) = pyth_lazer_feed_id_to_perp_market_index(feed_id) @@ -458,8 +460,8 @@ pub fn subscribe_price_feeds( } } } - _other => { - log::warn!(target: "pyth", "unknown msg: {_other:?}"); + other => { + log::warn!(target: "pyth", "unknown msg: {other:?}"); } } }