aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-08-06 00:13:42 +0800
committerchriseth <c@ethdev.com>2015-08-06 00:13:42 +0800
commitf1fa2734d0a58ea1a107897b060755ee0a85916f (patch)
treed5c7f363517a45b19e7637e71032815993258c33
parentc070c23d8309387a5092e876e925a50cec04d9b2 (diff)
parenteab9585ea15f61fdf3076ed8da867c740bde51c7 (diff)
downloaddexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar.gz
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar.bz2
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar.lz
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar.xz
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.tar.zst
dexon-solidity-f1fa2734d0a58ea1a107897b060755ee0a85916f.zip
Merge pull request #2697 from chriseth/sol_fix_clone
Fix clone with regards to value transfer.
-rw-r--r--Compiler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index eadfc204..f0d1b38e 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -712,11 +712,13 @@ eth::Assembly Compiler::getCloneRuntime()
a << u256(0) << eth::Instruction::DUP1 << eth::Instruction::CALLDATACOPY;
//@todo adjust for larger return values, make this dynamic.
a << u256(0x20) << u256(0) << eth::Instruction::CALLDATASIZE;
- a << u256(0) << eth::Instruction::DUP1;
+ // unfortunately, we have to send the value again, so that CALLVALUE returns the correct value
+ // in the callcoded contract.
+ a << u256(0) << eth::Instruction::CALLVALUE;
// this is the address which has to be substituted by the linker.
//@todo implement as special "marker" AssemblyItem.
a << u256("0xcafecafecafecafecafecafecafecafecafecafe");
- a << u256(eth::c_callGas + 10) << eth::Instruction::GAS << eth::Instruction::SUB;
+ a << u256(eth::c_callGas + eth::c_callValueTransferGas + 10) << eth::Instruction::GAS << eth::Instruction::SUB;
a << eth::Instruction::CALLCODE;
//@todo adjust for larger return values, make this dynamic.
a << u256(0x20) << u256(0) << eth::Instruction::RETURN;