@@ -38,6 +38,7 @@ import (
38
38
39
39
"github.com/ava-labs/avalanchego/utils/timer/mockable"
40
40
"github.com/ava-labs/avalanchego/utils/units"
41
+ "github.com/ava-labs/subnet-evm/commontype"
41
42
"github.com/ava-labs/subnet-evm/consensus"
42
43
"github.com/ava-labs/subnet-evm/consensus/misc/eip4844"
43
44
"github.com/ava-labs/subnet-evm/core"
@@ -46,7 +47,7 @@ import (
46
47
"github.com/ava-labs/subnet-evm/core/types"
47
48
"github.com/ava-labs/subnet-evm/core/vm"
48
49
"github.com/ava-labs/subnet-evm/params"
49
- "github.com/ava-labs/subnet-evm/plugin/evm/header"
50
+ customheader "github.com/ava-labs/subnet-evm/plugin/evm/header"
50
51
"github.com/ava-labs/subnet-evm/precompile/precompileconfig"
51
52
"github.com/ava-labs/subnet-evm/predicate"
52
53
"github.com/ethereum/go-ethereum/common"
@@ -150,8 +151,11 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
150
151
if err != nil {
151
152
return nil , err
152
153
}
153
- gasLimit := header .GasLimit (w .chainConfig , feeConfig , parent , timestamp )
154
- baseFee , err := header .BaseFee (w .chainConfig , feeConfig , parent , timestamp )
154
+ gasLimit , err := customheader .GasLimit (w .chainConfig , feeConfig , parent , timestamp )
155
+ if err != nil {
156
+ return nil , fmt .Errorf ("calculating new gas limit: %w" , err )
157
+ }
158
+ baseFee , err := customheader .BaseFee (w .chainConfig , feeConfig , parent , timestamp )
155
159
if err != nil {
156
160
return nil , fmt .Errorf ("failed to calculate new base fee: %w" , err )
157
161
}
@@ -200,7 +204,7 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
200
204
return nil , fmt .Errorf ("failed to prepare header for mining: %w" , err )
201
205
}
202
206
203
- env , err := w .createCurrentEnvironment (predicateContext , parent , header , tstart )
207
+ env , err := w .createCurrentEnvironment (predicateContext , parent , header , feeConfig , tstart )
204
208
if err != nil {
205
209
return nil , fmt .Errorf ("failed to create new current environment: %w" , err )
206
210
}
@@ -269,11 +273,15 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
269
273
return w .commit (env )
270
274
}
271
275
272
- func (w * worker ) createCurrentEnvironment (predicateContext * precompileconfig.PredicateContext , parent * types.Header , header * types.Header , tstart time.Time ) (* environment , error ) {
276
+ func (w * worker ) createCurrentEnvironment (predicateContext * precompileconfig.PredicateContext , parent * types.Header , header * types.Header , feeConfig commontype. FeeConfig , tstart time.Time ) (* environment , error ) {
273
277
currentState , err := w .chain .StateAt (parent .Root )
274
278
if err != nil {
275
279
return nil , err
276
280
}
281
+ capacity , err := customheader .GasCapacity (w .chainConfig , feeConfig , parent , header .Time )
282
+ if err != nil {
283
+ return nil , fmt .Errorf ("calculating gas capacity: %w" , err )
284
+ }
277
285
numPrefetchers := w .chain .CacheConfig ().TriePrefetcherParallelism
278
286
currentState .StartPrefetcher ("miner" , state .WithConcurrentWorkers (numPrefetchers ))
279
287
return & environment {
@@ -282,7 +290,7 @@ func (w *worker) createCurrentEnvironment(predicateContext *precompileconfig.Pre
282
290
parent : parent ,
283
291
header : header ,
284
292
tcount : 0 ,
285
- gasPool : new (core.GasPool ).AddGas (header . GasLimit ),
293
+ gasPool : new (core.GasPool ).AddGas (capacity ),
286
294
rules : w .chainConfig .Rules (header .Number , header .Time ),
287
295
predicateContext : predicateContext ,
288
296
predicateResults : predicate .NewResults (),
0 commit comments