Skip to content

Commit

Permalink
feat: introduce skeletons for new components
Browse files Browse the repository at this point in the history
Introduce the following new components:
 * fhevm-listener (renamed from listener)
 * gw-listener
 * zkproof-worker

This commit only specifies their name and some of their configuration
options.
  • Loading branch information
dartdart26 committed Feb 12, 2025
1 parent 687ed14 commit 85f0aed
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 994 deletions.
1,229 changes: 254 additions & 975 deletions fhevm-engine/Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion fhevm-engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[workspace]
resolver = "2"
members = ["coprocessor", "executor", "fhevm-engine-common", "listener", "sns-executor", "transaction-sender"]
members = ["coprocessor", "executor", "fhevm-engine-common", "fhevm-listener", "gw-listener", "sns-executor", "transaction-sender", "zkproof-worker"]

[workspace.package]
authors = ["Zama"]
edition = "2021"
license = "BSD-3-Clause-Clear"

[workspace.dependencies]
alloy = { version = "0.11.1", features = ["full", "provider-anvil-api", "provider-anvil-node", "sol-types"] }
anyhow = "1.0.86"
bincode = "1.3.3"
clap = { version = "4.5", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion fhevm-engine/coprocessor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true

[dependencies]
# workspace dependencies
alloy = { workspace = true }
bincode = { workspace = true }
clap = { workspace = true }
prometheus = { workspace = true }
Expand All @@ -23,7 +24,6 @@ tracing-subscriber = { workspace = true }

# crates.io dependencies
actix-web = "4.9.0"
alloy = { version = "0.3.2", features = ["eip712", "sol-types", "signer-local"] }
bigdecimal = "0.4"
hex = "0.4"
itertools = "0.13.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "listener"
name = "fhevm-listener"
version = "0.0.1"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Listener
# fhEVM-Listener

The listener primary role is to observe the block chain execution and extend that execution off the chain.
The fhevm-listener primary role is to observe the block chain execution and extend that execution off the chain.

## How

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use alloy_sol_types::SolEventInterface;

use clap::Parser;

use listener::contracts::{AclContract, TfheContract};
use fhevm_listener::contracts::{AclContract, TfheContract};

const DEFAULT_BLOCK: BlockNumberOrTag = BlockNumberOrTag::Latest;
const DEFAULT_CATCHUP: u64 = 5;

#[derive(Parser, Debug, Clone)]
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions fhevm-engine/gw-listener/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "gw-listener"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
# workspace dependencies
alloy = { workspace = true }
clap = { workspace = true }
26 changes: 26 additions & 0 deletions fhevm-engine/gw-listener/src/bin/gw_listener.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use alloy::primitives::Address;
use clap::Parser;

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
struct Args {
#[arg(short, long)]
database_url: Option<String>,

#[arg(short, long, default_value = "16")]
database_pool_size: u32,

#[arg(short, long)]
gw_url: String,

#[arg(short, long)]
zkpok_manager_address: Address,

#[arg(short, long, default_value = "1")]
error_sleep_initial_secs: u16,

#[arg(short, long, default_value = "10")]
error_sleep_max_secs: u16,
}

fn main() {}
14 changes: 14 additions & 0 deletions fhevm-engine/gw-listener/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
2 changes: 1 addition & 1 deletion fhevm-engine/transaction-sender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license.workspace = true

[dependencies]
# workspace dependencies
alloy = { workspace = true }
anyhow = { workspace = true }
clap = { workspace = true }
futures-util = { workspace = true }
Expand All @@ -17,7 +18,6 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }

# crates.io dependencies
alloy = { version = "0.11.0", features = ["full", "provider-anvil-api", "provider-anvil-node"] }
async-trait = "0.1.86"

