From 6a16afc3e40bdb3413e5910d3701bc6b8c8a313b Mon Sep 17 00:00:00 2001 From: Arnon Hod Date: Mon, 12 Aug 2024 10:19:21 +0300 Subject: [PATCH] refactor(gateway): remove reduncdent config level on gateway compiler (#373) --- config/mempool/default_config.json | 2 +- crates/gateway/src/config.rs | 16 +--------------- crates/gateway/src/gateway.rs | 4 +--- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/config/mempool/default_config.json b/config/mempool/default_config.json index e6888a1d7d..03520b04e1 100644 --- a/config/mempool/default_config.json +++ b/config/mempool/default_config.json @@ -89,7 +89,7 @@ "privacy": "Public", "value": 3 }, - "gateway_config.compiler_config.sierra_to_casm_compiler_config.max_bytecode_size": { + "gateway_config.compiler_config.max_bytecode_size": { "description": "Limitation of contract bytecode size.", "privacy": "Public", "value": 81920 diff --git a/crates/gateway/src/config.rs b/crates/gateway/src/config.rs index fbfed4520e..9ecd82fc62 100644 --- a/crates/gateway/src/config.rs +++ b/crates/gateway/src/config.rs @@ -17,7 +17,7 @@ pub struct GatewayConfig { pub network_config: GatewayNetworkConfig, pub stateless_tx_validator_config: StatelessTransactionValidatorConfig, pub stateful_tx_validator_config: StatefulTransactionValidatorConfig, - pub compiler_config: GatewayCompilerConfig, + pub compiler_config: SierraToCasmCompilationConfig, } impl SerializeConfig for GatewayConfig { @@ -224,17 +224,3 @@ impl StatefulTransactionValidatorConfig { } } } - -#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, Validate, PartialEq)] -pub struct GatewayCompilerConfig { - pub sierra_to_casm_compiler_config: SierraToCasmCompilationConfig, -} - -impl SerializeConfig for GatewayCompilerConfig { - fn dump(&self) -> BTreeMap { - append_sub_config_name( - self.sierra_to_casm_compiler_config.dump(), - "sierra_to_casm_compiler_config", - ) - } -} diff --git a/crates/gateway/src/gateway.rs b/crates/gateway/src/gateway.rs index 6be26c424b..dc1c971fd9 100644 --- a/crates/gateway/src/gateway.rs +++ b/crates/gateway/src/gateway.rs @@ -154,9 +154,7 @@ pub fn create_gateway( mempool_client: SharedMempoolClient, ) -> Gateway { let state_reader_factory = Arc::new(RpcStateReaderFactory { config: rpc_state_reader_config }); - let gateway_compiler = GatewayCompiler::new_cairo_lang_compiler( - config.compiler_config.sierra_to_casm_compiler_config, - ); + let gateway_compiler = GatewayCompiler::new_cairo_lang_compiler(config.compiler_config); Gateway::new(config, state_reader_factory, gateway_compiler, mempool_client) }