paritytech / paritytech/web3-storage

Scheduling & lazy processing: move unbounded on_finalize work to on_poll / bounded lazy cleanup

Open
#177 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

architecture discussion enhancement
Dominant language
Rust
Stars
12
Forks
3
Avg merge
2d 2h
Merged PRs (30d)
33

Description

Scheduling & lazy processing

The design's principle is to avoid periodic/scheduled on-chain work (the chain is "a credible threat, not the hot path" — explicitly contrasted with Filecoin's per-sector periodic proofs). So almost everything is intentionally pull / event / off-chain. The one thing the design does schedule is challenge-timeout slashing, processed at the deadline block.

The Implement? column is validated against the canonical design (#170).

Concern Deadline source Current handling Implement?
Challenge timeout → slash Challenges[deadline_block], deadline = now + ChallengeTimeout on_finalize(n) slashes every challenge maturing at block n 🟡 Keep scheduled (by design); harden only. Design intends deadline-block processing and considers the batch bounded-by-weight (all challenges at n were created at the single block n − ChallengeTimeout). Not a design gap. Defensive hardening: make the bound explicit (BoundedVec) and consider moving the slashing off on_finalize (critical path) to on_idle/on_poll
Agreement expiry (expires_at) per-agreement field Pull: end_agreement (owner) / claim_expired_agreement (provider) ⚠️ Optional / low. Pull is by design; only consider cleanup for the residual where neither party acts
Missed checkpoint → slash checkpoint window + grace Pull + incentivized: report_missed_checkpoint (reporter gets 10%) No (works as designed). 10% reporter reward is canonical; at most document it
Agreement request expiry (RequestTimeout) config (6h) None — only a // TODO in provider-node/src/api.rs:815 🟡 Decision first. Design↔code divergence: design (#170) keeps on-chain requests with expires_at; code (#105) moved negotiation off-chain. Reconcile, then implement lazy expiry only if requests stay on-chain
Deregistration deregister_at = now + DeregisterAnnouncementPeriod Pull: announce → wait → complete_deregister No. Two-phase pull is intended
Checkpoint rewards accrue per (provider, bucket) Pull: claim_checkpoint_rewards No. Pull claim is fine; keep the accrual map bounded

Net: per the design, nothing new needs scheduling. Challenge-timeout slashing is the only chain-scheduled item and is bounded-by-design — worth only defensive hardening. RequestTimeout needs a design↔code decision first. Everything else works as designed (pull / off-chain).

Note: per design, challenge-resolution paths must use refund/penalty, never bounties (no challenger reward) — keep that separate from the checkpoint-miss reporter reward.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the canonical design in issue #170 with the scheduling paths around on_finalize, on_poll, and the Challenges deadline handling. Inspect the RequestTimeout TODO at provider-node/src/api.rs:815 and the related agreement and request expiry paths. Done means the design-versus-code decision is explicit and any accepted cleanup or hardening scope is bounded and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.