Skip to content

Commit e602ffc

Browse files
committed
feat: remove old states from signer state machine
1 parent e536027 commit e602ffc

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

mithril-signer/src/runtime/state_machine.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,6 @@ pub enum SignerState {
2323
epoch: Epoch,
2424
},
2525

26-
/// `Registered` state. The signer has successfully registered against the
27-
/// aggregator for this Epoch, it is now able to sign.
28-
Registered {
29-
/// Epoch when Signer may sign.
30-
epoch: Epoch,
31-
},
32-
33-
/// `Signed` state. The signer has signed the message for the
34-
/// current pending certificate.
35-
Signed {
36-
/// Epoch when signer signed.
37-
epoch: Epoch,
38-
39-
/// Entity type that is signed
40-
signed_entity_type: SignedEntityType,
41-
},
42-
4326
/// `ReadyToSign` state. The signer is registered and ready to sign new messages.
4427
ReadyToSign {
4528
/// Time point when signer transited to the state.
@@ -67,11 +50,6 @@ impl SignerState {
6750
matches!(*self, SignerState::Unregistered { epoch: _ })
6851
}
6952

70-
/// Returns `true` if the state in `Registered`
71-
pub fn is_registered(&self) -> bool {
72-
matches!(*self, SignerState::Registered { epoch: _ })
73-
}
74-
7553
/// Returns `true` if the state in `ReadyToSign`
7654
pub fn is_ready_to_sign(&self) -> bool {
7755
matches!(
@@ -87,29 +65,13 @@ impl SignerState {
8765
pub fn is_registered_not_able_to_sign(&self) -> bool {
8866
matches!(*self, SignerState::RegisteredNotAbleToSign { epoch: _ })
8967
}
90-
91-
/// Returns `true` if the state in `Signed`
92-
pub fn is_signed(&self) -> bool {
93-
matches!(
94-
*self,
95-
SignerState::Signed {
96-
epoch: _,
97-
signed_entity_type: _
98-
}
99-
)
100-
}
10168
}
10269

10370
impl Display for SignerState {
10471
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10572
match self {
10673
Self::Init => write!(f, "Init"),
10774
Self::Unregistered { epoch } => write!(f, "Unregistered - {epoch:?}"),
108-
Self::Registered { epoch } => write!(f, "Registered - {epoch}"),
109-
Self::Signed {
110-
epoch,
111-
signed_entity_type,
112-
} => write!(f, "Signed - {epoch} - {signed_entity_type:?}"),
11375
Self::RegisteredNotAbleToSign { epoch } => {
11476
write!(f, "RegisteredNotAbleToSign - {epoch}")
11577
}
@@ -224,15 +186,6 @@ impl StateMachine {
224186
info!("→ No epoch settings found yet, waiting…");
225187
}
226188
}
227-
SignerState::Registered { epoch: _epoch } => {
228-
todo!("Will be removed")
229-
}
230-
SignerState::Signed {
231-
epoch: _epoch,
232-
signed_entity_type: _signed_entity_type,
233-
} => {
234-
todo!("Will be removed")
235-
}
236189
SignerState::RegisteredNotAbleToSign { epoch } => {
237190
if let Some(new_epoch) = self.has_epoch_changed(*epoch).await? {
238191
info!(" → new Epoch detected, transiting to UNREGISTERED");

mithril-signer/tests/test_extensions/state_machine_tester.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -308,19 +308,6 @@ impl StateMachineTester {
308308
)
309309
}
310310

311-
/// cycle the state machine and test the resulting state
312-
pub async fn cycle_registered(&mut self) -> Result<&mut Self> {
313-
self.cycle().await?;
314-
315-
self.assert(
316-
self.state_machine.get_state().await.is_registered(),
317-
format!(
318-
"state machine is in {} state (Registered was expected)",
319-
self.state_machine.get_state().await
320-
),
321-
)
322-
}
323-
324311
/// cycle the state machine and test the resulting state
325312
pub async fn cycle_ready_to_sign(&mut self) -> Result<&mut Self> {
326313
self.cycle().await?;
@@ -372,19 +359,6 @@ impl StateMachineTester {
372359
)
373360
}
374361

375-
/// cycle the state machine and test the resulting state
376-
pub async fn cycle_signed(&mut self) -> Result<&mut Self> {
377-
self.cycle().await?;
378-
379-
self.assert(
380-
self.state_machine.get_state().await.is_signed(),
381-
format!(
382-
"state machine is in {} state (Signed was expected)",
383-
self.state_machine.get_state().await
384-
),
385-
)
386-
}
387-
388362
/// cycle the state machine and test the resulting state
389363
pub async fn cycle_unregistered(&mut self) -> Result<&mut Self> {
390364
self.cycle().await?;

0 commit comments

Comments
 (0)