aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-02-13 18:16:09 +0800
committerGav Wood <g@ethdev.com>2015-02-13 18:16:09 +0800
commit9f1515e9111627b5358cbacd0eb2cba8ed08a34d (patch)
treeb6d88dff367810328245f46a743f618984193bd7
parente10cde47c4c2e4693ae3ec9ab7ce66466b7ac8f5 (diff)
parent5d2223b934ec1e40e029d1372af9484905d642bd (diff)
downloaddexon-solidity-9f1515e9111627b5358cbacd0eb2cba8ed08a34d.tar.gz
dexon-solidity-9f1515e9111627b5358cbacd0eb2cba8ed08a34d.tar.zst
dexon-solidity-9f1515e9111627b5358cbacd0eb2cba8ed08a34d.zip
Merge pull request #1037 from chriseth/sol_bytesCalldataToMemory
Copying calldata directly to memory.
-rw-r--r--SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index abfc97b7..259123db 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -2273,6 +2273,21 @@ BOOST_AUTO_TEST_CASE(store_bytes)
BOOST_CHECK(callContractFunction("save()", "abcdefg") == encodeArgs(24));
}
+BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function() returns (hash) {
+ return sha3("abc", msg.data);
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ bytes calldata = bytes(61, 0x22) + bytes(12, 0x12);
+ sendMessage(calldata, false);
+ BOOST_CHECK(m_output == encodeArgs(dev::sha3(bytes{'a', 'b', 'c'} + calldata)));
+}
+
BOOST_AUTO_TEST_CASE(call_forward_bytes)
{
char const* sourceCode = R"(