1+ use mosaic_common:: { PeerId , constants:: N_SETUP_INPUT_WIRES } ;
12use serde:: { Deserialize , Serialize } ;
23
4+ use crate :: TablesetInstanceId ;
5+
36/// Info about a CaC game.
47#[ derive( Clone , Debug , Deserialize , Serialize ) ]
5- pub struct GameInfo {
8+ pub struct TablesetSetupInfo {
69 circuit_name : String ,
710 role : CacRole ,
8- config : CacConfig ,
9- state : GameState ,
11+ cac_params : CacParams ,
12+ setup_inputs : SetupWireInputs ,
13+ instance : TablesetInstanceId ,
14+ peer : PeerId ,
1015}
1116
1217/// The role the client should play in the garbling game.
@@ -20,32 +25,37 @@ pub enum CacRole {
2025 Evaluator ,
2126}
2227
23- /// Configuration for the CaC game .
24- #[ derive( Clone , Debug , Deserialize , Serialize ) ]
25- pub struct CacConfig {
26- /// The number of tables we'll generate to start off.
27- tables : u32 ,
28-
29- /// The number of tables to open as part of the setup process.
30- open : u32 ,
28+ /// Cac params that can be used to setup .
29+ #[ derive( Copy , Clone , Debug , Deserialize , Serialize ) ]
30+ pub enum CacParams {
31+ /// default
32+ N181K174 ,
33+ /// for testing (only available in debug builds)
34+ # [ cfg ( debug_assertions ) ]
35+ N5K3 ,
3136}
3237
33- /// Describes the high-level state of a game.
34- # [ derive ( Copy , Clone , Debug , Eq , PartialEq , Deserialize , Serialize ) ]
35- # [ serde ( rename_all = "lowercase" ) ]
36- pub enum GameState {
37- /// In the setup process.
38- Setup ,
39-
40- /// Setup finished, ready to eval.
41- Idle ,
42-
43- /// Evaluating .
44- Evaling ,
45-
46- /// Evaluated.
47- Evaled ,
48-
49- /// Dishonesty detected, aborted.
50- Abort ,
38+ impl CacParams {
39+ /// Total number of tables.
40+ pub fn tables ( & self ) -> u64 {
41+ match self {
42+ CacParams :: N181K174 => 181 ,
43+ # [ cfg ( debug_assertions ) ]
44+ CacParams :: N5K3 => 5 ,
45+ }
46+ }
47+
48+ /// Number of openings during Cac .
49+ pub fn selected_openings ( & self ) -> u64 {
50+ match self {
51+ CacParams :: N181K174 => 174 ,
52+ # [ cfg ( debug_assertions ) ]
53+ CacParams :: N5K3 => 3 ,
54+ }
55+ }
5156}
57+
58+ /// Input wire values provided during setup.
59+ /// This corresponds to operator bridge pubkey.
60+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
61+ pub struct SetupWireInputs ( [ u8 ; N_SETUP_INPUT_WIRES ] ) ;
0 commit comments