@@ -33,6 +33,8 @@ import (
33
33
"github.com/erigontech/erigon-lib/common/u256"
34
34
"github.com/erigontech/erigon-lib/crypto"
35
35
"github.com/erigontech/erigon-lib/log/v3"
36
+ "github.com/erigontech/erigon/consensus"
37
+ "github.com/erigontech/erigon/core/state"
36
38
"github.com/erigontech/erigon/core/tracing"
37
39
"github.com/erigontech/erigon/core/types"
38
40
"github.com/erigontech/erigon/core/vm"
@@ -102,7 +104,8 @@ type Message interface {
102
104
BlobHashes () []libcommon.Hash
103
105
Authorizations () []types.Authorization
104
106
105
- IsFree () bool
107
+ IsFree () bool // service transactions on Gnosis are exempt from EIP-1559 mandatory fees
108
+ SetIsFree (bool )
106
109
}
107
110
108
111
// NewStateTransition initialises and returns a new state transition object.
@@ -133,7 +136,17 @@ func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition
133
136
// `refunds` is false when it is not required to apply gas refunds
134
137
// `gasBailout` is true when it is not required to fail transaction if the balance is not enough to pay gas.
135
138
// for trace_call to replicate OE/Parity behaviour
136
- func ApplyMessage (evm * vm.EVM , msg Message , gp * GasPool , refunds bool , gasBailout bool ) (* evmtypes.ExecutionResult , error ) {
139
+ func ApplyMessage (evm * vm.EVM , msg Message , gp * GasPool , refunds bool , gasBailout bool , engine consensus.EngineReader ) (
140
+ * evmtypes.ExecutionResult , error ) {
141
+ // Only zero-gas transactions may be service ones
142
+ if msg .FeeCap ().IsZero () && ! msg .IsFree () && engine != nil {
143
+ blockContext := evm .Context
144
+ blockContext .Coinbase = state .SystemAddress
145
+ syscall := func (contract libcommon.Address , data []byte ) ([]byte , error ) {
146
+ return SysCallContractWithBlockContext (contract , data , evm .ChainConfig (), evm .IntraBlockState (), blockContext , engine , true /* constCall */ )
147
+ }
148
+ msg .SetIsFree (engine .IsServiceTransaction (msg .From (), syscall ))
149
+ }
137
150
return NewStateTransition (evm , msg , gp ).TransitionDb (refunds , gasBailout )
138
151
}
139
152
0 commit comments