Skip to content

Commit

Permalink
feat(proof-data-handler): add tee_proof_generation_timeout_in_secs param
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pbeza committed Oct 24, 2024
1 parent 8089b78 commit 0a495d4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/lib/config/src/configs/proof_data_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ pub struct TeeConfig {
pub tee_support: bool,
/// All batches before this one are considered to be processed.
pub first_tee_processed_batch: L1BatchNumber,
/// Timeout for proof generation in TEE in seconds.
pub tee_proof_generation_timeout_in_secs: u16,
}

impl Default for TeeConfig {
fn default() -> Self {
TeeConfig {
tee_support: Self::default_tee_support(),
first_tee_processed_batch: Self::default_first_tee_processed_batch(),
tee_proof_generation_timeout_in_secs:
Self::default_tee_proof_generation_timeout_in_secs(),
}
}
}
Expand All @@ -28,6 +32,10 @@ impl TeeConfig {
pub fn default_first_tee_processed_batch() -> L1BatchNumber {
L1BatchNumber(0)
}

pub fn default_tee_proof_generation_timeout_in_secs() -> u16 {
600
}
}

#[derive(Debug, Deserialize, Clone, PartialEq)]
Expand Down
1 change: 1 addition & 0 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ impl Distribution<configs::ProofDataHandlerConfig> for EncodeDist {
tee_config: configs::TeeConfig {
tee_support: self.sample(rng),
first_tee_processed_batch: L1BatchNumber(rng.gen()),
tee_proof_generation_timeout_in_secs: self.sample(rng),
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions core/lib/env_config/src/proof_data_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mod tests {
tee_config: TeeConfig {
tee_support: true,
first_tee_processed_batch: L1BatchNumber(1337),
tee_proof_generation_timeout_in_secs: 600,
},
}
}
Expand All @@ -39,6 +40,7 @@ mod tests {
PROOF_DATA_HANDLER_HTTP_PORT="3320"
PROOF_DATA_HANDLER_TEE_SUPPORT="true"
PROOF_DATA_HANDLER_FIRST_TEE_PROCESSED_BATCH="1337"
PROOF_DATA_HANDLER_TEE_PROOF_GENERATION_TIMEOUT_IN_SECS="600"
"#;
let mut lock = MUTEX.lock();
lock.set_env(config);
Expand Down
9 changes: 9 additions & 0 deletions core/lib/protobuf_config/src/proof_data_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ impl ProtoRepr for proto::ProofDataHandler {
.first_tee_processed_batch
.map(|x| L1BatchNumber(x as u32))
.unwrap_or_else(configs::TeeConfig::default_first_tee_processed_batch),
tee_proof_generation_timeout_in_secs: self
.tee_proof_generation_timeout_in_secs
.map(|x| x as u16)
.unwrap_or_else(
configs::TeeConfig::default_tee_proof_generation_timeout_in_secs,
),
},
})
}
Expand All @@ -33,6 +39,9 @@ impl ProtoRepr for proto::ProofDataHandler {
proof_generation_timeout_in_secs: Some(this.proof_generation_timeout_in_secs.into()),
tee_support: Some(this.tee_config.tee_support),
first_tee_processed_batch: Some(this.tee_config.first_tee_processed_batch.0 as u64),
tee_proof_generation_timeout_in_secs: Some(
this.tee_config.tee_proof_generation_timeout_in_secs.into(),
),
}
}
}
1 change: 1 addition & 0 deletions core/lib/protobuf_config/src/proto/config/prover.proto
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ message ProofDataHandler {
optional uint32 proof_generation_timeout_in_secs = 2; // required; s
optional bool tee_support = 3; // optional
optional uint64 first_tee_processed_batch = 4; // optional
optional uint32 tee_proof_generation_timeout_in_secs = 5; // optional
}
2 changes: 2 additions & 0 deletions core/node/proof_data_handler/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async fn request_tee_proof_inputs() {
tee_config: TeeConfig {
tee_support: true,
first_tee_processed_batch: L1BatchNumber(0),
tee_proof_generation_timeout_in_secs: 600,
},
},
L1BatchCommitmentMode::Rollup,
Expand Down Expand Up @@ -86,6 +87,7 @@ async fn submit_tee_proof() {
tee_config: TeeConfig {
tee_support: true,
first_tee_processed_batch: L1BatchNumber(0),
tee_proof_generation_timeout_in_secs: 600,
},
},
L1BatchCommitmentMode::Rollup,
Expand Down
1 change: 1 addition & 0 deletions etc/env/base/proof_data_handler.toml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions etc/env/file_based/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,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
Expand Down

0 comments on commit 0a495d4

Please sign in to comment.