prevent sstore under accounts with no code

This commit is contained in:
Hadrien Croubois 2024-02-15 22:51:50 +01:00
parent a2065c7ad6
commit 55dd2d5e69
No known key found for this signature in database
GPG key ID: B53810561A746A06

View file

@ -518,7 +518,8 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
}
func opSstore(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
if interpreter.readOnly {
// if scope is an account with no code (EOA delegation through EIP-5806) sstore is protected
if interpreter.readOnly || scope.Contract.CodeHash == (common.Hash{}) {
return nil, ErrWriteProtection
}
loc := scope.Stack.pop()