glifio / go-pools

The GoLang SDK for GLIF Pools Protocol
Apache License 2.0
3 stars 2 forks source link

Research task: create `termPenaltyOnPledge` method #83

Open Schwartz10 opened 2 months ago

Schwartz10 commented 2 months ago

It's important to understand what new hypothetical termination penalties you will incur as a miner if you pledge new FIL.

The method interface:

termPenaltyOnPledge(filToPledge *big.Int, sectorSize uint64, percQAP *big.Float) => (cost *big.Int, penalty *big.Int, error)

cost - the cost to pledge the given sector (hypothetically) penalty - the hypothetical term penalty on the sector

For the variables we need to supply to the TerminateSector call:

    height uint64 => current block height
    sectorSize uint64 => get from the miner ID
    qaPowerSmoothedPositionEstimate *corebig.Int => network params
    qaPowerSmoothedVelocityEstimate *corebig.Int => network params
    rewardSmoothedPositionEstimate *corebig.Int => network params
    rewardSmoothedVelocityEstimate *corebig.Int => network params
    activation uint64 => current block height
    expiration uint64 => hardcode to 18 months
    dealWeight *corebig.Int => hardcode to 0 for now
    verifiedDealWeight *corebig.Int => percQAP passed as a parameter
    expectedDayReward *corebig.Int => network parameter based on sector power
    expectedStoragePledge *corebig.Int => network parameter
    powerBaseEpoch uint64 => ???
    replacedDayReward *corebig.Int => IGNORE FOR NOW

NOTE that this does not have to do with any existing economics pledged in sectors for any particular single miner. It's helpful to understand how 1 FIL will devalue upon pledging

jimpick commented 1 month ago

PR #84 has a possible implementation for this.