Skip to content

Commit e7ee8a8

Browse files
committed
refactor: pass only signed_entity_type to transition_from_ready_to_sign_to_ready_to_signand not the certificate
1 parent 8719f00 commit e7ee8a8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

mithril-signer/src/runtime/state_machine.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ impl StateMachine {
228228
.await
229229
{
230230
*state = self
231-
.transition_from_ready_to_sign_to_ready_to_sign(*epoch, &certificate)
231+
.transition_from_ready_to_sign_to_ready_to_sign(
232+
*epoch,
233+
&certificate.signed_entity_type,
234+
)
232235
.await?;
233236
}
234237
}
@@ -412,10 +415,9 @@ impl StateMachine {
412415
/// Launch the transition process from the `ReadyToSign` to the `ReadyToSign` state.
413416
async fn transition_from_ready_to_sign_to_ready_to_sign(
414417
&self,
415-
state_epoch: Epoch,
416-
pending_certificate: &CertificatePending,
418+
current_epoch: Epoch,
419+
signed_entity_type: &SignedEntityType,
417420
) -> Result<SignerState, RuntimeError> {
418-
let current_epoch = pending_certificate.epoch;
419421
let (retrieval_epoch, next_retrieval_epoch) = (
420422
current_epoch.offset_to_signer_retrieval_epoch()?,
421423
current_epoch.offset_to_next_signer_retrieval_epoch(),
@@ -433,7 +435,7 @@ impl StateMachine {
433435

434436
let message = self
435437
.runner
436-
.compute_message(&pending_certificate.signed_entity_type)
438+
.compute_message(signed_entity_type)
437439
.await
438440
.map_err(|e| RuntimeError::KeepState {
439441
message: format!("Could not compute message during 'ready to sign → ready to sign' phase (current epoch {current_epoch:?})"),
@@ -448,7 +450,7 @@ impl StateMachine {
448450
message: format!("Could not compute single signature during 'ready to sign → ready to sign' phase (current epoch {current_epoch:?})"),
449451
nested_error: Some(e)
450452
})?;
451-
self.runner.send_single_signature(&pending_certificate.signed_entity_type, single_signatures).await
453+
self.runner.send_single_signature(signed_entity_type, single_signatures).await
452454
.map_err(|e| RuntimeError::KeepState {
453455
message: format!("Could not send single signature during 'ready to sign → ready to sign' phase (current epoch {current_epoch:?})"),
454456
nested_error: Some(e)
@@ -460,8 +462,8 @@ impl StateMachine {
460462
.signature_registration_success_last_epoch_gauge_set(current_epoch);
461463

462464
Ok(SignerState::ReadyToSign {
463-
epoch: state_epoch,
464-
last_signed_entity_type: Some(pending_certificate.to_owned().signed_entity_type),
465+
epoch: current_epoch,
466+
last_signed_entity_type: Some(signed_entity_type.to_owned()),
465467
})
466468
}
467469

0 commit comments

Comments
 (0)