Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enabling verify_pc2 will automatically abort task. because pc2_out is not correctly set to sector state #1063

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- damocles-worker
- 修复无法从统一链服务入口获取 piece 文件 [#1041](https://github.com/ipfs-force-community/damocles/pull/1041)
- 支持校验 pc2 的结果 [#1060](https://github.com/ipfs-force-community/damocles/pull/1060)
- 支持在 pc2 完成后校验封装的结果 [#1060](https://github.com/ipfs-force-community/damocles/pull/1060)

## v0.9.0

Expand Down
10 changes: 5 additions & 5 deletions damocles-worker/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ pub struct Sealing {
/// max retry times for request task from sector manager
pub request_task_max_retries: u32,

// whether to verify the results of pc2
pub verify_pc2: bool,
// whether to verify the sealing results alfter pc2
pub verify_after_pc2: bool,
}

impl Default for Sealing {
Expand All @@ -82,7 +82,7 @@ impl Default for Sealing {
rpc_polling_interval: Duration::from_secs(180),
ignore_proof_check: false,
request_task_max_retries: 3,
verify_pc2: false,
verify_after_pc2: false,
}
}
}
Expand Down Expand Up @@ -132,8 +132,8 @@ pub struct SealingOptional {
/// max retry times for request task from sector manager
pub request_task_max_retries: Option<u32>,

// whether to verify the results of pc2
pub verify_pc2: Option<bool>,
// whether to verify the sealing results after pc2
pub verify_after_pc2: Option<bool>,
}

/// configuration for remote store
Expand Down
8 changes: 4 additions & 4 deletions damocles-worker/src/sealing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub(crate) fn merge_sealing_fields(
rpc_polling_interval,
ignore_proof_check,
request_task_max_retries,
verify_pc2,
verify_after_pc2,
},
}
}
Expand Down Expand Up @@ -397,7 +397,7 @@ mod tests {
rpc_polling_interval: ms(1000),
ignore_proof_check: true,
request_task_max_retries: 10,
verify_pc2: false,
verify_after_pc2: false,
},
},
SealingThreadInner {
Expand All @@ -415,7 +415,7 @@ mod tests {
rpc_polling_interval: Some(ms(1000)),
ignore_proof_check: None,
request_task_max_retries: Some(11),
verify_pc2: Some(true),
verify_after_pc2: Some(true),
}),
},
SealingWithPlan {
Expand All @@ -433,7 +433,7 @@ mod tests {
rpc_polling_interval: ms(1000),
ignore_proof_check: true,
request_task_max_retries: 11,
verify_pc2: true,
verify_after_pc2: true,
},
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ pub(crate) fn pre_commit2(
seed: [0; 32].into(),
epoch: 0,
},
out.clone(),
)?;
}

Expand All @@ -348,12 +349,18 @@ pub(crate) fn commit1_with_seed(
) -> Result<SealCommitPhase1Output, Failure> {
let _token = task.sealing_ctrl.ctrl_ctx().wait(STAGE_NAME_C1).crit()?;

commit1_with_seed_inner(task, seed)
cloned_required! {
pc2out,
task.sector.phases.pc2out
}

commit1_with_seed_inner(task, seed, pc2out)
}

pub(crate) fn commit1_with_seed_inner(
task: &Task,
seed: Seed,
pc2out: SealPreCommitPhase2Output,
) -> Result<SealCommitPhase1Output, Failure> {
let sector_id = task.sector_id()?;

Expand All @@ -374,11 +381,6 @@ pub(crate) fn commit1_with_seed_inner(
task.sector.phases.ticket.as_ref()
}

cloned_required! {
p2out,
task.sector.phases.pc2out
}

let cache_dir = task.cache_dir(sector_id);
let sealed_file = task.sealed_file(sector_id);

Expand All @@ -389,7 +391,7 @@ pub(crate) fn commit1_with_seed_inner(
seal_sector_id,
ticket.ticket.0,
seed.seed.0,
p2out,
pc2out,
piece_infos,
)
.perm()?;
Expand Down
4 changes: 2 additions & 2 deletions damocles-worker/src/sealing/sealing_thread/planner/sealer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ impl<'t> Sealer<'t> {
}

fn handle_pc1_done(&self) -> Result<Event, Failure> {
let verify_pc2 = self.task.sealing_ctrl.config().verify_pc2;
common::pre_commit2(self.task, verify_pc2).map(|out| {
let verify_after_pc2 = self.task.sealing_ctrl.config().verify_after_pc2;
common::pre_commit2(self.task, verify_after_pc2).map(|out| {
if out
.registered_proof
.feature_enabled(ApiFeature::SyntheticPoRep)
Expand Down
4 changes: 2 additions & 2 deletions docs/en/03.damocles-worker-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ rpc_client.addr = "/ip4/127.0.0.1/tcp/1789"
# default is 3
# request_task_max_retries = 3

# Whether to enable verification of PC2 results
# whether to verify the sealing results after pc2
# default is false
# verify_pc2 = false
# verify_after_pc2 = false
```

The configuration items in `sealing` usually have default items preset from experiences, which removes the need for manual configurations in most cases.
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/03.damocles-worker的配置解析.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ rpc_client.addr = "/ip4/127.0.0.1/tcp/1789"
# 默认为 3
# request_task_max_retries = 3

# 是否启用校验 pc2 的结果
# 是否启用在 pc2 完成后校验封装的结果
# 默认为 false
# verify_pc2 = false
# verify_after_pc2 = false
```

`sealing` 中的配置项通常有根据经验预设的默认项,这使得我们在绝大多数情况下无需自行配置。
Expand Down
Loading