From 02d32cafc4356274b6e74bec8dc72b275063d7e4 Mon Sep 17 00:00:00 2001 From: Yair Bakalchuk Date: Sun, 7 Jul 2024 12:48:51 +0300 Subject: [PATCH] test(gateway): test StatefulTransactionValidator creation --- .../src/stateful_transaction_validator_test.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/gateway/src/stateful_transaction_validator_test.rs b/crates/gateway/src/stateful_transaction_validator_test.rs index 1b670863..39d58765 100644 --- a/crates/gateway/src/stateful_transaction_validator_test.rs +++ b/crates/gateway/src/stateful_transaction_validator_test.rs @@ -91,3 +91,19 @@ fn test_stateful_tx_validator( stateful_validator.run_validate(&external_tx, optional_class_info, None, validator); assert_eq!(format!("{:?}", result), format!("{:?}", expected_result)); } + +#[test] +fn test_prepare_validate() { + let state_reader_factory = local_test_state_reader_factory(CairoVersion::Cairo1, false); + let block_context = &BlockContext::create_for_testing(); + let stateful_validator = StatefulTransactionValidator { + config: StatefulTransactionValidatorConfig { + max_nonce_for_validation_skip: Default::default(), + validate_max_n_steps: block_context.versioned_constants().validate_max_n_steps, + max_recursion_depth: block_context.versioned_constants().max_recursion_depth, + chain_info: block_context.chain_info().clone().into(), + }, + }; + let blockifier_validator = stateful_validator.prepare_validate(&state_reader_factory); + assert!(blockifier_validator.is_ok()); +}