Skip to content

Commit d0e730b

Browse files
committed
Use blocktime not blocknumber
1 parent f1348bb commit d0e730b

File tree

16 files changed

+39
-35
lines changed

16 files changed

+39
-35
lines changed

cmd/evm/internal/t8ntool/execution.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
180180
snapshot := statedb.Snapshot()
181181
evm := vm.NewEVM(vmContext, txContext, statedb, chainConfig, vmConfig)
182182

183-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, chainConfig, new(big.Int).SetUint64(pre.Env.Number))
183+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp)
184184
if err != nil {
185185
log.Info("rejected tx due to fees.CalculateL1DataFee", "index", i, "hash", tx.Hash(), "from", msg.From(), "error", err)
186186
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})

core/state_prefetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
7171
}
7272
statedb.SetTxContext(tx.Hash(), i)
7373

74-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, p.config, block.Number())
74+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, p.config, block.Number(), block.Time())
7575
if err != nil {
7676
return
7777
}

core/state_processor.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
8080
header = block.Header()
8181
blockHash = block.Hash()
8282
blockNumber = block.Number()
83+
blockTime = block.Time()
8384
allLogs []*types.Log
8485
gp = new(GasPool).AddGas(block.GasLimit())
8586
)
@@ -105,7 +106,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
105106
return nil, nil, 0, fmt.Errorf("could not apply tx %d [%v]: %w", i, tx.Hash().Hex(), err)
106107
}
107108
statedb.SetTxContext(tx.Hash(), i)
108-
receipt, err := applyTransaction(msg, p.config, p.bc, nil, gp, statedb, blockNumber, blockHash, tx, usedGas, vmenv)
109+
receipt, err := applyTransaction(msg, p.config, p.bc, nil, gp, statedb, blockNumber, blockTime, blockHash, tx, usedGas, vmenv)
109110
if err != nil {
110111
return nil, nil, 0, fmt.Errorf("could not apply tx %d [%v]: %w", i, tx.Hash().Hex(), err)
111112
}
@@ -120,7 +121,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
120121
return receipts, allLogs, *usedGas, nil
121122
}
122123

123-
func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, blockNumber *big.Int, blockHash common.Hash, tx *types.Transaction, usedGas *uint64, evm *vm.EVM) (*types.Receipt, error) {
124+
func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, blockNumber *big.Int, blockTime uint64, blockHash common.Hash, tx *types.Transaction, usedGas *uint64, evm *vm.EVM) (*types.Receipt, error) {
124125
defer func(t0 time.Time) {
125126
applyTransactionTimer.Update(time.Since(t0))
126127
}(time.Now())
@@ -129,7 +130,7 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
129130
txContext := NewEVMTxContext(msg)
130131
evm.Reset(txContext, statedb)
131132

132-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, config, blockNumber)
133+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, config, blockNumber, blockTime)
133134
if err != nil {
134135
return nil, err
135136
}
@@ -201,7 +202,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
201202
// Create a new context to be used in the EVM environment
202203
blockContext := NewEVMBlockContext(header, bc, config, author)
203204
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg)
204-
return applyTransaction(msg, config, bc, author, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv)
205+
return applyTransaction(msg, config, bc, author, gp, statedb, header.Number, header.Time, header.Hash(), tx, usedGas, vmenv)
205206
}
206207

207208
// ProcessParentBlockHash stores the parent block hash in the history storage contract

