From 7e3a7046eef98cd5fe0317aa3dbf9cc4751ee9b5 Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Thu, 26 Dec 2024 13:42:23 +0200 Subject: [PATCH] chore(starknet_gateway): use the get nonce method of the stateful validator trait --- crates/starknet_gateway/src/gateway.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/starknet_gateway/src/gateway.rs b/crates/starknet_gateway/src/gateway.rs index 102e2cf0b6..41acaf64d7 100644 --- a/crates/starknet_gateway/src/gateway.rs +++ b/crates/starknet_gateway/src/gateway.rs @@ -18,7 +18,10 @@ use crate::config::{GatewayConfig, RpcStateReaderConfig}; use crate::errors::GatewayResult; use crate::rpc_state_reader::RpcStateReaderFactory; use crate::state_reader::StateReaderFactory; -use crate::stateful_transaction_validator::StatefulTransactionValidator; +use crate::stateful_transaction_validator::{ + StatefulTransactionValidator, + StatefulTransactionValidatorTrait, +}; use crate::stateless_transaction_validator::StatelessTransactionValidator; use crate::utils::compile_contract_and_build_executable_tx; @@ -134,10 +137,11 @@ impl ProcessTxBlockingTask { .stateful_tx_validator .instantiate_validator(self.state_reader_factory.as_ref(), &self.chain_info)?; let address = executable_tx.contract_address(); - let nonce = validator.get_nonce(address).map_err(|e| { - error!("Failed to get nonce for sender address {}: {}", address, e); - GatewaySpecError::UnexpectedError { data: "Internal server error.".to_owned() } - })?; + let nonce = + StatefulTransactionValidatorTrait::get_nonce(&mut validator, address).map_err(|e| { + error!("Failed to get nonce for sender address {}: {}", address, e); + GatewaySpecError::UnexpectedError { data: "Internal server error.".to_owned() } + })?; self.stateful_tx_validator.run_validate(&executable_tx, nonce, validator)?;