Set gas to 1

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-29 18:56:27 +02:00
parent cd2595da67
commit ca7e5f5e16
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -281,16 +281,24 @@ func (s1 *stats) Combine(s2 *stats) {
func tallyGasCharges(charges map[string]*stats, et types.ExecutionTrace) { func tallyGasCharges(charges map[string]*stats, et types.ExecutionTrace) {
for _, gc := range et.GasCharges { for _, gc := range et.GasCharges {
compGas := gc.ComputeGas compGas := gc.VirtualComputeGas
if compGas == 0 { if compGas == 0 {
compGas = 1 compGas = 1
} }
compGas = 1
ratio := float64(compGas) / float64(gc.TimeTaken.Nanoseconds()) ratio := float64(compGas) / float64(gc.TimeTaken.Nanoseconds())
ratio = 1 / ratio ratio = 1 / ratio
if math.IsNaN(ratio) { if math.IsNaN(ratio) {
log.Errorf("NaN: comGas: %f, taken: %d", compGas, gc.TimeTaken.Nanoseconds()) log.Errorf("NaN: comGas: %f, taken: %d", compGas, gc.TimeTaken.Nanoseconds())
} }
name := gc.Name
if eString, ok := gc.Extra.(string); ok {
name += "-" + eString
} else if eInt, ok := gc.Extra.(float64); ok {
// handle scaling
_ = eInt
}
s := charges[gc.Name] s := charges[gc.Name]
if s == nil { if s == nil {