Prevent usage of create to avoid EOA nonce to change by more than one.

This commit is contained in:
Hadrien Croubois 2024-02-17 20:21:45 +01:00
parent 926104ecdc
commit aea7e6f069
No known key found for this signature in database
GPG key ID: B53810561A746A06

View file

@ -578,6 +578,11 @@ func opGas(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte
}
func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
if interpreter.evm.TxContext.Is5806 {
if scope.Contract.CodeHash == types.EmptyCodeHash || scope.Contract.CodeHash == (common.Hash{}) {
return nil, ErrEip5806Write
}
}
if interpreter.readOnly {
return nil, ErrWriteProtection
}