@@ -1607,30 +1607,6 @@ BOOST_AUTO_TEST_CASE(library_call_protection)
16071607 )
16081608}
16091609
1610- BOOST_AUTO_TEST_CASE (library_staticcall_delegatecall)
1611- {
1612- char const * sourceCode = R"(
1613- library Lib {
1614- function x() public view returns (uint) {
1615- return 1;
1616- }
1617- }
1618- contract Test {
1619- uint t;
1620- function f() public returns (uint) {
1621- t = 2;
1622- return this.g();
1623- }
1624- function g() public view returns (uint) {
1625- return Lib.x();
1626- }
1627- }
1628- )" ;
1629- compileAndRun (sourceCode, 0 , " Lib" );
1630- compileAndRun (sourceCode, 0 , " Test" , bytes (), map<string, h160>{{" :Lib" , m_contractAddress}});
1631- ABI_CHECK (callContractFunction (" f()" ), encodeArgs (1 ));
1632- }
1633-
16341610BOOST_AUTO_TEST_CASE (bytes_from_calldata_to_memory)
16351611{
16361612 char const * sourceCode = R"(
@@ -1786,49 +1762,6 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data)
17861762 );
17871763}
17881764
1789- BOOST_AUTO_TEST_CASE (storing_invalid_boolean)
1790- {
1791- char const * sourceCode = R"(
1792- contract C {
1793- event Ev(bool);
1794- bool public perm;
1795- function set() public returns(uint) {
1796- bool tmp;
1797- assembly {
1798- tmp := 5
1799- }
1800- perm = tmp;
1801- return 1;
1802- }
1803- function ret() public returns(bool) {
1804- bool tmp;
1805- assembly {
1806- tmp := 5
1807- }
1808- return tmp;
1809- }
1810- function ev() public returns(uint) {
1811- bool tmp;
1812- assembly {
1813- tmp := 5
1814- }
1815- emit Ev(tmp);
1816- return 1;
1817- }
1818- }
1819- )" ;
1820- compileAndRun (sourceCode);
1821- ABI_CHECK (callContractFunction (" set()" ), encodeArgs (1 ));
1822- ABI_CHECK (callContractFunction (" perm()" ), encodeArgs (1 ));
1823- ABI_CHECK (callContractFunction (" ret()" ), encodeArgs (1 ));
1824- ABI_CHECK (callContractFunction (" ev()" ), encodeArgs (1 ));
1825- BOOST_REQUIRE_EQUAL (numLogs (), 1 );
1826- BOOST_CHECK_EQUAL (logAddress (0 ), m_contractAddress);
1827- BOOST_CHECK (logData (0 ) == encodeArgs (1 ));
1828- BOOST_REQUIRE_EQUAL (numLogTopics (0 ), 1 );
1829- BOOST_CHECK_EQUAL (logTopic (0 , 0 ), util::keccak256 (string (" Ev(bool)" )));
1830- }
1831-
18321765BOOST_AUTO_TEST_CASE (struct_referencing)
18331766{
18341767 static char const * sourceCode = R"(
@@ -2059,70 +1992,6 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_abi)
20591992// ABI_CHECK(callContractFunction("f()"), encodeArgs(5));
20601993// }
20611994
2062- BOOST_AUTO_TEST_CASE (packed_storage_structs_delete)
2063- {
2064- char const * sourceCode = R"(
2065- contract C {
2066- struct str { uint8 a; uint16 b; uint8 c; }
2067- uint8 x;
2068- uint16 y;
2069- str data;
2070- function test() public returns (uint) {
2071- x = 1;
2072- y = 2;
2073- data.a = 2;
2074- data.b = 0xabcd;
2075- data.c = 0xfa;
2076- if (x != 1 || y != 2 || data.a != 2 || data.b != 0xabcd || data.c != 0xfa)
2077- return 2;
2078- delete y;
2079- delete data.b;
2080- if (x != 1 || y != 0 || data.a != 2 || data.b != 0 || data.c != 0xfa)
2081- return 3;
2082- delete x;
2083- delete data;
2084- return 1;
2085- }
2086- }
2087- )" ;
2088- compileAndRun (sourceCode);
2089- ABI_CHECK (callContractFunction (" test()" ), encodeArgs (1 ));
2090- BOOST_CHECK (storageEmpty (m_contractAddress));
2091- }
2092-
2093- BOOST_AUTO_TEST_CASE (invalid_enum_logged)
2094- {
2095- char const * sourceCode = R"(
2096- contract C {
2097- enum X { A, B }
2098- event Log(X);
2099-
2100- function test_log() public returns (uint) {
2101- X garbled = X.A;
2102- assembly {
2103- garbled := 5
2104- }
2105- emit Log(garbled);
2106- return 1;
2107- }
2108- function test_log_ok() public returns (uint) {
2109- X x = X.A;
2110- emit Log(x);
2111- return 1;
2112- }
2113- }
2114- )" ;
2115- compileAndRun (sourceCode, 0 , " C" );
2116- ABI_CHECK (callContractFunction (" test_log_ok()" ), encodeArgs (u256 (1 )));
2117- BOOST_REQUIRE_EQUAL (numLogs (), 1 );
2118- BOOST_CHECK_EQUAL (logAddress (0 ), m_contractAddress);
2119- BOOST_REQUIRE_EQUAL (numLogTopics (0 ), 1 );
2120- BOOST_REQUIRE_EQUAL (logTopic (0 , 0 ), util::keccak256 (string (" Log(uint8)" )));
2121- BOOST_CHECK_EQUAL (h256 (logData (0 )), h256 (u256 (0 )));
2122-
2123- ABI_CHECK (callContractFunction (" test_log()" ), panicData (PanicCode::EnumConversionError));
2124- }
2125-
21261995BOOST_AUTO_TEST_CASE (evm_exceptions_in_constructor_out_of_baund)
21271996{
21281997 char const * sourceCode = R"(
@@ -2164,31 +2033,6 @@ BOOST_AUTO_TEST_CASE(failing_send)
21642033 BOOST_REQUIRE (callContractFunction (" callHelper(address)" , c_helperAddress) == encodeArgs (true , 20 ));
21652034}
21662035
2167- BOOST_AUTO_TEST_CASE (return_string)
2168- {
2169- char const * sourceCode = R"(
2170- contract Main {
2171- string public s;
2172- function set(string calldata _s) external {
2173- s = _s;
2174- }
2175- function get1() public returns (string memory r) {
2176- return s;
2177- }
2178- function get2() public returns (string memory r) {
2179- r = s;
2180- }
2181- }
2182- )" ;
2183- compileAndRun (sourceCode, 0 , " Main" );
2184- string s (" Julia" );
2185- bytes args = encodeArgs (u256 (0x20 ), u256 (s.length ()), s);
2186- BOOST_REQUIRE (callContractFunction (" set(string)" , asString (args)) == encodeArgs ());
2187- ABI_CHECK (callContractFunction (" get1()" ), args);
2188- ABI_CHECK (callContractFunction (" get2()" ), args);
2189- ABI_CHECK (callContractFunction (" s()" ), args);
2190- }
2191-
21922036BOOST_AUTO_TEST_CASE (return_multiple_strings_of_various_sizes)
21932037{
21942038 char const * sourceCode = R"(
@@ -2343,28 +2187,6 @@ BOOST_AUTO_TEST_CASE(return_bytes_internal)
23432187 }
23442188}
23452189
2346- BOOST_AUTO_TEST_CASE (memory_types_initialisation)
2347- {
2348- char const * sourceCode = R"(
2349- contract Test {
2350- mapping(uint=>uint) data;
2351- function stat() public returns (uint[5] memory)
2352- {
2353- data[2] = 3; // make sure to use some memory
2354- }
2355- function dyn() public returns (uint[] memory) { stat(); }
2356- function nested() public returns (uint[3][] memory) { stat(); }
2357- function nestedStat() public returns (uint[3][7] memory) { stat(); }
2358- }
2359- )" ;
2360- compileAndRun (sourceCode, 0 , " Test" );
2361-
2362- ABI_CHECK (callContractFunction (" stat()" ), encodeArgs (vector<u256>(5 )));
2363- ABI_CHECK (callContractFunction (" dyn()" ), encodeArgs (u256 (0x20 ), u256 (0 )));
2364- ABI_CHECK (callContractFunction (" nested()" ), encodeArgs (u256 (0x20 ), u256 (0 )));
2365- ABI_CHECK (callContractFunction (" nestedStat()" ), encodeArgs (vector<u256>(3 * 7 )));
2366- }
2367-
23682190BOOST_AUTO_TEST_CASE (calldata_struct_short)
23692191{
23702192 char const * sourceCode = R"(
@@ -2718,38 +2540,6 @@ BOOST_AUTO_TEST_CASE(nested_mixed_string_as_public_mapping_key)
27182540 ), encodeArgs (u256 (i - 3 )));
27192541}
27202542
2721- BOOST_AUTO_TEST_CASE (constant_string_literal)
2722- {
2723- char const * sourceCode = R"(
2724- contract Test {
2725- bytes32 constant public b = "abcdefghijklmnopq";
2726- string constant public x = "abefghijklmnopqabcdefghijklmnopqabcdefghijklmnopqabca";
2727-
2728- constructor() {
2729- string memory xx = x;
2730- bytes32 bb = b;
2731- }
2732- function getB() public returns (bytes32) { return b; }
2733- function getX() public returns (string memory) { return x; }
2734- function getX2() public returns (string memory r) { r = x; }
2735- function unused() public returns (uint) {
2736- "unusedunusedunusedunusedunusedunusedunusedunusedunusedunusedunusedunused";
2737- return 2;
2738- }
2739- }
2740- )" ;
2741-
2742- compileAndRun (sourceCode);
2743- string longStr = " abefghijklmnopqabcdefghijklmnopqabcdefghijklmnopqabca" ;
2744- string shortStr = " abcdefghijklmnopq" ;
2745- ABI_CHECK (callContractFunction (" b()" ), encodeArgs (shortStr));
2746- ABI_CHECK (callContractFunction (" x()" ), encodeDyn (longStr));
2747- ABI_CHECK (callContractFunction (" getB()" ), encodeArgs (shortStr));
2748- ABI_CHECK (callContractFunction (" getX()" ), encodeDyn (longStr));
2749- ABI_CHECK (callContractFunction (" getX2()" ), encodeDyn (longStr));
2750- ABI_CHECK (callContractFunction (" unused()" ), encodeArgs (2 ));
2751- }
2752-
27532543BOOST_AUTO_TEST_CASE (library_call)
27542544{
27552545 char const * sourceCode = R"(
0 commit comments