Skip to content

Commit

Permalink
fix(tee-prover): fix deserialization of duration in envy config
Browse files Browse the repository at this point in the history
Relevant logs from the `stage` environment showcasing the issue:
https://grafana.matterlabs.dev/goto/IC-9k4eIR?orgId=1

Error message from the above logs:
```
Error: missing value for field initial_retry_backoff
```

The root cause of the problem supposedly boils down to the mismatch
between the expected format of `TEE_PROVER_INITIAL_RETRY_BACKOFF` and
the actual format. We export it as follows:
```
export TEE_PROVER_INITIAL_RETRY_BACKOFF=1
```
which is not supported as explained here:
serde-rs/serde#339 (comment)
  • Loading branch information
pbeza committed Sep 6, 2024
1 parent 64f9551 commit 67d55e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/bin/zksync_tee_prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ envy.workspace = true
reqwest.workspace = true
secp256k1 = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive"] }
serde_with.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing.workspace = true
Expand Down
4 changes: 4 additions & 0 deletions core/bin/zksync_tee_prover/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ use std::{path::PathBuf, time::Duration};

use secp256k1::SecretKey;
use serde::Deserialize;
use serde_with::{serde_as, DurationSecondsWithFrac};
use url::Url;
use zksync_env_config::FromEnv;
use zksync_types::tee_types::TeeType;

/// Configuration for the TEE prover.
#[serde_with::serde_as]
#[derive(Debug, Clone, Deserialize)]
pub(crate) struct TeeProverConfig {
/// The private key used to sign the proofs.
Expand All @@ -22,10 +24,12 @@ pub(crate) struct TeeProverConfig {
pub max_retries: usize,
/// Initial back-off interval when retrying recovery on a retriable error. Each subsequent retry interval
/// will be multiplied by [`Self.retry_backoff_multiplier`].
#[serde_as(as = "DurationSecondsWithFrac")]
pub initial_retry_backoff: Duration,
/// Multiplier for the back-off interval when retrying recovery on a retriable error.
pub retry_backoff_multiplier: f32,
/// Maximum back-off interval when retrying recovery on a retriable error.
#[serde_as(as = "DurationSecondsWithFrac")]
pub max_backoff: Duration,
}

Expand Down

0 comments on commit 67d55e0

Please sign in to comment.