Abnormal gas usage of ProveCommitAggregate
compared with ProveCommitSector
#689
Replies: 5 comments 10 replies
-
Your observation is correct and we do have a regression on this feature atm - have you seen filecoin-project/builtin-actors#1276, we have some context there? |
Beta Was this translation helpful? Give feedback.
-
This looks a high priority issue. The base-fee will get higher if storage providers stop prove-aggregation, which may make the chain quality worse. |
Beta Was this translation helpful? Give feedback.
-
This note expands an item from Cron safety - survey of the problem and solutions. It describes why and how to to remove from cron the expensive sector and deal activation work associated with onboarding via the single-sector ProveCommit method. This:
Developed in collaboration with @ZenGround0. BackgroundSingle PoRep proofs are validated asynchronously via a cron call to the power actor. The asynchrony is to enable the use of multiple CPU cores by verifying multiple proofs submitted that epoch in parallel. Blockchain execution is usually single-threaded, so multiple processor cores are seen as an otherwise wasted resource. After a proof is verified the sector is activated back with the miner actor, all in the power actor’s cron handler. By contrast, when submitting an aggregated PoRep, all of the proof validation and sector activation is executed synchronously and billed to the caller. ProblemsWe explicitly charge gas (discounted) for the single proof validation when it is submitted, so it’s both bounded and paid for. However, the state updates associated with sector activation are not metered, because they execute in cron. The execution cost of this activation varies significantly with the deal content of the sector, but the storage provider doesn’t pay gas for this. On the other hand, aggregated proof validation also activates the sector synchronously, for which the SP pays the gas cost. Thus single-sector onboarding is subsidised relative to aggregation, but aggregation would otherwise efficiently support much higher onboarding rates. Deal activation is cron only (kind-of) ok at the moment because the built-in market is the only market, and it offers no facility to synchronously invoke (notify) user actors/contracts during deal activation. To better support deal-related user actors we would like support activation notifications to untrusted code, which we cannot do from cron. ProposalUltimately the SP must pay the gas costs associated with sector activation, including deal activation. The present cron subsidy must be removed. Synchronous sector activationAdd a new The existing This will have the effect of removing the subsidy to single Optimise deal activation costsResolving the imbalance results in an aggregate increase in onboarding gas costs, as the SP must pay for the deal activation work currently hidden in cron. We should also optimise the on-chain work that’s now uniformly paid for by the SP. Details of are deferred to filecoin-project/builtin-actors#1276 (we need to profile and understand the costs first). Asynchronous sector activation (optional)Add a new Internally, instead of calling the current Add a new This will restore the global efficiency gain of asynchronous, batched proof validation, but requires an SP to submit a total of three messages to complete sector onboarding (or four, with deals). This would introduce protocol and operational complexity which may not be worth the gain. It’s also a stepping stone to more functionality. Sealing as a service support (optional)Add This method efficiently supports sealing as a service. The sealer may submit proof verification on chain, then take their time to transport the physical sector to the miner, who then activates it when they are ready to submit regular WindowPost. The motivation for this is from discussion #570. Deadline assignment support (optional)Add parameters to TODO: determine if SP control over WindowPoSt scheduling is safe; initial design assumed not. Future-proofingFuture changes for improved storage programmability (sector events/notifications) will need additional parameters to sector activation methods (ActivateSector, ProveCommitSync, and the existing methods) to include a list of PieceCIDs and associated actor addresses and piece identifiers to be notified about piece inclusion in an activated sector. We could probably add these to the parameter object for this method now, but require them to be empty. |
Beta Was this translation helpful? Give feedback.
-
Quick question, while the optimization part of filecoin-project/builtin-actors#1276 is being worked on. Our team is currently not prioritizing filecoin-project/builtin-actors#1277:
With that being said, I am curious if the community prefers correctness soon on this so that you can leverage Aggregation! |
Beta Was this translation helpful? Give feedback.
-
@anorth - have a q when writing #820. In the past, we have always been keeping an outdated method for an upgrade or two after the introduction of the new method before dropping it. However, sometimes we forgot about the deprecation which leads unnecessary protocol methods and code in actors. Thus im wondering, can we introduce the new method and drop the old method in the same upgrade. The old method deprecation will be activated 1-2 days after the upgrade so to avoid messages that are inflight around upgrade to fail & give a bit more time for clients to adopt if they haven't already? |
Beta Was this translation helpful? Give feedback.
-
We found that the average cost of
ProveCommitAggregate
is higher thanProveCommitSector
, mainly because the gas usage ofProveCommitAggregate
is higher than N times the gas usage ofProveCommitSector
, here're two typical transactions:ProveCommitAggregate
(which aggregates 16 sectors):https://filfox.info/en/message/bafy2bzacebejx2n2jjzfn3d5xtwe54qy6j35txjiofdgcsuwt54cmh2uox6du
ProveCommitSector
:https://filfox.info/en/message/bafy2bzacedf6z7ll6t5wgy34tltebjk7ucsm5fahqquy32vpnwwgw2gz3spzy
The gas usage of
ProveCommitAggregate
is2,778,005,962
, ofProveCommitSector
is63,750,572
, the average gas cost(ignoringaggregate_fee
for now) is2,778,005,962/(63,750,572*16)=2.723510820028407
times that ofProveCommitSector
.A possible reason is that for
ProveCommitSector
, the gas cost is mostly decided by this empirical constant, and activation is delayed to cron for free; But forProveCommitAggregate
, even though there's also a empirical constant, the activation gas is also paid by the miner directly.So we guess that current activation gas is much higher than anticipated earlier, and we've stopped using
ProveCommitAggregate
for DC sectors(CC sectors don't have deals to activate).Beta Was this translation helpful? Give feedback.
All reactions