@@ -10,8 +10,8 @@ use std::sync::Arc;
10
10
11
11
use mithril_common:: {
12
12
entities:: {
13
- Beacon , Certificate , Epoch , MithrilStakeDistribution , SignedEntity , SignedEntityType ,
14
- SignedEntityTypeDiscriminants , Snapshot ,
13
+ Beacon , CardanoTransactionsCommitment , Certificate , Epoch , MithrilStakeDistribution ,
14
+ SignedEntity , SignedEntityType , SignedEntityTypeDiscriminants , Snapshot ,
15
15
} ,
16
16
signable_builder:: Artifact ,
17
17
StdResult ,
@@ -68,6 +68,8 @@ pub struct MithrilSignedEntityService {
68
68
mithril_stake_distribution_artifact_builder :
69
69
Arc < dyn ArtifactBuilder < Epoch , MithrilStakeDistribution > > ,
70
70
cardano_immutable_files_full_artifact_builder : Arc < dyn ArtifactBuilder < Beacon , Snapshot > > ,
71
+ cardano_transactions_artifact_builder :
72
+ Arc < dyn ArtifactBuilder < Beacon , CardanoTransactionsCommitment > > ,
71
73
}
72
74
73
75
impl MithrilSignedEntityService {
@@ -78,11 +80,15 @@ impl MithrilSignedEntityService {
78
80
dyn ArtifactBuilder < Epoch , MithrilStakeDistribution > ,
79
81
> ,
80
82
cardano_immutable_files_full_artifact_builder : Arc < dyn ArtifactBuilder < Beacon , Snapshot > > ,
83
+ cardano_transactions_artifact_builder : Arc <
84
+ dyn ArtifactBuilder < Beacon , CardanoTransactionsCommitment > ,
85
+ > ,
81
86
) -> Self {
82
87
Self {
83
88
signed_entity_storer,
84
89
mithril_stake_distribution_artifact_builder,
85
90
cardano_immutable_files_full_artifact_builder,
91
+ cardano_transactions_artifact_builder,
86
92
}
87
93
}
88
94
@@ -114,7 +120,16 @@ impl MithrilSignedEntityService {
114
120
} ) ?,
115
121
) ) ) ,
116
122
SignedEntityType :: CardanoStakeDistribution ( _) => todo ! ( ) ,
117
- SignedEntityType :: CardanoTransactions ( _) => Ok ( None ) ,
123
+ SignedEntityType :: CardanoTransactions ( beacon) => Ok ( Some ( Arc :: new (
124
+ self . cardano_transactions_artifact_builder
125
+ . compute_artifact ( beacon. clone ( ) , certificate)
126
+ . await
127
+ . with_context ( || {
128
+ format ! (
129
+ "Signed Entity Service can not compute artifact for entity type: '{signed_entity_type}'"
130
+ )
131
+ } ) ?,
132
+ ) ) ) ,
118
133
}
119
134
}
120
135
}
@@ -302,11 +317,14 @@ mod tests {
302
317
303
318
let mock_cardano_immutable_files_full_artifact_builder =
304
319
MockArtifactBuilder :: < Beacon , Snapshot > :: new ( ) ;
320
+ let mock_cardano_transactions_artifact_builder =
321
+ MockArtifactBuilder :: < Beacon , CardanoTransactionsCommitment > :: new ( ) ;
305
322
306
323
let artifact_builder_service = MithrilSignedEntityService :: new (
307
324
Arc :: new ( mock_signed_entity_storer) ,
308
325
Arc :: new ( mock_mithril_stake_distribution_artifact_builder) ,
309
326
Arc :: new ( mock_cardano_immutable_files_full_artifact_builder) ,
327
+ Arc :: new ( mock_cardano_transactions_artifact_builder) ,
310
328
) ;
311
329
let certificate = fake_data:: certificate ( "hash" . to_string ( ) ) ;
312
330
@@ -355,11 +373,14 @@ mod tests {
355
373
. expect_compute_artifact ( )
356
374
. times ( 1 )
357
375
. return_once ( move |_, _| Ok ( snapshot_expected_clone) ) ;
376
+ let mock_cardano_transactions_artifact_builder =
377
+ MockArtifactBuilder :: < Beacon , CardanoTransactionsCommitment > :: new ( ) ;
358
378
359
379
let artifact_builder_service = MithrilSignedEntityService :: new (
360
380
Arc :: new ( mock_signed_entity_storer) ,
361
381
Arc :: new ( mock_mithril_stake_distribution_artifact_builder) ,
362
382
Arc :: new ( mock_cardano_immutable_files_full_artifact_builder) ,
383
+ Arc :: new ( mock_cardano_transactions_artifact_builder) ,
363
384
) ;
364
385
let certificate = fake_data:: certificate ( "hash" . to_string ( ) ) ;
365
386
@@ -392,11 +413,14 @@ mod tests {
392
413
MockArtifactBuilder :: < Epoch , MithrilStakeDistribution > :: new ( ) ;
393
414
let mock_cardano_immutable_files_full_artifact_builder =
394
415
MockArtifactBuilder :: < Beacon , Snapshot > :: new ( ) ;
416
+ let mock_cardano_transactions_artifact_builder =
417
+ MockArtifactBuilder :: < Beacon , CardanoTransactionsCommitment > :: new ( ) ;
395
418
396
419
let artifact_builder_service = MithrilSignedEntityService :: new (
397
420
Arc :: new ( mock_signed_entity_storer) ,
398
421
Arc :: new ( mock_mithril_stake_distribution_artifact_builder) ,
399
422
Arc :: new ( mock_cardano_immutable_files_full_artifact_builder) ,
423
+ Arc :: new ( mock_cardano_transactions_artifact_builder) ,
400
424
) ;
401
425
402
426
let certificate = fake_data:: certificate ( "hash" . to_string ( ) ) ;
0 commit comments