From 6b7dcbb199401a4db92f9743277d1afc8b0cf783 Mon Sep 17 00:00:00 2001 From: Arnon Hod Date: Thu, 29 Aug 2024 18:12:25 +0300 Subject: [PATCH] chore: remove class_info referance from test_stateful_tx_validator (#611) --- .../src/stateful_transaction_validator_test.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/crates/gateway/src/stateful_transaction_validator_test.rs b/crates/gateway/src/stateful_transaction_validator_test.rs index 0a2a2a945b..f0f70a1697 100644 --- a/crates/gateway/src/stateful_transaction_validator_test.rs +++ b/crates/gateway/src/stateful_transaction_validator_test.rs @@ -3,7 +3,6 @@ use blockifier::blockifier::stateful_validator::{ StatefulValidatorResult as BlockifierStatefulValidatorResult, }; use blockifier::context::BlockContext; -use blockifier::execution::contract_class::ClassInfo; use blockifier::test_utils::CairoVersion; use blockifier::transaction::errors::{TransactionFeeError, TransactionPreValidationError}; use mempool_test_utils::invoke_tx_args; @@ -23,11 +22,9 @@ use starknet_api::core::{ContractAddress, Nonce, PatriciaKey}; use starknet_api::rpc_transaction::RpcTransaction; use starknet_api::transaction::TransactionHash; use starknet_api::{contract_address, felt, patricia_key}; -use starknet_sierra_compile::config::SierraToCasmCompilationConfig; use starknet_types_core::felt::Felt; use super::ValidateInfo; -use crate::compilation::GatewayCompiler; use crate::config::StatefulTransactionValidatorConfig; use crate::errors::GatewaySpecError; use crate::state_reader::{MockStateReaderFactory, StateReaderFactory}; @@ -65,6 +62,7 @@ fn stateful_validator(block_context: BlockContext) -> StatefulTransactionValidat } } +// TODO(Arni): consider testing declare and deploy account. #[rstest] #[case::valid_tx( invoke_tx(CairoVersion::Cairo1), @@ -82,18 +80,6 @@ fn test_stateful_tx_validator( #[case] expected_result: BlockifierStatefulValidatorResult, stateful_validator: StatefulTransactionValidator, ) { - let optional_class_info = match &rpc_tx { - RpcTransaction::Declare(declare_tx) => Some( - ClassInfo::try_from( - GatewayCompiler::new_cairo_lang_compiler(SierraToCasmCompilationConfig::default()) - .process_declare_tx(declare_tx) - .unwrap(), - ) - .unwrap(), - ), - _ => None, - }; - let expected_result_as_stateful_transaction_result = expected_result.as_ref().map(|validate_info| *validate_info).map_err(|blockifier_error| { GatewaySpecError::ValidationFailure { data: blockifier_error.to_string() } @@ -103,7 +89,7 @@ fn test_stateful_tx_validator( mock_validator.expect_validate().return_once(|_, _| expected_result.map(|_| ())); mock_validator.expect_get_nonce().returning(|_| Ok(Nonce(Felt::ZERO))); - let result = stateful_validator.run_validate(&rpc_tx, optional_class_info, mock_validator); + let result = stateful_validator.run_validate(&rpc_tx, None, mock_validator); assert_eq!(result, expected_result_as_stateful_transaction_result); }