@@ -207,34 +207,32 @@ internal static IEnumerable<ActionEvaluation> EvaluateActions(
207207 {
208208 IActionContext CreateActionContext (
209209 IWorld prevState ,
210- int randomSeed ,
211- long actionGasLimit )
210+ int randomSeed )
212211 {
213212 return new ActionContext (
214213 signer : tx ? . Signer ?? block . Miner ,
215214 txid : tx ? . Id ?? null ,
216215 miner : block . Miner ,
217216 blockIndex : block . Index ,
218217 blockProtocolVersion : block . ProtocolVersion ,
218+ lastCommit : block . LastCommit ,
219219 txs : block . Transactions ,
220220 previousState : prevState ,
221221 isPolicyAction : isPolicyAction ,
222222 randomSeed : randomSeed ,
223- gasLimit : actionGasLimit ,
223+ maxGasPrice : tx ? . MaxGasPrice ,
224224 evidence : block . Evidence ) ;
225225 }
226226
227- long gasLimit = tx ? . GasLimit ?? long . MaxValue ;
228-
229227 byte [ ] preEvaluationHashBytes = block . PreEvaluationHash . ToByteArray ( ) ;
230228 byte [ ] signature = tx ? . Signature ?? Array . Empty < byte > ( ) ;
231229 int seed = GenerateRandomSeed ( preEvaluationHashBytes , signature , 0 ) ;
232230
233231 IWorld state = previousState ;
234232 foreach ( IAction action in actions )
235233 {
236- IActionContext context = CreateActionContext ( state , seed , gasLimit ) ;
237- ( ActionEvaluation Evaluation , long NextGasLimit ) result = EvaluateAction (
234+ IActionContext context = CreateActionContext ( state , seed ) ;
235+ ActionEvaluation evaluation = EvaluateAction (
238236 block ,
239237 tx ,
240238 context ,
@@ -243,10 +241,9 @@ IActionContext CreateActionContext(
243241 isPolicyAction ,
244242 logger ) ;
245243
246- yield return result . Evaluation ;
244+ yield return evaluation ;
247245
248- state = result . Evaluation . OutputState ;
249- gasLimit = result . NextGasLimit ;
246+ state = evaluation . OutputState ;
250247
251248 unchecked
252249 {
@@ -255,7 +252,7 @@ IActionContext CreateActionContext(
255252 }
256253 }
257254
258- internal static ( ActionEvaluation Evaluation , long NextGasLimit ) EvaluateAction (
255+ internal static ActionEvaluation EvaluateAction (
259256 IPreEvaluationBlock block ,
260257 ITransaction ? tx ,
261258 IActionContext context ,
@@ -274,7 +271,6 @@ internal static (ActionEvaluation Evaluation, long NextGasLimit) EvaluateAction(
274271 IActionContext inputContext = context ;
275272 IWorld state = inputContext . PreviousState ;
276273 Exception ? exc = null ;
277- IFeeCollector feeCollector = new FeeCollector ( context , tx ? . MaxGasPrice ) ;
278274
279275 IActionContext CreateActionContext ( IWorld newPrevState )
280276 {
@@ -284,10 +280,11 @@ IActionContext CreateActionContext(IWorld newPrevState)
284280 miner : inputContext . Miner ,
285281 blockIndex : inputContext . BlockIndex ,
286282 blockProtocolVersion : inputContext . BlockProtocolVersion ,
283+ lastCommit : inputContext . LastCommit ,
287284 previousState : newPrevState ,
288285 randomSeed : inputContext . RandomSeed ,
289286 isPolicyAction : isPolicyAction ,
290- gasLimit : inputContext . GasLimit ( ) ,
287+ maxGasPrice : tx ? . MaxGasPrice ,
291288 txs : inputContext . Txs ,
292289 evidence : inputContext . Evidence ) ;
293290 }
@@ -297,9 +294,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
297294 Stopwatch stopwatch = new Stopwatch ( ) ;
298295 stopwatch . Start ( ) ;
299296 AccountMetrics . Initialize ( ) ;
300- state = feeCollector . Mortgage ( state ) ;
301297 context = CreateActionContext ( state ) ;
302- feeCollector = feeCollector . Next ( context ) ;
303298 state = action . Execute ( context ) ;
304299 logger ?
305300 . ForContext ( "Tag" , "Metric" )
@@ -361,8 +356,6 @@ IActionContext CreateActionContext(IWorld newPrevState)
361356 e ) ;
362357 }
363358
364- state = feeCollector . Refund ( state ) ;
365- state = feeCollector . Reward ( state ) ;
366359 state = stateStore . CommitWorld ( state ) ;
367360
368361 if ( ! state . Trie . Recorded )
@@ -371,13 +364,11 @@ IActionContext CreateActionContext(IWorld newPrevState)
371364 $ "Failed to record { nameof ( IAccount ) } 's { nameof ( ITrie ) } .") ;
372365 }
373366
374- return (
375- new ActionEvaluation (
367+ return new ActionEvaluation (
376368 action : action ,
377369 inputContext : inputContext ,
378370 outputState : state ,
379- exception : exc ) ,
380- context . GasLimit ( ) - context . GasUsed ( ) ) ;
371+ exception : exc ) ;
381372 }
382373
383374 /// <summary>
@@ -479,6 +470,8 @@ internal IEnumerable<ActionEvaluation> EvaluateTx(
479470 ITransaction tx ,
480471 IWorld previousState )
481472 {
473+ GasTracer . Initialize ( tx . GasLimit ?? long . MaxValue ) ;
474+ GasTracer . StartTrace ( ) ;
482475 var evaluations = ImmutableList < ActionEvaluation > . Empty ;
483476 if ( _policyActionsRegistry . BeginTxActions . Length > 0 )
484477 {
@@ -507,6 +500,8 @@ internal IEnumerable<ActionEvaluation> EvaluateTx(
507500 EvaluatePolicyEndTxActions ( block , tx , previousState ) ) ;
508501 }
509502
503+ GasTracer . EndTrace ( ) ;
504+
510505 return evaluations ;
511506 }
512507
0 commit comments