Skip to content

Commit

Permalink
chore: remove class_info referance from test_stateful_tx_validator (#611
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ArniStarkware authored Aug 29, 2024
1 parent fdddbe3 commit 6b7dcbb
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions crates/gateway/src/stateful_transaction_validator_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -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),
Expand All @@ -82,18 +80,6 @@ fn test_stateful_tx_validator(
#[case] expected_result: BlockifierStatefulValidatorResult<ValidateInfo>,
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() }
Expand All @@ -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);
}

Expand Down

0 comments on commit 6b7dcbb

Please sign in to comment.