Adapt virtual gas

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-11-11 19:07:39 +01:00
parent f130cd6fca
commit 238174cfca
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 8 additions and 1 deletions

View File

@ -208,7 +208,8 @@ func (pl *pricelistV0) OnVerifyPost(info proof2.WindowPoStVerifyInfo) GasCharge
gasUsed /= 2 // XXX: this is an artificial discount
}
return newGasCharge("OnVerifyPost", gasUsed, 0).WithVirtual(117680921+43780len(info.ChallengedSectors), 0)
return newGasCharge("OnVerifyPost", gasUsed, 0).
WithVirtual(117680921+43780*int64(len(info.ChallengedSectors)), 0).
WithExtra(map[string]interface{}{
"type": sectorSize,
"size": len(info.ChallengedSectors),

View File

@ -545,6 +545,12 @@ func (rt *Runtime) chargeGasInternal(gas GasCharge, skip int) aerrors.ActorError
Callers: callers[:cout],
}
if gasTrace.VirtualStorageGas == 0 {
gasTrace.VirtualStorageGas = gasTrace.StorageGas
}
if gasTrace.VirtualComputeGas == 0 {
gasTrace.VirtualComputeGas = gasTrace.ComputeGas
}
rt.executionTrace.GasCharges = append(rt.executionTrace.GasCharges, &gasTrace)
rt.lastGasChargeTime = now
rt.lastGasCharge = &gasTrace