mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove EWASM backend.
This commit is contained in:
@@ -2,5 +2,4 @@ abstract contract C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract C {
|
||||
m[c] = payable(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { {} }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { function g() { pop(blockhash(20)) } g() }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { function f() { leave } }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { for {} 1 { pop(sload(0)) } { break continue } }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -8,5 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -5,5 +5,4 @@ contract C {
|
||||
assembly { let x := s.offset let y := mul(s.slot, 2) }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { let x := "abc" }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -8,5 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { switch 0 case 0 {} default {} }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
assembly { x := 7 }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -16,5 +16,4 @@ contract C {
|
||||
/** Some comment on mod.*/ modifier mod() { _; }
|
||||
/** Some comment on fn.*/ function fn() public {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -21,5 +21,4 @@ contract C {
|
||||
uint param3
|
||||
) public {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -12,5 +12,4 @@ contract C {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -12,5 +12,4 @@ contract C {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
contract C {
|
||||
event E(function() internal);
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -11,6 +11,5 @@ interface I {
|
||||
uint calldata c = 123.4;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// failAfter: Parsed
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
fallback() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
fallback() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
contract C {
|
||||
fallback() external {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -5,5 +5,4 @@ contract C {
|
||||
mapping(E => bool) c;
|
||||
mapping(address keyAddress => uint256 value) d;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C
|
||||
uint public constant b = 2;
|
||||
uint public c = 3;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,6 +4,5 @@ contract C is NotExisting.X
|
||||
NotExisting.SomeStruct public myStruct;
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
// ----
|
||||
// failAfter: Parsed
|
||||
|
||||
@@ -9,5 +9,4 @@ contract C is B {
|
||||
function foo() public override { }
|
||||
function faa() public override { }
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
receive() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract B {
|
||||
contract C is A, B {
|
||||
function f() public override(A, B) {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
error T();
|
||||
function h() public { f(); }
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -9,5 +9,4 @@ contract C {
|
||||
type MyUInt is uint;
|
||||
mapping(MyAddress => MyUInt) public m;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract C {
|
||||
return -a - b;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract Sample {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -50,7 +50,6 @@ SemanticTest::SemanticTest(
|
||||
langutil::EVMVersion _evmVersion,
|
||||
optional<uint8_t> _eofVersion,
|
||||
vector<boost::filesystem::path> const& _vmPaths,
|
||||
bool _enforceCompileToEwasm,
|
||||
bool _enforceGasCost,
|
||||
u256 _enforceGasCostMinValue
|
||||
):
|
||||
@@ -60,7 +59,6 @@ SemanticTest::SemanticTest(
|
||||
m_lineOffset(m_reader.lineNumber()),
|
||||
m_builtins(makeBuiltins()),
|
||||
m_sideEffectHooks(makeSideEffectHooks()),
|
||||
m_enforceCompileToEwasm(_enforceCompileToEwasm),
|
||||
m_enforceGasCost(_enforceGasCost),
|
||||
m_enforceGasCostMinValue(std::move(_enforceGasCostMinValue))
|
||||
{
|
||||
@@ -83,25 +81,6 @@ SemanticTest::SemanticTest(
|
||||
m_testCaseWantsYulRun = util::contains(yulRunTriggers, compileViaYul);
|
||||
m_testCaseWantsLegacyRun = util::contains(legacyRunTriggers, compileViaYul);
|
||||
|
||||
// Do not enforce ewasm, if via yul was explicitly denied.
|
||||
if (compileViaYul == "false")
|
||||
m_enforceCompileToEwasm = false;
|
||||
|
||||
string compileToEwasm = m_reader.stringSetting("compileToEwasm", "false");
|
||||
if (compileToEwasm == "also")
|
||||
m_testCaseWantsEwasmRun = true;
|
||||
else if (compileToEwasm == "false")
|
||||
m_testCaseWantsEwasmRun = false;
|
||||
else
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + "."));
|
||||
|
||||
if (m_testCaseWantsEwasmRun && !m_testCaseWantsYulRun)
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + ", compileViaYul need to be enabled."));
|
||||
|
||||
// run ewasm tests only if an ewasm evmc vm was defined
|
||||
if (m_testCaseWantsEwasmRun && !m_supportsEwasm)
|
||||
m_testCaseWantsEwasmRun = false;
|
||||
|
||||
auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default"));
|
||||
soltestAssert(revertStrings, "Invalid revertStrings setting.");
|
||||
m_revertStrings = revertStrings.value();
|
||||
@@ -298,24 +277,10 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
|
||||
TestResult result = TestResult::Success;
|
||||
|
||||
if (m_testCaseWantsLegacyRun && !m_eofVersion.has_value())
|
||||
result = runTest(_stream, _linePrefix, _formatted, false, false);
|
||||
result = runTest(_stream, _linePrefix, _formatted, false);
|
||||
|
||||
if (m_testCaseWantsYulRun && result == TestResult::Success)
|
||||
result = runTest(_stream, _linePrefix, _formatted, true, false);
|
||||
|
||||
if (!m_eofVersion.has_value() && (m_testCaseWantsEwasmRun || m_enforceCompileToEwasm) && result == TestResult::Success)
|
||||
{
|
||||
// TODO: Once we have full Ewasm support, we could remove try/catch here.
|
||||
try
|
||||
{
|
||||
result = runTest(_stream, _linePrefix, _formatted, true, true);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (!m_enforceCompileToEwasm)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
result = runTest(_stream, _linePrefix, _formatted, true);
|
||||
|
||||
if (result != TestResult::Success)
|
||||
solidity::test::CommonOptions::get().printSelectedOptions(
|
||||
@@ -331,33 +296,19 @@ TestCase::TestResult SemanticTest::runTest(
|
||||
ostream& _stream,
|
||||
string const& _linePrefix,
|
||||
bool _formatted,
|
||||
bool _isYulRun,
|
||||
bool _isEwasmRun)
|
||||
bool _isYulRun)
|
||||
{
|
||||
bool success = true;
|
||||
m_gasCostFailure = false;
|
||||
|
||||
if (_isEwasmRun)
|
||||
{
|
||||
soltestAssert(_isYulRun, "");
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EWASM);
|
||||
}
|
||||
else
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
|
||||
|
||||
reset();
|
||||
|
||||
m_compileViaYul = _isYulRun;
|
||||
if (_isEwasmRun)
|
||||
{
|
||||
soltestAssert(m_compileViaYul, "");
|
||||
m_compileToEwasm = _isEwasmRun;
|
||||
}
|
||||
|
||||
m_canEnableEwasmRun = false;
|
||||
|
||||
if (_isYulRun)
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul" << (_isEwasmRun ? " (ewasm):" : ":") << endl;
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul: " << endl;
|
||||
|
||||
for (TestFunctionCall& test: m_tests)
|
||||
test.reset();
|
||||
@@ -470,31 +421,8 @@ TestCase::TestResult SemanticTest::runTest(
|
||||
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
|
||||
}
|
||||
|
||||
// Right now we have sometimes different test results in Yul vs. Ewasm.
|
||||
// The main reason is that Ewasm just returns a failure in some cases.
|
||||
// TODO: If Ewasm support got fully implemented, we could implement this in the same way as above.
|
||||
if (success && !m_testCaseWantsEwasmRun && _isEwasmRun)
|
||||
{
|
||||
// TODO: There is something missing in Ewasm to support other types of revert strings:
|
||||
// for now, we just ignore test-cases that do not use RevertStrings::Default.
|
||||
if (m_revertStrings != RevertStrings::Default)
|
||||
return TestResult::Success;
|
||||
|
||||
m_canEnableEwasmRun = true;
|
||||
AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) <<
|
||||
_linePrefix << endl <<
|
||||
_linePrefix << "Test can pass via Yul (Ewasm), but marked with \"compileToEwasm: false.\"" << endl;
|
||||
return TestResult::Failure;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
// Ignore failing tests that can't yet get compiled to Ewasm:
|
||||
// if the test run was not successful and enforce compiling to ewasm was set,
|
||||
// but the test case did not want to get run with Ewasm, we just ignore this failure.
|
||||
if (m_enforceCompileToEwasm && !m_testCaseWantsEwasmRun)
|
||||
return TestResult::Success;
|
||||
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl;
|
||||
for (TestFunctionCall const& test: m_tests)
|
||||
{
|
||||
@@ -647,21 +575,12 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
|
||||
void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix)
|
||||
{
|
||||
auto& settings = m_reader.settings();
|
||||
if (settings.empty() && !m_canEnableEwasmRun)
|
||||
if (settings.empty())
|
||||
return;
|
||||
|
||||
_stream << _linePrefix << "// ====" << endl;
|
||||
if (m_canEnableEwasmRun)
|
||||
{
|
||||
soltestAssert(m_testCaseWantsYulRun, "");
|
||||
_stream << _linePrefix << "// compileToEwasm: also\n";
|
||||
}
|
||||
|
||||
for (auto const& [settingName, settingValue]: settings)
|
||||
if (
|
||||
!(settingName == "compileToEwasm" && m_canEnableEwasmRun)
|
||||
)
|
||||
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
|
||||
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
|
||||
}
|
||||
|
||||
void SemanticTest::parseExpectations(istream& _stream)
|
||||
|
||||
@@ -53,7 +53,6 @@ public:
|
||||
_options.evmVersion,
|
||||
_options.eofVersion,
|
||||
_options.vmPaths,
|
||||
_options.enforceCompileToEwasm,
|
||||
_options.enforceGasCost,
|
||||
_options.enforceGasCostMinValue
|
||||
);
|
||||
@@ -64,7 +63,6 @@ public:
|
||||
langutil::EVMVersion _evmVersion,
|
||||
std::optional<uint8_t> _eofVersion,
|
||||
std::vector<boost::filesystem::path> const& _vmPaths,
|
||||
bool _enforceCompileToEwasm = false,
|
||||
bool _enforceGasCost = false,
|
||||
u256 _enforceGasCostMinValue = 100000
|
||||
);
|
||||
@@ -85,7 +83,7 @@ public:
|
||||
bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map<std::string, solidity::test::Address> const& _libraries = {});
|
||||
|
||||
private:
|
||||
TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun, bool _isEwasmRun);
|
||||
TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun);
|
||||
bool checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const;
|
||||
std::map<std::string, Builtin> makeBuiltins();
|
||||
std::vector<SideEffectHook> makeSideEffectHooks() const;
|
||||
@@ -98,12 +96,9 @@ private:
|
||||
std::map<std::string, Builtin> const m_builtins;
|
||||
std::vector<SideEffectHook> const m_sideEffectHooks;
|
||||
bool m_testCaseWantsYulRun = true;
|
||||
bool m_testCaseWantsEwasmRun = false;
|
||||
bool m_testCaseWantsLegacyRun = true;
|
||||
bool m_enforceCompileToEwasm = false;
|
||||
bool m_runWithABIEncoderV1Only = false;
|
||||
bool m_allowNonExistingFunctions = false;
|
||||
bool m_canEnableEwasmRun = false;
|
||||
bool m_gasCostFailure = false;
|
||||
bool m_enforceGasCost = false;
|
||||
u256 m_enforceGasCostMinValue;
|
||||
|
||||
@@ -53,33 +53,19 @@ using namespace solidity::langutil;
|
||||
|
||||
#define ALSO_VIA_YUL(CODE) \
|
||||
{ \
|
||||
m_doEwasmTestrun = true; \
|
||||
\
|
||||
m_compileViaYul = false; \
|
||||
m_compileToEwasm = false; \
|
||||
{ CODE } \
|
||||
\
|
||||
m_compileViaYul = true; \
|
||||
reset(); \
|
||||
{ CODE } \
|
||||
\
|
||||
if (m_doEwasmTestrun) \
|
||||
{ \
|
||||
m_compileToEwasm = true; \
|
||||
reset(); \
|
||||
{ CODE } \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DISABLE_EWASM_TESTRUN() \
|
||||
{ m_doEwasmTestrun = false; }
|
||||
|
||||
namespace solidity::frontend::test
|
||||
{
|
||||
|
||||
struct SolidityEndToEndTestExecutionFramework: public SolidityExecutionFramework
|
||||
{
|
||||
bool m_doEwasmTestrun = false;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(SolidityEndToEndTest, SolidityEndToEndTestExecutionFramework)
|
||||
@@ -108,7 +94,6 @@ BOOST_AUTO_TEST_CASE(creation_code_optimizer)
|
||||
reset();
|
||||
compileAndRun(codeC + codeD);
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0x20, bytecodeC.size()) + encode(bytecodeC, false));
|
||||
m_doEwasmTestrun = false;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -166,8 +151,6 @@ BOOST_AUTO_TEST_CASE(recursive_calls)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
function<u256(u256)> recursive_calls_cpp = [&recursive_calls_cpp](u256 const& n) -> u256
|
||||
{
|
||||
@@ -193,8 +176,6 @@ BOOST_AUTO_TEST_CASE(while_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto while_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -223,8 +204,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto do_while_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -270,8 +249,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto do_while = [](u256 n) -> u256
|
||||
@@ -322,8 +299,6 @@ BOOST_AUTO_TEST_CASE(nested_loops)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto nested_loops_cpp = [](u256 n) -> u256
|
||||
@@ -390,8 +365,6 @@ BOOST_AUTO_TEST_CASE(nested_loops_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto nested_loops_cpp = [](u256 n) -> u256
|
||||
@@ -446,8 +419,6 @@ BOOST_AUTO_TEST_CASE(for_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop = [](u256 n) -> u256
|
||||
@@ -509,8 +480,6 @@ BOOST_AUTO_TEST_CASE(nested_for_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop = [](u256 n) -> u256
|
||||
@@ -551,8 +520,6 @@ BOOST_AUTO_TEST_CASE(for_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -580,8 +547,6 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop_simple_init_expr_cpp = [](u256 const& n) -> u256
|
||||
@@ -621,7 +586,6 @@ BOOST_AUTO_TEST_CASE(for_loop_break_continue)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto breakContinue = [](u256 const& n) -> u256
|
||||
@@ -657,8 +621,6 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto short_circuiting_cpp = [](u256 n) -> u256
|
||||
@@ -776,8 +738,6 @@ BOOST_AUTO_TEST_CASE(mapping_state_inc_dec)
|
||||
return --table[value++];
|
||||
};
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
value = 0;
|
||||
table.clear();
|
||||
@@ -804,8 +764,6 @@ BOOST_AUTO_TEST_CASE(multi_level_mapping)
|
||||
else return table[_x][_y] = _z;
|
||||
};
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
table.clear();
|
||||
|
||||
@@ -842,8 +800,6 @@ BOOST_AUTO_TEST_CASE(constructor)
|
||||
};
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
testContractAgainstCpp("get(uint256)", get, u256(6));
|
||||
testContractAgainstCpp("get(uint256)", get, u256(7));
|
||||
@@ -862,8 +818,6 @@ BOOST_AUTO_TEST_CASE(send_ether)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
u256 amount(250);
|
||||
compileAndRun(sourceCode, amount + 1);
|
||||
h160 address(23);
|
||||
@@ -896,8 +850,6 @@ BOOST_AUTO_TEST_CASE(transfer_ether)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "B");
|
||||
h160 const nonPayableRecipient = m_contractAddress;
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
@@ -1237,8 +1189,6 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("f(uint256,uint256)", 5, 9) != encodeArgs(5, 8));
|
||||
ABI_CHECK(callContractFunction("f(uint256,uint256)", 5, 9), encodeArgs(9, 8));
|
||||
@@ -1382,7 +1332,6 @@ BOOST_AUTO_TEST_CASE(library_call_protection)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
ABI_CHECK(callContractFunction("np(Lib.S storage)", 0), encodeArgs());
|
||||
ABI_CHECK(callContractFunction("v(Lib.S storage)", 0), encodeArgs(m_sender));
|
||||
@@ -1406,7 +1355,6 @@ BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN();
|
||||
compileAndRun(sourceCode);
|
||||
bytes calldata1 = util::selectorFromSignatureH32("f()").asBytes() + bytes(61, 0x22) + bytes(12, 0x12);
|
||||
sendMessage(calldata1, false);
|
||||
@@ -1446,7 +1394,6 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN();
|
||||
compileAndRun(sourceCode, 0, "sender");
|
||||
|
||||
// No additional data, just function selector
|
||||
@@ -1485,7 +1432,6 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "sender");
|
||||
ABI_CHECK(callContractFunction("recv(uint256)", 7), bytes());
|
||||
ABI_CHECK(callContractFunction("val()"), encodeArgs(0));
|
||||
@@ -1508,7 +1454,6 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode);
|
||||
ABI_CHECK(callContractFunction("set()", 1, 2, 3, 4, 5), encodeArgs(true));
|
||||
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
||||
@@ -1569,7 +1514,6 @@ BOOST_AUTO_TEST_CASE(struct_referencing)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "L");
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0, 3));
|
||||
ABI_CHECK(callContractFunction("g()"), encodeArgs(4));
|
||||
@@ -1618,7 +1562,6 @@ BOOST_AUTO_TEST_CASE(enum_referencing)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "L");
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(1));
|
||||
ABI_CHECK(callContractFunction("g()"), encodeArgs(3));
|
||||
@@ -1649,8 +1592,6 @@ BOOST_AUTO_TEST_CASE(bytes_in_arguments)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
string innercalldata1 = asString(util::selectorFromSignatureH32("f(uint256,uint256)").asBytes() + encodeArgs(8, 9));
|
||||
@@ -1702,8 +1643,6 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_abi)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
bytes valueSequence;
|
||||
for (size_t i = 0; i < 101; ++i)
|
||||
@@ -2138,8 +2077,6 @@ BOOST_AUTO_TEST_CASE(string_as_mapping_key)
|
||||
};
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "Test");
|
||||
for (unsigned i = 0; i < strings.size(); i++)
|
||||
ABI_CHECK(callContractFunction(
|
||||
@@ -2308,7 +2245,6 @@ BOOST_AUTO_TEST_CASE(library_call)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f(uint256)", u256(33)), encodeArgs(u256(33) * 9));
|
||||
@@ -2326,7 +2262,6 @@ BOOST_AUTO_TEST_CASE(library_function_external)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f(bytes)", u256(0x20), u256(5), "abcde"), encodeArgs("c"));
|
||||
@@ -2478,7 +2413,6 @@ BOOST_AUTO_TEST_CASE(short_strings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "A");
|
||||
ABI_CHECK(callContractFunction("data1()"), encodeDyn(string("123")));
|
||||
ABI_CHECK(callContractFunction("lengthChange()"), encodeArgs(u256(0)));
|
||||
@@ -2522,7 +2456,6 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "lib");
|
||||
Address libraryAddress = m_contractAddress;
|
||||
compileAndRun(sourceCode, 10, "c");
|
||||
@@ -2737,7 +2670,6 @@ BOOST_AUTO_TEST_CASE(non_payable_throw)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunctionWithValue("f()", 27), encodeArgs());
|
||||
BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 0);
|
||||
@@ -2784,7 +2716,6 @@ BOOST_AUTO_TEST_CASE(receive_external_function_type)
|
||||
)";
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction(
|
||||
"f(function)",
|
||||
@@ -2839,8 +2770,6 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
|
||||
contract C2 {}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "C1");
|
||||
compileAndRun(sourceCode, 0, "C2");
|
||||
)
|
||||
@@ -3308,7 +3237,6 @@ BOOST_AUTO_TEST_CASE(bare_call_return_data)
|
||||
}
|
||||
)DELIMITER";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_bool()"))), encodeArgs(true, 0x40, 0x20, true));
|
||||
ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_int32()"))), encodeArgs(true, 0x40, 0x20, u256(-32)));
|
||||
@@ -3369,7 +3297,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction("f0()"), encodeArgs(0x20, 0));
|
||||
@@ -3447,7 +3374,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_storage)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4);
|
||||
@@ -3521,7 +3447,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_memory)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4);
|
||||
@@ -3568,7 +3493,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_functionPtr)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
string directEncoding = asString(fromHex("08" "1112131400000000000011121314000000000087" "26121ff0" "02"));
|
||||
@@ -3611,7 +3535,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_structs)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes structEnc = encodeArgs(int(0x12), u256(-7), int(2), int(3), u256(-7), u256(-8));
|
||||
ABI_CHECK(callContractFunction("testStorage()"), encodeArgs());
|
||||
@@ -3647,7 +3570,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_nestedArray)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes structEnc = encodeArgs(1, 2, 3, 0, 0, 0, 0, 4);
|
||||
ABI_CHECK(callContractFunction("testNestedArrays()"), encodeArgs());
|
||||
@@ -3678,7 +3600,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_arrayOfStrings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes arrayEncoding = encodeArgs("abc", "0123456789012345678901234567890123456789");
|
||||
ABI_CHECK(callContractFunction("testStorage()"), encodeArgs());
|
||||
@@ -3798,7 +3719,6 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "ClientReceipt", bytes());
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":ClientReceipt", m_contractAddress}});
|
||||
|
||||
@@ -3874,7 +3794,6 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
m_revertStrings = RevertStrings::Default;
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
|
||||
entry.second = addPreamble(entry.second);
|
||||
|
||||
m_compiler.reset();
|
||||
m_compiler.enableEwasmGeneration(m_compileToEwasm);
|
||||
m_compiler.setSources(sourcesWithPreamble);
|
||||
m_compiler.setLibraries(_libraryAddresses);
|
||||
m_compiler.setRevertStringBehaviour(m_revertStrings);
|
||||
@@ -83,46 +82,41 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
|
||||
evmasm::LinkerObject obj;
|
||||
if (m_compileViaYul)
|
||||
{
|
||||
if (m_compileToEwasm)
|
||||
obj = m_compiler.ewasmObject(contractName);
|
||||
else
|
||||
// Try compiling twice: If the first run fails due to stack errors, forcefully enable
|
||||
// the optimizer.
|
||||
for (bool forceEnableOptimizer: {false, true})
|
||||
{
|
||||
// Try compiling twice: If the first run fails due to stack errors, forcefully enable
|
||||
// the optimizer.
|
||||
for (bool forceEnableOptimizer: {false, true})
|
||||
OptimiserSettings optimiserSettings = m_optimiserSettings;
|
||||
if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser)
|
||||
{
|
||||
OptimiserSettings optimiserSettings = m_optimiserSettings;
|
||||
if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser)
|
||||
{
|
||||
// Enable some optimizations on the first run
|
||||
optimiserSettings.runYulOptimiser = true;
|
||||
optimiserSettings.yulOptimiserSteps = "uljmul jmul";
|
||||
}
|
||||
else if (forceEnableOptimizer)
|
||||
optimiserSettings = OptimiserSettings::full();
|
||||
// Enable some optimizations on the first run
|
||||
optimiserSettings.runYulOptimiser = true;
|
||||
optimiserSettings.yulOptimiserSteps = "uljmul jmul";
|
||||
}
|
||||
else if (forceEnableOptimizer)
|
||||
optimiserSettings = OptimiserSettings::full();
|
||||
|
||||
yul::YulStack asmStack(
|
||||
m_evmVersion,
|
||||
m_eofVersion,
|
||||
yul::YulStack::Language::StrictAssembly,
|
||||
optimiserSettings,
|
||||
DebugInfoSelection::All()
|
||||
);
|
||||
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
|
||||
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");
|
||||
yul::YulStack asmStack(
|
||||
m_evmVersion,
|
||||
m_eofVersion,
|
||||
yul::YulStack::Language::StrictAssembly,
|
||||
optimiserSettings,
|
||||
DebugInfoSelection::All()
|
||||
);
|
||||
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
|
||||
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");
|
||||
|
||||
try
|
||||
{
|
||||
asmStack.optimize();
|
||||
obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
||||
obj.link(_libraryAddresses);
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full())
|
||||
throw;
|
||||
}
|
||||
try
|
||||
{
|
||||
asmStack.optimize();
|
||||
obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
||||
obj.link(_libraryAddresses);
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full())
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ protected:
|
||||
std::optional<uint8_t> m_eofVersion;
|
||||
CompilerStack m_compiler;
|
||||
bool m_compileViaYul = false;
|
||||
bool m_compileToEwasm = false;
|
||||
bool m_showMetadata = false;
|
||||
bool m_appendCBORMetadata = true;
|
||||
CompilerStack::MetadataHash m_metadataHash = CompilerStack::MetadataHash::IPFS;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
contract Errort6 {
|
||||
using foo for ; // missing type name
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError 3546: (36-37): Expected type name
|
||||
// Warning 3796: (59-60): Recovered in ContractDefinition at '}'.
|
||||
|
||||
@@ -15,7 +15,6 @@ contract SendCoin {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError 6635: (235-236): Expected identifier but got '}'
|
||||
// ParserError 6635: (276-284): Expected ';' but got 'contract'
|
||||
|
||||
@@ -40,7 +40,6 @@ function free() pure
|
||||
// ^^^^^^^^ @FunctionInFreeFunction
|
||||
// ^ @CursorInFreeFunction
|
||||
}
|
||||
|
||||
// ----
|
||||
// -> textDocument/rename {
|
||||
// "newName": "Renamed",
|
||||
|
||||
@@ -26,7 +26,6 @@ contract C
|
||||
// ^^^^ @UserInPublicVariable
|
||||
// ^ @CursorOnUserInPublicVariable
|
||||
}
|
||||
|
||||
// ----
|
||||
// contract:
|
||||
// -> textDocument/rename {
|
||||
|
||||
@@ -24,7 +24,6 @@ function freeFunction(C _contract) view returns(int)
|
||||
// ^^^^^^^^ @VariableInFreeFunction
|
||||
// ^ @CursorOnVariableInFreeFunction
|
||||
}
|
||||
|
||||
// ----
|
||||
// -> textDocument/rename {
|
||||
// "newName": "Renamed",
|
||||
|
||||
@@ -17,7 +17,6 @@ function getColorEnum() pure returns (Color result)
|
||||
{
|
||||
result = Color.Red;
|
||||
}
|
||||
|
||||
// ----
|
||||
// -> textDocument/semanticTokens/full {
|
||||
// }
|
||||
|
||||
@@ -22,7 +22,6 @@ contract Contract
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// functions: @unusedVariable 2072
|
||||
// -> textDocument/semanticTokens/full {
|
||||
|
||||
@@ -3,6 +3,5 @@ contract C {
|
||||
return abi.decode(data, (uint256[]));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0xc0, 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 -> 0x20, 0x4, 0x3, 0x4, 0x5, 0x6
|
||||
|
||||
@@ -7,6 +7,5 @@ contract C {
|
||||
return abi.decode(data, (uint256[2][3]));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6
|
||||
|
||||
@@ -10,6 +10,5 @@ contract C {
|
||||
return abi.decode(data, (uint256[2][3]));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6
|
||||
|
||||
@@ -3,6 +3,5 @@ contract C {
|
||||
return abi.decode(data, (uint256));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x20, 0x21 -> 33
|
||||
|
||||
@@ -17,6 +17,5 @@ contract C {
|
||||
return abi.decode(abi.encode(s), (S));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb
|
||||
|
||||
@@ -11,6 +11,5 @@ contract C {
|
||||
return abi.decode(data, (S));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc
|
||||
|
||||
@@ -19,7 +19,6 @@ contract C {
|
||||
return abi.decode(data, (S));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb
|
||||
// gas irOptimized: 203166
|
||||
|
||||
@@ -27,9 +27,6 @@ contract C {
|
||||
return abi.encode(bytes2(x));
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f0() -> 0x20, 0x0
|
||||
// f1() -> 0x20, 0x40, 0x1, 0x2
|
||||
|
||||
@@ -21,6 +21,5 @@ contract C {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f() -> true
|
||||
|
||||
@@ -4,8 +4,5 @@ contract C {
|
||||
return abi.decode(abi.encode(uint256(33), arg), (uint256, bytes));
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
|
||||
@@ -19,7 +19,6 @@ contract C {
|
||||
return abi.encodeWithSelector(0x00000001, msg);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// ABIEncoderV1Only: true
|
||||
// compileViaYul: false
|
||||
|
||||
@@ -4,8 +4,5 @@ contract C {
|
||||
return abi.encode(1, -2);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x20, 0x40, 0x1, -2
|
||||
|
||||
@@ -3,7 +3,5 @@ contract C {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256,uint256[],uint256): 6, 0x60, 9, 0x8000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE
|
||||
|
||||
@@ -5,8 +5,5 @@ contract C {
|
||||
f = abi.decode(msg.data[4 + 32 : 4 + 32 + 32], (uint256));
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256,uint256): 42, 23 -> 42, 23, 42, 23
|
||||
|
||||
@@ -18,7 +18,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// test(bytes): 0x20, 0x80, 0x40, 0x60, 0, 0 -> false, false
|
||||
// test(bytes): 0x20, 0xC0, 0x40, 0x80, 1, 0x42, 1, 0x42 -> false, false
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ contract C {
|
||||
return f(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
|
||||
@@ -8,8 +8,5 @@ contract C {
|
||||
return (abi.encode(""), abi.encodePacked(""));
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x40, 0xa0, 0x40, 0x20, 0x0, 0x0
|
||||
|
||||
@@ -7,8 +7,5 @@ contract C {
|
||||
return abi.encode(1, -2);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x20, 0x40, 0x1, -2
|
||||
|
||||
@@ -44,7 +44,6 @@ contract C {
|
||||
require(y[0] == "e");
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f0() -> 0x20, 0x0
|
||||
// f1() -> 0x20, 0x40, 0x1, 0x2
|
||||
|
||||
@@ -3,8 +3,6 @@ pragma abicoder v2;
|
||||
contract C {
|
||||
function f(bool b) public pure returns (bool) { return b; }
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(bool): true -> true
|
||||
// f(bool): false -> false
|
||||
|
||||
-2
@@ -5,8 +5,6 @@ contract C {
|
||||
return 23;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256[][2][]): 0x20, 0x01, 0x20, 0x40, 0x60, 0x00, 0x00 -> 23 # this is the common encoding for x.length == 1 && x[0][0].length == 0 && x[0][1].length == 0 #
|
||||
// f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00, 0x00 -> 23 # exotic, but still valid encoding #
|
||||
|
||||
@@ -13,7 +13,6 @@ contract C {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(uint256[][]): 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8 -> 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8
|
||||
// f(uint256[][]): 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8, 9 -> 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8
|
||||
|
||||
@@ -22,7 +22,6 @@ contract C {
|
||||
return abi.encode(s);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f_memory(uint256[],uint256[2]): 0x20, 1, 2 -> 0x60, 0x01, 0x02, 1, 2
|
||||
// f_memory(uint256[],uint256[2]): 0x40, 1, 2, 5, 6 -> 0x60, 1, 2, 2, 5, 6
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ contract C {
|
||||
return a[which];
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f_memory(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 1, 2 -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 2, 1, 2
|
||||
// f_memory(uint256[][]): 0x20, 2, 0x40, 0x60, 2, 1, 2 -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 1, 2
|
||||
|
||||
@@ -33,7 +33,6 @@ contract C {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ----
|
||||
// f((uint256[])): 0x20, 0x20, 0 -> 0x20, 0x60, 0x20, 0x20, 0
|
||||
// f((uint256[])): 0x20, 0x20, 1 -> FAILURE
|
||||
|
||||
-1
@@ -23,7 +23,6 @@ contract C {
|
||||
return abi.encode(s[i][j].a);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
|
||||
@@ -39,7 +39,6 @@ contract C {
|
||||
return (a[which], b[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f_memory(uint256[]): 0x80, 9, 9, 9, 0 -> 0x20, 0
|
||||
// f_memory(uint256[]): 0x80, 9, 9, 9, 1, 7 -> 0x20, 1, 7
|
||||
|
||||
@@ -6,8 +6,6 @@ contract C {
|
||||
assembly { v := a w := b x := c y := d z := e}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint16,int16,address,bytes3,bool): 1, 2, 3, "a", true -> 1, 2, 3, "a", true
|
||||
// f(uint16,int16,address,bytes3,bool): 0xffffff, 0x1ffff, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "abcd", 1 -> FAILURE
|
||||
|
||||
@@ -6,8 +6,6 @@ contract C {
|
||||
assembly { x := e }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint8): 0 -> 0
|
||||
// f(uint8): 1 -> 1
|
||||
|
||||
-1
@@ -7,7 +7,6 @@ contract C {
|
||||
return f(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(uint256[],bytes): 0x40, 0x80, 1, 0xFF, 6, "123456" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xff, 6, "123456"
|
||||
// g(uint256[],bytes): 0x40, 0x80, 1, 0xffff, 8, "12345678" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xffff, 8, "12345678"
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ contract C {
|
||||
return (a, b);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(uint256[],uint256[1]): 0x40, 0xff, 1, 0xffff -> 0x20, 0x80, 0x40, 0xff, 1, 0xffff
|
||||
// g(uint256[],uint256[1]): 0x40, 0xff, 1, 0xffff -> 0x20, 0x80, 0x40, 0xff, 1, 0xffff
|
||||
|
||||
@@ -6,8 +6,6 @@ contract C {
|
||||
q = s;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f((int256,uint256,bytes16)): 0xff010, 0xff0002, "abcd" -> 0xff010, 0xff0002, "abcd"
|
||||
// f((int256,uint256,bytes16)): 0xff010, 0xff0002, 0x1111222233334444555566667777888800000000000000000000000000000000 -> 0xff010, 0xff0002, left(0x11112222333344445555666677778888)
|
||||
|
||||
@@ -9,7 +9,5 @@ contract C {
|
||||
d = uint16(s.d);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f((uint256,uint8,uint8,bytes2)): 1, 2, 3, "ab" -> 1, 2, 3, 0x6162
|
||||
|
||||
@@ -10,8 +10,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f((int16,uint8,bytes2)): 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab" -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab"
|
||||
// f((int16,uint8,bytes2)): 0xff010, 0xff, "ab" -> FAILURE
|
||||
|
||||
-2
@@ -6,8 +6,6 @@ contract C {
|
||||
function g(S calldata) external pure returns (uint r) { r = 2; }
|
||||
function h(S calldata s) external pure returns (uint r) { s.x; r = 3; }
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f((function)): "01234567890123456789abcd" -> 1
|
||||
// f((function)): "01234567890123456789abcdX" -> FAILURE
|
||||
|
||||
@@ -7,6 +7,5 @@ contract C {
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
|
||||
@@ -3,6 +3,5 @@ contract C {
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
|
||||
@@ -6,7 +6,6 @@ contract C {
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
// gas irOptimized: 135693
|
||||
|
||||
@@ -44,6 +44,5 @@ contract C {
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// callExternal() -> true
|
||||
|
||||
@@ -46,7 +46,6 @@ contract C is Base {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
|
||||
@@ -21,6 +21,5 @@ contract C {
|
||||
return bytes4(a);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// test() -> 0xa7a0d53700000000000000000000000000000000000000000000000000000000
|
||||
|
||||
@@ -15,8 +15,6 @@ contract C {
|
||||
return abi.encodeWithSelector(x, type(uint).max);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f0() -> 0x20, 4, 8234104107246695022420661102507966550300666591269321702959126607540084801536
|
||||
// f1() -> 0x20, 0x64, 8234104107246695022420661102507966550300666591269321702959126607540084801536, 862718293348820473429344482784628181556388621521298319395315527974912, 91135606241822717681769169345594720818313984248279388438121731325952, 0
|
||||
|
||||
@@ -24,8 +24,6 @@ contract C {
|
||||
return abi.encodeWithSelector(x, type(uint).max, s, uint(3));
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f0() -> 0x20, 4, 8234104107246695022420661102507966550300666591269321702959126607540084801536
|
||||
// f1() -> 0x20, 0x64, 8234104107246695022420661102507966550300666591269321702959126607540084801536, 862718293348820473429344482784628181556388621521298319395315527974912, 91135606241822717681769169345594720818313984248279388438121731325952, 0
|
||||
|
||||
@@ -23,7 +23,5 @@ contract Test {
|
||||
return decoded[1][0];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// test() -> FAILURE
|
||||
|
||||
@@ -24,7 +24,5 @@ contract Test {
|
||||
return decoded[0][0] + decoded[1][0];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// withinArray() -> FAILURE
|
||||
|
||||
@@ -17,7 +17,5 @@ contract Test {
|
||||
return decoded[1][0];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// test() -> FAILURE
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
contract Lotto {
|
||||
uint256 public constant ticketPrice = 555;
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// ticketPrice() -> 555
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
contract Lotto {
|
||||
uint256 public ticketPrice = 500;
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// ticketPrice() -> 500
|
||||
|
||||
@@ -7,8 +7,5 @@ contract C {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// test() -> 0
|
||||
|
||||
@@ -17,9 +17,6 @@ contract C {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256): 0 -> FAILURE, hex"4e487b71", 0x12
|
||||
// g(uint256): 0 -> FAILURE, hex"4e487b71", 0x12
|
||||
|
||||
@@ -7,7 +7,5 @@ contract C {
|
||||
}}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x00
|
||||
|
||||
@@ -7,8 +7,6 @@ contract C {
|
||||
unchecked { return add(a, b) + c; }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> FAILURE, hex"4e487b71", 0x11
|
||||
// f(uint16,uint16,uint16): 0xe000, 0x1000, 0x1000 -> 0x00
|
||||
|
||||
@@ -8,8 +8,6 @@ contract C {
|
||||
return b + c;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> 58626
|
||||
// f(uint16,uint16,uint16): 0x1000, 0xe500, 0xe000 -> FAILURE, hex"4e487b71", 0x11
|
||||
|
||||
@@ -7,8 +7,6 @@ contract C {
|
||||
return a % b;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// div(uint256,uint256): 7, 2 -> 3
|
||||
// div(uint256,uint256): 7, 0 -> FAILURE, hex"4e487b71", 0x12 # throws #
|
||||
|
||||
@@ -29,7 +29,6 @@ contract C {
|
||||
(b**a**a/b**a**b == (b**(a**a))/(b**(a**b)));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// test_hardcode1(uint256,uint256,uint256): 2, 3, 4 -> 2417851639229258349412352
|
||||
// test_hardcode2(uint256,uint256,uint256,uint256): 3, 2, 2, 2 -> 43046721
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user