Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
94c2f61
chore(coprocessor): implement SupportedFheCiphertexts::deserialize
goshawk-3 Feb 6, 2026
18f7824
feat(coprocessor): implement first version of tfhe-compute-node
goshawk-3 Feb 6, 2026
f329755
feat(coprocessor): implement initial version of tfhe-dispatcher
goshawk-3 Feb 13, 2026
de23fba
chore(coprocessor): use create_recv_channel from common
goshawk-3 Feb 13, 2026
541693e
chore(coprocessor): add rmq helper functions in common
goshawk-3 Feb 13, 2026
c53e35f
chore(coprocessor): update dispatcher
goshawk-3 Feb 18, 2026
ad0694f
chore(coprocessor): update tfhe-compute-node
goshawk-3 Feb 18, 2026
56dec14
chore(coprocessor): add msg_broker
goshawk-3 Feb 18, 2026
9d89d16
chore(coprocessor): update tfhe-dispatcher, tfhe-compute-node
goshawk-3 Feb 19, 2026
7d987e0
chore(coprocessor): re-randomize non-scalar inputs
goshawk-3 Feb 20, 2026
133c9c0
chore(coprocessor): update dispatcher
goshawk-3 Feb 20, 2026
d1b9d9c
chore(coprocessor): fetch cks_key
goshawk-3 Feb 20, 2026
33ffb5a
chore(coprocessor): update cargo.lock
goshawk-3 Feb 20, 2026
ad9f69c
feat(coprocessor): implement message broker abstraction
goshawk-3 Mar 9, 2026
11435d8
chore(coprocessor): refactor tfhe-dispatcher to integrate with the me…
goshawk-3 Mar 9, 2026
b73c24a
chore(coprocessor): refactor tfhe-compute-node to integrate with the …
goshawk-3 Mar 9, 2026
c3019cd
chore(coprocessor): remove message-broker related code from engine-co…
goshawk-3 Mar 9, 2026
1f9b015
chore(coprocessor): implement create_default_receiver in message broker
goshawk-3 Mar 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
840 changes: 838 additions & 2 deletions coprocessor/fhevm-engine/Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions coprocessor/fhevm-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
resolver = "2"
members = [
"tfhe-worker",
"tfhe-dispatcher",
"tfhe-compute-node",
"fhevm-engine-common",
"host-listener",
"gw-listener",
Expand Down
26 changes: 26 additions & 0 deletions coprocessor/fhevm-engine/fhevm-engine-common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,32 @@ impl SupportedFheCiphertexts {
}
}

pub fn deserialize(ct_type: i16, bytes: &[u8]) -> Result<Self, FhevmError> {
match ct_type {
0 => Ok(SupportedFheCiphertexts::FheBool(safe_deserialize(bytes)?)),
1 => Ok(SupportedFheCiphertexts::FheUint4(safe_deserialize(bytes)?)),
2 => Ok(SupportedFheCiphertexts::FheUint8(safe_deserialize(bytes)?)),
3 => Ok(SupportedFheCiphertexts::FheUint16(safe_deserialize(bytes)?)),
4 => Ok(SupportedFheCiphertexts::FheUint32(safe_deserialize(bytes)?)),
5 => Ok(SupportedFheCiphertexts::FheUint64(safe_deserialize(bytes)?)),
6 => Ok(SupportedFheCiphertexts::FheUint128(safe_deserialize(
bytes,
)?)),
7 => Ok(SupportedFheCiphertexts::FheUint160(safe_deserialize(
bytes,
)?)),
8 => Ok(SupportedFheCiphertexts::FheUint256(safe_deserialize(
bytes,
)?)),
9 => Ok(SupportedFheCiphertexts::FheBytes64(safe_deserialize(
bytes,
)?)),
10 => Ok(SupportedFheCiphertexts::FheBytes128(safe_deserialize(bytes)?)),
11 => Ok(SupportedFheCiphertexts::FheBytes256(safe_deserialize(bytes)?)),
_ => Err(FhevmError::UnknownFheType(ct_type as i32).into()),
}
}

