Prover service: a paid shard is found through igneum_getProofRecords for the submitted segment (a slow proof outlives the work list's 60-block window)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
36bb744524
commit
2278714a09
1 changed files with 11 additions and 2 deletions
|
|
@ -197,6 +197,10 @@ fn run_tool(t: &Tools, exe: &Path, args: &[String], env: &[(&str, &str)], limit:
|
|||
}
|
||||
}
|
||||
|
||||
fn payout_address(shared: &Shared) -> String {
|
||||
shared.settings.lock().unwrap().address.clone()
|
||||
}
|
||||
|
||||
fn set<F: FnOnce(&mut crate::state::ProvingState)>(shared: &Shared, f: F) {
|
||||
let mut st = shared.state.lock().unwrap();
|
||||
f(&mut st.proving);
|
||||
|
|
@ -298,9 +302,14 @@ fn loop_forever(shared: Arc<Shared>, bin_dir: PathBuf) {
|
|||
continue;
|
||||
}
|
||||
};
|
||||
// paid shards among what we submitted
|
||||
// paid shards among what we submitted: asked per segment (a slow proof outlives the work list's window)
|
||||
for (n, h, s, wei) in submitted.clone() {
|
||||
if work.iter().any(|w| w.hash == h && w.shard == s && w.paid) {
|
||||
let paid = evm_rpc(&shared, "igneum_getProofRecords", json!([format!("{n:#x}")]), Duration::from_secs(10))
|
||||
.ok()
|
||||
.and_then(|r| r["paid"].as_array().and_then(|p| p.get(s as usize)).cloned())
|
||||
.map(|p| !p.is_null() && p["payout"].as_str().map(|a| a.eq_ignore_ascii_case(&payout_address(&shared))).unwrap_or(false))
|
||||
.unwrap_or(false);
|
||||
if paid {
|
||||
submitted.retain(|x| !(x.1 == h && x.2 == s));
|
||||
shared.event("proving", &format!("block {n} shard {s} paid {} IGN", wei as f64 / 1e18));
|
||||
set(&shared, |p| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue