From f6705a463212b2194b5518a04a6e4280b3e40b24 Mon Sep 17 00:00:00 2001 From: bexan Date: Wed, 22 May 2024 15:55:28 +0200 Subject: [PATCH] update transaction type --- crates/katana/core/src/hooker.rs | 6 +++--- crates/katana/rpc/rpc/src/starknet.rs | 13 +++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/crates/katana/core/src/hooker.rs b/crates/katana/core/src/hooker.rs index 48d277ae43..a7724a96bb 100644 --- a/crates/katana/core/src/hooker.rs +++ b/crates/katana/core/src/hooker.rs @@ -5,7 +5,7 @@ use crate::sequencer::KatanaSequencer; use async_trait::async_trait; use katana_executor::ExecutorFactory; use starknet::accounts::Call; -use starknet::core::types::{BroadcastedInvokeTransactionV3, FieldElement}; +use starknet::core::types::{BroadcastedInvokeTransaction, FieldElement}; use std::sync::Arc; use tracing::{error, info}; @@ -44,7 +44,7 @@ pub trait KatanaHooker { /// # Arguments /// /// * `transaction` - The invoke transaction to be verified. - async fn verify_invoke_tx_before_pool(&self, transaction: BroadcastedInvokeTransactionV3) + async fn verify_invoke_tx_before_pool(&self, transaction: BroadcastedInvokeTransaction) -> bool; /// Runs code right before a message to starknet @@ -108,7 +108,7 @@ impl KatanaHooker for DefaultKa async fn verify_invoke_tx_before_pool( &self, - transaction: BroadcastedInvokeTransactionV3, + transaction: BroadcastedInvokeTransaction, ) -> bool { info!("HOOKER: verify_invoke_tx_before_pool called with transaction: {:?}", transaction); true diff --git a/crates/katana/rpc/rpc/src/starknet.rs b/crates/katana/rpc/rpc/src/starknet.rs index 797084da55..a0fde82e7e 100644 --- a/crates/katana/rpc/rpc/src/starknet.rs +++ b/crates/katana/rpc/rpc/src/starknet.rs @@ -677,16 +677,9 @@ impl StarknetApiServer for StarknetApi { ) -> RpcResult { if let Some(hooker) = &self.inner.sequencer.hooker { - let tx_clone = invoke_transaction.0.clone(); - match tx_clone { - BroadcastedInvokeTransaction::V3(tx) => { - if !hooker.read().await.verify_invoke_tx_before_pool(tx).await { - return Err(StarknetApiError::SolisAssetFault.into()); - } - }, - BroadcastedInvokeTransaction::V1(_tx) => { - return Err(StarknetApiError::UnsupportedTransactionVersion.into()); - } + let tx = invoke_transaction.0.clone(); + if !hooker.read().await.verify_invoke_tx_before_pool(tx).await { + return Err(StarknetApiError::SolisAssetFault.into()); } } self.on_io_blocking_task(move |this| {