Skip to content

Commit

Permalink
chore: rename max_raw_casm_class_size to max_casm_contract_class_obje…
Browse files Browse the repository at this point in the history
…ct_size
  • Loading branch information
ArniStarkware committed Aug 12, 2024
1 parent 976f8fb commit f2e4797
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/mempool/default_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"compiler_config.post_compilation_config.max_raw_casm_class_size": {
"compiler_config.post_compilation_config.max_casm_contract_class_object_size": {
"description": "Limitation of contract class object size.",
"privacy": "Public",
"value": 4089446
Expand Down
4 changes: 2 additions & 2 deletions crates/gateway/src/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,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,
});
}

Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/src/compilation_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_cairo_lang_compiler(GatewayCompilerConfig {
post_compilation_config: PostCompilationConfig { max_raw_casm_class_size: 1 },
post_compilation_config: PostCompilationConfig { max_casm_contract_class_object_size: 1 },
..Default::default()
});

Expand Down
8 changes: 4 additions & 4 deletions crates/gateway/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,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<ParamPath, SerializedParam> {
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,
)])
Expand Down

0 comments on commit f2e4797

Please sign in to comment.