From 1885ee47933aeff9727ccb445a16fd1a3665bcbe Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Fri, 15 Nov 2024 14:42:32 +0400 Subject: [PATCH] Add kill switch --- core/lib/contract_verifier/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/lib/contract_verifier/src/lib.rs b/core/lib/contract_verifier/src/lib.rs index 13c39de0d7d..aaa9c126641 100644 --- a/core/lib/contract_verifier/src/lib.rs +++ b/core/lib/contract_verifier/src/lib.rs @@ -124,9 +124,18 @@ impl ContractVerifier { ) -> anyhow::Result { let env_resolver = Arc::::default(); let gh_resolver = Arc::new(GitHubCompilerResolver::new().await?); - let resolver = Arc::new(ResolverMultiplexer::new(env_resolver).with_resolver(gh_resolver)); + let mut resolver = ResolverMultiplexer::new(env_resolver); - Self::with_resolver(compilation_timeout, connection_pool, resolver).await + // Killer switch: if anything goes wrong with GH resolver, we can disable it without having to rollback. + // TODO: Remove once GH resolver is proven to be stable. + let disable_gh_resolver = std::env::var("DISABLE_GITHUB_RESOLVER").is_ok(); + if !disable_gh_resolver { + resolver = resolver.with_resolver(gh_resolver); + } else { + tracing::warn!("GitHub resolver was disabled via DISABLE_GITHUB_RESOLVER env variable") + } + + Self::with_resolver(compilation_timeout, connection_pool, Arc::new(resolver)).await } async fn with_resolver(