[build-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions fhevm-engine/transaction-sender/src/bin/transaction_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ struct Conf {
#[arg(short, long)]
database_url: Option<String>,

#[arg(short, long, default_value = "16")]
#[arg(short, long, default_value = "10")]
database_pool_size: u32,

#[arg(short, long, default_value = "5")]
database_polling_interval_secs: u16,

#[arg(short, long, default_value = "verify_proofs")]
verify_proofs_database_channel: String,
#[arg(short, long, default_value = "verify_proof_responses")]
verify_proof_resp_database_channel: String,

#[arg(short, long, default_value = "add_ciphertexts")]
add_ciphertexts_database_channel: String,

#[arg(short, long, default_value = "64")]
#[arg(short, long, default_value = "128")]
verify_proofs_batch_limit: u32,

#[arg(short, long, default_value = "10")]
#[arg(short, long, default_value = "15")]
verify_proofs_max_retries: u32,

#[arg(short, long, default_value = "1")]
Expand Down Expand Up @@ -90,7 +90,7 @@ async fn main() -> anyhow::Result<()> {
db_url: database_url,
db_pool_size: conf.database_pool_size,

verify_proofs_db_channel: conf.verify_proofs_database_channel,
verify_proof_resp_db_channel: conf.verify_proof_resp_database_channel,
add_ciphertexts_db_channel: conf.add_ciphertexts_database_channel,

verify_proofs_batch_limit: conf.verify_proofs_batch_limit,
Expand Down
10 changes: 5 additions & 5 deletions fhevm-engine/transaction-sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct ConfigSettings {
pub db_url: String,
pub db_pool_size: u32,

pub verify_proofs_db_channel: String,
pub verify_proof_resp_db_channel: String,
pub add_ciphertexts_db_channel: String,

pub verify_proofs_batch_limit: u32,
Expand All @@ -22,11 +22,11 @@ impl Default for ConfigSettings {
fn default() -> Self {
Self {
db_url: std::env::var("DATABASE_URL").expect("DATABASE_URL is undefined"),
db_pool_size: 16,
verify_proofs_db_channel: "verify_proofs".to_owned(),
db_pool_size: 10,
verify_proof_resp_db_channel: "verify_proofs".to_owned(),
add_ciphertexts_db_channel: "add_ciphertexts".to_owned(),
verify_proofs_batch_limit: 64,
verify_proofs_max_retries: 10,
verify_proofs_batch_limit: 128,
verify_proofs_max_retries: 15,
db_polling_interval_secs: 5,
error_sleep_initial_secs: 1,
error_sleep_max_secs: 16,
Expand Down
22 changes: 22 additions & 0 deletions fhevm-engine/zkproof-worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "zkproof-worker"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
# workspace dependencies
clap = { workspace = true }

# crates.io dependencies


# arch-specific dependencies
[target.'cfg(target_arch = "x86_64")'.dependencies]
tfhe = { workspace = true, features = ["x86_64-unix"] }
[target.'cfg(target_arch = "aarch64")'.dependencies]
tfhe = { workspace = true, features = ["aarch64-unix"] }

[features]
nightly-avx512 = ["tfhe/nightly-avx512"]
28 changes: 28 additions & 0 deletions fhevm-engine/zkproof-worker/src/bin/zkproof_worker.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use clap::Parser;

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
struct Conf {
#[arg(short, long)]
database_url: Option<String>,

#[arg(short, long, default_value = "10")]
database_pool_size: u32,

#[arg(short, long, default_value = "5")]
database_polling_interval_secs: u16,

#[arg(short, long, default_value = "verify_proof_resquests")]
verify_proof_req_database_channel: String,

#[arg(short, long, default_value = "16")]
tokio_blocking_threads: usize,

#[arg(short, long, default_value = "1")]
error_sleep_initial_secs: u16,

#[arg(short, long, default_value = "10")]
error_sleep_max_secs: u16,
}

fn main() {}
14 changes: 14 additions & 0 deletions fhevm-engine/zkproof-worker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

0 comments on commit 85f0aed

Please sign in to comment.