Skip to content

Commit e9b3e77

Browse files
authored
fix(coprocessor): gate test bypass behind feature flag (#1881)
* fix(gw-listener): gate test bypass behind feature flag Move the "key_bytes" test bypass in extract_server_key_without_ns behind a feature flag to prevent it from being compiled into production builds. * trigger CI
1 parent 4a80b53 commit e9b3e77

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

coprocessor/fhevm-engine/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/gw-listener/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ authors.workspace = true
55
edition.workspace = true
66
license.workspace = true
77

8+
[features]
9+
default = []
10+
test_bypass_key_extraction = []
11+
812
[dependencies]
913
# workspace dependencies
1014
alloy = { workspace = true }
@@ -43,3 +47,8 @@ alloy = { workspace = true, features = ["node-bindings"] }
4347
aws-smithy-mocks = "0.1.1"
4448
serial_test = { workspace = true }
4549
test-harness = { path = "../test-harness" }
50+
51+
# Enable test bypass features for integration tests
52+
[dev-dependencies.gw-listener]
53+
path = "."
54+
features = ["test_bypass_key_extraction"]

coprocessor/fhevm-engine/gw-listener/src/sks_key.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use tfhe::ServerKey;
33
use fhevm_engine_common::utils::{safe_deserialize_sns_key, safe_serialize_key};
44

55
pub fn extract_server_key_without_ns(sns_key: &[u8]) -> anyhow::Result<Vec<u8>> {
6-
// for integration tests
7-
if sns_key == "key_bytes".as_bytes() {
8-
return Ok("key_bytes".as_bytes().to_vec());
6+
// Bypass for integration tests
7+
#[cfg(feature = "test_bypass_key_extraction")]
8+
if sns_key == b"key_bytes" {
9+
return Ok(b"key_bytes".to_vec());
910
}
1011

1112
let server_key: ServerKey = safe_deserialize_sns_key(sns_key)?;

0 commit comments

Comments
 (0)