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,
|
hashingBase: 110685,
|
||||||
computeUnsealedSectorCidBase: 431890,
|
computeUnsealedSectorCidBase: 431890,
|
||||||
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
|
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
|
||||||
verifyPostBase: 2621447835,
|
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
|
||||||
verifyConsensusFault: 495422,
|
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"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type scalingCost struct {
|
||||||
|
flat int64
|
||||||
|
scale int64
|
||||||
|
}
|
||||||
|
|
||||||
type pricelistV0 struct {
|
type pricelistV0 struct {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// System operations
|
// System operations
|
||||||
@ -81,7 +86,7 @@ type pricelistV0 struct {
|
|||||||
|
|
||||||
computeUnsealedSectorCidBase int64
|
computeUnsealedSectorCidBase int64
|
||||||
verifySealBase int64
|
verifySealBase int64
|
||||||
verifyPostBase int64
|
verifyPostLookup map[abi.RegisteredPoStProof]scalingCost
|
||||||
verifyConsensusFault int64
|
verifyConsensusFault int64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,13 +182,22 @@ func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) GasCharge {
|
|||||||
// OnVerifyPost
|
// OnVerifyPost
|
||||||
func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) GasCharge {
|
func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) GasCharge {
|
||||||
sectorSize := "unknown"
|
sectorSize := "unknown"
|
||||||
if len(info.ChallengedSectors) != 0 {
|
var proofType abi.RegisteredPoStProof
|
||||||
ss, err := info.ChallengedSectors[0].SealProof.SectorSize()
|
|
||||||
|
if len(info.Proofs) != 0 {
|
||||||
|
proofType = info.Proofs[0].PoStProof
|
||||||
|
ss, err := info.Proofs[0].PoStProof.SectorSize()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
sectorSize = ss.ShortString()
|
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{}{
|
WithExtra(map[string]interface{}{
|
||||||
"type": sectorSize,
|
"type": sectorSize,
|
||||||
"size": len(info.ChallengedSectors),
|
"size": len(info.ChallengedSectors),
|
||||||
|
Loading…
Reference in New Issue
Block a user