Use scaling VerifyPost costs
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
b488012d5f
commit
0d169dd947
@ -111,8 +111,22 @@ var prices = map[abi.ChainEpoch]Pricelist{
|
||||
hashingBase: 110685,
|
||||
computeUnsealedSectorCidBase: 431890,
|
||||
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
|
||||
verifyPostBase: 2621447835,
|
||||
verifyConsensusFault: 495422,
|
||||
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
|
||||
abi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
|
||||
flat: 106102820,
|
||||
scale: 10238878,
|
||||
},
|
||||
abi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
|
||||
flat: 1165718059,
|
||||
scale: 166657,
|
||||
},
|
||||
abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
|
||||
// TODO, for now the same as 32GiB
|
||||
flat: 1165718059,
|
||||
scale: 166657,
|
||||
},
|
||||
},
|
||||
verifyConsensusFault: 495422,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,11 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
)
|
||||
|
||||
type scalingCost struct {
|
||||
flat int64
|
||||
scale int64
|
||||
}
|
||||
|
||||
type pricelistV0 struct {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// System operations
|
||||
@ -81,7 +86,7 @@ type pricelistV0 struct {
|
||||
|
||||
computeUnsealedSectorCidBase int64
|
||||
verifySealBase int64
|
||||
verifyPostBase int64
|
||||
verifyPostLookup map[abi.RegisteredPoStProof]scalingCost
|
||||
verifyConsensusFault int64
|
||||
}
|
||||
|
||||
@ -177,13 +182,22 @@ func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) GasCharge {
|
||||
// OnVerifyPost
|
||||
func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) GasCharge {
|
||||
sectorSize := "unknown"
|
||||
if len(info.ChallengedSectors) != 0 {
|
||||
ss, err := info.ChallengedSectors[0].SealProof.SectorSize()
|
||||
var proofType abi.RegisteredPoStProof
|
||||
|
||||
if len(info.Proofs) != 0 {
|
||||
proofType = info.Proofs[0].PoStProof
|
||||
ss, err := info.Proofs[0].PoStProof.SectorSize()
|
||||
if err == nil {
|
||||
sectorSize = ss.ShortString()
|
||||
}
|
||||
}
|
||||
return newGasCharge("OnVerifyPost", pl.verifyPostBase, 0).
|
||||
|
||||
cost, ok := pl.verifyPostLookup[proofType]
|
||||
if !ok {
|
||||
cost = pl.verifyPostLookup[abi.RegisteredPoStProof_StackedDrgWindow512MiBV1]
|
||||
}
|
||||
|
||||
return newGasCharge("OnVerifyPost", cost.flat+int64(len(info.ChallengedSectors))*cost.scale, 0).
|
||||
WithExtra(map[string]interface{}{
|
||||
"type": sectorSize,
|
||||
"size": len(info.ChallengedSectors),
|
||||
|
Loading…
Reference in New Issue
Block a user