diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-08-15 17:56:09 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-15 19:40:12 +0800 |
commit | 3df7142b3e2804aa7ccf88cc0c2663861ebfa3b9 (patch) | |
tree | 0e08d6a956f89b19ff8b85ced853f491dd06bfd2 /core/vm/interpreter.go | |
parent | 3d123bcde67973b57c0a9e7edc219cc2ea589443 (diff) | |
download | go-tangerine-3df7142b3e2804aa7ccf88cc0c2663861ebfa3b9.tar.gz go-tangerine-3df7142b3e2804aa7ccf88cc0c2663861ebfa3b9.tar.zst go-tangerine-3df7142b3e2804aa7ccf88cc0c2663861ebfa3b9.zip |
core/vm: minor polishes, fix STATICCALL for precompiles
* Fix STATICCALL so it is able to call precompiles too
* Fix write detection to use the correct value argument of CALL
* Fix write protection to ignore the value in CALLCODE
Diffstat (limited to 'core/vm/interpreter.go')
-rw-r--r-- | core/vm/interpreter.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 32d764b9f..661ada691 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -89,13 +89,12 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter { func (in *Interpreter) enforceRestrictions(op OpCode, operation operation, stack *Stack) error { if in.evm.chainRules.IsMetropolis { if in.readonly { - // if the interpreter is operating in readonly mode, make sure no - // state-modifying operation is performed. The 4th stack item + // If the interpreter is operating in readonly mode, make sure no + // state-modifying operation is performed. The 3rd stack item // for a call operation is the value. Transfering value from one // account to the others means the state is modified and should also // return with an error. - if operation.writes || - ((op == CALL || op == CALLCODE) && stack.Back(3).BitLen() > 0) { + if operation.writes || (op == CALL && stack.Back(2).BitLen() > 0) { return errWriteProtection } } |