Skip to content

Optimise gas use for SettleDealPaymentsExported #1753

Description

@rjan90

(Follow-up from filecoin-project/FIPs#1224 and filecoin-project/lotus#13471; this ticket is specifically about reducing the builtin-actors execution cost, while the Lotus issue tracks client-side gas-aware batching.)

We have seen SettleDealPaymentsExported messages large enough to consume a significant fraction of a block on their own, and they are expected to become more common as deal settlement tooling gets used more heavily.

Some examples:

The actor path is:

  • settle_deal_payments loops over each deal ID here.
  • Each deal loads the proposal/state, serializes/hashes the proposal to a deal CID, calls get_active_deal_or_process_timeout, and then calls process_deal_update here.
  • process_deal_update transfers elapsed payment per deal here, and transfer_balance reloads and flushes the balance tables through unlock_balance here.
  • The final deal-state and sector mapping writes are already batched through put_deal_states and remove_sector_deal_ids here and here, so the obvious investigation area is the repeated per-deal accounting / table load-flush work before those final batched writes.

Possible things to investigate:

  • Batch or aggregate payment/accounting table updates by client/provider where the settlement semantics allow it.
  • Avoid repeatedly loading/flushing the same escrow/locked balance tables inside a single settlement transaction.
  • Look for per-deal work that can be moved outside the loop, or avoided for common cases.
  • Re-check this after the cleanup tracked in Remove async handling of terminated deals from market actor #1388, since removing slashed-deal compatibility paths may simplify process_deal_update.

This is similar in spirit to #1610: reducing the execution cost of high-fanout messages rather than relying only on senders to choose smaller batches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    📌 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions