Add CLI option to soltest to always use ABIEncoderV2

This commit is contained in:
Alex Beregszaszi 2018-09-26 18:06:35 +01:00 committed by chriseth
parent b43d75cee7
commit 219406f45b
3 changed files with 7 additions and 1 deletions

View File

@ -55,6 +55,8 @@ Options::Options()
} }
else if (string(suite.argv[i]) == "--optimize") else if (string(suite.argv[i]) == "--optimize")
optimize = true; optimize = true;
else if (string(suite.argv[i]) == "--abiencoderv2")
useABIEncoderV2 = true;
else if (string(suite.argv[i]) == "--evm-version") else if (string(suite.argv[i]) == "--evm-version")
{ {
evmVersionString = i + 1 < suite.argc ? suite.argv[i + 1] : "INVALID"; evmVersionString = i + 1 < suite.argc ? suite.argv[i + 1] : "INVALID";

View File

@ -41,6 +41,7 @@ struct Options: boost::noncopyable
bool optimize = false; bool optimize = false;
bool disableIPC = false; bool disableIPC = false;
bool disableSMT = false; bool disableSMT = false;
bool useABIEncoderV2 = false;
void validate() const; void validate() const;
solidity::EVMVersion evmVersion() const; solidity::EVMVersion evmVersion() const;

View File

@ -65,7 +65,10 @@ public:
) )
{ {
// Silence compiler version warning // Silence compiler version warning
std::string sourceCode = "pragma solidity >=0.0;\n" + _sourceCode; std::string sourceCode = "pragma solidity >=0.0;\n";
if (dev::test::Options::get().useABIEncoderV2 && _sourceCode.find("pragma experimental ABIEncoderV2;") == std::string::npos)
sourceCode += "pragma experimental ABIEncoderV2;\n";
sourceCode += _sourceCode;
m_compiler.reset(false); m_compiler.reset(false);
m_compiler.addSource("", sourceCode); m_compiler.addSource("", sourceCode);
m_compiler.setLibraries(_libraryAddresses); m_compiler.setLibraries(_libraryAddresses);