From 6d4254e7393819adf7933e0330d4d6c586262816 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Wed, 29 May 2024 21:43:06 +0900 Subject: [PATCH] Compute fastLzSize correctly --- core/types/transaction.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 03542fe9f33..e8db1dc661d 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -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 }