From 5a50f51a0c5b46600f6b7aeeab319ec4f5c3d8df Mon Sep 17 00:00:00 2001 From: Gilad Chase Date: Tue, 17 Sep 2024 19:07:10 +0300 Subject: [PATCH] refactor(papyrus): remove unnecessary dep + style commit-id:19ed8b4a --- Cargo.lock | 1 - Cargo.toml | 1 - crates/papyrus_base_layer/Cargo.toml | 1 - .../src/ethereum_base_layer_contract.rs | 8 +++----- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e68fb5495a..e7bba7cecb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7081,7 +7081,6 @@ version = "0.0.0" dependencies = [ "alloy-contract", "alloy-dyn-abi", - "alloy-json-abi", "alloy-json-rpc", "alloy-primitives", "alloy-provider", diff --git a/Cargo.toml b/Cargo.toml index 05ccfaeff4..c1c23e0a24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,7 +59,6 @@ license-file = "LICENSE" # TODO: Remove this once udeps is fixed. alloy-contract = "0.3.5" alloy-dyn-abi = "0.8.3" -alloy-json-abi = "0.8.3" alloy-json-rpc = "0.3.5" alloy-primitives = "0.8.3" alloy-provider = "0.3.5" diff --git a/crates/papyrus_base_layer/Cargo.toml b/crates/papyrus_base_layer/Cargo.toml index d81f05d927..fc685d06fc 100644 --- a/crates/papyrus_base_layer/Cargo.toml +++ b/crates/papyrus_base_layer/Cargo.toml @@ -8,7 +8,6 @@ license-file.workspace = true [dependencies] alloy-contract.workspace = true alloy-dyn-abi.workspace = true -alloy-json-abi.workspace = true alloy-json-rpc.workspace = true alloy-primitives.workspace = true alloy-provider.workspace = true diff --git a/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs b/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs index 3b6c028f8a..2334e275a4 100644 --- a/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs +++ b/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs @@ -3,7 +3,6 @@ use std::future::IntoFuture; use alloy_contract::{ContractInstance, Interface}; use alloy_dyn_abi::SolType; -use alloy_json_abi::JsonAbi; use alloy_primitives::Address; use alloy_provider::network::Ethereum; use alloy_provider::{Provider, ProviderBuilder, RootProvider}; @@ -77,12 +76,11 @@ pub struct EthereumBaseLayerContract { impl EthereumBaseLayerContract { pub fn new(config: EthereumBaseLayerConfig) -> Result { - let address = config.starknet_contract_address.parse::
()?; + let address: Address = config.starknet_contract_address.parse()?; let client = ProviderBuilder::new().on_http(config.node_url.parse()?); // The solidity contract was pre-compiled, and only the relevant functions were kept. - let abi: JsonAbi = - serde_json::from_str::(include_str!("core_contract_latest_block.abi"))?; + let abi = serde_json::from_str(include_str!("core_contract_latest_block.abi"))?; Ok(Self { contract: ContractInstance::new(address, client, Interface::new(abi)) }) } } @@ -100,7 +98,7 @@ impl BaseLayerContract for EthereumBaseLayerContract { .provider() .get_block_number() .await? - .checked_sub(min_confirmations.unwrap_or(0).into()); + .checked_sub(min_confirmations.unwrap_or_default()); let Some(ethereum_block_number) = ethereum_block_number else { return Ok(None); };