Skip to content

Commit 0654881

Browse files
authored
Merge pull request #17 from alpenlabs/feature/new-model-rpcs
refactor: remove irrelevant RPCs
2 parents 1d82eac + db28e90 commit 0654881

3 files changed

Lines changed: 21 additions & 97 deletions

File tree

crates/rpc/api/src/traits.rs

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,69 +35,19 @@ pub trait MosaicRpc {
3535
// ==== Protocol flow.
3636

3737
/// Creates an instance of a tableset game.
38-
#[method(name = "mosaic_createTablesetGame")]
39-
fn create_tableset_instance(&self, config: RpcTablesetConfig) -> RpcResult<TablesetId>;
38+
#[method(name = "mosaic_createGame")]
39+
fn create_game_instance(&self, config: RpcGameInstanceConfig) -> RpcResult<TablesetId>;
4040

4141
/// Gets current info about about a game.
4242
#[method(name = "mosaic_getGameInfo")]
4343
fn get_game_info(&self, tsid: TablesetId) -> RpcResult<GameInfo>;
4444

45-
/// Starts generating the garbler side's commitments.
46-
#[method(name = "mosaic_startGenGarbCommitments")]
47-
fn start_generate_game_tableset(&self, tsid: TablesetId) -> RpcResult<JobId>;
48-
49-
/// Gets the garbler commitments to send to the verifier.
50-
#[method(name = "mosaic_getGarbCommitments")]
51-
fn get_garb_commitments(&self, tsid: TablesetId) -> RpcResult<TablesetCommitments>;
52-
53-
/// Provides the tableset commitments from the garbler. Returns the table
54-
/// ID's we're choosing to open.
55-
#[method(name = "mosaic_provideGarbTablesetCommitments")]
56-
fn provide_garb_commitments(
57-
&self,
58-
tsid: TablesetId,
59-
commitments: TablesetCommitments,
60-
) -> RpcResult<CacChoices>;
61-
62-
/// Provides the CaC choices from the evaluator.
63-
#[method(name = "mosaic_provideEvalCacChoices")]
64-
fn provide_eval_cac_choices(&self, tsid: TablesetId, choices: CacChoices) -> RpcResult<()>;
65-
66-
/// Gets the tableset seeds for each table according to the previously-
67-
/// provided CaC choices.
68-
#[method(name = "mosaic_getCacSeeds")]
69-
fn get_cac_seeds(&self, tsid: TablesetId) -> RpcResult<CacSeeds>;
70-
71-
/// Provides the evaluator with the garbler's seeds for each table that we
72-
/// can verify.
73-
#[method(name = "mosaic_startVerifyGarbCacSeeds")]
74-
fn start_verify_garb_cac_seeds(&self, tsid: TablesetId, seeds: CacSeeds) -> RpcResult<JobId>;
75-
76-
/// Checks if the we've successfully verified the seeds for the tables we
77-
/// opened from the garbler. This means the other tables in the tableset
78-
/// are probably okay.
79-
#[method(name = "mosaic_checkVerifyGarbCacSeeds")]
80-
fn check_verify_cac_commitments(&self, tsid: TablesetId) -> RpcResult<bool>;
81-
82-
/// Starts exporting the unopened tables so that we can provide them to the
83-
/// evaluator.
84-
#[method(name = "mosaic_startExportUnopenedTables")]
85-
fn start_export_unopened_tables(&self, tsid: TablesetId) -> RpcResult<JobId>;
86-
8745
/// Gets the data for exchanging exported tables.
8846
#[method(name = "mosaic_getTableExportData")]
8947
fn get_export_data(&self, tsid: TablesetId) -> RpcResult<TableExportMeta>;
9048

9149
// TODO more methods for dealing with exports here?
9250

93-
/// Starts downloading exported tables from the provided metadata.
94-
#[method(name = "mosaic_startDownloadTableExport")]
95-
fn start_download_table_export(
96-
&self,
97-
tsid: TablesetId,
98-
export_meta: TableExportMeta,
99-
) -> RpcResult<JobId>;
100-
10151
/// Starts evaluating the tables in the set using the provided inputs.
10252
#[method(name = "mosaic_startEvalTableset")]
10353
fn start_eval_tableset(&self, tsid: TablesetId, inputs: TableEvalInputs) -> RpcResult<JobId>;
@@ -106,4 +56,8 @@ pub trait MosaicRpc {
10656
/// provided inputs.
10757
#[method(name = "mosaic_getEvalOutputs")]
10858
fn get_eval_outputs(&self, tsid: TablesetId) -> RpcResult<TableEvalOutputs>;
59+
60+
/// Cleans up a completed game, regardless of its state.
61+
#[method(name = "mosaic_cleanupGame")]
62+
fn cleanup_game(&self, tsid: TablesetId) -> RpcResult<()>;
10963
}

crates/rpc/server/src/server.rs

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,67 +34,27 @@ impl<P: RpcContextProvider> MosaicRpcServer for RpcServerImpl<P> {
3434
todo!()
3535
}
3636

37-
fn create_tableset_instance(&self, config: RpcTablesetConfig) -> RpcResult<TablesetId> {
37+
fn create_game_instance(&self, config: RpcGameInstanceConfig) -> RpcResult<TablesetId> {
3838
todo!()
3939
}
4040

4141
fn get_game_info(&self, tsid: TablesetId) -> RpcResult<GameInfo> {
4242
todo!()
4343
}
4444

45-
fn start_generate_game_tableset(&self, tsid: TablesetId) -> RpcResult<JobId> {
46-
todo!()
47-
}
48-
49-
fn get_garb_commitments(&self, tsid: TablesetId) -> RpcResult<TablesetCommitments> {
50-
todo!()
51-
}
52-
53-
fn provide_garb_commitments(
54-
&self,
55-
tsid: TablesetId,
56-
commitments: TablesetCommitments,
57-
) -> RpcResult<CacChoices> {
58-
todo!()
59-
}
60-
61-
fn provide_eval_cac_choices(&self, tsid: TablesetId, choices: CacChoices) -> RpcResult<()> {
62-
todo!()
63-
}
64-
65-
fn get_cac_seeds(&self, tsid: TablesetId) -> RpcResult<CacSeeds> {
66-
todo!()
67-
}
68-
69-
fn start_verify_garb_cac_seeds(&self, tsid: TablesetId, seeds: CacSeeds) -> RpcResult<JobId> {
70-
todo!()
71-
}
72-
73-
fn check_verify_cac_commitments(&self, tsid: TablesetId) -> RpcResult<bool> {
74-
todo!()
75-
}
76-
77-
fn start_export_unopened_tables(&self, tsid: TablesetId) -> RpcResult<JobId> {
78-
todo!()
79-
}
80-
8145
fn get_export_data(&self, tsid: TablesetId) -> RpcResult<TableExportMeta> {
8246
todo!()
8347
}
8448

85-
fn start_download_table_export(
86-
&self,
87-
tsid: TablesetId,
88-
export_meta: TableExportMeta,
89-
) -> RpcResult<JobId> {
49+
fn start_eval_tableset(&self, tsid: TablesetId, inputs: TableEvalInputs) -> RpcResult<JobId> {
9050
todo!()
9151
}
9252

93-
fn start_eval_tableset(&self, tsid: TablesetId, inputs: TableEvalInputs) -> RpcResult<JobId> {
53+
fn get_eval_outputs(&self, tsid: TablesetId) -> RpcResult<TableEvalOutputs> {
9454
todo!()
9555
}
9656

97-
fn get_eval_outputs(&self, tsid: TablesetId) -> RpcResult<TableEvalOutputs> {
57+
fn cleanup_game(&self, tsid: TablesetId) -> RpcResult<()> {
9858
todo!()
9959
}
10060
}

crates/rpc/types/src/tableset.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
33

44
/// Configuration provided as part of setting up a game instance.
55
#[derive(Clone, Debug, Deserialize, Serialize)]
6-
pub struct RpcTablesetConfig {
6+
pub struct RpcGameInstanceConfig {
77
/// The name of the circuit we'll use.
88
///
99
/// This matches the client configuration for where to find this circuit information.
@@ -14,4 +14,14 @@ pub struct RpcTablesetConfig {
1414

1515
/// CaC game configuration.
1616
cac_config: CacConfig,
17+
18+
/// Peer connection information.
19+
peer_info: GamePeerInfo,
20+
}
21+
22+
/// Describes information about the peer we're interacting with so we can
23+
/// connect to them and authenticate messages.
24+
#[derive(Clone, Debug, Deserialize, Serialize)]
25+
pub struct GamePeerInfo {
26+
// TODO
1727
}

0 commit comments

Comments
 (0)