1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use lifeline::dyn_bus::DynBus;
use lifeline::{Lifeline, Service, Task};
use component_state::state::BridgeState;
use support_lifeline::service::BridgeService;
use support_tracker::Tracker;
use crate::bridge::{BridgeBus, BridgeTask};
use crate::service::ecdsa_relay::ecdsa_scanner::{EcdsaScanType, EcdsaScanner};
mod collected_enough_authorities_change_signatures;
mod collected_enough_new_message_root_signatures;
mod collecting_authorities_change_signatures;
mod collecting_new_message_root_signatures;
mod ecdsa_scanner;
mod types;
#[derive(Debug)]
pub struct ECDSARelayService {
_greet_collecting_message: Lifeline,
_greet_collected_message: Lifeline,
_greet_collecting_authorities: Lifeline,
_greet_collected_authorities: Lifeline,
}
impl BridgeService for ECDSARelayService {}
impl Service for ECDSARelayService {
type Bus = BridgeBus;
type Lifeline = color_eyre::Result<Self>;
fn spawn(bus: &Self::Bus) -> Self::Lifeline {
let state = bus.storage().clone_resource::<BridgeState>()?;
let microkv = state.microkv_with_namespace(BridgeTask::name());
let tracker_collecting_message =
Tracker::new(microkv.clone(), "scan.pangoro.collecting-message");
let tracker_collected_message =
Tracker::new(microkv.clone(), "scan.pangoro.collected-message");
let tracker_collecting_authorities =
Tracker::new(microkv.clone(), "scan.pangoro.collecting-authorities");
let tracker_collected_authorities =
Tracker::new(microkv, "scan.pangoro.collected-authorities");
let _greet_collecting_message =
Self::try_task("pangoro-to-goerli-ecdsa-collecting-message", async move {
EcdsaScanner
.start(
tracker_collecting_message.clone(),
EcdsaScanType::CollectingMessage,
)
.await;
Ok(())
});
let _greet_collected_message =
Self::try_task("pangoro-to-goerli-ecdsa-collected-message", async move {
EcdsaScanner
.start(
tracker_collected_message.clone(),
EcdsaScanType::CollectedMessage,
)
.await;
Ok(())
});
let _greet_collecting_authorities = Self::try_task(
"pangoro-to-goerli-ecdsa-collecting-authorities",
async move {
EcdsaScanner
.start(
tracker_collecting_authorities.clone(),
EcdsaScanType::CollectingAuthority,
)
.await;
Ok(())
},
);
let _greet_collected_authorities = Self::try_task(
"pangoro-to-goerli-ecdsa-collected-authorities",
async move {
EcdsaScanner
.start(
tracker_collected_authorities.clone(),
EcdsaScanType::CollectedAuthority,
)
.await;
Ok(())
},
);
Ok(Self {
_greet_collecting_message,
_greet_collected_message,
_greet_collecting_authorities,
_greet_collected_authorities,
})
}
}