Reject system deposit transactions in Regolith

This commit is contained in:
Adrian Sutton 2023-02-23 12:13:46 +10:00 committed by Adrian Sutton
parent 7643709fe8
commit 7303e2be73
2 changed files with 7 additions and 0 deletions

View File

@ -100,4 +100,7 @@ var (
// ErrSenderNoEOA is returned if the sender of a transaction is a contract.
ErrSenderNoEOA = errors.New("sender not an eoa")
// ErrSystemTxNotSupported is returned for any deposit tx with IsSystemTx=true after the Regolith fork
ErrSystemTxNotSupported = errors.New("system tx not supported")
)

View File

@ -259,6 +259,10 @@ func (st *StateTransition) preCheck() error {
st.gas += st.msg.Gas() // Add gas here in order to be able to execute calls.
// Don't touch the gas pool for system transactions
if st.msg.IsSystemTx() {
if st.evm.ChainConfig().IsOptimismRegolith(st.evm.Context.Time) {
return fmt.Errorf("%w: address %v", ErrSystemTxNotSupported,
st.msg.From().Hex())
}
return nil
}
return st.gp.SubGas(st.msg.Gas()) // gas used by deposits may not be used by other txs