From aef6614acb2835dcfef73d0917412906a9e8350c Mon Sep 17 00:00:00 2001 From: Harsh Bajpai Date: Tue, 26 Sep 2023 18:57:16 +0700 Subject: [PATCH] dev: remove `SerializableClassRecord` --- crates/sequencer/src/serde/state.rs | 17 ++++------------- crates/sequencer/src/state.rs | 9 ++------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/crates/sequencer/src/serde/state.rs b/crates/sequencer/src/serde/state.rs index e4c4cb49..79417227 100644 --- a/crates/sequencer/src/serde/state.rs +++ b/crates/sequencer/src/serde/state.rs @@ -30,7 +30,7 @@ pub enum SerializationError { #[derive(Clone, Debug, Serialize, Deserialize, Default)] pub struct SerializableState { - pub classes: FxHashMap, + pub classes: FxHashMap, pub compiled_classes_hash: FxHashMap, pub contracts: FxHashMap, #[serde(with = "serialize_contract_storage")] @@ -82,24 +82,15 @@ impl From<&State> for SerializableState { .classes .iter() .for_each(|(class_hash, contract_class)| { - serializable_state.classes.insert( - *class_hash, - SerializableClassRecord { - class: contract_class.clone().into(), - }, - ); + serializable_state + .classes + .insert(*class_hash, contract_class.clone().into()); }); serializable_state } } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct SerializableClassRecord { - /// The compiled class. - pub class: SerializableContractClass, -} - mod serialize_contract_storage { use blockifier::state::cached_state::ContractStorageKey; use rustc_hash::FxHashMap; diff --git a/crates/sequencer/src/state.rs b/crates/sequencer/src/state.rs index 2f402634..14cafc14 100644 --- a/crates/sequencer/src/state.rs +++ b/crates/sequencer/src/state.rs @@ -192,7 +192,7 @@ impl From<&SerializableState> for State { serializable_state.classes.iter().for_each(|(class_hash, contract_class)|{ state.classes.insert( *class_hash, - contract_class.class.clone().try_into().unwrap_or_else(|error| panic!("failed to convert SerializableClassRecord to ContractClass for class_hash {},\n error {}", class_hash, error)) + contract_class.clone().try_into().unwrap_or_else(|error| panic!("failed to convert SerializableClassRecord to ContractClass for class_hash {},\n error {}", class_hash, error)) ); }); @@ -215,12 +215,7 @@ mod tests { use crate::{serde::utils::contract_class, state::State}; use blockifier::state::cached_state::ContractStorageKey; - use starknet_api::{ - core::{ClassHash, CompiledClassHash, ContractAddress, Nonce, PatriciaKey}, - hash::{StarkFelt, StarkHash}, - patricia_key, stark_felt, - state::StorageKey, - }; + use starknet_api::{core::Nonce, state::StorageKey}; #[test] fn test_storage() {