@@ -38,6 +38,9 @@ const (
3838 ModeSyncReplay = "syncer-replay"
3939 ModeManualReplay = "manual-replay"
4040 ModeVerify = "verify"
41+
42+ // TODO: align with protocol – currently using a dummy address to match Ethereum block structure
43+ CoinbaseShardIndependentAddr = "0x0"
4144)
4245
4346var blocksTracer * BlocksTracer
@@ -109,6 +112,8 @@ type ExecutionState struct {
109112
110113 GasUsed types.Gas
111114
115+ CoinbaseAddress types.Address
116+
112117 // Transient storage
113118 transientStorage transientStorage
114119
@@ -281,6 +286,7 @@ func NewEVMBlockContext(es *ExecutionState) (*vm.BlockContext, error) {
281286 BlobBaseFee : big .NewInt (10 ),
282287 GasLimit : es .GasLimit .Uint64 (),
283288 Time : time ,
289+ Coinbase : es .CoinbaseAddress ,
284290
285291 RollbackCounter : rollbackCounter ,
286292 }, nil
@@ -352,6 +358,7 @@ func NewExecutionState(tx db.RoTx, shardId types.ShardId, params StateParams) (*
352358 Logs : map [common.Hash ][]* types.Log {},
353359 DebugLogs : map [common.Hash ][]* types.DebugLog {},
354360 Errors : map [common.Hash ]error {},
361+ CoinbaseAddress : types .ShardAndHexToAddress (shardId , CoinbaseShardIndependentAddr ),
355362
356363 journal : newJournal (),
357364 transientStorage : newTransientStorage (),
@@ -1185,6 +1192,11 @@ func (es *ExecutionState) HandleTransaction(
11851192 default :
11861193 res = es .handleExecutionTransaction (ctx , txn )
11871194 }
1195+
1196+ if err := es .transferPriorityFee (res .GasUsed .ToValue (txn .MaxPriorityFeePerGas )); err != nil {
1197+ return NewExecutionResult ().SetFatal (fmt .Errorf ("transferPriorityFee failed: %w" , err ))
1198+ }
1199+
11881200 responseWasSent := false
11891201 bounced := false
11901202 if txn .IsRequest () {
@@ -2191,3 +2203,7 @@ func VerboseTracingHooks(logger logging.Logger) *tracing.Hooks {
21912203 },
21922204 }
21932205}
2206+
2207+ func (es * ExecutionState ) transferPriorityFee (priorityFee types.Value ) error {
2208+ return es .AddBalance (es .CoinbaseAddress , priorityFee , tracing .BalanceIncreaseRewardTransactionFee )
2209+ }
0 commit comments