Skip to content

Commit

Permalink
fix: switch to atomic.Pointer for rollupGas only
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbriche committed Jun 17, 2024
1 parent 9d3aaf3 commit accacae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ type TransactionMisc struct {
from atomic.Value

// cache how much gas the tx takes on L1 for its share of rollup data
rollupGas atomic.Value
rollupGas atomic.Pointer[types2.RollupCostData]
}

type rollupGasCounter struct {
Expand Down Expand Up @@ -134,7 +134,7 @@ func (tm *TransactionMisc) computeRollupGas(tx interface {
return types2.RollupCostData{}
}
if v := tm.rollupGas.Load(); v != nil {
return v.(types2.RollupCostData)
return *v
}
var c rollupGasCounter
var buf bytes.Buffer
Expand All @@ -147,7 +147,7 @@ func (tm *TransactionMisc) computeRollupGas(tx interface {
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)
tm.rollupGas.Store(&total)
return total
}

Expand Down

0 comments on commit accacae

Please sign in to comment.