Skip to content

Commit 5d81f67

Browse files
committed
Make buffer integration test send authenticated signatures
1 parent c19f497 commit 5d81f67

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

mithril-aggregator/tests/create_certificate_with_buffered_signatures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async fn create_certificate_with_buffered_signatures() {
6969

7070
comment!("signers send their single signature before the state machine is signing");
7171
tester
72-
.send_single_signatures(
72+
.send_authenticated_single_signatures(
7373
SignedEntityTypeDiscriminants::MithrilStakeDistribution,
7474
&fixture.signers_fixture(),
7575
)

mithril-aggregator/tests/test_extensions/runtime_tester.rs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ use mithril_aggregator::{
99
AggregatorRuntime, Configuration, DependencyContainer, DumbSnapshotUploader, DumbSnapshotter,
1010
SignerRegistrationError,
1111
};
12-
use mithril_common::entities::ProtocolMessagePartKey;
1312
use mithril_common::{
1413
cardano_block_scanner::{DumbBlockScanner, ScannedBlock},
1514
chain_observer::{ChainObserver, FakeObserver},
1615
crypto_helper::ProtocolGenesisSigner,
1716
digesters::{DumbImmutableDigester, DumbImmutableFileObserver},
1817
entities::{
1918
BlockNumber, Certificate, CertificateSignature, ChainPoint, Epoch, ImmutableFileNumber,
20-
SignedEntityType, SignedEntityTypeDiscriminants, SlotNumber, Snapshot, StakeDistribution,
21-
TimePoint,
19+
ProtocolMessagePartKey, SignedEntityType, SignedEntityTypeDiscriminants,
20+
SingleSignatureAuthenticationStatus, SlotNumber, Snapshot, StakeDistribution, TimePoint,
2221
},
2322
era::{adapters::EraReaderDummyAdapter, EraMarker, EraReader, SupportedEra},
2423
test_utils::{
@@ -380,11 +379,37 @@ impl RuntimeTester {
380379
Ok(())
381380
}
382381

383-
/// "Send", actually register, the given single signatures in the multi-signers
382+
pub async fn send_authenticated_single_signatures(
383+
&mut self,
384+
discriminant: SignedEntityTypeDiscriminants,
385+
signers: &[SignerFixture],
386+
) -> StdResult<()> {
387+
self.send_single_signatures_with_auth_status(
388+
discriminant,
389+
signers,
390+
SingleSignatureAuthenticationStatus::Authenticated,
391+
)
392+
.await
393+
}
394+
384395
pub async fn send_single_signatures(
385396
&mut self,
386397
discriminant: SignedEntityTypeDiscriminants,
387398
signers: &[SignerFixture],
399+
) -> StdResult<()> {
400+
self.send_single_signatures_with_auth_status(
401+
discriminant,
402+
signers,
403+
SingleSignatureAuthenticationStatus::Unauthenticated,
404+
)
405+
.await
406+
}
407+
408+
async fn send_single_signatures_with_auth_status(
409+
&mut self,
410+
discriminant: SignedEntityTypeDiscriminants,
411+
signers: &[SignerFixture],
412+
authentication_status: SingleSignatureAuthenticationStatus,
388413
) -> StdResult<()> {
389414
let certifier_service = self.dependencies.certifier_service.clone();
390415
let signed_entity_type = self
@@ -411,7 +436,12 @@ impl RuntimeTester {
411436
);
412437

413438
for signer_fixture in signers {
414-
if let Some(single_signatures) = signer_fixture.sign(&message) {
439+
if let Some(mut single_signatures) = signer_fixture.sign(&message) {
440+
if authentication_status == SingleSignatureAuthenticationStatus::Authenticated {
441+
single_signatures.authentication_status =
442+
SingleSignatureAuthenticationStatus::Authenticated;
443+
}
444+
415445
certifier_service
416446
.register_single_signature(&signed_entity_type, &single_signatures)
417447
.await

0 commit comments

Comments
 (0)