Skip to content

Commit

Permalink
Merge pull request #182 from testinprod-io/fjrod-l1gas-fix
Browse files Browse the repository at this point in the history
Compute fastLzSize correctly
  • Loading branch information
ImTei authored May 29, 2024
2 parents f73de63 + 6d4254e commit 12f16cd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,16 @@ func (tm *TransactionMisc) computeRollupGas(tx interface {
return v.(types2.RollupCostData)
}
var c rollupGasCounter
err := tx.MarshalBinary(&c)
var buf bytes.Buffer
err := tx.MarshalBinary(&buf)
if err != nil { // Silent error, invalid txs will not be marshalled/unmarshalled for batch submission anyway.
log.Error("failed to encode tx for L1 cost computation", "err", err)
}
total := types2.RollupCostData{Zeroes: c.zeroes, Ones: c.ones}
_, err = c.Write(buf.Bytes())
if err != nil {
log.Error("failed to compute rollup cost data", "err", err)
}
total := types2.RollupCostData{Zeroes: c.zeroes, Ones: c.ones, FastLzSize: c.fastLzSize}
tm.rollupGas.Store(total)
return total
}
Expand Down

0 comments on commit 12f16cd

Please sign in to comment.