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] 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) {