Logo
    Activation Gas Costs Comparison Between ProveCommit and ProofReplicaUpdates
    ⛽

    Activation Gas Costs Comparison Between ProveCommit and ProofReplicaUpdates

    Authors
    Creator
    Created
    May 9, 2023 10:55 AM
    Project
    Storage on-boarding
    Stage
    Still Valid
    💡
    TL;DR: There is an asymmetry between ProveCommit and ProveReplicaUpdates in the way we charge gas activation costs (ProveReplicaUpdates pays those costs, ProveCommit does not). If we want to re-balance gas costs we can either - Subsidize Activation costs for ProveReplicaUpdates ⇒ ProveReplicaUpdates Avg. gas cost reduced by ~60% or - Make ProveCommit pay for activation gas costs ⇒ ProveCommit Avg. gas cost ~3x higher

    If we want to re-balance gas costs we can:

    • Either: Subsidize Activation costs for ProveReplicaUpdates ⇒ ProveReplicaUpdates Avg. gas cost reduced by 60%
    • Or: Make ProveCommit pay for activation gas costs ⇒ ProveCommit Avg. gas cost 3x higher. (scheduled for nv21)

    Motivation

    Gas costs given by deal activation are subsidized by Cron ProveCommit message (single precommited sectors), while are paid by ProveReplicaUpdates message when snapping and by ProveCommitAggregate for batched provecommit.

    This asymmetry is already underlined in Separating proof validation from sector activation.

    We want here to estimate which is the difference in gas unit (and thus cost) in both scenarios.

    Gas Mismatch Estimation

    We operate as follows

    • Consider different blocks with different ProveReplicaUpdates by different SPs
    • Integrating the data with the average gas used values taken from FilFox.

    What we'll have in the end will be the unit of gas needed for deal activation which will give us an estimation of what would be the overhead for deal activation in ProveCommit messages

    Blocks considered

    We consider two different blocks with ProveReplicaUpdates from which we'll extrapolate all the subcalls needed for deal activation and sector (re)activation which are subsidizez by cron in case of PreCommit messages.

    Epoch 2843500

    Epoch 2843500.htm11836.7KB

    Epoch 2844239

    Epoch 2844239.htm24151.6KB

    Assumptions

    • Cost of a unit of gas: 0.5 nanofil (5*10^{-10} FIL)
      • It is an average value evaluated using the average gas fee and the average gas used of ProveCommitand ProveReplicaUpdates from FilFox on May 9th, 2023 (that is, considering Avg. Gas Fee/Avg. Gas Used in both cases)
    • Average gas used for ProveCommitSector ~ 72M gas units
    • Average gas used for `ProveReplicaUpdates ~272.9M gas units
    • image
      image
      image

    Subcalls of ProveReplicaUpdates to be considered

    Deal Activation

    • ActivateDeals
    • ClaimAllocations (verified deals only)
      • BurnExported (subcall of ClaimAllocations)
    • VerifyDealsforActivation
      • This call can be optimised out by using the information returned from Activate Deals
        • https://github.com/filecoin-project/builtin-actors/blob/7140df519fa355f966aac2d7d6f6b014b5851154/actors/miner/src/lib.rs#L4968 (Activate Deals) https://github.com/filecoin-project/builtin-actors/blob/7140df519fa355f966aac2d7d6f6b014b5851154/actors/market/src/types.rs#L106-L118
        • While VerifyDealsForActivation returns only Data CIDs: https://github.com/filecoin-project/builtin-actors/blob/7140df519fa355f966aac2d7d6f6b014b5851154/actors/market/src/types.rs#L88-L97

    Sector Re-activation

    • ThisEpochReward
    • CurrentTotalPower
    • UpdatePledgeTotal
    • UpdateClaimedPower

    Subcalls of ProveCommitAggregate to be considered

    Deal Activation

    • ActivateDeals
    • ClaimAllocations
      • BurnExported (subcall of ClaimAllocations)
    • VerifyDealsforActivation

    Sector Activation

    • ThisEpochReward
    • CurrentTotalPower
    • UpdatePledgeTotal
    • UpdateClaimedPower
      • UpdateClaimedPower for new sectors is called once during the first WindowPoSt after the sector is on-boarded. It will also be called only once for all new sectors in the given deadline.

    ProveReplicaUpdates

    ActivateDeals
    # deals
    ClaimAllocations
    BurnExported
    VerifyDealsforActivation
    ThisEpochReward
    CurrentTotalPower
    UpdatePledgeTotal
    UpdateClaimedPower
    Epoch 2843500
    50M
    1
    64.7M
    14M
    4.5M
    1M
    1M
    5.2M
    24M
    55M
    1
    69.6M
    14M
    4.5M
    1M
    1M
    5.2M
    24M
    Epoch 2844239
    72.7M
    2
    93.2M
    14M
    4.5
    1M
    1M
    5.1M
    23.6M
    72.1
    2
    99.3M
    14M
    4.5M
    1M
    1M
    5.1M
    23.6M
    72.7
    2
    93.2M
    14M
    4.5M
    1M
    1M
    5.1M
    23.6M
    423.5M
    16
    423.2M
    14M
    20M
    1M
    1M
    5.1M
    23.5M
    • Amortized per Deal Activation gas cost ~ 100M gas unit
    • Single Deal sector Deal Activation gas cost ~ 140.65M gas units
    • Sector Re-Activation gas cost ~31.2M gas units

    ProveCommitAggregate

    ActivateDeals
    ClaimAllocations
    VerifyDealsforActivation
    ThisEpochReward
    CurrentTotalPower
    UpdatePledgeTotal
    UpdateClaimedPower
    Epoch 2843500
    —
    —
    —
    —
    —
    —
    —
    Epoch 2844239
    ~56M per deal
    ~62M per deal
    —
    1M
    1M
    5.1M
    —
    • Per Deal Activation gas cost ~ 118M gas units
    • Sector Activation gas cost ~ 7.1 M gas units

    Estimations

    We consider the case of ProveReplicaUpdates with 1 deal per sector (since it is the case we are modeling in ↗️[2023Q2] CC Sector Upgrade: Guidelines and Modeling ).

    Activation Estimates

    Per-Deal Activation for ProveReplicaUpdates
    Per-Deal Activation for ProveCommitAggregate
    Sector Re-Activation (ProveReplicaUpdates)
    Sector Activation (ProveCommitAggregate)
    Estimation
    140.65M
    118M
    31.2M
    7.1M

    ProveCommit and ProveReplicaUpdates Gas Costs Comparison

    ProveCommit
    ProveReplicaUpdate
    Average gas units
    71.8M
    272.9M
    Gas units w/o counting Activation
    71.8M
    101.05M (272.9-140.65-31.2)
    Gas units counting Activation
    196.9 (71.8+118+7.1)
    272.9
    Average cost assuming 0.5 nanofil per unit of gas w/o counting for Activation
    0.039 FIL (currently paid)
    0.0505 FIL
    Average cost assuming 0.5 nanofil per unit of gas counting for Activation
    0.09845 FIL
    0.1268 FIL (currently paid)

    Considering the average value for gas used by ProveReplicaUpdates ~ 273M, we have that activation gas costs (deal activation + sector activation) represent the ~ 62.9% of the gas fees.

    Considering the average value for gas used by ProveCommit ~71.8M, we have that charging activation gas fees (deal activation + sector activation) to ProveCommit would increase its cost by 3x.

    CryptoNet is a Protocol Labs initiative.