From 21f56a214a116fbef8f9c4d8fca3e5e4b32108ff Mon Sep 17 00:00:00 2001 From: Patrick Beza Date: Fri, 18 Oct 2024 16:46:45 +0200 Subject: [PATCH] feat(proof-data-handler): add tee_proof_generation_timeout_in_secs param Add `tee_proof_generation_timeout_in_secs` parameter to the `proof-data-handler` configuration to not share the same `proof_generation_timeout_in_secs` timeout with the prover. --- core/lib/config/src/configs/proof_data_handler.rs | 5 +++++ core/lib/config/src/testonly.rs | 1 + core/lib/env_config/src/proof_data_handler.rs | 2 ++ core/lib/protobuf_config/src/proof_data_handler.rs | 8 ++++++++ core/lib/protobuf_config/src/proto/config/prover.proto | 1 + core/node/proof_data_handler/src/tests.rs | 2 ++ etc/env/base/proof_data_handler.toml | 1 + etc/env/file_based/general.yaml | 9 +++------ 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/core/lib/config/src/configs/proof_data_handler.rs b/core/lib/config/src/configs/proof_data_handler.rs index de7f6969b05..8be5afc0444 100644 --- a/core/lib/config/src/configs/proof_data_handler.rs +++ b/core/lib/config/src/configs/proof_data_handler.rs @@ -6,6 +6,7 @@ use serde::Deserialize; pub struct ProofDataHandlerConfig { pub http_port: u16, pub proof_generation_timeout_in_secs: u16, + pub tee_proof_generation_timeout_in_secs: u16, pub tee_support: bool, } @@ -13,4 +14,8 @@ impl ProofDataHandlerConfig { pub fn proof_generation_timeout(&self) -> Duration { Duration::from_secs(self.proof_generation_timeout_in_secs as u64) } + + pub fn tee_proof_generation_timeout(&self) -> Duration { + Duration::from_secs(self.tee_proof_generation_timeout_in_secs as u64) + } } diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index 0fdd927d19f..b561a65c0ec 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -680,6 +680,7 @@ impl Distribution for EncodeDist { configs::ProofDataHandlerConfig { http_port: self.sample(rng), proof_generation_timeout_in_secs: self.sample(rng), + tee_proof_generation_timeout_in_secs: self.sample(rng), tee_support: self.sample(rng), } } diff --git a/core/lib/env_config/src/proof_data_handler.rs b/core/lib/env_config/src/proof_data_handler.rs index f69aa1d6dc5..af3346dda71 100644 --- a/core/lib/env_config/src/proof_data_handler.rs +++ b/core/lib/env_config/src/proof_data_handler.rs @@ -19,6 +19,7 @@ mod tests { ProofDataHandlerConfig { http_port: 3320, proof_generation_timeout_in_secs: 18000, + tee_proof_generation_timeout_in_secs: 600, tee_support: true, } } @@ -27,6 +28,7 @@ mod tests { fn from_env() { let config = r#" PROOF_DATA_HANDLER_PROOF_GENERATION_TIMEOUT_IN_SECS="18000" + PROOF_DATA_HANDLER_TEE_PROOF_GENERATION_TIMEOUT_IN_SECS="600" PROOF_DATA_HANDLER_HTTP_PORT="3320" PROOF_DATA_HANDLER_TEE_SUPPORT="true" "#; diff --git a/core/lib/protobuf_config/src/proof_data_handler.rs b/core/lib/protobuf_config/src/proof_data_handler.rs index 4b7bd2fd7c3..19f9131159a 100644 --- a/core/lib/protobuf_config/src/proof_data_handler.rs +++ b/core/lib/protobuf_config/src/proof_data_handler.rs @@ -17,6 +17,11 @@ impl ProtoRepr for proto::ProofDataHandler { tee_support: required(&self.tee_support) .copied() .context("tee_support")?, + tee_proof_generation_timeout_in_secs: required( + &self.tee_proof_generation_timeout_in_secs, + ) + .and_then(|x| Ok((*x).try_into()?)) + .context("tee_proof_generation_timeout_in_secs")?, }) } @@ -25,6 +30,9 @@ impl ProtoRepr for proto::ProofDataHandler { http_port: Some(this.http_port.into()), proof_generation_timeout_in_secs: Some(this.proof_generation_timeout_in_secs.into()), tee_support: Some(this.tee_support), + tee_proof_generation_timeout_in_secs: Some( + this.tee_proof_generation_timeout_in_secs.into(), + ), } } } diff --git a/core/lib/protobuf_config/src/proto/config/prover.proto b/core/lib/protobuf_config/src/proto/config/prover.proto index 4fe3861183b..6c2d3e7a335 100644 --- a/core/lib/protobuf_config/src/proto/config/prover.proto +++ b/core/lib/protobuf_config/src/proto/config/prover.proto @@ -108,4 +108,5 @@ message ProofDataHandler { optional uint32 http_port = 1; // required; u16 optional uint32 proof_generation_timeout_in_secs = 2; // required; s optional bool tee_support = 3; // required + optional uint32 tee_proof_generation_timeout_in_secs = 4; // required; s } diff --git a/core/node/proof_data_handler/src/tests.rs b/core/node/proof_data_handler/src/tests.rs index a10044cacd9..a886a0127da 100644 --- a/core/node/proof_data_handler/src/tests.rs +++ b/core/node/proof_data_handler/src/tests.rs @@ -25,6 +25,7 @@ async fn request_tee_proof_inputs() { ProofDataHandlerConfig { http_port: 1337, proof_generation_timeout_in_secs: 10, + tee_proof_generation_timeout_in_secs: 5, tee_support: true, }, L1BatchCommitmentMode::Rollup, @@ -80,6 +81,7 @@ async fn submit_tee_proof() { ProofDataHandlerConfig { http_port: 1337, proof_generation_timeout_in_secs: 10, + tee_proof_generation_timeout_in_secs: 5, tee_support: true, }, L1BatchCommitmentMode::Rollup, diff --git a/etc/env/base/proof_data_handler.toml b/etc/env/base/proof_data_handler.toml index 7a1999a03c3..b56ac26fb17 100644 --- a/etc/env/base/proof_data_handler.toml +++ b/etc/env/base/proof_data_handler.toml @@ -1,4 +1,5 @@ [proof_data_handler] http_port = 3320 proof_generation_timeout_in_secs = 18000 +tee_proof_generation_timeout_in_secs = 600 tee_support = true diff --git a/etc/env/file_based/general.yaml b/etc/env/file_based/general.yaml index 587ba4614a5..0f1efdf26eb 100644 --- a/etc/env/file_based/general.yaml +++ b/etc/env/file_based/general.yaml @@ -41,7 +41,7 @@ api: estimate_gas_scale_factor: 1.3 estimate_gas_acceptable_overestimation: 5000 max_tx_size: 1000000 - api_namespaces: [ en,eth,net,web3,zks,pubsub,debug ] + api_namespaces: [en, eth, net, web3, zks, pubsub, debug] state_keeper: transaction_slots: 8192 max_allowed_l2_tx_gas_limit: 15000000000 @@ -104,7 +104,7 @@ eth: aggregated_block_execute_deadline: 10 timestamp_criteria_max_allowed_lag: 30 max_eth_tx_data_size: 120000 - aggregated_proof_sizes: [ 1 ] + aggregated_proof_sizes: [1] max_aggregated_tx_gas: 15000000 max_acceptable_priority_fee_in_gwei: 100000000000 pubdata_sending_mode: BLOBS @@ -121,7 +121,6 @@ eth: confirmations_for_eth_event: 0 eth_node_poll_interval: 300 - snapshot_creator: object_store: file_backed: @@ -130,7 +129,6 @@ snapshot_creator: concurrent_queries_count: 25 storage_logs_chunk_size: 1000000 - prover: prover_object_store: file_backed: @@ -169,6 +167,7 @@ witness_vector_generator: data_handler: http_port: 3320 proof_generation_timeout_in_secs: 18000 + tee_proof_generation_timeout_in_secs: 600 tee_support: true prover_gateway: api_url: http://127.0.0.1:3320 @@ -289,7 +288,6 @@ prover_job_monitor: witness_job_queuer_run_interval_ms: 10000 http_port: 3074 - base_token_adjuster: price_polling_interval_ms: 30000 price_cache_update_interval_ms: 2000 @@ -301,7 +299,6 @@ external_price_api_client: forced_numerator: 3 forced_denominator: 2 - house_keeper: l1_batch_metrics_reporting_interval_ms: 10000