From 58ad13fd98a86f23f572e3eb064c0539b603acc9 Mon Sep 17 00:00:00 2001 From: Ammar Arif Date: Sat, 3 Aug 2024 04:15:29 +0800 Subject: [PATCH 1/3] bump metrics dependencies (#2251) --- .github/workflows/ci.yml | 3 + Cargo.lock | 213 +++++++++++++++++----- Cargo.toml | 2 +- crates/metrics/Cargo.toml | 8 +- crates/metrics/src/prometheus_exporter.rs | 12 +- 5 files changed, 179 insertions(+), 59 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19b59273e9..b8e2ea5dbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,9 @@ jobs: - uses: arduino/setup-protoc@v2 with: repo-token: ${{ secrets.github_token }} + - uses: ilammy/setup-nasm@v1 + with: + version: "2.15.05" - run: cargo build --target x86_64-pc-windows-msvc --bins # This job is used to ensure the built katana image doesn't depend on any diff --git a/Cargo.lock b/Cargo.lock index e10bca624f..af8d7465d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1550,6 +1550,33 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "aws-lc-rs" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae74d9bd0a7530e8afd1770739ad34b36838829d6ad61818f9230f683f5ad77" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0e249228c6ad2d240c2dc94b714d711629d52bad946075d8e9b2f5391f0703" +dependencies = [ + "bindgen 0.69.4", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "axum" version = "0.6.20" @@ -1764,12 +1791,15 @@ dependencies = [ "itertools 0.12.1", "lazy_static", "lazycell", + "log", + "prettyplease 0.2.20", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", "syn 2.0.71", + "which 4.4.2", ] [[package]] @@ -3368,6 +3398,15 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59" +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + [[package]] name = "cobs" version = "0.2.3" @@ -6312,6 +6351,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "2.4.1" @@ -6645,7 +6703,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -6668,9 +6726,11 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2 0.4.5", "http 1.1.0", "http-body 1.0.1", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -6712,7 +6772,7 @@ dependencies = [ "hyper 0.14.30", "log", "rustls 0.20.9", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.23.4", ] @@ -6728,7 +6788,7 @@ dependencies = [ "hyper 0.14.30", "log", "rustls 0.21.12", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", "webpki-roots 0.25.4", @@ -6744,7 +6804,9 @@ dependencies = [ "http 1.1.0", "hyper 1.4.1", "hyper-util", + "log", "rustls 0.23.11", + "rustls-native-certs 0.7.1", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -7413,7 +7475,7 @@ dependencies = [ "jsonrpsee-core 0.16.3", "jsonrpsee-types 0.16.3", "pin-project", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "soketto", "thiserror", "tokio", @@ -7433,7 +7495,7 @@ dependencies = [ "http 0.2.12", "jsonrpsee-core 0.20.3", "pin-project", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "soketto", "thiserror", "tokio", @@ -8931,24 +8993,26 @@ dependencies = [ [[package]] name = "metrics" -version = "0.21.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +checksum = "884adb57038347dfbaf2d5065887b6cf4312330dc8e94bc30a1a839bd79d3261" dependencies = [ "ahash 0.8.11", - "metrics-macros", "portable-atomic", ] [[package]] name = "metrics-exporter-prometheus" -version = "0.12.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +checksum = "b4f0c8427b39666bf970460908b213ec09b3b350f20c0c2eabcbba51704a08e6" dependencies = [ - "base64 0.21.7", - "hyper 0.14.30", - "indexmap 1.9.3", + "base64 0.22.1", + "http-body-util", + "hyper 1.4.1", + "hyper-rustls 0.27.2", + "hyper-util", + "indexmap 2.2.6", "ipnet", "metrics", "metrics-util", @@ -8958,22 +9022,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "metrics-macros" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] - [[package]] name = "metrics-process" -version = "1.0.14" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2a67e2580fbeba4d5a96e659945981e700a383b4cea1432e0cfc18f58c5da" +checksum = "cb524e5438255eaa8aa74214d5a62713b77b2c3c6e3c0bbeee65cfd9a58948ba" dependencies = [ "libproc", "mach2", @@ -8981,23 +9034,23 @@ dependencies = [ "once_cell", "procfs", "rlimit", - "windows 0.52.0", + "windows 0.57.0", ] [[package]] name = "metrics-util" -version = "0.15.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" +checksum = "4259040465c955f9f2f1a4a8a16dc46726169bca0f88e8fb2dbeced487c3e828" dependencies = [ "aho-corasick", "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.13.1", - "indexmap 1.9.3", + "hashbrown 0.14.5", + "indexmap 2.2.6", "metrics", "num_cpus", - "ordered-float 3.9.2", + "ordered-float 4.2.2", "quanta", "radix_trie", "sketches-ddsketch", @@ -9056,6 +9109,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "monch" version = "0.5.0" @@ -9727,9 +9786,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.2" +version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +checksum = "4a91171844676f8c7990ce64959210cd2eaef32c2612c50f9fae9f8aaa6065a6" dependencies = [ "num-traits 0.2.19", ] @@ -10667,13 +10726,12 @@ dependencies = [ [[package]] name = "quanta" -version = "0.11.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" dependencies = [ "crossbeam-utils", "libc", - "mach2", "once_cell", "raw-cpuid", "wasi", @@ -10901,11 +10959,11 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.7.0" +version = "11.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] @@ -11071,7 +11129,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -11086,7 +11144,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls 0.21.12", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -11204,8 +11262,8 @@ dependencies = [ [[package]] name = "reth-metrics-derive" -version = "0.2.0-beta.4" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.2.0-beta.4#c04dbe6e9bd05be5da3a5d541adbf76166c14a08" +version = "1.0.3" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v1.0.3#390f30aadebcdd509e72cc04327c3b854de076a6" dependencies = [ "once_cell", "proc-macro2", @@ -11638,6 +11696,8 @@ version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" dependencies = [ + "aws-lc-rs", + "log", "once_cell", "ring 0.17.8", "rustls-pki-types", @@ -11658,6 +11718,19 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.2", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -11699,6 +11772,7 @@ version = "0.102.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" dependencies = [ + "aws-lc-rs", "ring 0.17.8", "rustls-pki-types", "untrusted 0.9.0", @@ -14222,7 +14296,7 @@ dependencies = [ "axum", "base64 0.21.7", "bytes", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -15704,11 +15778,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.52.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" dependencies = [ - "windows-core 0.52.0", + "windows-core 0.57.0", "windows-targets 0.52.6", ] @@ -15730,6 +15804,49 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.45.0" diff --git a/Cargo.toml b/Cargo.toml index 6ee030c337..2043125a0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,7 +161,7 @@ itertools = "0.12.1" jsonrpsee = { version = "0.16.2", default-features = false } lazy_static = "1.4.0" log = "0.4.21" -metrics = "0.21.1" +metrics = "0.23.0" num-traits = { version = "0.2", default-features = false } once_cell = "1.0" parking_lot = "0.12.1" diff --git a/crates/metrics/Cargo.toml b/crates/metrics/Cargo.toml index 92fda92b98..3a8818c217 100644 --- a/crates/metrics/Cargo.toml +++ b/crates/metrics/Cargo.toml @@ -13,11 +13,11 @@ tokio.workspace = true tracing.workspace = true # Metrics -metrics-exporter-prometheus = "0.12.1" -metrics-process = "=1.0.14" -metrics-util = "0.15.0" metrics.workspace = true -reth-metrics-derive = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.2.0-beta.4" } +metrics-exporter-prometheus = "0.15.3" +metrics-process = "2.1.0" +metrics-util = "0.17.0" +reth-metrics-derive = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.3" } [target.'cfg(not(windows))'.dependencies] jemalloc-ctl = { version = "0.5.0", optional = true } diff --git a/crates/metrics/src/prometheus_exporter.rs b/crates/metrics/src/prometheus_exporter.rs index 19b8e29529..17a170f0e4 100644 --- a/crates/metrics/src/prometheus_exporter.rs +++ b/crates/metrics/src/prometheus_exporter.rs @@ -121,7 +121,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.active." ) }) { - gauge!("jemalloc.active", value as f64); + gauge!("jemalloc.active").increment(value as f64); } if let Ok(value) = stats::allocated::read().map_err(|error| { @@ -131,7 +131,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.allocated." ) }) { - gauge!("jemalloc.allocated", value as f64); + gauge!("jemalloc.allocated").increment(value as f64); } if let Ok(value) = stats::mapped::read().map_err(|error| { @@ -141,7 +141,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.mapped." ) }) { - gauge!("jemalloc.mapped", value as f64); + gauge!("jemalloc.mapped").increment(value as f64); } if let Ok(value) = stats::metadata::read().map_err(|error| { @@ -151,7 +151,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.metadata." ) }) { - gauge!("jemalloc.metadata", value as f64); + gauge!("jemalloc.metadata").increment(value as f64); } if let Ok(value) = stats::resident::read().map_err(|error| { @@ -161,7 +161,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.resident." ) }) { - gauge!("jemalloc.resident", value as f64); + gauge!("jemalloc.resident").increment(value as f64); } if let Ok(value) = stats::retained::read().map_err(|error| { @@ -171,7 +171,7 @@ fn collect_memory_stats() { "Read jemalloc.stats.retained." ) }) { - gauge!("jemalloc.retained", value as f64); + gauge!("jemalloc.retained").increment(value as f64); } } From e1c9597cd06143b34e47976e861a0b208b1eb505 Mon Sep 17 00:00:00 2001 From: glihm Date: Fri, 2 Aug 2024 16:37:54 -0600 Subject: [PATCH 2/3] devcontainer: bump to 1.80 --- .devcontainer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 471f71cf32..ef9a9a324d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -26,7 +26,7 @@ ENV LLVM_SYS_170_PREFIX=/usr/lib/llvm-17 ENV TABLEGEN_170_PREFIX=/usr/lib/llvm-17 # To allow independent workflow of the container, the rust-toolchain is explicitely given. -RUN echo "1.79.0" > rust_toolchain_version +RUN echo "1.80.0" > rust_toolchain_version # Install cargo-binstall RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash @@ -37,7 +37,7 @@ RUN rustup toolchain install $(cat rust_toolchain_version) && \ rustup component add rustfmt RUN rustup toolchain install nightly && \ - rustup component add rustfmt --toolchain nightly + rustup component add rustfmt clippy --toolchain nightly RUN rustup target add x86_64-pc-windows-msvc && \ rustup target add wasm32-unknown-unknown From 9834932365efade1585176af0c017815542c9457 Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 4 Aug 2024 09:54:05 +0530 Subject: [PATCH 3/3] fix(torii): only retrieve metadata for world (#2252) * fix: only retrieve metadata for world * update comment --- crates/torii/core/src/processors/metadata_update.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/torii/core/src/processors/metadata_update.rs b/crates/torii/core/src/processors/metadata_update.rs index a25d02f535..9bfea3e905 100644 --- a/crates/torii/core/src/processors/metadata_update.rs +++ b/crates/torii/core/src/processors/metadata_update.rs @@ -4,7 +4,7 @@ use anyhow::{Error, Result}; use async_trait::async_trait; use base64::engine::general_purpose; use base64::Engine as _; -use cainome::cairo_serde::{ByteArray, CairoSerde}; +use cainome::cairo_serde::{ByteArray, CairoSerde, Zeroable}; use dojo_world::contracts::world::WorldContractReader; use dojo_world::metadata::{Uri, WorldMetadata}; use reqwest::Client; @@ -68,9 +68,13 @@ where let db = db.clone(); let resource = *resource; - tokio::spawn(async move { - try_retrieve(db, resource, uri_str).await; - }); + + // Only retrieve metadata for the World contract. + if resource.is_zero() { + tokio::spawn(async move { + try_retrieve(db, resource, uri_str).await; + }); + } Ok(()) }