From 830e95ed709a4c32c12539aa9263ee1362e421a1 Mon Sep 17 00:00:00 2001 From: Charpa <102919164+jbcaron@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:49:08 +0100 Subject: [PATCH 1/2] fix: fetch class (#394) --- CHANGELOG.md | 1 + Cargo.lock | 35 ++++++++++++++++++--- Cargo.toml | 2 ++ crates/client/gateway/client/src/methods.rs | 11 +++++++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5839eee8f..af6790eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next release +- fix(fgw): fetch class - feat: possibility of starting madara & kakarot-rpc in docker - feat(debug): service cancelling and profiling build - feat(endpoint): added extra admin rpc endpoint for sensitive rpc calls diff --git a/Cargo.lock b/Cargo.lock index be5daccef..7a991995f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5412,7 +5412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -8402,8 +8402,7 @@ dependencies = [ [[package]] name = "starknet-core" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538240cbe6663c673fe77465f294da707080f39678dd7066761554899e46100" +source = "git+https://github.com/kasarlabs/starknet-rs.git?branch=fork#70e1ee45dc701afc2a7629bf88bb5d90a93d51a7" dependencies = [ "base64 0.21.7", "crypto-bigint", @@ -8414,7 +8413,7 @@ dependencies = [ "serde_json_pythonic", "serde_with", "sha3", - "starknet-crypto 0.7.3", + "starknet-crypto 0.7.2", "starknet-types-core", ] @@ -8458,6 +8457,24 @@ dependencies = [ "zeroize", ] +[[package]] +name = "starknet-crypto" +version = "0.7.2" +source = "git+https://github.com/kasarlabs/starknet-rs.git?branch=fork#70e1ee45dc701afc2a7629bf88bb5d90a93d51a7" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-curve 0.5.1 (git+https://github.com/kasarlabs/starknet-rs.git?branch=fork)", + "starknet-types-core", + "zeroize", +] + [[package]] name = "starknet-crypto" version = "0.7.3" @@ -8472,7 +8489,7 @@ dependencies = [ "num-traits", "rfc6979", "sha2", - "starknet-curve 0.5.1", + "starknet-curve 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "starknet-types-core", "zeroize", ] @@ -8515,6 +8532,14 @@ dependencies = [ "starknet-types-core", ] +[[package]] +name = "starknet-curve" +version = "0.5.1" +source = "git+https://github.com/kasarlabs/starknet-rs.git?branch=fork#70e1ee45dc701afc2a7629bf88bb5d90a93d51a7" +dependencies = [ + "starknet-types-core", +] + [[package]] name = "starknet-ff" version = "0.3.7" diff --git a/Cargo.toml b/Cargo.toml index 1077df129..1057ccf3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -238,3 +238,5 @@ tracing-opentelemetry = "0.26.0" [patch.crates-io] # wait for PR https://github.com/starknet-io/types-rs/pull/76 to be merged starknet-types-core = { git = "https://github.com/kasarlabs/types-rs.git", branch = "feat-deserialize-v0.1.7" } + +starknet-core = { git = "https://github.com/kasarlabs/starknet-rs.git", branch = "fork" } diff --git a/crates/client/gateway/client/src/methods.rs b/crates/client/gateway/client/src/methods.rs index 639e47fce..e2950a447 100644 --- a/crates/client/gateway/client/src/methods.rs +++ b/crates/client/gateway/client/src/methods.rs @@ -163,6 +163,8 @@ mod tests { const CLASS_BLOCK_0: &str = "0x010455c752b86932ce552f2b0fe81a880746649b9aee7e0d842bf3f52378f9f8"; + const CLASS_NO_ABI: &str = "0x371b5f7c5517d84205365a87f02dcef230efa7b4dd91a9e4ba7e04c5b69d69b"; + const CLASS_ACCOUNT: &str = "0x07595b4f7d50010ceb00230d8b5656e3c3dd201b6df35d805d3f2988c69a1432"; const CLASS_ACCOUNT_BLOCK: u64 = 1342; @@ -408,6 +410,15 @@ mod tests { assert_eq!(class, class_compressed_reference.into()); } + #[rstest] + #[tokio::test] + async fn get_class_by_hash_legacy_without_abi(client_mainnet_fixture: GatewayProvider) { + let _ = client_mainnet_fixture + .get_class_by_hash(Felt::from_hex_unchecked(CLASS_NO_ABI), BlockId::Number(20734)) + .await + .unwrap_or_else(|_| panic!("Getting class {CLASS_NO_ABI} at block number 0")); + } + #[rstest] #[tokio::test] async fn get_class_by_hash_account(client_mainnet_fixture: GatewayProvider) { From de271ba22b57d495b11f2a5e8642394ca6c78133 Mon Sep 17 00:00:00 2001 From: Heemank Verma Date: Wed, 27 Nov 2024 14:48:02 +0530 Subject: [PATCH 2/2] Fix/rust log filtering (#397) --- CHANGELOG.md | 1 + README.md | 1 - crates/client/analytics/src/lib.rs | 14 +++++--------- crates/node/src/cli/analytics.rs | 5 ----- crates/node/src/main.rs | 1 - 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af6790eed..d0e98c9c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next release +- fix(tracing): RUST_LOG filtering support - fix(fgw): fetch class - feat: possibility of starting madara & kakarot-rpc in docker - feat(debug): service cancelling and profiling build diff --git a/README.md b/README.md index a93658d6f..bc2fbaabe 100644 --- a/README.md +++ b/README.md @@ -478,7 +478,6 @@ Madara comes packed with OTEL integration, supporting export of traces, metrics ### Basic Command-Line Option - **`--analytics-collection-endpoint `**: Endpoint for OTLP collector, if not provided then OTLP is not enabled. -- **`--analytics-log-level `**: Picked up from `RUST_LOG` automatically, can be provided using this flag as well. - **`--analytics-service-name `**: Allows to customize the collection service name. #### Setting up Signoz diff --git a/crates/client/analytics/src/lib.rs b/crates/client/analytics/src/lib.rs index f806c4da0..15c77b5e5 100644 --- a/crates/client/analytics/src/lib.rs +++ b/crates/client/analytics/src/lib.rs @@ -18,22 +18,18 @@ use tracing::Level; use tracing_opentelemetry::OpenTelemetryLayer; use tracing_subscriber::layer::SubscriberExt as _; use tracing_subscriber::util::SubscriberInitExt as _; +use tracing_subscriber::EnvFilter; use url::Url; pub struct Analytics { meter_provider: Option, service_name: String, - log_level: Level, collection_endpoint: Option, } impl Analytics { - pub fn new( - service_name: String, - log_level: tracing::Level, - collection_endpoint: Option, - ) -> anyhow::Result { - Ok(Self { meter_provider: None, service_name, log_level, collection_endpoint }) + pub fn new(service_name: String, collection_endpoint: Option) -> anyhow::Result { + Ok(Self { meter_provider: None, service_name, collection_endpoint }) } pub fn setup(&mut self) -> anyhow::Result<()> { @@ -41,8 +37,8 @@ impl Analytics { let custom_formatter = CustomFormatter { local_offset }; let tracing_subscriber = tracing_subscriber::registry() - .with(tracing_subscriber::filter::LevelFilter::from_level(self.log_level)) - .with(tracing_subscriber::fmt::layer().event_format(custom_formatter)); + .with(tracing_subscriber::fmt::layer().event_format(custom_formatter)) + .with(EnvFilter::from_default_env()); if self.collection_endpoint.is_none() { tracing_subscriber.init(); diff --git a/crates/node/src/cli/analytics.rs b/crates/node/src/cli/analytics.rs index 1f3ee7220..02647cc07 100644 --- a/crates/node/src/cli/analytics.rs +++ b/crates/node/src/cli/analytics.rs @@ -1,6 +1,5 @@ use clap::Args; use mp_utils::parsers::parse_url; -use tracing::Level; use url::Url; /// Parameters used to config analytics. @@ -10,10 +9,6 @@ pub struct AnalyticsParams { #[arg(env = "MADARA_ANALYTICS_SERVICE_NAME", long, alias = "analytics", default_value = "madara_analytics")] pub analytics_service_name: String, - /// Log level of the service. - #[arg(env = "RUST_LOG", long, default_value = "info")] - pub analytics_log_level: Level, - /// Endpoint of the analytics server. #[arg(env = "OTEL_EXPORTER_OTLP_ENDPOINT", long, value_parser = parse_url, default_value = None)] pub analytics_collection_endpoint: Option, diff --git a/crates/node/src/main.rs b/crates/node/src/main.rs index 7721525bf..2f7948287 100644 --- a/crates/node/src/main.rs +++ b/crates/node/src/main.rs @@ -35,7 +35,6 @@ async fn main() -> anyhow::Result<()> { let mut analytics = Analytics::new( run_cmd.analytics_params.analytics_service_name.clone(), - run_cmd.analytics_params.analytics_log_level, run_cmd.analytics_params.analytics_collection_endpoint.clone(), ) .context("Initializing analytics service")?;