From 5d2223b934ec1e40e029d1372af9484905d642bd Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 13 Feb 2015 01:29:21 +0100 Subject: [PATCH] Copying calldata directly to memory. --- SolidityEndToEndTest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index abfc97b73..259123db6 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"(