core/tx_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func (l *txList) Overlaps(tx *types.Transaction) bool {
282282
//
283283
// If the new transaction is accepted into the list, the lists' cost and gas
284284
// thresholds are also potentially updated.
285-
func (l *txList) Add(tx *types.Transaction, state *state.StateDB, priceBump uint64, chainconfig *params.ChainConfig, blockNumber *big.Int) (bool, *types.Transaction) {
285+
func (l *txList) Add(tx *types.Transaction, state *state.StateDB, priceBump uint64, chainconfig *params.ChainConfig, blockNumber *big.Int, blockTime uint64) (bool, *types.Transaction) {
286286
// If there's an older better transaction, abort
287287
old := l.txs.Get(tx.Nonce())
288288
if old != nil {
@@ -310,7 +310,7 @@ func (l *txList) Add(tx *types.Transaction, state *state.StateDB, priceBump uint
310310
l1DataFee := big.NewInt(0)
311311
if state != nil && chainconfig != nil {
312312
var err error
313-
l1DataFee, err = fees.CalculateL1DataFee(tx, state, chainconfig, blockNumber)
313+
l1DataFee, err = fees.CalculateL1DataFee(tx, state, chainconfig, blockNumber, blockTime)
314314
if err != nil {
315315
log.Error("Failed to calculate L1 data fee", "err", err, "tx", tx)
316316
return false, nil

core/tx_list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestStrictTxListAdd(t *testing.T) {
3838
// Insert the transactions in a random order
3939
list := newTxList(true)
4040
for _, v := range rand.Perm(len(txs)) {
41-
list.Add(txs[v], nil, DefaultTxPoolConfig.PriceBump, nil, nil)
41+
list.Add(txs[v], nil, DefaultTxPoolConfig.PriceBump, nil, nil, 0)
4242
}
4343
// Verify internal state
4444
if len(list.txs.items) != len(txs) {
@@ -65,7 +65,7 @@ func BenchmarkTxListAdd(b *testing.B) {
6565
for i := 0; i < b.N; i++ {
6666
list := newTxList(true)
6767
for _, v := range rand.Perm(len(txs)) {
68-
list.Add(txs[v], nil, DefaultTxPoolConfig.PriceBump, nil, nil)
68+
list.Add(txs[v], nil, DefaultTxPoolConfig.PriceBump, nil, nil, 0)
6969
list.Filter(priceLimit, DefaultTxPoolConfig.PriceBump)
7070
}
7171
}

core/tx_pool.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ type TxPool struct {
301301

302302
currentState *state.StateDB // Current state in the blockchain head
303303
currentHead *big.Int // Current blockchain head
304+
currentTime uint64 // Current blockchain head time
304305
pendingNonces *txNoncer // Pending state tracking virtual nonces
305306
currentMaxGas uint64 // Current gas limit for transaction caps
306307

@@ -838,7 +839,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
838839
// 2. If FeeVault is enabled, perform an additional check for L1 data fees.
839840
if pool.chainconfig.Scroll.FeeVaultEnabled() {
840841
// Get L1 data fee in current state
841-
l1DataFee, err := fees.CalculateL1DataFee(tx, pool.currentState, pool.chainconfig, pool.currentHead)
842+
l1DataFee, err := fees.CalculateL1DataFee(tx, pool.currentState, pool.chainconfig, pool.currentHead, pool.currentTime)
842843
if err != nil {
843844
return fmt.Errorf("failed to calculate L1 data fee, err: %w", err)
844845
}
@@ -947,7 +948,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
947948
from, _ := types.Sender(pool.signer, tx) // already validated
948949
if list := pool.pending[from]; list != nil && list.Overlaps(tx) {
949950
// Nonce already pending, check if required price bump is met
950-
inserted, old := list.Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead)
951+
inserted, old := list.Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead, pool.currentTime)
951952
if !inserted {
952953
log.Debug("Discarding underpriced pending transaction", "hash", hash.Hex(), "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap())
953954
pendingDiscardMeter.Mark(1)
@@ -1001,7 +1002,7 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction, local boo
10011002
pool.queue[from] = newTxList(false)
10021003
}
10031004

1004-
inserted, old := pool.queue[from].Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead)
1005+
inserted, old := pool.queue[from].Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead, pool.currentTime)
10051006
if !inserted {
10061007
// An older transaction was better, discard this
10071008
log.Debug("Discarding underpriced queued transaction", "hash", hash.Hex(), "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap())
@@ -1068,7 +1069,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
10681069
return false
10691070
}
10701071

1071-
inserted, old := list.Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead)
1072+
inserted, old := list.Add(tx, pool.currentState, pool.config.PriceBump, pool.chainconfig, pool.currentHead, pool.currentTime)
10721073
if !inserted {
10731074
// An older transaction was better, discard this
10741075
log.Debug("Discarding underpriced pending transaction", "hash", hash.Hex(), "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap())
@@ -1603,6 +1604,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
16031604

16041605
// Update current head
16051606
pool.currentHead = next
1607+
pool.currentTime = newHead.Time
16061608
}
16071609

16081610
// promoteExecutables moves transactions that have become processable from the
@@ -1690,7 +1692,7 @@ func (pool *TxPool) executableTxFilter(costLimit *big.Int) func(tx *types.Transa
16901692

16911693
if pool.chainconfig.Scroll.FeeVaultEnabled() {
16921694
// recheck L1 data fee, as the oracle price may have changed
1693-
l1DataFee, err := fees.CalculateL1DataFee(tx, pool.currentState, pool.chainconfig, pool.currentHead)
1695+
l1DataFee, err := fees.CalculateL1DataFee(tx, pool.currentState, pool.chainconfig, pool.currentHead, pool.currentTime)
16941696
if err != nil {
16951697
log.Error("Failed to calculate L1 data fee", "err", err, "tx", tx)
16961698
return false

eth/state_accessor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec
198198
// Not yet the searched for transaction, execute on top of the current state
199199
vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{})
200200
statedb.SetTxContext(tx.Hash(), idx)
201-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, eth.blockchain.Config(), block.Number())
201+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, eth.blockchain.Config(), block.Number(), block.Time())
202202
if err != nil {
203203
return nil, vm.BlockContext{}, nil, err
204204
}

eth/tracers/api.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func (api *API) traceChain(ctx context.Context, start, end *types.Block, config
292292
TxHash: tx.Hash(),
293293
}
294294

295-
l1DataFee, err := fees.CalculateL1DataFee(tx, task.statedb, api.backend.ChainConfig(), task.block.Number())
295+
l1DataFee, err := fees.CalculateL1DataFee(tx, task.statedb, api.backend.ChainConfig(), task.block.Number(), task.block.Time())
296296
if err != nil {
297297
// though it's not a "tracing error", we still need to put it here
298298
task.results[i] = &txTraceResult{Error: err.Error()}
@@ -557,7 +557,7 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
557557
)
558558
statedb.SetTxContext(tx.Hash(), i)
559559

560-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number())
560+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number(), block.Time())
561561
if err != nil {
562562
log.Warn("Tracing intermediate roots did not complete due to fees.CalculateL1DataFee", "txindex", i, "txhash", tx.Hash(), "err", err)
563563
return nil, err
@@ -645,7 +645,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
645645
TxHash: txs[task.index].Hash(),
646646
}
647647

648-
l1DataFee, err := fees.CalculateL1DataFee(txs[task.index], task.statedb, api.backend.ChainConfig(), block.Number())
648+
l1DataFee, err := fees.CalculateL1DataFee(txs[task.index], task.statedb, api.backend.ChainConfig(), block.Number(), block.Time())
649649
if err != nil {
650650
// though it's not a "tracing error", we still need to put it here
651651
results[task.index] = &txTraceResult{
@@ -679,7 +679,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
679679
msg, _ := tx.AsMessage(signer, block.BaseFee())
680680
statedb.SetTxContext(tx.Hash(), i)
681681
vmenv := vm.NewEVM(blockCtx, core.NewEVMTxContext(msg), statedb, api.backend.ChainConfig(), vm.Config{})
682-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number())
682+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number(), block.Time())
683683
if err != nil {
684684
failed = err
685685
break
@@ -804,7 +804,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
804804
// Execute the transaction and flush any traces to disk
805805
vmenv := vm.NewEVM(vmctx, txContext, statedb, chainConfig, vmConf)
806806
statedb.SetTxContext(tx.Hash(), i)
807-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number())
807+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number(), block.Time())
808808
if err == nil {
809809
_, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas()), l1DataFee)
810810
}
@@ -869,7 +869,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
869869
TxIndex: int(index),
870870
TxHash: hash,
871871
}
872-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number())
872+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, api.backend.ChainConfig(), block.Number(), block.Time())
873873
if err != nil {
874874
return nil, err
875875
}

eth/tracers/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (b *testBackend) StateAtTransaction(ctx context.Context, block *types.Block
173173
return msg, context, statedb, nil
174174
}
175175
vmenv := vm.NewEVM(context, txContext, statedb, b.chainConfig, vm.Config{})
176-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, b.chainConfig, block.Number())
176+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, b.chainConfig, block.Number(), block.Time())
177177
if err != nil {
178178
return nil, vm.BlockContext{}, nil, err
179179
}

eth/tracers/internal/tracetest/calltrace_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
193193
if err != nil {
194194
t.Fatalf("failed to prepare transaction for tracing: %v", err)
195195
}
196-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, test.Genesis.Config, context.BlockNumber)
196+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, test.Genesis.Config, context.BlockNumber, context.Time.Uint64())
197197
if err != nil {
198198
t.Fatalf("failed to calculate l1DataFee: %v", err)
199199
}
@@ -308,7 +308,7 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
308308
}
309309
evm := vm.NewEVM(context, txContext, statedb, test.Genesis.Config, vm.Config{Debug: true, Tracer: tracer})
310310
snap := statedb.Snapshot()
311-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, test.Genesis.Config, context.BlockNumber)
311+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, test.Genesis.Config, context.BlockNumber, context.Time.Uint64())
312312
if err != nil {
313313
b.Fatalf("failed to calculate l1DataFee: %v", err)
314314
}
@@ -381,7 +381,7 @@ func TestZeroValueToNotExitCall(t *testing.T) {
381381
if err != nil {
382382
t.Fatalf("failed to prepare transaction for tracing: %v", err)
383383
}
384-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, params.MainnetChainConfig, context.BlockNumber)
384+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, params.MainnetChainConfig, context.BlockNumber, context.Time.Uint64())
385385
if err != nil {
386386
t.Fatalf("failed to calculate l1DataFee: %v", err)
387387
}

