-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
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:
- Start with a
--max-dealssized batch - Call
GasEstimateMessageGason the message - If gas exceeds target (
--max-gas, defaulting toBlockGasLimit / 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
Labels
Type
Projects
Status