Skip to content

Commit

Permalink
refactor(gateway): remove unnecessary error
Browse files Browse the repository at this point in the history
  • Loading branch information
yair-starkware committed Jul 22, 2024
1 parent ab4d6c9 commit ff8c432
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions crates/gateway/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use blockifier::state::errors::StateError;
use blockifier::transaction::errors::TransactionExecutionError;
use cairo_vm::types::errors::program_errors::ProgramError;
use serde_json::{Error as SerdeError, Value};
use starknet_api::block::{BlockNumber, GasPrice};
use starknet_api::block::GasPrice;
use starknet_api::core::CompiledClassHash;
use starknet_api::transaction::{Resource, ResourceBounds};
use starknet_api::StarknetApiError;
Expand Down Expand Up @@ -96,8 +96,6 @@ pub type StatelessTransactionValidatorResult<T> = Result<T, StatelessTransaction

#[derive(Debug, Error)]
pub enum StatefulTransactionValidatorError {
#[error("Block number {block_number:?} is out of range.")]
OutOfRangeBlockNumber { block_number: BlockNumber },
#[error(transparent)]
StarknetApiError(#[from] StarknetApiError),
#[error(transparent)]
Expand Down
8 changes: 2 additions & 6 deletions crates/gateway/src/stateful_transaction_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use starknet_api::transaction::TransactionHash;
use starknet_types_core::felt::Felt;

use crate::config::StatefulTransactionValidatorConfig;
use crate::errors::{StatefulTransactionValidatorError, StatefulTransactionValidatorResult};
use crate::errors::StatefulTransactionValidatorResult;
use crate::state_reader::{MempoolStateReader, StateReaderFactory};
use crate::utils::{external_tx_to_account_tx, get_sender_address, get_tx_hash};

Expand Down Expand Up @@ -59,11 +59,7 @@ impl StatefulTransactionValidator {
self.config.max_recursion_depth,
);
let mut block_info = latest_block_info;
block_info.block_number = block_info.block_number.next().ok_or(
StatefulTransactionValidatorError::OutOfRangeBlockNumber {
block_number: block_info.block_number,
},
)?;
block_info.block_number = block_info.block_number.unchecked_next();
// TODO(yael 21/4/24): create the block context using pre_process_block once we will be
// able to read the block_hash of 10 blocks ago from papyrus.
let block_context = BlockContext::new(
Expand Down

0 comments on commit ff8c432

Please sign in to comment.