Skip to content

Commit

Permalink
remove set_state from trait
Browse files Browse the repository at this point in the history
  • Loading branch information
xoloki committed Oct 23, 2023
1 parent 7f599b9 commit 0974a5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
9 changes: 2 additions & 7 deletions src/state_machine/coordinator/fire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,6 @@ impl<Aggregator: AggregatorTrait> CoordinatorTrait for Coordinator<Aggregator> {
self.state.clone()
}

/// Set the current state
fn set_state(&mut self, state: State) {
self.state = state;
}

/// Start a DKG round
fn start_dkg_round(&mut self) -> Result<Packet, Error> {
self.current_dkg_id = self.current_dkg_id.wrapping_add(1);
Expand Down Expand Up @@ -718,7 +713,7 @@ pub mod test {
};
let mut coordinator = FireCoordinator::<Aggregator>::new(config);

coordinator.set_state(State::DkgPublicDistribute); // Must be in this state before calling start public shares
coordinator.state = State::DkgPublicDistribute; // Must be in this state before calling start public shares

let result = coordinator.start_public_shares().unwrap();

Expand Down Expand Up @@ -747,7 +742,7 @@ pub mod test {
};
let mut coordinator = FireCoordinator::<Aggregator>::new(config);

coordinator.set_state(State::DkgPrivateDistribute); // Must be in this state before calling start private shares
coordinator.state = State::DkgPrivateDistribute; // Must be in this state before calling start private shares

let message = coordinator.start_private_shares().unwrap();
assert!(matches!(message.msg, Message::DkgPrivateBegin(_)));
Expand Down
9 changes: 2 additions & 7 deletions src/state_machine/coordinator/frost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,6 @@ impl<Aggregator: AggregatorTrait> CoordinatorTrait for Coordinator<Aggregator> {
self.state.clone()
}

/// Set the current state
fn set_state(&mut self, state: State) {
self.state = state;
}

/// Start a DKG round
fn start_dkg_round(&mut self) -> Result<Packet, Error> {
self.current_dkg_id = self.current_dkg_id.wrapping_add(1);
Expand Down Expand Up @@ -664,7 +659,7 @@ pub mod test {
};
let mut coordinator = FrostCoordinator::<Aggregator>::new(config);

coordinator.set_state(State::DkgPublicDistribute); // Must be in this state before calling start public shares
coordinator.state = State::DkgPublicDistribute; // Must be in this state before calling start public shares

let result = coordinator.start_public_shares().unwrap();

Expand Down Expand Up @@ -693,7 +688,7 @@ pub mod test {
};
let mut coordinator = FrostCoordinator::<Aggregator>::new(config);

coordinator.set_state(State::DkgPrivateDistribute); // Must be in this state before calling start private shares
coordinator.state = State::DkgPrivateDistribute; // Must be in this state before calling start private shares

let message = coordinator.start_private_shares().unwrap();
assert!(matches!(message.msg, Message::DkgPrivateBegin(_)));
Expand Down
3 changes: 0 additions & 3 deletions src/state_machine/coordinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ pub trait Coordinator {
/// Retrive the current state
fn get_state(&self) -> State;

/// Set the current state
fn set_state(&mut self, state: State);

/// Trigger a DKG round
fn start_dkg_round(&mut self) -> Result<Packet, Error>;

Expand Down

0 comments on commit 0974a5d

Please sign in to comment.