aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-06 21:14:55 +0800
committerchriseth <chris@ethereum.org>2018-04-12 19:09:38 +0800
commit4faa839813ce76fc87f99b002aad6cadd2b784e1 (patch)
treec461378847bc2ad15f0cc85fc2100a26b9ee9902 /test/libsolidity
parent338a875134f2e41e9a7e254cc3f7d87c7f4d462e (diff)
downloaddexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar.gz
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar.bz2
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar.lz
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar.xz
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.tar.zst
dexon-solidity-4faa839813ce76fc87f99b002aad6cadd2b784e1.zip
Use error signature for revert data.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 600757f1..c71d6b59 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -10453,8 +10453,9 @@ BOOST_AUTO_TEST_CASE(revert_with_cause)
)";
compileAndRun(sourceCode, 0, "C");
bool const haveReturndata = dev::test::Options::get().evmVersion().supportsReturndata();
- ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 7, "test123") : bytes());
- ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0xa0, 0, 0x40, 44, "test1234567890123456789012345678901234567890") : bytes());
+ bytes const errorSignature = bytes{0x08, 0xc3, 0x79, 0xa0};
+ ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 7, "test123") + bytes(28, 0) : bytes());
+ ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0x84) + errorSignature + encodeArgs(0x20, 44, "test1234567890123456789012345678901234567890") + bytes(28, 0): bytes());
}
BOOST_AUTO_TEST_CASE(require_with_message)
@@ -10507,11 +10508,12 @@ BOOST_AUTO_TEST_CASE(require_with_message)
)";
compileAndRun(sourceCode, 0, "C");
bool const haveReturndata = dev::test::Options::get().evmVersion().supportsReturndata();
+ bytes const errorSignature = bytes{0x08, 0xc3, 0x79, 0xa0};
ABI_CHECK(callContractFunction("f(uint256)", 8), haveReturndata ? encodeArgs(1, 0x40, 0) : bytes());
- ABI_CHECK(callContractFunction("f(uint256)", 5), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 6, "failed") : bytes());
+ ABI_CHECK(callContractFunction("f(uint256)", 5), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 6, "failed") + bytes(28, 0) : bytes());
ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(1, 0x40, 0) : bytes());
- ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 18 , "only on second run") : bytes());
- ABI_CHECK(callContractFunction("h()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 3, "abc") : bytes());
+ ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 18, "only on second run") + bytes(28, 0) : bytes());
+ ABI_CHECK(callContractFunction("h()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 3, "abc") + bytes(28, 0): bytes());
}
BOOST_AUTO_TEST_CASE(bubble_up_error_messages)
@@ -10548,8 +10550,9 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages)
)";
compileAndRun(sourceCode, 0, "C");
bool const haveReturndata = dev::test::Options::get().evmVersion().supportsReturndata();
- ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 7, "message") : bytes());
- ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 7, "message") : bytes());
+ bytes const errorSignature = bytes{0x08, 0xc3, 0x79, 0xa0};
+ ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 7, "message") + bytes(28, 0) : bytes());
+ ABI_CHECK(callContractFunction("g()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 7, "message") + bytes(28, 0) : bytes());
}
BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_transfer)
@@ -10583,7 +10586,8 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_transfer)
)";
compileAndRun(sourceCode, 0, "C");
bool const haveReturndata = dev::test::Options::get().evmVersion().supportsReturndata();
- ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 7, "message") : bytes());
+ bytes const errorSignature = bytes{0x08, 0xc3, 0x79, 0xa0};
+ ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 7, "message") + bytes(28, 0) : bytes());
}
BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_create)
@@ -10619,7 +10623,8 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_create)
)";
compileAndRun(sourceCode, 0, "C");
bool const haveReturndata = dev::test::Options::get().evmVersion().supportsReturndata();
- ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x80, 0, 0x40, 7, "message") : bytes());
+ bytes const errorSignature = bytes{0x08, 0xc3, 0x79, 0xa0};
+ ABI_CHECK(callContractFunction("f()"), haveReturndata ? encodeArgs(0, 0x40, 0x64) + errorSignature + encodeArgs(0x20, 7, "message") + bytes(28, 0) : bytes());
}
BOOST_AUTO_TEST_CASE(negative_stack_height)