From e50289240222eef424e17a8faab65648016fe777 Mon Sep 17 00:00:00 2001 From: Eric Woolsey Date: Tue, 13 Feb 2024 18:02:28 -0800 Subject: [PATCH] Telemetry Batteries PRO-536 (#696) --- .github/workflows/test.yml | 8 +- Cargo.lock | 556 ++++++------------ Cargo.toml | 19 +- Dockerfile | 2 +- build.rs | 7 - src/config.rs | 42 ++ src/lib.rs | 1 + src/main.rs | 61 +- src/server.rs | 2 +- src/server/custom_middleware/logging_layer.rs | 9 +- src/shutdown.rs | 100 ++++ src/utils.rs | 6 +- supply-chain/config.toml | 151 ++--- supply-chain/imports.lock | 55 +- tests/common/mod.rs | 2 +- tests/common/test_config.rs | 3 +- 16 files changed, 482 insertions(+), 542 deletions(-) delete mode 100644 build.rs create mode 100644 src/shutdown.rs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11062ae3..c29c3cf8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,12 +56,12 @@ jobs: - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --locked --features "mimalloc" --all-targets + args: --locked --all-targets - name: Check docs uses: actions-rs/cargo@v1 with: command: doc - args: --locked --features "mimalloc" --no-deps --document-private-items + args: --locked --no-deps --document-private-items test: name: Test @@ -98,12 +98,12 @@ jobs: uses: actions-rs/cargo@v1 with: command: nextest - args: run --workspace --features "mimalloc" --no-run + args: run --workspace --no-run - name: Run tests uses: actions-rs/cargo@v1 with: command: nextest - args: run --workspace --features "mimalloc" + args: run --workspace cargo-vet: name: Vet Dependencies diff --git a/Cargo.lock b/Cargo.lock index 84616bfe..e6a009c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,15 +102,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.11" @@ -1144,6 +1135,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "cadence" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51923ae2126911a3456e05ddf421ece6380a214722bffa0ef15c5912d8fe8761" +dependencies = [ + "crossbeam-channel", +] + [[package]] name = "camino" version = "1.1.6" @@ -1254,9 +1254,6 @@ dependencies = [ "anstyle", "clap_lex", "strsim", - "terminal_size", - "unicase", - "unicode-width", ] [[package]] @@ -1277,48 +1274,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" -[[package]] -name = "cli-batteries" -version = "0.5.0" -source = "git+https://github.com/recmo/cli-batteries?rev=fc1186d1aba6a25120570fe04ad3362b08c8adfd#fc1186d1aba6a25120570fe04ad3362b08c8adfd" -dependencies = [ - "ansi_term", - "chrono", - "clap 4.4.18", - "color-eyre 0.6.2", - "eyre", - "futures", - "heck", - "hex", - "hex-literal 0.4.1", - "http 0.2.11", - "hyper", - "itertools 0.10.5", - "mimalloc", - "once_cell", - "opentelemetry", - "opentelemetry-datadog", - "opentelemetry-http", - "opentelemetry-otlp", - "opentelemetry-semantic-conventions", - "prometheus", - "serde", - "serde_json", - "thiserror", - "time", - "tokio", - "tracing", - "tracing-error 0.2.0", - "tracing-flame", - "tracing-futures", - "tracing-log 0.1.4", - "tracing-opentelemetry", - "tracing-serde", - "tracing-subscriber 0.3.18", - "url", - "users", -] - [[package]] name = "cognito_srp" version = "0.1.2" @@ -1430,7 +1385,6 @@ dependencies = [ "once_cell", "owo-colors 3.5.0", "tracing-error 0.2.0", - "url", ] [[package]] @@ -1831,19 +1785,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.3", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "data-encoding" version = "2.5.0" @@ -3067,18 +3008,6 @@ dependencies = [ "tokio-rustls", ] -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper", - "pin-project-lite", - "tokio", - "tokio-io-timeout", -] - [[package]] name = "hyper-tls" version = "0.5.0" @@ -3220,17 +3149,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.5", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -3244,7 +3162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi 0.3.5", - "rustix 0.38.31", + "rustix", "windows-sys 0.52.0", ] @@ -3412,16 +3330,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libmimalloc-sys" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "libredox" version = "0.0.1" @@ -3450,12 +3358,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -3499,15 +3401,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown 0.12.3", -] - [[package]] name = "mach" version = "0.3.2" @@ -3590,6 +3483,61 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metrics" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd71d9db2e4287c3407fa04378b8c2ee570aebe0854431562cdd89ca091854f4" +dependencies = [ + "ahash 0.8.7", + "portable-atomic", +] + +[[package]] +name = "metrics-exporter-prometheus" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bf4e7146e30ad172c42c39b3246864bd2d3c6396780711a1baf749cfe423e21" +dependencies = [ + "base64 0.21.7", + "hyper", + "hyper-tls", + "indexmap 2.2.2", + "ipnet", + "metrics", + "metrics-util", + "quanta", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "metrics-exporter-statsd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82bd7bb16e431f15d56a61b18ee34881cd9d427da7b4450d1a588c911c1d9ac3" +dependencies = [ + "cadence", + "metrics", + "thiserror", +] + +[[package]] +name = "metrics-util" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece71ab046dcf45604e573329966ec1db5ff4b81cfa170a924ff4c959ab5451a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.14.3", + "metrics", + "num_cpus", + "quanta", + "sketches-ddsketch", +] + [[package]] name = "micro-oz" version = "0.1.0" @@ -3609,15 +3557,6 @@ dependencies = [ "tracing-subscriber 0.3.18", ] -[[package]] -name = "mimalloc" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" -dependencies = [ - "libmimalloc-sys", -] - [[package]] name = "mime" version = "0.3.17" @@ -3983,29 +3922,35 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.19.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4b8347cc26099d3aeee044065ecc3ae11469796b4d65d065a23a584ed92a6f" +checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", + "futures-core", + "futures-sink", + "indexmap 2.2.2", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", ] [[package]] name = "opentelemetry-datadog" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf08569fbddd2149b268e2bde2bca0bab84bc19ee2efcc234f855f49a911536" +checksum = "3e09667367cb509f10d7cf5960a83f9c4d96e93715f750b164b4b98d46c3cbf4" dependencies = [ - "async-trait", "futures-core", "http 0.2.11", - "indexmap 1.9.3", - "itertools 0.10.5", + "indexmap 2.2.2", + "itertools 0.11.0", "once_cell", "opentelemetry", "opentelemetry-http", "opentelemetry-semantic-conventions", + "opentelemetry_sdk", "reqwest", "rmp", "thiserror", @@ -4014,88 +3959,41 @@ dependencies = [ [[package]] name = "opentelemetry-http" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a819b71d6530c4297b49b3cae2939ab3a8cc1b9f382826a1bc29dd0ca3864906" +checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e" dependencies = [ "async-trait", "bytes", "http 0.2.11", - "opentelemetry_api", - "reqwest", -] - -[[package]] -name = "opentelemetry-otlp" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8af72d59a4484654ea8eb183fea5ae4eb6a41d7ac3e3bae5f4d2a282a3a7d3ca" -dependencies = [ - "async-trait", - "futures", - "futures-util", - "http 0.2.11", "opentelemetry", - "opentelemetry-proto", - "prost", - "thiserror", - "tokio", - "tonic", -] - -[[package]] -name = "opentelemetry-proto" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045f8eea8c0fa19f7d48e7bc3128a39c2e5c533d5c61298c548dfefc1064474c" -dependencies = [ - "futures", - "futures-util", - "opentelemetry", - "prost", - "tonic", + "reqwest", ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e33428e6bf08c6f7fcea4ddb8e358fab0fe48ab877a87c70c6ebe20f673ce5" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" dependencies = [ "opentelemetry", ] -[[package]] -name = "opentelemetry_api" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed41783a5bf567688eb38372f2b7a8530f5a607a4b49d38dd7573236c23ca7e2" -dependencies = [ - "fnv", - "futures-channel", - "futures-util", - "indexmap 1.9.3", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - [[package]] name = "opentelemetry_sdk" -version = "0.19.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b3a2a91fdbfdd4d212c0dcc2ab540de2c2bcbbd90be17de7a7daf8822d010c1" +checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" dependencies = [ "async-trait", "crossbeam-channel", - "dashmap", - "fnv", "futures-channel", "futures-executor", "futures-util", + "glob", "once_cell", - "opentelemetry_api", + "opentelemetry", + "ordered-float", "percent-encoding", "rand", "thiserror", @@ -4109,6 +4007,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-float" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" +dependencies = [ + "num-traits", +] + [[package]] name = "ordered-multimap" version = "0.4.3" @@ -4488,6 +4395,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "postgres-docker-utils" version = "0.1.0" @@ -4600,19 +4513,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "procfs" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de8dacb0873f77e6aefc6d71e044761fcc68060290f5b1089fcdf84626bb69" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "hex", - "lazy_static", - "rustix 0.36.17", -] - [[package]] name = "prometheus" version = "0.13.3" @@ -4622,10 +4522,8 @@ dependencies = [ "cfg-if", "fnv", "lazy_static", - "libc", "memchr", "parking_lot", - "procfs", "protobuf", "thiserror", ] @@ -4646,29 +4544,6 @@ dependencies = [ "unarray", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "protobuf" version = "2.28.0" @@ -4695,6 +4570,21 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "quanta" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi", + "web-sys", + "winapi", +] + [[package]] name = "quote" version = "1.0.35" @@ -4749,6 +4639,15 @@ dependencies = [ "rand_core", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.4.2", +] + [[package]] name = "rayon" version = "1.8.1" @@ -5140,20 +5039,6 @@ dependencies = [ "semver 1.0.21", ] -[[package]] -name = "rustix" -version = "0.36.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - [[package]] name = "rustix" version = "0.38.31" @@ -5163,7 +5048,7 @@ dependencies = [ "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -5588,7 +5473,6 @@ dependencies = [ "bytes", "chrono", "clap 4.4.18", - "cli-batteries", "config", "ethers", "ethers-solc", @@ -5616,6 +5500,7 @@ dependencies = [ "similar-asserts", "sqlx", "take_mut", + "telemetry-batteries", "tempfile", "test-case", "thiserror", @@ -5674,6 +5559,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "sketches-ddsketch" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" + [[package]] name = "slab" version = "0.4.9" @@ -6122,6 +6013,32 @@ version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +[[package]] +name = "telemetry-batteries" +version = "0.1.0" +source = "git+https://github.com/worldcoin/telemetry-batteries.git?rev=545e96d#545e96ddb84e4325578531d1858a88edba3e91e2" +dependencies = [ + "chrono", + "dirs", + "http 0.2.11", + "metrics", + "metrics-exporter-prometheus", + "metrics-exporter-statsd", + "opentelemetry", + "opentelemetry-datadog", + "opentelemetry-http", + "opentelemetry_sdk", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry", + "tracing-serde", + "tracing-subscriber 0.3.18", +] + [[package]] name = "tempfile" version = "3.10.0" @@ -6130,7 +6047,7 @@ checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "rustix 0.38.31", + "rustix", "windows-sys 0.52.0", ] @@ -6145,16 +6062,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix 0.38.31", - "windows-sys 0.48.0", -] - [[package]] name = "test-case" version = "3.3.1" @@ -6312,16 +6219,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.2.0" @@ -6471,38 +6368,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tonic" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" -dependencies = [ - "async-stream", - "async-trait", - "axum", - "base64 0.13.1", - "bytes", - "futures-core", - "futures-util", - "h2", - "http 0.2.11", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tower-layer", - "tower-service", - "tracing", - "tracing-futures", -] - [[package]] name = "tower" version = "0.4.13" @@ -6511,13 +6376,9 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", - "slab", "tokio", - "tokio-util", "tower-layer", "tower-service", "tracing", @@ -6547,6 +6408,18 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber 0.3.18", +] + [[package]] name = "tracing-attributes" version = "0.1.27" @@ -6588,17 +6461,6 @@ dependencies = [ "tracing-subscriber 0.3.18", ] -[[package]] -name = "tracing-flame" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bae117ee14789185e129aaee5d93750abe67fdc5a9a62650452bfe4e122a3a9" -dependencies = [ - "lazy_static", - "tracing", - "tracing-subscriber 0.3.18", -] - [[package]] name = "tracing-futures" version = "0.2.5" @@ -6609,19 +6471,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "ahash 0.7.7", - "log", - "lru", - "once_cell", - "tracing-core", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -6635,16 +6484,20 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00a39dcf9bfc1742fa4d6215253b33a6e474be78275884c216fc2a06267b3600" +checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" dependencies = [ + "js-sys", "once_cell", "opentelemetry", + "opentelemetry_sdk", + "smallvec", "tracing", "tracing-core", - "tracing-log 0.1.4", + "tracing-log", "tracing-subscriber 0.3.18", + "web-time", ] [[package]] @@ -6677,7 +6530,6 @@ dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "parking_lot", "regex", "serde", "serde_json", @@ -6686,7 +6538,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log 0.2.0", + "tracing-log", "tracing-serde", ] @@ -6783,15 +6635,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -6867,16 +6710,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "users" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" -dependencies = [ - "libc", - "log", -] - [[package]] name = "utf-8" version = "0.7.6" @@ -7298,6 +7131,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.25.4" @@ -7313,7 +7156,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.31", + "rustix", ] [[package]] @@ -7390,15 +7233,6 @@ dependencies = [ "windows_x86_64_msvc 0.33.0", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 370e9097..8f06c4cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ authors = [ "Lucas Ege ", ] edition = "2021" -build = "build.rs" homepage = "https://github.com/worldcoin/signup-sequencer" repository = "https://github.com/worldcoin/signup-sequencer" description = "A tool that processes WorldID signups on-chain." @@ -20,7 +19,6 @@ members = ["crates/*"] [features] default = [] -mimalloc = ["cli-batteries/mimalloc"] [dependencies] anyhow = { version = "1.0.68" } @@ -31,13 +29,7 @@ axum-server = "0.4.4" bytes = "1.4.0" chrono = { version = "0.4.19", features = ["serde"] } clap = { version = "4.0", features = ["derive"] } -cli-batteries = { git = "https://github.com/recmo/cli-batteries", rev = "fc1186d1aba6a25120570fe04ad3362b08c8adfd", features = [ - "signals", - "prometheus", - "metered-allocator", - "otlp", - "datadog", -] } +telemetry-batteries = { git = "https://github.com/worldcoin/telemetry-batteries.git", rev = "545e96d" } config = "0.13.4" ethers = { version = "2.0.10", features = ["ws", "ipc", "openssl", "abigen"] } ethers-solc = "2.0.10" @@ -52,7 +44,8 @@ hyper = { version = "^0.14.17", features = ["server", "tcp", "http1", "http2"] } indoc = "2.0.4" once_cell = "1.8" oz-api = { path = "crates/oz-api" } -prometheus = "0.13.3" # We need upstream PR#465 to fix #272. +# We need upstream PR#465 to fix #272. +prometheus = "0.13.3" reqwest = { version = "0.11.18", features = ["json"] } # ruint has broken semver, specify exact version. ruint = { version = "=1.11.1", features = ["primitive-types", "sqlx"] } @@ -88,9 +81,6 @@ url = { version = "2.2", features = ["serde"] } zeroize = "1.6.0" [dev-dependencies] -cli-batteries = { git = "https://github.com/recmo/cli-batteries", rev = "fc1186d1aba6a25120570fe04ad3362b08c8adfd", features = [ - "mock-shutdown", -] } hex = "0.4.3" maplit = "1.0.2" micro-oz = { path = "crates/micro-oz" } @@ -104,9 +94,6 @@ test-case = "3.0" tracing-subscriber = "0.3.11" tracing-test = "0.2" -[build-dependencies] -cli-batteries = { git = "https://github.com/recmo/cli-batteries", rev = "fc1186d1aba6a25120570fe04ad3362b08c8adfd" } - [profile.release] panic = "abort" overflow-checks = true diff --git a/Dockerfile b/Dockerfile index ae1ddaca..a98c7604 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ENV CARGO_HOME="/root/.cargo" RUN rustup component add cargo # Build the sequencer -RUN cargo build --release --features mimalloc +RUN cargo build --release # Make sure it runs RUN /src/target/release/signup-sequencer --version diff --git a/build.rs b/build.rs deleted file mode 100644 index 08d8639a..00000000 --- a/build.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - cli_batteries::build_rs().expect("Failed to setup build environment"); - - println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rerun-if-changed=schemas"); - println!("cargo:rerun-if-changed=sol"); -} diff --git a/src/config.rs b/src/config.rs index bc2fe68b..4b2d73b8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,6 +19,8 @@ pub struct Config { pub relayer: RelayerConfig, pub database: DatabaseConfig, pub server: ServerConfig, + #[serde(default)] + pub service: ServiceConfig, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -204,9 +206,36 @@ pub struct ServerConfig { pub serve_timeout: Duration, } +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct ServiceConfig { + // Service name - used for logging, metrics and tracing + #[serde(default = "default::service_name")] + pub service_name: String, + pub datadog: Option, + pub statsd: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DatadogConfig { + pub traces_endpoint: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StatsdConfig { + pub metrics_host: String, + pub metrics_port: u16, + pub metrics_queue_size: usize, + pub metrics_buffer_size: usize, + pub metrics_prefix: String, +} + pub mod default { use std::time::Duration; + pub fn service_name() -> String { + "signup-sequencer".to_string() + } + pub fn oz_api_url() -> String { "https://api.defender.openzeppelin.com".to_string() } @@ -369,6 +398,19 @@ mod tests { [server] address = "0.0.0.0:3001" serve_timeout = "30s" + + [service] + service_name = "signup-sequencer" + + [service.datadog] + traces_endpoint = "http://localhost:8126" + + [service.statsd] + metrics_host = "localhost" + metrics_port = 8125 + metrics_queue_size = 100 + metrics_buffer_size = 100 + metrics_prefix = "signup_sequencer" "#}; #[test] diff --git a/src/lib.rs b/src/lib.rs index d17320c4..0ca28a98 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,5 +10,6 @@ mod ethereum; pub mod identity_tree; pub mod prover; pub mod server; +pub mod shutdown; pub mod task_monitor; pub mod utils; diff --git a/src/main.rs b/src/main.rs index bc18cb47..6414a09c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,11 +9,15 @@ use std::path::PathBuf; use clap::Parser; -use cli_batteries::{run, version}; use signup_sequencer::app::App; -use signup_sequencer::config::Config; +use signup_sequencer::config::{Config, ServiceConfig}; use signup_sequencer::server; +use signup_sequencer::shutdown::watch_shutdown_signals; use signup_sequencer::task_monitor::TaskMonitor; +use telemetry_batteries::metrics::statsd::StatsdBattery; +use telemetry_batteries::tracing::datadog::DatadogBattery; +use telemetry_batteries::tracing::stdout::StdoutBattery; +use telemetry_batteries::tracing::TracingShutdownHandle; #[derive(Debug, Clone, Parser)] struct Args { @@ -21,24 +25,20 @@ struct Args { config: Option, } -async fn app(args: Args) -> eyre::Result<()> { +#[tokio::main] +async fn main() -> eyre::Result<()> { + let args = Args::parse(); sequencer_app(args) .await .map_err(|e| eyre::eyre!("{:?}", e)) } async fn sequencer_app(args: Args) -> anyhow::Result<()> { - let mut settings = config::Config::builder(); - - if let Some(path) = args.config { - settings = settings.add_source(config::File::from(path).required(true)); - } + let config = load_config(&args)?; - let settings = settings - .add_source(config::Environment::with_prefix("SEQ").separator("__")) - .build()?; + let _ = init_telemetry(&config.service)?; - let config = settings.try_deserialize::()?; + watch_shutdown_signals(); let server_config = config.server.clone(); @@ -59,6 +59,39 @@ async fn sequencer_app(args: Args) -> anyhow::Result<()> { Ok(()) } -fn main() { - run(version!(semaphore, ethers), app); +fn load_config(args: &Args) -> anyhow::Result { + let mut settings = config::Config::builder(); + + if let Some(ref path) = args.config { + settings = settings.add_source(config::File::from(path.clone()).required(true)); + } + + let settings = settings + .add_source(config::Environment::with_prefix("SEQ").separator("__")) + .build()?; + + Ok(settings.try_deserialize::()?) +} + +fn init_telemetry(service: &ServiceConfig) -> anyhow::Result { + if let Some(ref statsd) = service.statsd { + StatsdBattery::init( + &statsd.metrics_host, + statsd.metrics_port, + statsd.metrics_queue_size, + statsd.metrics_buffer_size, + Some(&statsd.metrics_prefix), + )?; + } + + if let Some(ref datadog) = service.datadog { + Ok(DatadogBattery::init( + datadog.traces_endpoint.as_deref(), + &service.service_name, + None, + true, + )) + } else { + Ok(StdoutBattery::init()) + } } diff --git a/src/server.rs b/src/server.rs index c53cc522..4b198ab2 100644 --- a/src/server.rs +++ b/src/server.rs @@ -7,13 +7,13 @@ use std::time::Duration; use axum::extract::{Query, State}; use axum::routing::{get, post}; use axum::{middleware, Json, Router}; -use cli_batteries::await_shutdown; use error::Error; use hyper::StatusCode; use tracing::info; use crate::app::App; use crate::config::ServerConfig; +use crate::shutdown::await_shutdown; mod custom_middleware; pub mod data; diff --git a/src/server/custom_middleware/logging_layer.rs b/src/server/custom_middleware/logging_layer.rs index 074f5870..3c3bfb2d 100644 --- a/src/server/custom_middleware/logging_layer.rs +++ b/src/server/custom_middleware/logging_layer.rs @@ -6,6 +6,7 @@ use axum::response::Response; use bytes::Bytes; use hyper::body::HttpBody; use hyper::{Body, Method}; +use telemetry_batteries::tracing::{trace_from_headers, trace_to_headers}; use tracing::{error, info, info_span, warn, Instrument}; // 1 MiB @@ -26,7 +27,7 @@ where let span = info_span!("request", ?uri_path, ?request_method, ?request_query); async { - cli_batteries::trace_from_headers(&parts.headers); + trace_from_headers(&parts.headers); info!( uri_path, @@ -48,7 +49,7 @@ where ) .await?; - cli_batteries::trace_to_headers(response.headers_mut()); + trace_to_headers(response.headers_mut()); Ok(response) } @@ -60,7 +61,7 @@ where let span = info_span!("request", ?uri_path, ?request_method, ?request_query, ?body); async { - cli_batteries::trace_from_headers(&parts.headers); + trace_from_headers(&parts.headers); info!( ?uri_path, @@ -83,7 +84,7 @@ where ) .await?; - cli_batteries::trace_to_headers(response.headers_mut()); + trace_to_headers(response.headers_mut()); Ok(response) } diff --git a/src/shutdown.rs b/src/shutdown.rs new file mode 100644 index 00000000..6bac915e --- /dev/null +++ b/src/shutdown.rs @@ -0,0 +1,100 @@ +use eyre::Result; +use once_cell::sync::Lazy; +use tokio::sync::watch::{self, Receiver, Sender}; +use tracing::info; + +static NOTIFY: Lazy<(Sender, Receiver)> = Lazy::new(|| watch::channel(false)); + +/// Send the signal to shutdown the program. +pub fn shutdown() { + // Does not fail because the channel never closes. + NOTIFY.0.send(true).unwrap(); +} + +/// Reset the shutdown signal so it can be triggered again. +/// +/// This is only useful for testing. Strange things can happen to any existing +/// `await_shutdown()` futures. +pub fn reset_shutdown() { + // Does not fail because the channel never closes. + NOTIFY.0.send(false).unwrap(); +} + +/// Are we currently shutting down? +#[must_use] +pub fn is_shutting_down() -> bool { + *NOTIFY.1.borrow() +} + +/// Wait for the program to shutdown. +/// +/// Resolves immediately if the program is already shutting down. +/// The resulting future is safe to cancel by dropping. +pub async fn await_shutdown() { + let mut watch = NOTIFY.1.clone(); + if *watch.borrow_and_update() { + return; + } + // Does not fail because the channel never closes. + watch.changed().await.unwrap(); +} + +pub fn watch_shutdown_signals() { + tokio::spawn({ + async move { + signal_shutdown() + .await + .map_err(|err| tracing::error!("Error handling Ctrl-C: {}", err)) + .unwrap(); + shutdown(); + } + }); +} + +#[cfg(unix)] +async fn signal_shutdown() -> Result<()> { + use tokio::signal::unix::{signal, SignalKind}; + + let sigint = signal(SignalKind::interrupt())?; + let sigterm = signal(SignalKind::terminate())?; + tokio::pin!(sigint); + tokio::pin!(sigterm); + tokio::select! { + _ = sigint.recv() => { info!("SIGINT received, shutting down"); } + _ = sigterm.recv() => { info!("SIGTERM received, shutting down"); } + }; + Ok(()) +} + +#[cfg(not(unix))] +async fn signal_shutdown() -> Result<()> { + use tokio::signal::ctrl_c; + + ctrl_c().await?; + info!("Ctrl-C received, shutting down"); + Ok(()) +} + +#[cfg(test)] +mod tests { + use tokio::time::{sleep, Duration}; + + use super::*; + + #[tokio::test] + async fn shutdown_signal() { + let start = tokio::time::Instant::now(); + + tokio::spawn(async { + sleep(Duration::from_millis(100)).await; + shutdown(); + }); + + await_shutdown().await; + + let elapsed = start.elapsed(); + + assert!(elapsed > Duration::from_millis(100)); + assert!(elapsed < Duration::from_millis(200)); + } +} diff --git a/src/utils.rs b/src/utils.rs index e7846ce9..57cf381f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,6 +7,8 @@ use tokio::sync::broadcast; use tokio::task::JoinHandle; use tracing::{error, info}; +use crate::shutdown::is_shutting_down; + pub mod batch_type; pub mod index_packing; pub mod min_map; @@ -51,7 +53,7 @@ where Ok(Err(e)) => { error!("Task failed: {e:?}"); - if cli_batteries::is_shutting_down() { + if is_shutting_down() { std::process::abort(); } @@ -60,7 +62,7 @@ where Err(e) => { error!("Task panicked: {e:?}"); - if cli_batteries::is_shutting_down() { + if is_shutting_down() { std::process::abort(); } diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 7c2d8718..98f9a9ff 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -25,9 +25,6 @@ url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/ [policy.ark-groth16] audit-as-crates-io = true -[policy.cli-batteries] -audit-as-crates-io = true - [policy."ethers-core:2.0.13@git:4d267f763a19e42a09e92741e1489c123f852f53"] audit-as-crates-io = true @@ -67,10 +64,6 @@ criteria = "safe-to-deploy" version = "0.1.1" criteria = "safe-to-deploy" -[[exemptions.ansi_term]] -version = "0.12.1" -criteria = "safe-to-deploy" - [[exemptions.ark-bn254]] version = "0.3.0" criteria = "safe-to-deploy" @@ -331,6 +324,10 @@ criteria = "safe-to-deploy" version = "0.1.4" criteria = "safe-to-deploy" +[[exemptions.cadence]] +version = "1.1.0" +criteria = "safe-to-deploy" + [[exemptions.camino]] version = "1.1.6" criteria = "safe-to-deploy" @@ -363,10 +360,6 @@ criteria = "safe-to-deploy" version = "4.4.7" criteria = "safe-to-deploy" -[[exemptions.cli-batteries]] -version = "0.5.0@git:fc1186d1aba6a25120570fe04ad3362b08c8adfd" -criteria = "safe-to-deploy" - [[exemptions.cognito_srp]] version = "0.1.2" criteria = "safe-to-deploy" @@ -503,10 +496,6 @@ criteria = "safe-to-deploy" version = "0.20.5" criteria = "safe-to-deploy" -[[exemptions.dashmap]] -version = "5.5.3" -criteria = "safe-to-deploy" - [[exemptions.data-encoding]] version = "2.5.0" criteria = "safe-to-deploy" @@ -823,10 +812,6 @@ criteria = "safe-to-deploy" version = "0.24.2" criteria = "safe-to-deploy" -[[exemptions.hyper-timeout]] -version = "0.4.1" -criteria = "safe-to-deploy" - [[exemptions.iana-time-zone]] version = "0.1.60" criteria = "safe-to-deploy" @@ -911,10 +896,6 @@ criteria = "safe-to-deploy" version = "0.2.2" criteria = "safe-to-deploy" -[[exemptions.libmimalloc-sys]] -version = "0.1.35" -criteria = "safe-to-deploy" - [[exemptions.libredox]] version = "0.0.1" criteria = "safe-to-deploy" @@ -927,10 +908,6 @@ criteria = "safe-to-deploy" version = "0.5.6" criteria = "safe-to-deploy" -[[exemptions.linux-raw-sys]] -version = "0.1.4" -criteria = "safe-to-deploy" - [[exemptions.linux-raw-sys]] version = "0.4.13" criteria = "safe-to-deploy" @@ -947,10 +924,6 @@ criteria = "safe-to-deploy" version = "0.1.3" criteria = "safe-to-deploy" -[[exemptions.lru]] -version = "0.7.8" -criteria = "safe-to-deploy" - [[exemptions.mach]] version = "0.3.2" criteria = "safe-to-deploy" @@ -983,8 +956,20 @@ criteria = "safe-to-deploy" version = "0.6.5" criteria = "safe-to-deploy" -[[exemptions.mimalloc]] -version = "0.1.39" +[[exemptions.metrics]] +version = "0.22.1" +criteria = "safe-to-deploy" + +[[exemptions.metrics-exporter-prometheus]] +version = "0.13.1" +criteria = "safe-to-deploy" + +[[exemptions.metrics-exporter-statsd]] +version = "0.7.0" +criteria = "safe-to-deploy" + +[[exemptions.metrics-util]] +version = "0.16.2" criteria = "safe-to-deploy" [[exemptions.minimal-lexical]] @@ -1011,10 +996,6 @@ criteria = "safe-to-deploy" version = "0.15.0" criteria = "safe-to-deploy" -[[exemptions.nix]] -version = "0.26.4" -criteria = "safe-to-deploy" - [[exemptions.nom]] version = "7.1.1" criteria = "safe-to-deploy" @@ -1076,41 +1057,33 @@ version = "0.9.99" criteria = "safe-to-deploy" [[exemptions.opentelemetry]] -version = "0.19.0" +version = "0.21.0" criteria = "safe-to-deploy" [[exemptions.opentelemetry-datadog]] -version = "0.7.0" +version = "0.9.0" criteria = "safe-to-deploy" [[exemptions.opentelemetry-http]] -version = "0.8.0" -criteria = "safe-to-deploy" - -[[exemptions.opentelemetry-otlp]] -version = "0.12.0" -criteria = "safe-to-deploy" - -[[exemptions.opentelemetry-proto]] -version = "0.2.0" +version = "0.10.0" criteria = "safe-to-deploy" [[exemptions.opentelemetry-semantic-conventions]] -version = "0.11.0" -criteria = "safe-to-deploy" - -[[exemptions.opentelemetry_api]] -version = "0.19.0" +version = "0.13.0" criteria = "safe-to-deploy" [[exemptions.opentelemetry_sdk]] -version = "0.19.0" +version = "0.21.2" criteria = "safe-to-deploy" [[exemptions.option-ext]] version = "0.2.0" criteria = "safe-to-deploy" +[[exemptions.ordered-float]] +version = "4.2.0" +criteria = "safe-to-deploy" + [[exemptions.ordered-multimap]] version = "0.4.3" criteria = "safe-to-deploy" @@ -1239,6 +1212,10 @@ criteria = "safe-to-deploy" version = "0.3.5" criteria = "safe-to-deploy" +[[exemptions.portable-atomic]] +version = "1.6.0" +criteria = "safe-to-deploy" + [[exemptions.powerfmt]] version = "0.2.0" criteria = "safe-to-deploy" @@ -1271,10 +1248,6 @@ criteria = "safe-to-deploy" version = "1.0.78" criteria = "safe-to-deploy" -[[exemptions.procfs]] -version = "0.14.2" -criteria = "safe-to-deploy" - [[exemptions.prometheus]] version = "0.13.3" criteria = "safe-to-deploy" @@ -1283,14 +1256,6 @@ criteria = "safe-to-deploy" version = "1.2.0" criteria = "safe-to-deploy" -[[exemptions.prost]] -version = "0.11.9" -criteria = "safe-to-deploy" - -[[exemptions.prost-derive]] -version = "0.11.9" -criteria = "safe-to-deploy" - [[exemptions.protobuf]] version = "2.28.0" criteria = "safe-to-deploy" @@ -1303,6 +1268,10 @@ criteria = "safe-to-deploy" version = "0.1.4" criteria = "safe-to-deploy" +[[exemptions.quanta]] +version = "0.12.2" +criteria = "safe-to-deploy" + [[exemptions.radium]] version = "0.7.0" criteria = "safe-to-deploy" @@ -1311,6 +1280,10 @@ criteria = "safe-to-deploy" version = "0.8.5" criteria = "safe-to-deploy" +[[exemptions.raw-cpuid]] +version = "11.0.1" +criteria = "safe-to-deploy" + [[exemptions.redox_syscall]] version = "0.4.1" criteria = "safe-to-deploy" @@ -1419,10 +1392,6 @@ criteria = "safe-to-deploy" version = "0.3.3" criteria = "safe-to-deploy" -[[exemptions.rustix]] -version = "0.36.17" -criteria = "safe-to-deploy" - [[exemptions.rustix]] version = "0.38.31" criteria = "safe-to-deploy" @@ -1539,6 +1508,10 @@ criteria = "safe-to-deploy" version = "0.3.10" criteria = "safe-to-deploy" +[[exemptions.sketches-ddsketch]] +version = "0.2.2" +criteria = "safe-to-deploy" + [[exemptions.slab]] version = "0.4.9" criteria = "safe-to-deploy" @@ -1659,10 +1632,6 @@ criteria = "safe-to-deploy" version = "0.7.0" criteria = "safe-to-deploy" -[[exemptions.terminal_size]] -version = "0.3.0" -criteria = "safe-to-deploy" - [[exemptions.test-case]] version = "3.3.1" criteria = "safe-to-deploy" @@ -1695,10 +1664,6 @@ criteria = "safe-to-deploy" version = "1.2.1" criteria = "safe-to-deploy" -[[exemptions.tokio-io-timeout]] -version = "1.2.0" -criteria = "safe-to-deploy" - [[exemptions.tokio-macros]] version = "2.2.0" criteria = "safe-to-deploy" @@ -1715,10 +1680,6 @@ criteria = "safe-to-deploy" version = "0.7.10" criteria = "safe-to-deploy" -[[exemptions.tonic]] -version = "0.8.3" -criteria = "safe-to-deploy" - [[exemptions.tower]] version = "0.4.13" criteria = "safe-to-deploy" @@ -1735,6 +1696,10 @@ criteria = "safe-to-deploy" version = "0.1.40" criteria = "safe-to-deploy" +[[exemptions.tracing-appender]] +version = "0.2.2" +criteria = "safe-to-deploy" + [[exemptions.tracing-attributes]] version = "0.1.23" criteria = "safe-to-deploy" @@ -1751,24 +1716,16 @@ criteria = "safe-to-deploy" version = "0.2.0" criteria = "safe-to-deploy" -[[exemptions.tracing-flame]] -version = "0.2.0" -criteria = "safe-to-deploy" - [[exemptions.tracing-futures]] version = "0.2.5" criteria = "safe-to-deploy" -[[exemptions.tracing-log]] -version = "0.1.4" -criteria = "safe-to-deploy" - [[exemptions.tracing-log]] version = "0.2.0" criteria = "safe-to-deploy" [[exemptions.tracing-opentelemetry]] -version = "0.19.0" +version = "0.22.0" criteria = "safe-to-deploy" [[exemptions.tracing-serde]] @@ -1807,10 +1764,6 @@ criteria = "safe-to-deploy" version = "0.1.4" criteria = "safe-to-deploy" -[[exemptions.unicase]] -version = "2.7.0" -criteria = "safe-to-deploy" - [[exemptions.unicode_categories]] version = "0.1.1" criteria = "safe-to-deploy" @@ -1823,10 +1776,6 @@ criteria = "safe-to-deploy" version = "2.1.3" criteria = "safe-to-deploy" -[[exemptions.users]] -version = "0.11.0" -criteria = "safe-to-deploy" - [[exemptions.utf-8]] version = "0.7.6" criteria = "safe-to-deploy" @@ -1931,6 +1880,10 @@ criteria = "safe-to-deploy" version = "0.3.68" criteria = "safe-to-deploy" +[[exemptions.web-time]] +version = "0.2.4" +criteria = "safe-to-deploy" + [[exemptions.webpki-roots]] version = "0.25.4" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index eabadcb4..e89e877b 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -478,13 +478,6 @@ user-id = 64539 user-login = "kennykerr" user-name = "Kenny Kerr" -[[publisher.windows-sys]] -version = "0.45.0" -when = "2023-01-21" -user-id = 64539 -user-login = "kennykerr" -user-name = "Kenny Kerr" - [[publisher.windows-sys]] version = "0.48.0" when = "2023-03-31" @@ -968,24 +961,6 @@ crate is broadly used throughout the ecosystem and does not contain anything suspicious. """ -[[audits.bytecodealliance.audits.io-lifetimes]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "1.0.3" -notes = "I am the author of this crate." - -[[audits.bytecodealliance.audits.io-lifetimes]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "1.0.3 -> 1.0.5" -notes = "The Bytecode Alliance is the author of this crate." - -[[audits.bytecodealliance.audits.io-lifetimes]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -delta = "1.0.5 -> 1.0.10" -notes = "I am the maintainer of this crate." - [[audits.bytecodealliance.audits.itertools]] who = "Nick Fitzgerald " criteria = "safe-to-deploy" @@ -2271,12 +2246,6 @@ version = "0.1.3" notes = "Reviewed in full." aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" -[[audits.zcash.audits.io-lifetimes]] -who = "Jack Grigg " -criteria = "safe-to-deploy" -delta = "1.0.10 -> 1.0.11" -aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" - [[audits.zcash.audits.ipnet]] who = "Jack Grigg " criteria = "safe-to-deploy" @@ -2325,6 +2294,20 @@ code (but adapted to `u16` and `u8` reads, instead of `u32`). """ aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" +[[audits.zcash.audits.nix]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.26.2 -> 0.26.4" +notes = """ +Most of the `unsafe` changes are cleaning up their usage: +- Replacing `data.len() * std::mem::size_of::<$ty>()` with `std::mem::size_of_val(data)`. +- Removing some `mem::transmute`s. +- Using `*mut` instead of `*const` to convey intended semantics. + +A new unsafe trait method `SockaddrLike::set_length` is added; it's impls look fine. +""" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + [[audits.zcash.audits.parity-scale-codec]] who = "Jack Grigg " criteria = "safe-to-deploy" @@ -2504,6 +2487,16 @@ delta = "0.1.0 -> 0.1.1" notes = "Adds `#![forbid(unsafe_code)]` and license files." aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" +[[audits.zcash.audits.tracing-appender]] +who = "Jack Grigg " +criteria = "safe-to-deploy" +delta = "0.2.2 -> 0.2.3" +notes = """ +- The rolling file appender has new code to automatically delete files; this is + restricted to files within the configured log directory. +""" +aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" + [[audits.zcash.audits.tracing-attributes]] who = "Jack Grigg " criteria = "safe-to-deploy" diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 7c0ad311..05aedc8e 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -13,7 +13,6 @@ pub mod prelude { pub use anyhow::Context; pub use clap::Parser; - pub use cli_batteries::{reset_shutdown, shutdown}; pub use ethers::abi::{AbiEncode, Address}; pub use ethers::core::abi::Abi; pub use ethers::core::k256::ecdsa::SigningKey; @@ -45,6 +44,7 @@ pub mod prelude { pub use signup_sequencer::identity_tree::Hash; pub use signup_sequencer::prover::ProverType; pub use signup_sequencer::server; + pub use signup_sequencer::shutdown::{reset_shutdown, shutdown}; pub use tokio::spawn; pub use tokio::task::JoinHandle; pub use tracing::{error, info, instrument}; diff --git a/tests/common/test_config.rs b/tests/common/test_config.rs index d6a983f2..ade3569d 100644 --- a/tests/common/test_config.rs +++ b/tests/common/test_config.rs @@ -5,7 +5,7 @@ use anyhow::Context; use ethers::types::Address; use signup_sequencer::config::{ default, AppConfig, Config, DatabaseConfig, NetworkConfig, OzDefenderConfig, ProvidersConfig, - RelayerConfig, ServerConfig, TreeConfig, + RelayerConfig, ServerConfig, ServiceConfig, TreeConfig, }; use signup_sequencer::prover::ProverConfig; use signup_sequencer::utils::secret::SecretUrl; @@ -176,6 +176,7 @@ impl TestConfigBuilder { address: SocketAddr::from(([127, 0, 0, 1], 0)), serve_timeout: default::serve_timeout(), }, + service: ServiceConfig::default(), }; Ok(config)