From 8621e4882b796b6a893a370917d61c53c1dba625 Mon Sep 17 00:00:00 2001 From: AvivYossef-starkware <aviv.y@starkware.co> Date: Tue, 3 Dec 2024 17:59:34 +0200 Subject: [PATCH] refactor(starknet_api): change default sierra contract class to valid one --- crates/starknet_api/src/state.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/starknet_api/src/state.rs b/crates/starknet_api/src/state.rs index 5de7b488652..ada375f13f8 100644 --- a/crates/starknet_api/src/state.rs +++ b/crates/starknet_api/src/state.rs @@ -209,7 +209,7 @@ impl StorageKey { impl_from_through_intermediate!(u128, StorageKey, u8, u16, u32, u64); /// A contract class. -#[derive(Debug, Clone, Default, Eq, PartialEq, Deserialize, Serialize, Hash)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, Hash)] pub struct SierraContractClass { pub sierra_program: Vec<Felt>, pub contract_class_version: String, @@ -217,6 +217,17 @@ pub struct SierraContractClass { pub abi: String, } +impl Default for SierraContractClass { + fn default() -> Self { + Self { + sierra_program: [Felt::ONE, Felt::TWO, Felt::THREE].to_vec(), + contract_class_version: Default::default(), + entry_points_by_type: Default::default(), + abi: Default::default(), + } + } +} + /// An entry point of a [ContractClass](`crate::state::ContractClass`). #[derive(Debug, Default, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)] pub struct EntryPoint {