Skip to content

settle-deal: Gas-aware batching to reduce block congestion from SettleDealPaymentsExported #13471

@rvagg

Description

@rvagg

The lotus-miner actor settle-deal command (and underlying SettleDealPaymentsExported messages) currently batches deals using a fixed --max-deals threshold (default 50). A single message with 50 deals can consume ~70% of block capacity (~7B gas). This contributes to the network congestion issues documented in filecoin-project/FIPs#1224.

Without solving some of the underlying problems, I propose that we implement gas-aware batching in ActorDealSettlementCmd (cli/spcli/actor.go):

Adaptive splitting with gas estimation, targeting BlockGasLimit / 4 (2.5B gas) per message:

Use the pattern from CompactPartitions in cli/spcli/sectors.go which adaptively splits batches based on gas estimation:

  1. Start with a --max-deals sized batch
  2. Call GasEstimateMessageGas on the message
  3. If gas exceeds target (--max-gas, defaulting to BlockGasLimit / 4), split the batch in half and recurse

The goal is simply to get under the gas target, not to approach it optimally. Halving means the resulting batch could use anywhere from 50-100% of the target gas, which is acceptable, we're optimizing for smaller messages, not maximum efficiency.

This approach keeps each message at or below ~25% of block capacity, leaving room for other transactions and reducing the impact of message duplication across blocks in a tipset.

--max-deals can remain as a high upper bound (e.g., 50) since the splitting will adjust it down as needed. Add a --max-gas flag (defaulting to BlockGasLimit / 4) to allow users to override the target gas limit per message.

If this pattern works well, we should apply it to other commands with similar batching, such as extend-claim in cli/filplus.go (default batch-size of 500) and terminate in cli/spcli/sectors.go (no batching at all).

Fallback: If adaptive splitting adds too much complexity, a conservative fixed default (e.g., 15-20 deals based on observed gas usage) would still be an improvement over the current 50.

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