Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
144 changes: 143 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ members = [
"crates/adaptor-sigs",
"crates/cac/crypto",
"crates/cac/proto-types",
"crates/cac/protocol",
"crates/cac/types",
"crates/common",
"crates/compute-exec",
"crates/compute-fw",
"crates/job/types",
"crates/network/api",
"crates/rpc/api",
"crates/rpc/provider",
"crates/rpc/server",
"crates/rpc/types",
"crates/state-machine/api",
"crates/state-machine/executor",
"crates/storage/api",
"crates/table-types",
"crates/vs3",
]
Expand Down Expand Up @@ -42,24 +48,36 @@ clippy.too_long_first_doc_paragraph = "warn"

[workspace.dependencies]
mosaic-cac-proto-types = { path = "crates/cac/proto-types" }
mosaic-cac-protocol = { path = "crates/cac/protocol" }
mosaic-cac-types = { path = "crates/cac/types" }
mosaic-common = { path = "crates/common" }
mosaic-compute-fw = { path = "crates/compute-fw" }
mosaic-job-types = { path = "crates/job/types" }
mosaic-rpc-api = { path = "crates/rpc/api" }
mosaic-rpc-provider = { path = "crates/rpc/provider" }
mosaic-rpc-types = { path = "crates/rpc/types" }
mosaic-state-machine-api = { path = "crates/state-machine/api" }
mosaic-state-machine-executor = { path = "crates/state-machine/executor" }
mosaic-storage-api = { path = "crates/storage/api" }
mosaic-table-types = { path = "crates/table-types" }
mosaic-vs3 = { path = "crates/vs3" }

anyhow = "1.0"
ark-ec = "0.5.0"
ark-ff = "0.5.0"
ark-secp256k1 = "0.5.0"
async-trait = "0.1"
bytes = "1.10"
futures = "0.3.31"
jsonrpsee = { version = "0.26.0", features = ["macros"] }
jsonrpsee-types = "*" # constrained by jsonrpsee dep
jsonrpsee-types = "*" # constrained by jsonrpsee dep
rand = "0.8"
rand_core = "0.6"
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
strata-codec = { git = "https://github.com/alpenlabs/strata-common.git" }
thiserror = "2.0"
tokio = { version = "1.48.0", features = ["rt", "sync", "macros", "time"] }
tokio-util = "0.7"
tracing = "0.1"

[profile.release]
Expand Down
2 changes: 2 additions & 0 deletions crates/cac/proto-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ categories.workspace = true
keywords.workspace = true

[dependencies]
mosaic-common.workspace = true

serde.workspace = true

[lints]
Expand Down
68 changes: 39 additions & 29 deletions crates/cac/proto-types/src/game.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
use mosaic_common::{PeerId, constants::N_SETUP_INPUT_WIRES};
use serde::{Deserialize, Serialize};

use crate::TablesetInstanceId;

/// Info about a CaC game.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GameInfo {
pub struct TablesetSetupInfo {
circuit_name: String,
role: CacRole,
config: CacConfig,
state: GameState,
cac_params: CacParams,
setup_inputs: SetupWireInputs,
instance: TablesetInstanceId,
peer: PeerId,
}

/// The role the client should play in the garbling game.
Expand All @@ -20,32 +25,37 @@ pub enum CacRole {
Evaluator,
}

/// Configuration for the CaC game.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CacConfig {
/// The number of tables we'll generate to start off.
tables: u32,

/// The number of tables to open as part of the setup process.
open: u32,
/// Cac params that can be used to setup.
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
pub enum CacParams {
/// default
N181K174,
/// for testing (only available in debug builds)
#[cfg(debug_assertions)]
N5K3,
}

/// Describes the high-level state of a game.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum GameState {
/// In the setup process.
Setup,

/// Setup finished, ready to eval.
Idle,

/// Evaluating.
Evaling,

/// Evaluated.
Evaled,

/// Dishonesty detected, aborted.
Abort,
impl CacParams {
/// Total number of tables.
pub fn tables(&self) -> u64 {
match self {
CacParams::N181K174 => 181,
#[cfg(debug_assertions)]
CacParams::N5K3 => 5,
}
}

/// Number of openings during Cac.
pub fn selected_openings(&self) -> u64 {
match self {
CacParams::N181K174 => 174,
#[cfg(debug_assertions)]
CacParams::N5K3 => 3,
}
}
}

/// Input wire values provided during setup.
/// This corresponds to operator bridge pubkey.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SetupWireInputs([u8; N_SETUP_INPUT_WIRES]);
Loading
Loading