eth/tracers/tracers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func BenchmarkTransactionTrace(b *testing.B) {
112112

113113
for i := 0; i < b.N; i++ {
114114
snap := statedb.Snapshot()
115-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, params.AllEthashProtocolChanges, context.BlockNumber)
115+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, params.AllEthashProtocolChanges, context.BlockNumber, context.Time.Uint64())
116116
if err != nil {
117117
b.Fatal(err)
118118
}

les/state_accessor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (leth *LightEthereum) stateAtTransaction(ctx context.Context, block *types.
6565
}
6666
// Not yet the searched for transaction, execute on top of the current state
6767
vmenv := vm.NewEVM(context, txContext, statedb, leth.blockchain.Config(), vm.Config{})
68-
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, leth.blockchain.Config(), block.Number())
68+
l1DataFee, err := fees.CalculateL1DataFee(tx, statedb, leth.blockchain.Config(), block.Number(), block.Time())
6969
if err != nil {
7070
return nil, vm.BlockContext{}, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
7171
}

light/txpool.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type TxPool struct {
7474
shanghai bool // Fork indicator whether we are in the shanghai stage.
7575

7676
currentHead *big.Int // Current blockchain head
77+
currentTime uint64 // Current blockchain head time
7778
}
7879

7980
// TxRelayBackend provides an interface to the mechanism that forwards transacions
@@ -326,6 +327,7 @@ func (pool *TxPool) setNewHead(head *types.Header) {
326327
pool.shanghai = pool.config.IsShanghai(next)
327328

328329
pool.currentHead = next
330+
pool.currentTime = head.Time
329331
}
330332

