Skip to content

Commit d3fe381

Browse files
committed
refactor(signer): variable renaming, remove usage of predicate in tests
1 parent e03c7de commit d3fe381

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

mithril-signer/src/runtime/state_machine.rs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl StateMachine {
164164
"→ Epoch has changed, transiting to Unregistered"
165165
);
166166
*state = self.transition_from_unregistered_to_unregistered(new_epoch).await?;
167-
} else if let Some(signer_settings) = self
167+
} else if let Some(signer_registrations) = self
168168
.runner
169169
.get_epoch_settings()
170170
.await
@@ -173,7 +173,7 @@ impl StateMachine {
173173
nested_error: Some(e),
174174
})?
175175
{
176-
info!(self.logger, "→ Epoch settings found"); //TODO Do we switch the logs and type from SignerEpochSettings to SignerSettings since now we only read current and next signer from it ?
176+
info!(self.logger, "→ Epoch Signer registrations found");
177177
let network_configuration = self
178178
.runner
179179
.get_mithril_network_configuration()
@@ -190,16 +190,16 @@ impl StateMachine {
190190
*state = self
191191
.transition_from_unregistered_to_one_of_registered_states(
192192
network_configuration,
193-
signer_settings.current_signers,
194-
signer_settings.next_signers,
193+
signer_registrations.current_signers,
194+
signer_registrations.next_signers,
195195
)
196196
.await?;
197197
} else {
198198
info!(
199199
self.logger, " ⋅ Signer settings and Network Configuration found, but its epoch is behind the known epoch, waiting…";
200200
"network_configuration" => ?network_configuration,
201-
"current_singer" => ?signer_settings.current_signers,
202-
"next_signer" => ?signer_settings.next_signers,
201+
"current_singer" => ?signer_registrations.current_signers,
202+
"next_signer" => ?signer_registrations.next_signers,
203203
"known_epoch" => ?epoch,
204204
);
205205
}
@@ -488,7 +488,6 @@ mod tests {
488488
use anyhow::anyhow;
489489
use chrono::DateTime;
490490
use mithril_protocol_config::model::MithrilNetworkConfiguration;
491-
use mockall::predicate;
492491

493492
use mithril_common::entities::{ChainPoint, Epoch, ProtocolMessage, SignedEntityType};
494493
use mithril_common::test::double::{Dummy, fake_data};
@@ -600,12 +599,6 @@ mod tests {
600599

601600
runner
602601
.expect_inform_epoch_settings()
603-
.with(
604-
//todo do we really want to specify a WITH ?
605-
predicate::eq(MithrilNetworkConfiguration::dummy()),
606-
predicate::eq(SignerEpochSettings::dummy().current_signers),
607-
predicate::eq(SignerEpochSettings::dummy().next_signers),
608-
)
609602
.once()
610603
.returning(|_, _, _| Ok(()));
611604

@@ -658,12 +651,6 @@ mod tests {
658651

659652
runner
660653
.expect_inform_epoch_settings()
661-
.with(
662-
//todo do we really want to specify a WITH ?
663-
predicate::eq(MithrilNetworkConfiguration::dummy()),
664-
predicate::eq(SignerEpochSettings::dummy().current_signers),
665-
predicate::eq(SignerEpochSettings::dummy().next_signers),
666-
)
667654
.once()
668655
.returning(|_, _, _| Ok(()));
669656

@@ -720,12 +707,6 @@ mod tests {
720707

721708
runner
722709
.expect_inform_epoch_settings()
723-
.with(
724-
//todo do we really want to specify a WITH ?
725-
predicate::eq(MithrilNetworkConfiguration::dummy()),
726-
predicate::eq(SignerEpochSettings::dummy().current_signers),
727-
predicate::eq(SignerEpochSettings::dummy().next_signers),
728-
)
729710
.once()
730711
.returning(|_, _, _| Ok(()));
731712

0 commit comments

Comments
 (0)