mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11396 from ethereum/v1-yul
Add sanity check into SemanticTest for not allowing ABIEncoderV1Only and compileViaYul together
This commit is contained in:
commit
f58d58738e
@ -99,6 +99,14 @@ SemanticTest::SemanticTest(
|
||||
if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1)
|
||||
m_shouldRun = false;
|
||||
|
||||
// Sanity check
|
||||
if (m_runWithABIEncoderV1Only && (compileViaYul == "true" || compileViaYul == "also"))
|
||||
BOOST_THROW_EXCEPTION(runtime_error(
|
||||
"ABIEncoderV1Only can not be used with compileViaYul=" + compileViaYul +
|
||||
", set it to false or omit the flag. The compileViaYul setting ignores the abicoder pragma"
|
||||
" and runs everything with ABICoder V2."
|
||||
));
|
||||
|
||||
auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default"));
|
||||
soltestAssert(revertStrings, "Invalid revertStrings setting.");
|
||||
m_revertStrings = revertStrings.value();
|
||||
|
@ -6,7 +6,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ABIEncoderV1Only: true
|
||||
// ----
|
||||
// f() -> 0x40, 0xa0, 0x40, 0x20, 0x0, 0x0
|
||||
|
@ -0,0 +1,13 @@
|
||||
pragma abicoder v2;
|
||||
contract C {
|
||||
function f(uint16 a, uint16 b) public returns (uint16) {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint16,uint16): 65534, 0 -> 0xfffe
|
||||
// f(uint16,uint16): 65536, 0 -> FAILURE
|
||||
// f(uint16,uint16): 65535, 0 -> 0xffff
|
||||
// f(uint16,uint16): 65535, 1 -> FAILURE, hex"4e487b71", 0x11
|
@ -1,18 +0,0 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
revert("");
|
||||
}
|
||||
function g(string calldata msg) public {
|
||||
revert(msg);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// ABIEncoderV1Only: true
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: true
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// f() -> FAILURE, hex"08c379a0", 0x20, 0
|
||||
// g(string): "" -> FAILURE, hex"08c379a0", 0x20, 0
|
||||
// g(string): 0x20, 0, "" -> FAILURE, hex"08c379a0", 0x20, 0
|
||||
// g(string): 0x20, 0 -> FAILURE, hex"08c379a0", 0x20, 0
|
Loading…
Reference in New Issue
Block a user