diff --git a/crates/papyrus_protobuf/src/converters/class.rs b/crates/papyrus_protobuf/src/converters/class.rs index 770f2bdee9a..0976c88bf26 100644 --- a/crates/papyrus_protobuf/src/converters/class.rs +++ b/crates/papyrus_protobuf/src/converters/class.rs @@ -207,6 +207,8 @@ impl TryFrom for state::SierraContractClass { let sierra_program = value.program.into_iter().map(Felt::try_from).collect::, _>>()?; + let contract_class_version = value.contract_class_version; + let mut entry_points_by_type = HashMap::new(); let entry_points = value.entry_points.clone().ok_or(ProtobufConversionError::MissingField { @@ -243,7 +245,12 @@ impl TryFrom for state::SierraContractClass { ); } - Ok(state::SierraContractClass { sierra_program, entry_points_by_type, abi }) + Ok(state::SierraContractClass { + sierra_program, + entry_points_by_type, + abi, + contract_class_version, + }) } } diff --git a/crates/papyrus_storage/src/serialization/serializers.rs b/crates/papyrus_storage/src/serialization/serializers.rs index d4dab673a5b..d3fd9d4be28 100644 --- a/crates/papyrus_storage/src/serialization/serializers.rs +++ b/crates/papyrus_storage/src/serialization/serializers.rs @@ -983,6 +983,7 @@ impl StorageSerde for SierraContractClass { bytes, )?, abi: String::deserialize_from(&mut decompress_from_reader(bytes)?.as_slice())?, + contract_class_version: String::deserialize_from(bytes)?, }) } } diff --git a/crates/papyrus_storage/src/utils_test.rs b/crates/papyrus_storage/src/utils_test.rs index 157e2e7efd9..e7cf7c21bf1 100644 --- a/crates/papyrus_storage/src/utils_test.rs +++ b/crates/papyrus_storage/src/utils_test.rs @@ -31,6 +31,7 @@ fn test_dump_declared_classes() { declared_classes.push(( ClassHash(i_felt), SierraContractClass { + contract_class_version: "".to_string(), sierra_program: vec![i_felt, i_felt], entry_points_by_type: HashMap::new(), abi: "".to_string(), diff --git a/crates/papyrus_test_utils/src/lib.rs b/crates/papyrus_test_utils/src/lib.rs index 358f1c18017..f5d45706cc8 100644 --- a/crates/papyrus_test_utils/src/lib.rs +++ b/crates/papyrus_test_utils/src/lib.rs @@ -500,6 +500,7 @@ auto_impl_get_test_instance! { pub sierra_program: Vec, pub entry_points_by_type: HashMap>, pub abi: String, + pub contract_class_version: String, } pub struct DeprecatedContractClass { pub abi: Option>, diff --git a/crates/starknet_api/src/state.rs b/crates/starknet_api/src/state.rs index e0e37067a02..dc463387eb8 100644 --- a/crates/starknet_api/src/state.rs +++ b/crates/starknet_api/src/state.rs @@ -215,6 +215,7 @@ pub struct SierraContractClass { pub sierra_program: Vec, pub entry_points_by_type: HashMap>, pub abi: String, + pub contract_class_version: String, } /// An entry point of a [ContractClass](`crate::state::ContractClass`). diff --git a/crates/starknet_client/src/reader/objects/state.rs b/crates/starknet_client/src/reader/objects/state.rs index 67ad35b75b0..dd8fd132522 100644 --- a/crates/starknet_client/src/reader/objects/state.rs +++ b/crates/starknet_client/src/reader/objects/state.rs @@ -66,6 +66,7 @@ pub struct ContractClass { impl From for starknet_api::state::SierraContractClass { fn from(class: ContractClass) -> Self { Self { + contract_class_version: class.contract_class_version, sierra_program: class.sierra_program, entry_points_by_type: class.entry_points_by_type, abi: class.abi,