/
snark_user_command_verify_effects.rs
33 lines (31 loc) · 1.34 KB
/
snark_user_command_verify_effects.rs
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
use redux::ActionMeta;
use super::{SnarkUserCommandVerifyAction, SnarkUserCommandVerifyService};
impl SnarkUserCommandVerifyAction {
pub fn effects<Store, S>(self, _: &ActionMeta, store: &mut Store)
where
Store: crate::SnarkStore<S>,
Store::Service: SnarkUserCommandVerifyService,
SnarkUserCommandVerifyAction: redux::EnablingCondition<S>,
{
match self {
SnarkUserCommandVerifyAction::Init {
req_id, commands, ..
} => {
let verifier_index = store.state().work_verify.verifier_index.clone();
let verifier_srs = store.state().work_verify.verifier_srs.clone();
store
.service()
.verify_init(req_id, commands, verifier_index, verifier_srs);
store.dispatch(SnarkUserCommandVerifyAction::Pending { req_id });
}
SnarkUserCommandVerifyAction::Error { req_id, .. } => {
store.dispatch(SnarkUserCommandVerifyAction::Finish { req_id });
}
SnarkUserCommandVerifyAction::Success { req_id } => {
store.dispatch(SnarkUserCommandVerifyAction::Finish { req_id });
}
SnarkUserCommandVerifyAction::Pending { .. } => {}
SnarkUserCommandVerifyAction::Finish { .. } => {}
}
}
}