aboutsummaryrefslogtreecommitdiff
path: root/core/vm
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-07-02 01:36:18 -0400
committerDeterminant <[email protected]>2020-07-02 01:36:18 -0400
commitca6847998d867dc5d66e76a03bda9c72ae8d287b (patch)
treec6eb50a6e8c2d441d77468492c797c6c59885c46 /core/vm
parent2d396b3c69a26e4096ccb376c012911d299c68c7 (diff)
make MultiCoin.transfer work
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/interpreter.go2
-rw-r--r--core/vm/jump_table.go3
-rw-r--r--core/vm/memory_table.go16
3 files changed, 19 insertions, 2 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go
index 007e5e3..3d388d6 100644
--- a/core/vm/interpreter.go
+++ b/core/vm/interpreter.go
@@ -220,7 +220,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
// for a call operation is the value. Transferring value from one
// account to the others means the state is modified and should also
// return with an error.
- if operation.writes || (op == CALL && stack.Back(2).Sign() != 0) {
+ if operation.writes || ((op == CALL || op == CALLEX) && stack.Back(2).Sign() != 0) {
return nil, errWriteProtection
}
}
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
index 359b753..737dd14 100644
--- a/core/vm/jump_table.go
+++ b/core/vm/jump_table.go
@@ -183,6 +183,7 @@ func newTangerineWhistleInstructionSet() JumpTable {
instructionSet[SLOAD].constantGas = params.SloadGasEIP150
instructionSet[EXTCODECOPY].constantGas = params.ExtcodeCopyBaseEIP150
instructionSet[CALL].constantGas = params.CallGasEIP150
+ instructionSet[CALLEX].constantGas = params.CallGasEIP150
instructionSet[CALLCODE].constantGas = params.CallGasEIP150
instructionSet[DELEGATECALL].constantGas = params.CallGasEIP150
return instructionSet
@@ -1147,7 +1148,7 @@ func newFrontierInstructionSet() JumpTable {
dynamicGas: gasCall,
minStack: minStack(9, 1),
maxStack: maxStack(9, 1),
- memorySize: memoryCall,
+ memorySize: memoryCallExpert,
valid: true,
returns: true,
},
diff --git a/core/vm/memory_table.go b/core/vm/memory_table.go
index 4fcb414..047f610 100644
--- a/core/vm/memory_table.go
+++ b/core/vm/memory_table.go
@@ -70,6 +70,22 @@ func memoryCall(stack *Stack) (uint64, bool) {
}
return y, false
}
+
+func memoryCallExpert(stack *Stack) (uint64, bool) {
+ x, overflow := calcMemSize64(stack.Back(7), stack.Back(8))
+ if overflow {
+ return 0, true
+ }
+ y, overflow := calcMemSize64(stack.Back(5), stack.Back(6))
+ if overflow {
+ return 0, true
+ }
+ if x > y {
+ return x, false
+ }
+ return y, false
+}
+
func memoryDelegateCall(stack *Stack) (uint64, bool) {
x, overflow := calcMemSize64(stack.Back(4), stack.Back(5))
if overflow {