331333
// Stop stops the light transaction pool
@@ -408,7 +410,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
408410
// 2. If FeeVault is enabled, perform an additional check for L1 data fees.
409411
if pool.config.Scroll.FeeVaultEnabled() {
410412
// Get L1 data fee in current state
411-
l1DataFee, err := fees.CalculateL1DataFee(tx, currentState, pool.config, pool.currentHead)
413+
l1DataFee, err := fees.CalculateL1DataFee(tx, currentState, pool.config, pool.currentHead, pool.currentTime)
412414
if err != nil {
413415
return fmt.Errorf("failed to calculate L1 data fee, err: %w", err)
414416
}

rollup/fees/rollup_fee.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"math"
66
"math/big"
7-
"time"
87

98
"github.com/holiman/uint256"
109

@@ -268,7 +267,7 @@ func mulAndScale(x *big.Int, y *big.Int, precision *big.Int) *big.Int {
268267
return new(big.Int).Quo(z, precision)
269268
}
270269

271-
func CalculateL1DataFee(tx *types.Transaction, state StateDB, config *params.ChainConfig, blockNumber *big.Int) (*big.Int, error) {
270+
func CalculateL1DataFee(tx *types.Transaction, state StateDB, config *params.ChainConfig, blockNumber *big.Int, blockTime uint64) (*big.Int, error) {
272271
if tx.IsL1MessageTx() {
273272
return big.NewInt(0), nil
274273
}
@@ -284,7 +283,7 @@ func CalculateL1DataFee(tx *types.Transaction, state StateDB, config *params.Cha
284283

285284
if !config.IsCurie(blockNumber) {
286285
l1DataFee = calculateEncodedL1DataFee(raw, gpoState.overhead, gpoState.l1BaseFee, gpoState.scalar)
287-
} else if !config.IsFeynman(blockNumber) {
286+
} else if !config.IsFeynman(blockTime) {
288287
l1DataFee = calculateEncodedL1DataFeeCurie(raw, gpoState.l1BaseFee, gpoState.l1BlobBaseFee, gpoState.commitScalar, gpoState.blobScalar)
289288
} else {
290289
l1DataFee = calculateEncodedL1DataFeeFeynman(raw, gpoState.l1BaseFee, gpoState.l1BlobBaseFee, gpoState.commitScalar, gpoState.blobScalar)

rollup/tracing/tracing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error
239239
msg, _ := tx.AsMessage(env.signer, block.BaseFee())
240240
env.state.SetTxContext(tx.Hash(), i)
241241
vmenv := vm.NewEVM(env.blockCtx, core.NewEVMTxContext(msg), env.state, env.chainConfig, vm.Config{})
242-
l1DataFee, err := fees.CalculateL1DataFee(tx, env.state, env.chainConfig, block.Number())
242+
l1DataFee, err := fees.CalculateL1DataFee(tx, env.state, env.chainConfig, block.Number(), block.Time())
243243
if err != nil {
244244
failed = err
245245
break
@@ -342,7 +342,7 @@ func (env *TraceEnv) getTxResult(state *state.StateDB, index int, block *types.B
342342
state.SetTxContext(txctx.TxHash, txctx.TxIndex)
343343

344344
// Computes the new state by applying the given message.
345-
l1DataFee, err := fees.CalculateL1DataFee(tx, state, env.chainConfig, block.Number())
345+
l1DataFee, err := fees.CalculateL1DataFee(tx, state, env.chainConfig, block.Number(), block.Time())
346346
if err != nil {
347347
return err
348348
}

tests/state_test_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
251251
gaspool := new(core.GasPool)
252252
gaspool.AddGas(block.GasLimit())
253253

254-
l1DataFee, err := fees.CalculateL1DataFee(&ttx, statedb, config, block.Number())
254+
l1DataFee, err := fees.CalculateL1DataFee(&ttx, statedb, config, block.Number(), block.Time())
255255
if err != nil {
256256
return nil, nil, common.Hash{}, err
257257
}

0 commit comments

Comments
 (0)