diff --git a/Cargo.lock b/Cargo.lock index cdb997e..eab4848 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,6 +89,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + [[package]] name = "async-trait" version = "0.1.89" @@ -176,6 +203,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -321,6 +354,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -392,6 +434,39 @@ dependencies = [ "typenum", ] +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "deadpool" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e" +dependencies = [ + "async-trait", + "deadpool-runtime", + "num_cpus", + "retain_mut", + "tokio", +] + +[[package]] +name = "deadpool-runtime" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" + [[package]] name = "der" version = "0.7.10" @@ -483,6 +558,15 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -536,6 +620,21 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -580,6 +679,32 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "futures-sink" version = "0.3.31" @@ -592,14 +717,22 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -618,6 +751,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.17" @@ -626,7 +770,7 @@ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] @@ -700,6 +844,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "hex" version = "0.4.3" @@ -788,6 +938,27 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel", + "base64 0.13.1", + "futures-lite", + "http 0.2.12", + "infer", + "pin-project-lite", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "url", +] + [[package]] name = "httparse" version = "1.10.1" @@ -1010,6 +1181,21 @@ dependencies = [ "hashbrown 0.16.1", ] +[[package]] +name = "infer" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + +[[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" @@ -1158,7 +1344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", "windows-sys 0.61.2", ] @@ -1244,6 +1430,16 @@ dependencies = [ "libm", ] +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -1300,6 +1496,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.12.5" @@ -1410,6 +1612,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prometheus" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "memchr", + "parking_lot", + "protobuf", + "thiserror", +] + [[package]] name = "proptest" version = "1.10.0" @@ -1429,6 +1646,12 @@ dependencies = [ "unarray", ] +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + [[package]] name = "quick-error" version = "1.2.3" @@ -1450,6 +1673,19 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -1471,6 +1707,16 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -1491,6 +1737,15 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1509,6 +1764,15 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "rand_xorshift" version = "0.4.0" @@ -1536,6 +1800,18 @@ dependencies = [ "bitflags 2.10.0", ] +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + [[package]] name = "regex-automata" version = "0.4.13" @@ -1559,7 +1835,7 @@ version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -1593,6 +1869,12 @@ dependencies = [ "winreg", ] +[[package]] +name = "retain_mut" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" + [[package]] name = "rsa" version = "0.9.10" @@ -1632,7 +1914,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", ] [[package]] @@ -1751,6 +2033,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1979,7 +2272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bitflags 2.10.0", "byteorder", "bytes", @@ -2021,7 +2314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bitflags 2.10.0", "byteorder", "crc", @@ -2089,7 +2382,10 @@ dependencies = [ "axum", "chrono", "clap", + "dashmap", "dotenvy", + "http-body-util", + "prometheus", "proptest", "rand 0.8.5", "reqwest", @@ -2103,6 +2399,7 @@ dependencies = [ "tower-http", "tracing", "tracing-subscriber", + "wiremock", ] [[package]] @@ -2200,7 +2497,7 @@ version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ - "fastrand", + "fastrand 2.3.0", "getrandom 0.3.4", "once_cell", "rustix", @@ -2507,6 +2804,7 @@ dependencies = [ "idna", "percent-encoding", "serde", + "serde_derive", ] [[package]] @@ -2554,6 +2852,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "want" version = "0.3.1" @@ -2563,6 +2867,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -2954,6 +3264,28 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wiremock" +version = "0.5.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a3a53eaf34f390dd30d7b1b078287dd05df2aa2e21a589ccb80f5c7253c2e9" +dependencies = [ + "assert-json-diff", + "async-trait", + "base64 0.21.7", + "deadpool", + "futures", + "futures-timer", + "http-types", + "hyper 0.14.32", + "log", + "once_cell", + "regex", + "serde", + "serde_json", + "tokio", +] + [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/packages/core/.env.example b/packages/core/.env.example index 3c5d4dc..14ff210 100644 --- a/packages/core/.env.example +++ b/packages/core/.env.example @@ -10,7 +10,27 @@ POLL_INTERVAL_SECONDS=10 # API server port (default: 8080) API_PORT=8080 -# Comma-separated list of origins allowed to call the API. -# Defaults to http://localhost:3000 when unset. -# Example for production: ALLOWED_ORIGINS=https://your-app.vercel.app,https://www.your-domain.com +# Allowed origins ALLOWED_ORIGINS=http://localhost:3000 + +# Cache TTL for /fees/current responses (seconds) +CACHE_TTL_SECONDS=5 + +# Rate limiting (requests per minute per IP, default: 60) +RATE_LIMIT_PER_MINUTE=60 + +# Retention window for fee data in SQLite (days, default: 7) +STORAGE_RETENTION_DAYS=7 + +# Retry config +RETRY_ATTEMPTS=3 +BASE_RETRY_DELAY_MS=1000 + +# API key for protected routes (leave unset to disable auth) +# API_KEY=your-secret-key-here + +# Webhook URL for fee spike alerts (leave unset to disable) +# WEBHOOK_URL=https://hooks.slack.com/services/xxx + +# Alert threshold: Minor | Moderate | Major | Critical (default: Major) +ALERT_THRESHOLD=Major \ No newline at end of file diff --git a/packages/core/clippy-results.txt b/packages/core/clippy-results.txt new file mode 100644 index 0000000..fb5166f --- /dev/null +++ b/packages/core/clippy-results.txt @@ -0,0 +1,313 @@ + Checking cfg-if v1.0.4 + Checking smallvec v1.15.1 + Checking pin-project-lite v0.2.16 + Checking bytes v1.11.0 + Checking scopeguard v1.2.0 + Checking libc v0.2.180 + Checking futures-core v0.3.31 + Checking once_cell v1.21.3 + Checking itoa v1.0.17 + Compiling zerofrom v0.1.6 + Compiling stable_deref_trait v1.2.1 + Checking lock_api v0.4.14 + Compiling yoke v0.8.1 + Checking futures-sink v0.3.31 + Checking memchr v2.7.6 + Checking pin-utils v0.1.0 + Checking core-foundation-sys v0.8.7 + Checking tracing-core v0.1.36 + Checking log v0.4.29 + Checking futures-io v0.3.32 + Compiling zerovec v0.11.5 + Checking futures-task v0.3.31 + Compiling litemap v0.8.1 + Checking slab v0.4.11 + Compiling writeable v0.6.2 + Checking tracing v0.1.44 + Compiling zerotrie v0.2.3 + Checking serde_core v1.0.228 + Checking futures-util v0.3.31 + Checking parking_lot_core v0.9.12 + Checking errno v0.3.14 + Checking socket2 v0.6.2 + Checking mio v1.1.1 + Checking getrandom v0.3.4 + Checking signal-hook-registry v1.4.8 + Checking parking_lot v0.12.5 + Checking bitflags v2.10.0 + Checking tinystr v0.8.2 + Checking potential_utf v0.1.4 + Checking zerocopy v0.8.39 + Compiling typenum v1.19.0 + Checking icu_locale_core v2.1.1 + Compiling icu_collections v2.1.1 + Checking tokio v1.49.0 + Compiling generic-array v0.14.7 + Checking core-foundation v0.9.4 + Checking futures-channel v0.3.31 + Compiling icu_normalizer_data v2.1.1 + Checking icu_provider v2.1.1 + Compiling icu_properties_data v2.1.2 + Checking rustix v1.1.3 + Checking security-framework-sys v2.15.0 + Compiling icu_normalizer v2.1.1 + Compiling icu_properties v2.1.2 + Checking serde v1.0.228 + Checking percent-encoding v2.3.2 + Checking hashbrown v0.16.1 + Checking equivalent v1.0.2 + Checking fastrand v2.3.0 + Checking tower-service v0.3.3 + Checking form_urlencoded v1.2.2 + Checking tempfile v3.24.0 + Compiling block-buffer v0.10.4 + Compiling crypto-common v0.1.7 + Checking security-framework v2.11.1 + Checking indexmap v2.13.0 + Compiling idna_adapter v1.2.1 + Checking http v1.4.0 + Checking fnv v1.0.7 + Compiling utf8_iter v1.0.4 + Compiling minimal-lexical v0.2.1 + Compiling allocator-api2 v0.2.21 + Compiling nom v7.1.3 + Checking http-body v1.0.1 + Compiling idna v1.1.0 + Checking native-tls v0.2.14 + Checking ahash v0.8.12 + Compiling digest v0.10.7 + Checking httparse v1.10.1 + Compiling cpufeatures v0.2.17 + Compiling num-traits v0.2.19 + Compiling zmij v1.0.17 + Checking httpdate v1.0.3 + Compiling unicode_categories v0.1.1 + Compiling crc-catalog v2.4.0 + Compiling serde_json v1.0.149 + Checking hashbrown v0.14.5 + Compiling atoi v2.0.0 + Compiling sqlformat v0.2.6 + Compiling crc v3.4.0 + Compiling sha2 v0.10.9 + Compiling crossbeam-queue v0.3.12 + Compiling either v1.15.0 + Compiling url v2.5.8 + Compiling futures-intrusive v0.5.0 + Checking crossbeam-utils v0.8.21 + Checking http v0.2.12 + Compiling hashlink v0.8.4 + Compiling spin v0.9.8 + Compiling thiserror v1.0.69 + Compiling event-listener v2.5.3 + Compiling hex v0.4.3 + Compiling byteorder v1.5.0 + Compiling flume v0.11.1 + Checking tokio-util v0.7.18 + Compiling libsqlite3-sys v0.27.0 + Checking try-lock v0.2.5 + Compiling urlencoding v2.1.3 + Checking tower-layer v0.3.3 + Compiling futures-executor v0.3.31 + Checking utf8parse v0.2.2 + Checking anstyle-parse v0.2.7 + Checking want v0.3.1 + Checking http-body v0.4.6 + Checking tokio-stream v0.1.18 + Checking http-body-util v0.1.3 + Checking h2 v0.3.27 + Checking getrandom v0.2.17 + Checking socket2 v0.5.10 + Compiling dotenvy v0.15.7 + Checking atomic-waker v1.1.2 + Checking anstyle-query v1.1.5 + Checking mime v0.3.17 + Checking colorchoice v1.0.4 + Checking sync_wrapper v1.0.2 + Checking anstyle v1.0.13 + Checking lazy_static v1.5.0 + Checking is_terminal_polyfill v1.70.2 + Checking regex-syntax v0.8.8 + Checking ryu v1.0.22 + Checking hyper v1.8.1 + Checking anstream v0.6.21 + Checking serde_urlencoded v0.7.1 + Checking rand_core v0.6.4 + Checking system-configuration-sys v0.5.0 + Checking tokio-native-tls v0.3.1 + Checking ppv-lite86 v0.2.21 + Checking base64 v0.21.7 + Checking clap_lex v0.7.7 + Checking strsim v0.11.1 + Checking bitflags v1.3.2 + Checking rustls-pemfile v1.0.4 + Checking clap_builder v4.5.54 + Checking system-configuration v0.5.1 + Checking rand_chacha v0.3.1 + Checking hyper-util v0.1.19 + Checking axum-core v0.4.5 + Checking protobuf v2.28.0 + Checking sharded-slab v0.1.7 + Checking tower v0.5.3 + Checking regex-automata v0.4.13 + Compiling sqlx-core v0.7.4 + Checking serde_path_to_error v0.1.20 + Checking tracing-log v0.2.0 + Checking iana-time-zone v0.1.64 + Checking thread_local v1.1.9 + Checking encoding_rs v0.8.35 + Checking nu-ansi-term v0.50.3 + Checking ipnet v2.11.0 + Checking sync_wrapper v0.1.2 + Checking matchit v0.7.3 + Checking chrono v0.4.43 + Checking rand v0.8.5 + Checking clap v4.5.54 + Checking tower-http v0.5.2 + Checking dashmap v6.1.0 + Checking matchers v0.2.0 + Checking tracing-subscriber v0.3.22 + Checking axum v0.7.9 + Checking prometheus v0.13.4 + Checking hyper v0.14.32 + Compiling sqlx-sqlite v0.7.4 + Compiling sqlx-macros-core v0.7.4 + Checking hyper-tls v0.5.0 + Checking reqwest v0.11.27 + Compiling sqlx-macros v0.7.4 + Checking sqlx v0.7.4 + Checking stellar-fee-tracker v0.1.0 (/Users/bigben7/Documents/ME/stellar-fee-tracker/packages/core) +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:167:9 + | +167 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:183:37 + | +183 | pub async fn list_alert_configs(&self) -> Result, sqlx::Error> { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:216:9 + | +216 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:237:38 + | +237 | pub async fn delete_alert_config(&self, id: i64) -> Result { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:251:34 + | +251 | pub async fn log_alert_event(&self, event: &AlertEvent) -> Result<(), sqlx::Error> { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:275:9 + | +275 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:353:9 + | +353 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error[E0382]: use of moved value: `delivery` + --> packages/core/src/alerts/mod.rs:73:26 + | +37 | let Some(delivery) = self.webhook_delivery.clone() else { + | -------- move occurs because `delivery` has type `alerts::webhook::WebhookDelivery`, which does not implement the `Copy` trait +... +41 | for spike in &update.insights.congestion_trends.recent_spikes { + | ------------------------------------------------------------- inside of this loop +... +73 | tokio::spawn(async move { + | ^^^^^^^^^^ value moved here, in previous iteration of loop +74 | if let Err(err) = delivery.send_with_retry(&payload).await { + | -------- use occurs due to use in coroutine + +error[E0599]: no method named `insert_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:74:10 + | +73 | let id = repo + | ______________- +74 | | .insert_alert_config(&body.webhook_url, threshold) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + | |_________| + | + +error[E0599]: no method named `list_alert_configs` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:90:24 + | +90 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `list_alert_configs` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:107:24 + | +107 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `update_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:138:10 + | +137 | let updated = repo + | ___________________- +138 | | .update_alert_config(id, threshold, enabled) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + | |_________| + | + +error[E0599]: no method named `delete_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:162:24 + | +162 | let deleted = repo.delete_alert_config(id).await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `query_alert_history` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:225:14 + | +225 | repo.query_alert_history(limit, severity, delivered), + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `count_alert_events` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:226:14 + | +226 | repo.count_alert_events(severity, delivered), + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0282]: type annotations needed + --> packages/core/src/api/alerts.rs:224:26 + | +224 | let (items, total) = tokio::try_join!( + | __________________________^ +225 | | repo.query_alert_history(limit, severity, delivered), +226 | | repo.count_alert_events(severity, delivered), +227 | | ) + | |_____^ cannot infer type + | + = note: this error originates in the macro `$crate::try_join` which comes from the expansion of the macro `tokio::try_join` (in Nightly builds, run with -Z macro-backtrace for more info) + +Some errors have detailed explanations: E0282, E0382, E0599. +For more information about an error, try `rustc --explain E0282`. +error: could not compile `stellar-fee-tracker` (lib) due to 19 previous errors diff --git a/packages/core/src/alerts/mod.rs b/packages/core/src/alerts/mod.rs index 7c78068..8cb8aed 100644 --- a/packages/core/src/alerts/mod.rs +++ b/packages/core/src/alerts/mod.rs @@ -70,6 +70,7 @@ impl AlertManager { timestamp: Utc::now(), }; + let delivery = delivery.clone(); tokio::spawn(async move { if let Err(err) = delivery.send_with_retry(&payload).await { tracing::error!("Webhook dispatch failed: {}", err); @@ -245,4 +246,4 @@ mod tests { manager.check_and_dispatch(&update).await; tokio::time::sleep(std::time::Duration::from_millis(100)).await; } -} +} \ No newline at end of file diff --git a/packages/core/src/metrics.rs b/packages/core/src/metrics.rs index 094c5c8..9eaab06 100644 --- a/packages/core/src/metrics.rs +++ b/packages/core/src/metrics.rs @@ -247,7 +247,7 @@ mod integration_tests { .unwrap(); let resp = app.oneshot(req).await.unwrap(); let bytes = resp.into_body().collect().await.unwrap().to_bytes(); - let body = String::from_utf8(bytes).unwrap(); + let body = String::from_utf8(bytes.to_vec()).unwrap(); assert!(body.contains("stellar_fee_tracker_polls_total")); assert!(body.contains("stellar_fee_tracker_poll_errors_total")); @@ -270,9 +270,9 @@ mod integration_tests { .unwrap(); let resp = app.oneshot(req).await.unwrap(); let bytes = resp.into_body().collect().await.unwrap().to_bytes(); - let body = String::from_utf8(bytes).unwrap(); + let body = String::from_utf8(bytes.to_vec()).unwrap(); // Prometheus text format: metric_name value\n assert!(body.contains("stellar_fee_tracker_polls_total 5")); } -} +} \ No newline at end of file diff --git a/packages/core/src/repository.rs b/packages/core/src/repository.rs index 0b82df8..4d5c886 100644 --- a/packages/core/src/repository.rs +++ b/packages/core/src/repository.rs @@ -158,7 +158,6 @@ impl FeeRepository { Ok(result.rows_affected()) } -} // ---- Alert config CRUD ---- @@ -383,7 +382,6 @@ impl FeeRepository { let count: i64 = row.try_get("cnt").unwrap_or(0); Ok(count) } - } #[cfg(test)] @@ -711,4 +709,4 @@ mod alert_event_tests { assert!(events[0].id.is_some()); assert!(events[0].id.unwrap() > 0); } -} +} \ No newline at end of file diff --git a/packages/core/src/services/horizon.rs b/packages/core/src/services/horizon.rs index c50dd4b..d3a4518 100644 --- a/packages/core/src/services/horizon.rs +++ b/packages/core/src/services/horizon.rs @@ -60,6 +60,7 @@ pub struct HorizonFeeStats { pub struct FeeCharged { pub min: String, pub max: String, + #[serde(rename = "mode")] pub avg: String, pub p10: String, pub p25: String, @@ -302,4 +303,4 @@ mod tests { assert_eq!(stats.fee_charged.p50, "150"); assert_eq!(stats.fee_charged.p95, "800"); } -} +} \ No newline at end of file diff --git a/packages/core/stellar_fees.db b/packages/core/stellar_fees.db new file mode 100644 index 0000000..e695a12 Binary files /dev/null and b/packages/core/stellar_fees.db differ diff --git a/packages/core/test-results.txt b/packages/core/test-results.txt new file mode 100644 index 0000000..9f5d0fe --- /dev/null +++ b/packages/core/test-results.txt @@ -0,0 +1,637 @@ + Compiling stellar-fee-tracker v0.1.0 (/Users/bigben7/Documents/ME/stellar-fee-tracker/packages/core) +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:167:9 + | +167 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:183:37 + | +183 | pub async fn list_alert_configs(&self) -> Result, sqlx::Error> { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:216:9 + | +216 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:237:38 + | +237 | pub async fn delete_alert_config(&self, id: i64) -> Result { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:251:34 + | +251 | pub async fn log_alert_event(&self, event: &AlertEvent) -> Result<(), sqlx::Error> { + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:275:9 + | +275 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: `self` parameter is only allowed in associated functions + --> packages/core/src/repository.rs:353:9 + | +353 | &self, + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error[E0382]: use of moved value: `delivery` + --> packages/core/src/alerts/mod.rs:73:26 + | +37 | let Some(delivery) = self.webhook_delivery.clone() else { + | -------- move occurs because `delivery` has type `WebhookDelivery`, which does not implement the `Copy` trait +... +41 | for spike in &update.insights.congestion_trends.recent_spikes { + | ------------------------------------------------------------- inside of this loop +... +73 | tokio::spawn(async move { + | ^^^^^^^^^^ value moved here, in previous iteration of loop +74 | if let Err(err) = delivery.send_with_retry(&payload).await { + | -------- use occurs due to use in coroutine + +error[E0382]: use of moved value: `delivery` + --> packages/core/src/alerts/mod.rs:73:26 + | +37 | let Some(delivery) = self.webhook_delivery.clone() else { + | -------- move occurs because `delivery` has type `webhook::WebhookDelivery`, which does not implement the `Copy` trait +... +41 | for spike in &update.insights.congestion_trends.recent_spikes { + | ------------------------------------------------------------- inside of this loop +... +73 | tokio::spawn(async move { + | ^^^^^^^^^^ value moved here, in previous iteration of loop +74 | if let Err(err) = delivery.send_with_retry(&payload).await { + | -------- use occurs due to use in coroutine + +error[E0599]: no method named `insert_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:74:10 + | +73 | let id = repo + | ______________- +74 | | .insert_alert_config(&body.webhook_url, threshold) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + | |_________| + | + +error[E0599]: no method named `insert_alert_config` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:74:10 + | +73 | let id = repo + | ______________- +74 | | .insert_alert_config(&body.webhook_url, threshold) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `Arc` + | |_________| + | + +error[E0599]: no method named `list_alert_configs` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:90:24 + | +90 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `Arc` + +error[E0599]: no method named `list_alert_configs` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:90:24 + | +90 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `list_alert_configs` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:107:24 + | +107 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `Arc` + +error[E0599]: no method named `list_alert_configs` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:107:24 + | +107 | let configs = repo.list_alert_configs().await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `update_alert_config` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:138:10 + | +137 | let updated = repo + | ___________________- +138 | | .update_alert_config(id, threshold, enabled) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `Arc` + | |_________| + | + +error[E0599]: no method named `update_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:138:10 + | +137 | let updated = repo + | ___________________- +138 | | .update_alert_config(id, threshold, enabled) + | | -^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + | |_________| + | + +error[E0599]: no method named `delete_alert_config` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:162:24 + | +162 | let deleted = repo.delete_alert_config(id).await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^^ method not found in `Arc` + +error[E0599]: no method named `delete_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:162:24 + | +162 | let deleted = repo.delete_alert_config(id).await.map_err(|e| { + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `query_alert_history` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:225:14 + | +225 | repo.query_alert_history(limit, severity, delivered), + | ^^^^^^^^^^^^^^^^^^^ method not found in `Arc` + +error[E0599]: no method named `query_alert_history` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:225:14 + | +225 | repo.query_alert_history(limit, severity, delivered), + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `count_alert_events` found for struct `Arc` in the current scope + --> packages/core/src/api/alerts.rs:226:14 + | +226 | repo.count_alert_events(severity, delivered), + | ^^^^^^^^^^^^^^^^^^ method not found in `Arc` + +error[E0599]: no method named `count_alert_events` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:226:14 + | +226 | repo.count_alert_events(severity, delivered), + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0282]: type annotations needed + --> packages/core/src/api/alerts.rs:224:26 + | +224 | let (items, total) = tokio::try_join!( + | __________________________^ +225 | | repo.query_alert_history(limit, severity, delivered), +226 | | repo.count_alert_events(severity, delivered), +227 | | ) + | |_____^ cannot infer type + | + = note: this error originates in the macro `$crate::try_join` which comes from the expansion of the macro `tokio::try_join` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no method named `log_alert_event` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:432:18 + | +432 | repo.log_alert_event(e).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `insert_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:328:23 + | +328 | let id = repo.insert_alert_config("https://example.com/hook", "Minor").await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `insert_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:349:23 + | +349 | let id = repo.insert_alert_config("https://example.com/hook", "Minor").await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `insert_alert_config` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:370:23 + | +370 | let id = repo.insert_alert_config("https://example.com/hook", "Major").await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0599]: no method named `list_alert_configs` found for struct `std::sync::Arc` in the current scope + --> packages/core/src/api/alerts.rs:386:28 + | +386 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `std::sync::Arc` + +error[E0308]: mismatched types + --> packages/core/src/metrics.rs:250:38 + | +250 | let body = String::from_utf8(bytes).unwrap(); + | ----------------- ^^^^^- help: try using a conversion method: `.to_vec()` + | | | + | | expected `Vec`, found `Bytes` + | arguments to this function are incorrect + | + = note: expected struct `Vec` + found struct `axum::body::Bytes` +note: associated function defined here + --> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/alloc/src/string.rs:563:12 + +error[E0308]: mismatched types + --> packages/core/src/metrics.rs:273:38 + | +273 | let body = String::from_utf8(bytes).unwrap(); + | ----------------- ^^^^^- help: try using a conversion method: `.to_vec()` + | | | + | | expected `Vec`, found `Bytes` + | arguments to this function are incorrect + | + = note: expected struct `Vec` + found struct `axum::body::Bytes` +note: associated function defined here + --> /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/alloc/src/string.rs:563:12 + +error[E0599]: no method named `insert_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:532:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `insert_alert_config` not found for this struct +... +531 | let id = repo + | __________________- +532 | | .insert_alert_config("https://hooks.example.com/webhook", "Major") + | | -^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + | |_____________| + | + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:536:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +536 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `insert_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:547:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `insert_alert_config` not found for this struct +... +546 | let id = repo + | __________________- +547 | | .insert_alert_config("https://hooks.example.com/a", "Minor") + | | -^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + | |_____________| + | + +error[E0599]: no method named `update_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:550:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `update_alert_config` not found for this struct +... +550 | let updated = repo.update_alert_config(id, "Critical", false).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:552:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +552 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `update_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:560:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `update_alert_config` not found for this struct +... +560 | let updated = repo.update_alert_config(9999, "Major", true).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `insert_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:568:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `insert_alert_config` not found for this struct +... +567 | let id = repo + | __________________- +568 | | .insert_alert_config("https://hooks.example.com/b", "Major") + | | -^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + | |_____________| + | + +error[E0599]: no method named `delete_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:571:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `delete_alert_config` not found for this struct +... +571 | let deleted = repo.delete_alert_config(id).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:573:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +573 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `delete_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:581:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `delete_alert_config` not found for this struct +... +581 | let deleted = repo.delete_alert_config(9999).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `insert_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:589:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `insert_alert_config` not found for this struct +... +588 | let id = repo + | __________________- +589 | | .insert_alert_config("https://hooks.example.com/cycle", "Minor") + | | -^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + | |_____________| + | + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:592:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +592 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `update_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:594:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `update_alert_config` not found for this struct +... +594 | repo.update_alert_config(id, "Major", true).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:595:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +595 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `delete_alert_config` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:597:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `delete_alert_config` not found for this struct +... +597 | repo.delete_alert_config(id).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `list_alert_configs` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:598:28 + | +46 | pub struct FeeRepository { + | ------------------------ method `list_alert_configs` not found for this struct +... +598 | let configs = repo.list_alert_configs().await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:631:18 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +631 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +Some errors have detailed explanations: E0282, E0382, E0599. +For more information about an error, try `rustc --explain E0282`. +error: could not compile `stellar-fee-tracker` (lib) due to 19 previous errors +warning: build failed, waiting for other jobs to finish... +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:633:27 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +633 | let events = repo.query_alert_history(20, None, None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:640:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +640 | repo.log_alert_event(&make_event("Minor", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:641:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +641 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:642:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +642 | repo.log_alert_event(&make_event("Critical", false)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:644:26 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +644 | let major = repo.query_alert_history(20, Some("Major"), None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:648:29 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +648 | let critical = repo.query_alert_history(20, Some("Critical"), None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:656:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +656 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:657:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +657 | repo.log_alert_event(&make_event("Major", false)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:658:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +658 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:660:30 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +660 | let delivered = repo.query_alert_history(20, None, Some(true)).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:663:27 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +663 | let failed = repo.query_alert_history(20, None, Some(false)).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:671:18 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +671 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:674:27 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +674 | let events = repo.query_alert_history(999, None, None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:682:18 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +682 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `count_alert_events` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:684:26 + | +46 | pub struct FeeRepository { + | ------------------------ method `count_alert_events` not found for this struct +... +684 | let total = repo.count_alert_events(None, None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:691:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +691 | repo.log_alert_event(&make_event("Minor", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:692:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +692 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:693:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +693 | repo.log_alert_event(&make_event("Critical", false)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `count_alert_events` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:695:32 + | +46 | pub struct FeeRepository { + | ------------------------ method `count_alert_events` not found for this struct +... +695 | let major_count = repo.count_alert_events(Some("Major"), None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `count_alert_events` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:698:36 + | +46 | pub struct FeeRepository { + | ------------------------ method `count_alert_events` not found for this struct +... +698 | let delivered_count = repo.count_alert_events(None, Some(true)).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `count_alert_events` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:701:36 + | +46 | pub struct FeeRepository { + | ------------------------ method `count_alert_events` not found for this struct +... +701 | let critical_failed = repo.count_alert_events(Some("Critical"), Some(false)).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `log_alert_event` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:708:14 + | +46 | pub struct FeeRepository { + | ------------------------ method `log_alert_event` not found for this struct +... +708 | repo.log_alert_event(&make_event("Major", true)).await.unwrap(); + | ^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +error[E0599]: no method named `query_alert_history` found for struct `repository::FeeRepository` in the current scope + --> packages/core/src/repository.rs:709:27 + | +46 | pub struct FeeRepository { + | ------------------------ method `query_alert_history` not found for this struct +... +709 | let events = repo.query_alert_history(1, None, None).await.unwrap(); + | ^^^^^^^^^^^^^^^^^^^ method not found in `repository::FeeRepository` + +Some errors have detailed explanations: E0282, E0308, E0382, E0599. +error: could not compile `stellar-fee-tracker` (lib test) due to 66 previous errors diff --git a/packages/core/tests/api_integration.rs b/packages/core/tests/api_integration.rs index c7cc57d..c87a5fe 100644 --- a/packages/core/tests/api_integration.rs +++ b/packages/core/tests/api_integration.rs @@ -739,7 +739,7 @@ async fn metrics_body_contains_metric_names() { assert_eq!(resp.status(), StatusCode::OK); let bytes = resp.into_body().collect().await.unwrap().to_bytes(); - let body = String::from_utf8(bytes).unwrap(); + let body = String::from_utf8(bytes.to_vec()).unwrap(); assert!(body.contains("stellar_fee_tracker_polls_total")); assert!(body.contains("stellar_fee_tracker_http_request_duration_seconds")); } @@ -782,4 +782,4 @@ async fn alerts_history_returns_200_empty() { let json = json_body(resp.into_body()).await; assert_eq!(json["total"], 0); assert!(json["items"].as_array().unwrap().is_empty()); -} +} \ No newline at end of file