Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(blockifier_reexecution): fix bug in get contract class #1759

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use starknet_api::state::StorageKey;
use starknet_api::transaction::{Transaction, TransactionHash};
use starknet_core::types::ContractClass as StarknetContractClass;
use starknet_gateway::config::RpcStateReaderConfig;
use starknet_gateway::errors::serde_err_to_state_err;
use starknet_gateway::errors::{serde_err_to_state_err, RPCStateReaderError};
use starknet_gateway::rpc_objects::{BlockHeader, GetBlockWithTxHashesParams, ResourcePrice};
use starknet_gateway::rpc_state_reader::RpcStateReader;
use starknet_types_core::felt::Felt;
Expand Down Expand Up @@ -357,10 +357,16 @@ impl ReexecutionStateReader for TestStateReader {
"block_id": self.rpc_state_reader.block_id,
"class_hash": class_hash.0.to_string(),
});
let contract_class: StarknetContractClass = serde_json::from_value(
self.rpc_state_reader.send_rpc_request("starknet_getClass", params.clone())?,
)
.map_err(serde_err_to_state_err)?;
let raw_contract_class =
match self.rpc_state_reader.send_rpc_request("starknet_getClass", params.clone()) {
Err(RPCStateReaderError::ClassHashNotFound(_)) => {
return Err(StateError::UndeclaredClassHash(*class_hash));
}
other_result => other_result,
}?;

let contract_class: StarknetContractClass =
serde_json::from_value(raw_contract_class).map_err(serde_err_to_state_err)?;
// Create a binding to avoid value being dropped.
let mut dumper_binding = self.contract_class_mapping_dumper.lock().unwrap();
// If dumper exists, insert the contract class to the mapping.
Expand Down
Loading