From aea7e6f0692d6abe621d20fd3ec85837bb6035a9 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Sat, 17 Feb 2024 20:21:45 +0100 Subject: [PATCH] Prevent usage of create to avoid EOA nonce to change by more than one. --- core/vm/instructions.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index e5926e9adc..2a55f64e42 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -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 }