diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-08-16 18:07:33 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-16 18:43:08 +0800 |
commit | 9bd6068fefe5687735bed342f3545f515fa717c8 (patch) | |
tree | d68767398eedd0a07c055fc8e880c4b4ab565a70 /core/vm/jump_table.go | |
parent | 76069eef38082089d2eaf99661a80e1a953bf271 (diff) | |
download | go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar.gz go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar.bz2 go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar.lz go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar.xz go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.tar.zst go-tangerine-9bd6068fefe5687735bed342f3545f515fa717c8.zip |
core/vm: implement RETURNDATA metropolis opcodes
Diffstat (limited to 'core/vm/jump_table.go')
-rw-r--r-- | core/vm/jump_table.go | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index f6e8dae66..7fb11021f 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -53,6 +53,8 @@ type operation struct { valid bool // reverts determined whether the operation reverts state reverts bool + // clearsReturndata determines whether the opertions clears the return data + clearsReturndata bool } var ( @@ -73,6 +75,19 @@ func NewMetropolisInstructionSet() [256]operation { memorySize: memoryStaticCall, valid: true, } + instructionSet[RETURNDATASIZE] = operation{ + execute: opReturnDataSize, + gasCost: constGasFunc(GasQuickStep), + validateStack: makeStackFunc(0, 1), + valid: true, + } + instructionSet[RETURNDATACOPY] = operation{ + execute: opReturnDataCopy, + gasCost: gasReturnDataCopy, + validateStack: makeStackFunc(3, 0), + memorySize: memoryReturnDataCopy, + valid: true, + } return instructionSet } @@ -861,26 +876,29 @@ func NewFrontierInstructionSet() [256]operation { writes: true, }, CREATE: { - execute: opCreate, - gasCost: gasCreate, - validateStack: makeStackFunc(3, 1), - memorySize: memoryCreate, - valid: true, - writes: true, + execute: opCreate, + gasCost: gasCreate, + validateStack: makeStackFunc(3, 1), + memorySize: memoryCreate, + valid: true, + writes: true, + clearsReturndata: true, }, CALL: { - execute: opCall, - gasCost: gasCall, - validateStack: makeStackFunc(7, 1), - memorySize: memoryCall, - valid: true, + execute: opCall, + gasCost: gasCall, + validateStack: makeStackFunc(7, 1), + memorySize: memoryCall, + valid: true, + clearsReturndata: true, }, CALLCODE: { - execute: opCallCode, - gasCost: gasCallCode, - validateStack: makeStackFunc(7, 1), - memorySize: memoryCall, - valid: true, + execute: opCallCode, + gasCost: gasCallCode, + validateStack: makeStackFunc(7, 1), + memorySize: memoryCall, + valid: true, + clearsReturndata: true, }, RETURN: { execute: opReturn, |