aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp246
1 files changed, 83 insertions, 163 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 65473f0d..b8c85a63 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -1456,7 +1456,7 @@ BOOST_AUTO_TEST_CASE(multiple_elementary_accessors)
function test() {
data = 8;
name = "Celina";
- a_hash = keccak256(123);
+ a_hash = keccak256("\x7b");
an_address = address(0x1337);
super_secret_data = 42;
}
@@ -1812,7 +1812,7 @@ BOOST_AUTO_TEST_CASE(transfer_ether)
}
contract C {
- function () payable {
+ function () external payable {
throw;
}
}
@@ -1992,7 +1992,7 @@ BOOST_AUTO_TEST_CASE(keccak256)
char const* sourceCode = R"(
contract test {
function a(bytes32 input) returns (bytes32 hash) {
- return keccak256(input);
+ return keccak256(abi.encodePacked(input));
}
}
)";
@@ -2011,7 +2011,7 @@ BOOST_AUTO_TEST_CASE(sha256)
char const* sourceCode = R"(
contract test {
function a(bytes32 input) returns (bytes32 sha256hash) {
- return sha256(input);
+ return sha256(abi.encodePacked(input));
}
}
)";
@@ -2036,7 +2036,7 @@ BOOST_AUTO_TEST_CASE(ripemd)
char const* sourceCode = R"(
contract test {
function a(bytes32 input) returns (bytes32 sha256hash) {
- return ripemd160(input);
+ return ripemd160(abi.encodePacked(input));
}
}
)";
@@ -2063,7 +2063,7 @@ BOOST_AUTO_TEST_CASE(packed_keccak256)
function a(bytes32 input) returns (bytes32 hash) {
var b = 65536;
uint c = 256;
- return keccak256(8, input, b, input, c);
+ return keccak256(abi.encodePacked(8, input, b, input, c));
}
}
)";
@@ -2093,9 +2093,9 @@ BOOST_AUTO_TEST_CASE(packed_keccak256_complex_types)
x[0] = y[0] = uint120(-2);
x[1] = y[1] = uint120(-3);
x[2] = y[2] = uint120(-4);
- hash1 = keccak256(x);
- hash2 = keccak256(y);
- hash3 = keccak256(this.f);
+ hash1 = keccak256(abi.encodePacked(x));
+ hash2 = keccak256(abi.encodePacked(y));
+ hash3 = keccak256(abi.encodePacked(this.f));
}
}
)";
@@ -2115,7 +2115,7 @@ BOOST_AUTO_TEST_CASE(packed_sha256)
function a(bytes32 input) returns (bytes32 hash) {
var b = 65536;
uint c = 256;
- return sha256(8, input, b, input, c);
+ return sha256(abi.encodePacked(8, input, b, input, c));
}
}
)";
@@ -2142,7 +2142,7 @@ BOOST_AUTO_TEST_CASE(packed_ripemd160)
function a(bytes32 input) returns (bytes32 hash) {
var b = 65536;
uint c = 256;
- return ripemd160(8, input, b, input, c);
+ return ripemd160(abi.encodePacked(8, input, b, input, c));
}
}
)";
@@ -2506,7 +2506,7 @@ BOOST_AUTO_TEST_CASE(contracts_as_addresses)
{
char const* sourceCode = R"(
contract helper {
- function() payable { } // can receive ether
+ function() external payable { } // can receive ether
}
contract test {
helper h;
@@ -3054,7 +3054,7 @@ BOOST_AUTO_TEST_CASE(fallback_function)
char const* sourceCode = R"(
contract A {
uint data;
- function() { data = 1; }
+ function() external { data = 1; }
function getData() returns (uint r) { return data; }
}
)";
@@ -3069,7 +3069,7 @@ BOOST_AUTO_TEST_CASE(inherited_fallback_function)
char const* sourceCode = R"(
contract A {
uint data;
- function() { data = 1; }
+ function() external { data = 1; }
function getData() returns (uint r) { return data; }
}
contract B is A {}
@@ -3082,13 +3082,13 @@ BOOST_AUTO_TEST_CASE(inherited_fallback_function)
BOOST_AUTO_TEST_CASE(default_fallback_throws)
{
- char const* sourceCode = R"(
+ char const* sourceCode = R"YY(
contract A {
function f() returns (bool) {
- return this.call();
+ return this.call("");
}
}
- )";
+ )YY";
compileAndRun(sourceCode);
ABI_CHECK(callContractFunction("f()"), encodeArgs(0));
}
@@ -3100,7 +3100,7 @@ BOOST_AUTO_TEST_CASE(short_data_calls_fallback)
uint public x;
// Signature is d88e0b00
function fow() { x = 3; }
- function () { x = 2; }
+ function () external { x = 2; }
}
)";
compileAndRun(sourceCode);
@@ -3122,7 +3122,7 @@ BOOST_AUTO_TEST_CASE(event)
bytes32 s = 0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f;
log3(bytes32(msg.value), s, bytes32(uint256(msg.sender)), _id);
} else {
- Deposit(msg.sender, _id, msg.value);
+ emit Deposit(msg.sender, _id, msg.value);
}
}
}
@@ -3172,7 +3172,7 @@ BOOST_AUTO_TEST_CASE(event_no_arguments)
contract ClientReceipt {
event Deposit();
function deposit() {
- Deposit();
+ emit Deposit();
}
}
)";
@@ -3186,28 +3186,6 @@ BOOST_AUTO_TEST_CASE(event_no_arguments)
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()")));
}
-BOOST_AUTO_TEST_CASE(event_access_through_base_name)
-{
- char const* sourceCode = R"(
- contract A {
- event x();
- }
- contract B is A {
- function f() returns (uint) {
- A.x();
- return 1;
- }
- }
- )";
- compileAndRun(sourceCode);
- callContractFunction("f()");
- BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
- BOOST_CHECK(m_logs[0].data.empty());
- BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("x()")));
-}
-
BOOST_AUTO_TEST_CASE(event_access_through_base_name_emit)
{
char const* sourceCode = R"(
@@ -3238,67 +3216,15 @@ BOOST_AUTO_TEST_CASE(events_with_same_name)
event Deposit(address _addr);
event Deposit(address _addr, uint _amount);
function deposit() returns (uint) {
- Deposit();
- return 1;
- }
- function deposit(address _addr) returns (uint) {
- Deposit(_addr);
- return 1;
- }
- function deposit(address _addr, uint _amount) returns (uint) {
- Deposit(_addr, _amount);
- return 1;
- }
- }
- )";
- u160 const c_loggedAddress = m_contractAddress;
-
- compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("deposit()"), encodeArgs(u256(1)));
- BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
- BOOST_CHECK(m_logs[0].data.empty());
- BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()")));
-
- ABI_CHECK(callContractFunction("deposit(address)", c_loggedAddress), encodeArgs(u256(1)));
- BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
- BOOST_CHECK(m_logs[0].data == encodeArgs(c_loggedAddress));
- BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit(address)")));
-
- ABI_CHECK(callContractFunction("deposit(address,uint256)", c_loggedAddress, u256(100)), encodeArgs(u256(1)));
- BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
- BOOST_CHECK(m_logs[0].data == encodeArgs(c_loggedAddress, 100));
- BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
- BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit(address,uint256)")));
-}
-
-BOOST_AUTO_TEST_CASE(events_with_same_name_inherited)
-{
- char const* sourceCode = R"(
- contract A {
- event Deposit();
- }
-
- contract B {
- event Deposit(address _addr);
- }
-
- contract ClientReceipt is A, B {
- event Deposit(address _addr, uint _amount);
- function deposit() returns (uint) {
- Deposit();
+ emit Deposit();
return 1;
}
function deposit(address _addr) returns (uint) {
- Deposit(_addr);
+ emit Deposit(_addr);
return 1;
}
function deposit(address _addr, uint _amount) returns (uint) {
- Deposit(_addr, _amount);
+ emit Deposit(_addr, _amount);
return 1;
}
}
@@ -3386,7 +3312,7 @@ BOOST_AUTO_TEST_CASE(event_anonymous)
contract ClientReceipt {
event Deposit() anonymous;
function deposit() {
- Deposit();
+ emit Deposit();
}
}
)";
@@ -3401,7 +3327,7 @@ BOOST_AUTO_TEST_CASE(event_anonymous_with_topics)
contract ClientReceipt {
event Deposit(address indexed _from, bytes32 indexed _id, uint indexed _value, uint indexed _value2, bytes32 data) anonymous;
function deposit(bytes32 _id) payable {
- Deposit(msg.sender, _id, msg.value, 2, "abc");
+ emit Deposit(msg.sender, _id, msg.value, 2, "abc");
}
}
)";
@@ -3425,7 +3351,7 @@ BOOST_AUTO_TEST_CASE(event_lots_of_data)
contract ClientReceipt {
event Deposit(address _from, bytes32 _id, uint _value, bool _flag);
function deposit(bytes32 _id) payable {
- Deposit(msg.sender, _id, msg.value, true);
+ emit Deposit(msg.sender, _id, msg.value, true);
}
}
)";
@@ -3446,7 +3372,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data)
contract ClientReceipt {
event Deposit(uint fixeda, bytes dynx, uint fixedb);
function deposit() {
- Deposit(10, msg.data, 15);
+ emit Deposit(10, msg.data, 15);
}
}
)";
@@ -3470,7 +3396,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data_from_storage)
x[0] = "A";
x[1] = "B";
x[2] = "C";
- Deposit(10, x, 15);
+ emit Deposit(10, x, 15);
}
}
)";
@@ -3495,7 +3421,7 @@ BOOST_AUTO_TEST_CASE(event_really_really_lots_of_data_from_storage)
x[1] = "B";
x[2] = "C";
x[30] = "Z";
- Deposit(10, x, 15);
+ emit Deposit(10, x, 15);
}
}
)";
@@ -3523,7 +3449,7 @@ BOOST_AUTO_TEST_CASE(event_indexed_string)
y[1] = 5;
y[2] = 6;
y[3] = 7;
- E(x, y);
+ emit E(x, y);
}
}
)";
@@ -3577,7 +3503,7 @@ BOOST_AUTO_TEST_CASE(sha256_empty)
char const* sourceCode = R"(
contract C {
function f() returns (bytes32) {
- return sha256();
+ return sha256("");
}
}
)";
@@ -3590,7 +3516,7 @@ BOOST_AUTO_TEST_CASE(ripemd160_empty)
char const* sourceCode = R"(
contract C {
function f() returns (bytes20) {
- return ripemd160();
+ return ripemd160("");
}
}
)";
@@ -3603,7 +3529,7 @@ BOOST_AUTO_TEST_CASE(keccak256_empty)
char const* sourceCode = R"(
contract C {
function f() returns (bytes32) {
- return keccak256();
+ return keccak256("");
}
}
)";
@@ -3617,7 +3543,7 @@ BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments)
contract c {
function foo(uint a, uint b, uint c) returns (bytes32 d)
{
- d = keccak256(a, b, c);
+ d = keccak256(abi.encodePacked(a, b, c));
}
}
)";
@@ -3638,7 +3564,7 @@ BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments_with_numeric_literals)
contract c {
function foo(uint a, uint16 b) returns (bytes32 d)
{
- d = keccak256(a, b, 145);
+ d = keccak256(abi.encodePacked(a, b, 145));
}
}
)";
@@ -3663,7 +3589,7 @@ BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments_with_string_literals)
}
function bar(uint a, uint16 b) returns (bytes32 d)
{
- d = keccak256(a, b, 145, "foo");
+ d = keccak256(abi.encodePacked(a, b, 145, "foo"));
}
}
)";
@@ -3702,7 +3628,7 @@ BOOST_AUTO_TEST_CASE(keccak256_with_bytes)
BOOST_AUTO_TEST_CASE(iterated_keccak256_with_bytes)
{
- char const* sourceCode = R"(
+ char const* sourceCode = R"ABC(
contract c {
bytes data;
function foo() returns (bytes32)
@@ -3711,10 +3637,10 @@ BOOST_AUTO_TEST_CASE(iterated_keccak256_with_bytes)
data[0] = "x";
data[1] = "y";
data[2] = "z";
- return keccak256("b", keccak256(data), "a");
+ return keccak256(abi.encodePacked("b", keccak256(data), "a"));
}
}
- )";
+ )ABC";
compileAndRun(sourceCode);
ABI_CHECK(callContractFunction("foo()"), encodeArgs(
u256(dev::keccak256(bytes{'b'} + dev::keccak256("xyz").asBytes() + bytes{'a'}))
@@ -3733,7 +3659,7 @@ BOOST_AUTO_TEST_CASE(generic_call)
function doSend(address rec) returns (uint d)
{
bytes4 signature = bytes4(bytes32(keccak256("receive(uint256)")));
- rec.call.value(2)(signature, 23);
+ rec.call.value(2)(abi.encodeWithSelector(signature, 23));
return receiver(rec).received();
}
}
@@ -3763,7 +3689,7 @@ BOOST_AUTO_TEST_CASE(generic_delegatecall)
function doSend(address rec) payable
{
bytes4 signature = bytes4(bytes32(keccak256("receive(uint256)")));
- if (rec.delegatecall(signature, 23)) {}
+ if (rec.delegatecall(abi.encodeWithSelector(signature, 23))) {}
}
}
)**";
@@ -3860,7 +3786,7 @@ BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory)
char const* sourceCode = R"(
contract C {
function f() returns (bytes32) {
- return keccak256("abc", msg.data);
+ return keccak256(abi.encodePacked("abc", msg.data));
}
}
)";
@@ -3876,11 +3802,11 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes)
contract receiver {
uint public received;
function receive(uint x) { received += x + 1; }
- function() { received = 0x80; }
+ function() external { received = 0x80; }
}
contract sender {
function sender() { rec = new receiver(); }
- function() { savedData = msg.data; }
+ function() external { savedData = msg.data; }
function forward() returns (bool) { !rec.call(savedData); return true; }
function clear() returns (bool) { delete savedData; return true; }
function val() returns (uint) { return rec.received(); }
@@ -3904,7 +3830,7 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length)
char const* sourceCode = R"(
contract receiver {
uint public calledLength;
- function() { calledLength = msg.data.length; }
+ function() external { calledLength = msg.data.length; }
}
contract sender {
receiver rec;
@@ -3929,21 +3855,15 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length)
compileAndRun(sourceCode, 0, "sender");
// No additional data, just function selector
- ABI_CHECK(callContractFunction("viaCalldata()"), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(4));
- ABI_CHECK(callContractFunction("viaMemory()"), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(4));
- ABI_CHECK(callContractFunction("viaStorage()"), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(4));
+ ABI_CHECK(callContractFunction("viaCalldata()"), encodeArgs(4));
+ ABI_CHECK(callContractFunction("viaMemory()"), encodeArgs(4));
+ ABI_CHECK(callContractFunction("viaStorage()"), encodeArgs(4));
// Some additional unpadded data
bytes unpadded = asBytes(string("abc"));
- ABI_CHECK(callContractFunctionNoEncoding("viaCalldata()", unpadded), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(7));
- ABI_CHECK(callContractFunctionNoEncoding("viaMemory()", unpadded), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(7));
- ABI_CHECK(callContractFunctionNoEncoding("viaStorage()", unpadded), encodeArgs(0x20));
- // Should be this with 0.5.0: encodeArgs(7));
+ ABI_CHECK(callContractFunctionNoEncoding("viaCalldata()", unpadded), encodeArgs(7));
+ ABI_CHECK(callContractFunctionNoEncoding("viaMemory()", unpadded), encodeArgs(7));
+ ABI_CHECK(callContractFunctionNoEncoding("viaStorage()", unpadded), encodeArgs(7));
}
BOOST_AUTO_TEST_CASE(copying_bytes_multiassign)
@@ -3952,11 +3872,11 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign)
contract receiver {
uint public received;
function receive(uint x) { received += x + 1; }
- function() { received = 0x80; }
+ function() external { received = 0x80; }
}
contract sender {
function sender() { rec = new receiver(); }
- function() { savedData1 = savedData2 = msg.data; }
+ function() external { savedData1 = savedData2 = msg.data; }
function forward(bool selector) returns (bool) {
if (selector) { rec.call(savedData1); delete savedData1; }
else { rec.call(savedData2); delete savedData2; }
@@ -3983,7 +3903,7 @@ BOOST_AUTO_TEST_CASE(delete_removes_bytes_data)
{
char const* sourceCode = R"(
contract c {
- function() { data = msg.data; }
+ function() external { data = msg.data; }
function del() returns (bool) { delete data; return true; }
bytes data;
}
@@ -4000,7 +3920,7 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data)
char const* sourceCode = R"(
contract c {
function set() returns (bool) { data = msg.data; return true; }
- function() { data = msg.data; }
+ function() external { data = msg.data; }
bytes data;
}
)";
@@ -4246,7 +4166,7 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean)
assembly {
tmp := 5
}
- Ev(tmp);
+ emit Ev(tmp);
return 1;
}
}
@@ -6034,12 +5954,12 @@ BOOST_AUTO_TEST_CASE(invalid_enum_logged)
assembly {
garbled := 5
}
- Log(garbled);
+ emit Log(garbled);
return 1;
}
function test_log_ok() returns (uint) {
X x = X.A;
- Log(x);
+ emit Log(x);
return 1;
}
}
@@ -6345,7 +6265,7 @@ BOOST_AUTO_TEST_CASE(failing_send)
char const* sourceCode = R"(
contract Helper {
uint[] data;
- function () {
+ function () external {
data[9]; // trigger exception
}
}
@@ -6369,7 +6289,7 @@ BOOST_AUTO_TEST_CASE(send_zero_ether)
// (it previously did not because the gas stipend was not provided by the EVM)
char const* sourceCode = R"(
contract Receiver {
- function () payable {
+ function () external payable {
}
}
contract Main {
@@ -6398,7 +6318,7 @@ BOOST_AUTO_TEST_CASE(reusing_memory)
mapping(uint => uint) map;
function f(uint x) returns (uint) {
map[x] = x;
- return (new Helper(uint(keccak256(this.g(map[x]))))).flag();
+ return (new Helper(uint(keccak256(abi.encodePacked(this.g(map[x])))))).flag();
}
function g(uint a) returns (uint)
{
@@ -7885,7 +7805,7 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library)
function f(address x) returns (bool) {
return x.send(1);
}
- function () payable {}
+ function () external payable {}
}
)";
compileAndRun(sourceCode, 0, "lib");
@@ -9386,7 +9306,7 @@ BOOST_AUTO_TEST_CASE(mutex)
// NOTE: It is very bad practice to write this function this way.
// Please refer to the documentation of how to do this properly.
if (amount > shares) throw;
- if (!msg.sender.call.value(amount)()) throw;
+ if (!msg.sender.call.value(amount)("")) throw;
shares -= amount;
return shares;
}
@@ -9394,7 +9314,7 @@ BOOST_AUTO_TEST_CASE(mutex)
// NOTE: It is very bad practice to write this function this way.
// Please refer to the documentation of how to do this properly.
if (amount > shares) throw;
- if (!msg.sender.call.value(amount)()) throw;
+ if (!msg.sender.call.value(amount)("")) throw;
shares -= amount;
return shares;
}
@@ -9415,7 +9335,7 @@ BOOST_AUTO_TEST_CASE(mutex)
else
return fund.withdrawUnprotected(10);
}
- function() payable {
+ function() external payable {
callDepth++;
if (callDepth < 4)
attackInternal();
@@ -9460,14 +9380,14 @@ BOOST_AUTO_TEST_CASE(failing_ecrecover_invalid_input_proper)
0, // invalid v value
0x6944c77849b18048f6abe0db8084b0d0d0689cdddb53d2671c36967b58691ad4,
0xef4f06ba4f78319baafd0424365777241af4dfd3da840471b4b4b087b7750d0d,
- 0xca35b7d915458ef540ade6068dfe2f44e8fa733c,
- 0xca35b7d915458ef540ade6068dfe2f44e8fa733c
+ 0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c,
+ 0x00ca35b7d915458ef540ade6068dfe2f44e8fa733c
);
}
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s, uint blockExpired, bytes32 salt)
returns (address)
{
- require(hash == keccak256(blockExpired, salt));
+ require(hash == keccak256(abi.encodePacked(blockExpired, salt)));
return ecrecover(hash, v, r, s);
}
}
@@ -9499,7 +9419,7 @@ BOOST_AUTO_TEST_CASE(failing_ecrecover_invalid_input_asm)
BOOST_AUTO_TEST_CASE(calling_nonexisting_contract_throws)
{
- char const* sourceCode = R"(
+ char const* sourceCode = R"YY(
contract D { function g(); }
contract C {
D d = D(0x1212);
@@ -9512,11 +9432,11 @@ BOOST_AUTO_TEST_CASE(calling_nonexisting_contract_throws)
return 7;
}
function h() returns (uint) {
- d.call(); // this does not throw (low-level)
+ d.call(""); // this does not throw (low-level)
return 7;
}
}
- )";
+ )YY";
compileAndRun(sourceCode, 0, "C");
ABI_CHECK(callContractFunction("f()"), encodeArgs());
ABI_CHECK(callContractFunction("g()"), encodeArgs());
@@ -9541,7 +9461,7 @@ BOOST_AUTO_TEST_CASE(payable_function)
function f() payable returns (uint) {
return msg.value;
}
- function() payable {
+ function() external payable {
a = msg.value + 1;
}
}
@@ -9580,7 +9500,7 @@ BOOST_AUTO_TEST_CASE(non_payable_throw)
function f() returns (uint) {
return msg.value;
}
- function() {
+ function() external {
a = msg.value + 1;
}
}
@@ -11269,7 +11189,7 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_transfer)
{
char const* sourceCode = R"(
contract D {
- function() public payable {
+ function() external payable {
revert("message");
}
function f() public {
@@ -11420,7 +11340,7 @@ BOOST_AUTO_TEST_CASE(interface_contract)
interface I {
event A();
function f() returns (bool);
- function() payable;
+ function() external payable;
}
contract A is I {
@@ -11432,7 +11352,7 @@ BOOST_AUTO_TEST_CASE(interface_contract)
return true;
}
- function() payable {
+ function() external payable {
}
}
@@ -11520,17 +11440,17 @@ BOOST_AUTO_TEST_CASE(inlineasm_empty_let)
BOOST_AUTO_TEST_CASE(bare_call_invalid_address)
{
- char const* sourceCode = R"(
+ char const* sourceCode = R"YY(
contract C {
/// Calling into non-existant account is successful (creates the account)
function f() external returns (bool) {
- return address(0x4242).call();
+ return address(0x4242).call("");
}
function h() external returns (bool) {
- return address(0x4242).delegatecall();
+ return address(0x4242).delegatecall("");
}
}
- )";
+ )YY";
compileAndRun(sourceCode, 0, "C");
ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(1)));
ABI_CHECK(callContractFunction("h()"), encodeArgs(u256(1)));
@@ -11548,13 +11468,13 @@ BOOST_AUTO_TEST_CASE(delegatecall_return_value)
return value;
}
function get_delegated() external returns (bool) {
- return this.delegatecall(bytes4(keccak256("get()")));
+ return this.delegatecall(abi.encodeWithSignature("get()"));
}
function assert0() external view {
assert(value == 0);
}
function assert0_delegated() external returns (bool) {
- return this.delegatecall(bytes4(keccak256("assert0()")));
+ return this.delegatecall(abi.encodeWithSignature("assert0()"));
}
}
)DELIMITER";
@@ -11932,7 +11852,7 @@ BOOST_AUTO_TEST_CASE(snark)
input[7] = 9643208548031422463313148630985736896287522941726746581856185889848792022807;
input[8] = 18066496933330839731877828156604;
if (verify(input, proof) == 0) {
- Verified("Transaction successfully verified.");
+ emit Verified("Transaction successfully verified.");
return true;
} else {
return false;