Skip to content

Commit d782070

Browse files
committed
add composite actions and inputs
1 parent 6e87b62 commit d782070

4 files changed

Lines changed: 31 additions & 2 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//! Combined inputs and actions of all state machines.
2+
3+
use crate::{
4+
evaluator::{ActionContainer as EvaluatorActionContainer, input::Input as EvaluatorInput},
5+
garbler::{ActionContainer as GarblerActionContainer, input::Input as GarblerInput},
6+
};
7+
8+
/// All possible state machine inputs
9+
#[derive(Debug)]
10+
pub enum Input {
11+
/// Garbler SM inputs
12+
Garbler(GarblerInput),
13+
/// Evaluator SM inputs
14+
Evaluator(EvaluatorInput),
15+
}
16+
17+
/// All possible action container outputs
18+
#[derive(Debug)]
19+
pub enum ActionContainer {
20+
/// Garbler action container
21+
Garbler(GarblerActionContainer),
22+
/// Evaluator action container
23+
Evaluator(EvaluatorActionContainer),
24+
}

crates/cac/protocol/src/evaluator/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<S: EvaluatorArtifactStore> StateMachine for EvaluatorSM<S> {
3434

3535
type UntrackedAction = EvaluatorUntrackedAction;
3636

37-
type Actions = Vec<Action<EvaluatorUntrackedAction, EvaluatorTrackedActionTypes>>;
37+
type Actions = ActionContainer;
3838

3939
type TransitionError = SMError;
4040

@@ -89,3 +89,5 @@ impl TrackedActionTypes for EvaluatorTrackedActionTypes {
8989

9090
type Result = ();
9191
}
92+
93+
pub type ActionContainer = Vec<Action<EvaluatorUntrackedAction, EvaluatorTrackedActionTypes>>;

crates/cac/protocol/src/garbler/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<S: GarblerArtifactStore> StateMachine for GarblerSM<S> {
3434

3535
type UntrackedAction = GarblerUntrackedAction;
3636

37-
type Actions = Vec<Action<GarblerUntrackedAction, GarblerTrackedActionTypes>>;
37+
type Actions = ActionContainer;
3838

3939
type TransitionError = SMError;
4040

@@ -89,3 +89,5 @@ impl TrackedActionTypes for GarblerTrackedActionTypes {
8989

9090
type Result = ();
9191
}
92+
93+
pub type ActionContainer = Vec<Action<GarblerUntrackedAction, GarblerTrackedActionTypes>>;

crates/cac/protocol/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! protocol state machines
22
3+
pub mod composite;
34
pub mod deposit;
45
mod error;
56
pub mod evaluator;

0 commit comments

Comments
 (0)