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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
use std::collections::HashMap;
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::core::Task;
use crate::fil_proofs::{
ActorID, ChallengeSeed, Commitment, PieceInfo, ProverId, RegisteredPoStProof, RegisteredSealProof, RegisteredUpdateProof,
SealCommitPhase1Output, SealCommitPhase2Output, SealPreCommitPhase1Output, SealPreCommitPhase2Output, SectorId, SnapEncodeOutput,
SnapProveOutput, SnarkProof, Ticket,
};
pub const STAGE_NAME_TREED: &str = "tree_d";
pub const STAGE_NAME_PC1: &str = "pc1";
pub const STAGE_NAME_PC2: &str = "pc2";
pub const STAGE_NAME_C1: &str = "c1";
pub const STAGE_NAME_C2: &str = "c2";
pub const STAGE_NAME_SNAP_ENCODE: &str = "snap_encode";
pub const STAGE_NAME_SNAP_PROVE: &str = "snap_prove";
pub const STAGE_NAME_TRANSFER: &str = "transfer";
pub const STAGE_NAME_WINDOW_POST: &str = "window_post";
pub const STAGE_NAME_WINNING_POST: &str = "winning_post";
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TreeD {
pub registered_proof: RegisteredSealProof,
pub staged_file: PathBuf,
pub cache_dir: PathBuf,
}
impl Task for TreeD {
const STAGE: &'static str = STAGE_NAME_TREED;
type Output = bool;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PC1 {
pub registered_proof: RegisteredSealProof,
pub cache_path: PathBuf,
pub in_path: PathBuf,
pub out_path: PathBuf,
pub prover_id: ProverId,
pub sector_id: SectorId,
pub ticket: Ticket,
pub piece_infos: Vec<PieceInfo>,
}
impl Task for PC1 {
const STAGE: &'static str = STAGE_NAME_PC1;
type Output = SealPreCommitPhase1Output;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PC2 {
pub pc1out: SealPreCommitPhase1Output,
pub cache_dir: PathBuf,
pub sealed_file: PathBuf,
}
impl Task for PC2 {
const STAGE: &'static str = STAGE_NAME_PC2;
type Output = SealPreCommitPhase2Output;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct C2 {
pub c1out: SealCommitPhase1Output,
pub prover_id: ProverId,
pub sector_id: SectorId,
pub miner_id: ActorID,
}
impl Task for C2 {
const STAGE: &'static str = STAGE_NAME_C2;
type Output = SealCommitPhase2Output;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SnapEncode {
pub registered_proof: RegisteredUpdateProof,
pub new_replica_path: PathBuf,
pub new_cache_path: PathBuf,
pub sector_path: PathBuf,
pub sector_cache_path: PathBuf,
pub staged_data_path: PathBuf,
pub piece_infos: Vec<PieceInfo>,
}
impl Task for SnapEncode {
const STAGE: &'static str = STAGE_NAME_SNAP_ENCODE;
type Output = SnapEncodeOutput;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SnapProve {
pub registered_proof: RegisteredUpdateProof,
pub vannilla_proofs: Vec<Vec<u8>>,
pub comm_r_old: Commitment,
pub comm_r_new: Commitment,
pub comm_d_new: Commitment,
}
impl Task for SnapProve {
const STAGE: &'static str = STAGE_NAME_SNAP_PROVE;
type Output = SnapProveOutput;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransferStoreInfo {
pub name: String,
pub meta: Option<HashMap<String, String>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransferItem {
pub store_name: Option<String>,
pub uri: PathBuf,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransferOption {
pub is_dir: bool,
pub allow_link: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransferRoute {
pub src: TransferItem,
pub dest: TransferItem,
pub opt: Option<TransferOption>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Transfer {
pub stores: HashMap<String, TransferStoreInfo>,
pub routes: Vec<TransferRoute>,
}
impl Task for Transfer {
const STAGE: &'static str = STAGE_NAME_TRANSFER;
type Output = bool;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PoStReplicaInfo {
pub sector_id: SectorId,
pub comm_r: Commitment,
pub cache_dir: PathBuf,
pub sealed_file: PathBuf,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WindowPoStOutput {
pub proofs: Vec<SnarkProof>,
pub faults: Vec<u64>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WindowPoSt {
pub miner_id: ActorID,
pub proof_type: RegisteredPoStProof,
pub replicas: Vec<PoStReplicaInfo>,
pub seed: ChallengeSeed,
}
impl Task for WindowPoSt {
const STAGE: &'static str = STAGE_NAME_WINDOW_POST;
type Output = WindowPoStOutput;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WinningPoStOutput {
pub proofs: Vec<SnarkProof>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WinningPoSt {
pub miner_id: ActorID,
pub proof_type: RegisteredPoStProof,
pub replicas: Vec<PoStReplicaInfo>,
pub seed: ChallengeSeed,
}
impl Task for WinningPoSt {
const STAGE: &'static str = STAGE_NAME_WINNING_POST;
type Output = WinningPoStOutput;
}