From 353148308b3172db38bba51dfc65a171da68eede Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Wed, 7 Aug 2024 13:57:46 +0300 Subject: [PATCH] chore: rename max_raw_casm_class_size to max_casm_contract_class_object_size --- config/mempool/default_config.json | 2 +- crates/gateway/src/compilation.rs | 4 ++-- crates/gateway/src/compilation_test.rs | 2 +- crates/gateway/src/config.rs | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/mempool/default_config.json b/config/mempool/default_config.json index 9d57ed70624..9d1722e344b 100644 --- a/config/mempool/default_config.json +++ b/config/mempool/default_config.json @@ -14,7 +14,7 @@ "privacy": "Public", "value": 81920 }, - "gateway_config.compiler_config.max_raw_casm_class_size": { + "gateway_config.compiler_config.max_casm_class_total_size": { "description": "Limitation of contract class object size.", "privacy": "Public", "value": 4089446 diff --git a/crates/gateway/src/compilation.rs b/crates/gateway/src/compilation.rs index a74e96364fb..6fa0dd71eb7 100644 --- a/crates/gateway/src/compilation.rs +++ b/crates/gateway/src/compilation.rs @@ -80,10 +80,10 @@ impl GatewayCompiler { let contract_class_object_size = serde_json::to_string(&casm_contract_class) .expect("Unexpected error serializing Casm contract class.") .len(); - if contract_class_object_size > self.config.max_raw_casm_class_size { + if contract_class_object_size > self.config.max_casm_contract_class_object_size { return Err(GatewayError::CasmContractClassObjectSizeTooLarge { contract_class_object_size, - max_contract_class_object_size: self.config.max_raw_casm_class_size, + max_contract_class_object_size: self.config.max_casm_contract_class_object_size, }); } diff --git a/crates/gateway/src/compilation_test.rs b/crates/gateway/src/compilation_test.rs index 014f77a7e97..69425b4d831 100644 --- a/crates/gateway/src/compilation_test.rs +++ b/crates/gateway/src/compilation_test.rs @@ -72,7 +72,7 @@ fn test_compile_contract_class_bytecode_size_validation(declare_tx_v3: RpcDeclar #[rstest] fn test_compile_contract_class_raw_class_size_validation(declare_tx_v3: RpcDeclareTransactionV3) { let gateway_compiler = GatewayCompiler::new(GatewayCompilerConfig { - post_compilation_config: PostCompilationConfig { max_raw_casm_class_size: 1 }, + post_compilation_config: PostCompilationConfig { max_casm_contract_class_object_size: 1 }, ..Default::default() }); diff --git a/crates/gateway/src/config.rs b/crates/gateway/src/config.rs index 2364ff352ee..a7f1ba36bd9 100644 --- a/crates/gateway/src/config.rs +++ b/crates/gateway/src/config.rs @@ -249,20 +249,20 @@ impl SerializeConfig for GatewayCompilerConfig { /// The configuration for the post compilation process in the gateway compiler. #[derive(Clone, Copy, Debug, Serialize, Deserialize, Validate, PartialEq)] pub struct PostCompilationConfig { - pub max_raw_casm_class_size: usize, + pub max_casm_contract_class_object_size: usize, } impl Default for PostCompilationConfig { fn default() -> Self { - PostCompilationConfig { max_raw_casm_class_size: 4089446 } + PostCompilationConfig { max_casm_contract_class_object_size: 4089446 } } } impl SerializeConfig for PostCompilationConfig { fn dump(&self) -> BTreeMap { BTreeMap::from_iter([ser_param( - "max_raw_casm_class_size", - &self.max_raw_casm_class_size, + "max_casm_contract_class_object_size", + &self.max_casm_contract_class_object_size, "Limitation of contract class object size.", ParamPrivacyInput::Public, )])