pub fn to_ciphertext64(self) -> BaseRadixCiphertext<Ciphertext> {
match self {
SupportedFheCiphertexts::FheBool(v) => {
Expand Down
81 changes: 81 additions & 0 deletions coprocessor/fhevm-engine/tfhe-compute-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[package]
name = "tfhe-compute-node"
version = "0.7.0"
default-run = "tfhe_compute_node"
authors.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
# workspace dependencies
alloy = { workspace = true }
bigdecimal = { workspace = true }
clap = { workspace = true }
hex = { workspace = true }
lru = { workspace = true }
prometheus = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
rayon = { workspace = true }
serde_json = { workspace = true }
sha3 = { workspace = true }
strum = { workspace = true }
sqlx = { workspace = true }
tfhe = { workspace = true }
tfhe-zk-pok = { workspace = true }
time = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
tonic = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
# opentelemetry support
opentelemetry = { workspace = true }
opentelemetry-otlp = { workspace = true }
opentelemetry_sdk = { workspace = true }
opentelemetry-semantic-conventions = { workspace = true }
chrono = { workspace = true }
serde = { workspace = true }

# crates.io dependencies
actix-web = "4.9.0"
itertools = "0.13.0"
lazy_static = "1.5.0"
regex = "1.10.6"
tonic-health = "0.12.3"
tonic-types = "0.12.3"
tonic-web = "0.12.3"
uuid = { version = "1", features = ["v4"] }

# local dependencies
fhevm-engine-common = { path = "../fhevm-engine-common" }
scheduler = { path = "../scheduler" }
lapin = "3.7.2"
futures-util.workspace = true
redis = {version = "1.0.3", features = ["tokio-comp", "aio", "connection-manager"] }
postcard = { version = "1.1.3", features = ["alloc"] }
daggy.workspace = true
thiserror.workspace = true


[features]
nightly-avx512 = ["tfhe/nightly-avx512"]
gpu = ["tfhe/gpu", "scheduler/gpu", "fhevm-engine-common/gpu"]
bench = []
latency = ["fhevm-engine-common/latency"]
throughput = ["fhevm-engine-common/throughput"]

[dev-dependencies]
criterion = { version = "0.5.1", features = ["async_futures"] }
testcontainers = { workspace = true }
test-harness = { path = "../test-harness" }
serde = { workspace = true }
serial_test = { workspace = true }

[build-dependencies]
tonic-build = { workspace = true }

[[bin]]
name = "tfhe_compute_node"
path = "src/bin/tfhe_compute_node.rs"

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
let args = tfhe_compute_node::cli::parse();
//TODO: add signal handler and pass close_recv
tfhe_compute_node::start_runtime(args, None);
}
60 changes: 60 additions & 0 deletions coprocessor/fhevm-engine/tfhe-compute-node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use clap::Parser;
use fhevm_engine_common::utils::DatabaseURL;
use tracing::Level;
use uuid::Uuid;

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
pub struct Args {
/// Postgres database url. If unspecified DATABASE_URL environment variable is used
#[arg(long)]
pub database_url: Option<DatabaseURL>,

/// Redis URL
#[arg(long)]
pub redis_url: String,

/// RabbitMQ URI
#[arg(long, default_value = "amqp://guest:guest@localhost:5672/%2f")]
pub rmq_uri: String,

/// Tenant key cache size
#[arg(long, default_value_t = 32)]
pub tenant_key_cache_size: i32,

/// Ciphertext cache size
#[arg(long, default_value_t = 1000)]
pub ciphertext_cache_size: i32,

/// tfhe-worker service name in OTLP traces
#[arg(long, default_value = "tfhe-compute-node")]
pub service_name: String,

/// Prometheus metrics server address
#[arg(long, default_value = "0.0.0.0:9100")]
pub metrics_addr: Option<String>,

/// Tokio processing threads
#[arg(long, default_value_t = 32)]
pub blocking_fhe_threads: usize,

/// Tokio Async IO threads
#[arg(long, default_value_t = 4)]
pub tokio_threads: usize,

/// Log level for the application
#[arg(
long,
value_parser = clap::value_parser!(Level),
default_value_t = Level::INFO)]
pub log_level: Level,

/// Worker/replica ID for this worker instance
/// If not provided, a random UUID will be generated
#[arg(long, value_parser = clap::value_parser!(Uuid))]
pub worker_id: Option<Uuid>,
}

pub fn parse() -> Args {
Args::parse()
}
Loading
Loading