From fd7188665056f9f94b62eaaf04a132217e63e5da Mon Sep 17 00:00:00 2001 From: Patrick Beza Date: Fri, 6 Sep 2024 11:53:47 +0200 Subject: [PATCH] fix(tee-prover): fix deserialization of duration in envy config 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 ``` --- Cargo.lock | 1 + core/bin/zksync_tee_prover/Cargo.toml | 1 + core/bin/zksync_tee_prover/src/config.rs | 3 +++ 3 files changed, 5 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2d6263f7ab4e..bd91284b96d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9624,6 +9624,7 @@ dependencies = [ "reqwest 0.12.5", "secp256k1", "serde", + "serde_with", "thiserror", "tokio", "tracing", diff --git a/core/bin/zksync_tee_prover/Cargo.toml b/core/bin/zksync_tee_prover/Cargo.toml index 85908eebeaaa..6af9b7cbd2af 100644 --- a/core/bin/zksync_tee_prover/Cargo.toml +++ b/core/bin/zksync_tee_prover/Cargo.toml @@ -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 diff --git a/core/bin/zksync_tee_prover/src/config.rs b/core/bin/zksync_tee_prover/src/config.rs index 5b009e33f25e..e8193eceec77 100644 --- a/core/bin/zksync_tee_prover/src/config.rs +++ b/core/bin/zksync_tee_prover/src/config.rs @@ -2,6 +2,7 @@ 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; @@ -22,10 +23,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, }