diff options
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | docs/contracts.rst | 45 | ||||
-rw-r--r-- | docs/installing-solidity.rst | 183 | ||||
-rw-r--r-- | docs/utils/SolidityLexer.py | 6 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 33 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.h | 5 | ||||
-rw-r--r-- | solc/CommandLineInterface.cpp | 2 | ||||
-rw-r--r-- | solc/jsonCompiler.cpp | 2 | ||||
-rw-r--r-- | std/StandardToken.sol | 43 | ||||
-rw-r--r-- | std/Token.sol | 11 | ||||
-rw-r--r-- | std/mortal.sol | 8 | ||||
-rw-r--r-- | std/owned.sol | 13 | ||||
-rw-r--r-- | std/std.sol | 4 | ||||
-rw-r--r-- | test/contracts/AuctionRegistrar.cpp | 2 | ||||
-rw-r--r-- | test/contracts/FixedFeeRegistrar.cpp | 2 | ||||
-rw-r--r-- | test/contracts/Wallet.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 15 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 3 | ||||
-rw-r--r-- | test/libsolidity/SolidityNatspecJSON.cpp | 2 |
21 files changed, 248 insertions, 147 deletions
diff --git a/.travis.yml b/.travis.yml index e0716ac7..da9bd2f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,10 +84,10 @@ matrix: # OS X Mavericks (10.9) # https://en.wikipedia.org/wiki/OS_X_Mavericks # -# - os: osx -# osx_image: beta-xcode6.2 -# env: -# - ZIP_SUFFIX=osx-mavericks + - os: osx + osx_image: beta-xcode6.2 + env: + - ZIP_SUFFIX=osx-mavericks # OS X Yosemite (10.10) # https://en.wikipedia.org/wiki/OS_X_Yosemite @@ -14,7 +14,7 @@ Solidity is still under development. So please do not hesitate and open an [issu See the [Solidity documentation](http://solidity.readthedocs.io/en/latest/installing-solidity.html#building-from-source) for build instructions. ## How to Contribute -This repository uses the same [coding style](https://github.com/ethereum/webthree-umbrella/blob/develop/CodingStandards.txt) as -all of the cpp-ethereum projects. Please try to align with us in the gitter channel before making larger changes. +This repository uses the same [coding style](https://github.com/ethereum/cpp-ethereum/blob/develop/CodingStandards.txt) as +all of the cpp-ethereum projects. Please try to align with us in the Gitter channel before making larger changes. Any contributions are welcome! diff --git a/docs/contracts.rst b/docs/contracts.rst index 85592f5d..dfdcaf18 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -211,18 +211,18 @@ storage and is not able to call ``f``. Contract ``E`` is derived from ``C`` and contract D { function readData() { - C c = new C(); - local = c.f(7); // error: member "f" is not visible - c.setData(3); - uint local = c.getData(); - local = c.compute(3,5); // error: member "compute" is not visible - } + C c = new C(); + local = c.f(7); // error: member "f" is not visible + c.setData(3); + uint local = c.getData(); + local = c.compute(3,5); // error: member "compute" is not visible + } } contract E is C { function g() { - C c = new C(); - uint val = compute(3,5); // acces to internal member (from derivated to parent contract) + C c = new C(); + uint val = compute(3,5); // acces to internal member (from derivated to parent contract) } } @@ -244,12 +244,12 @@ be done at declaration. contract C { uint public data = 42; } - + contract Caller { - C c = new C(); - function f() { - uint local = c.data(); - } + C c = new C(); + function f() { + uint local = c.data(); + } } The accessor functions have external visibility. If the @@ -260,11 +260,11 @@ it is evaluated as state variable and if it is accessed externally :: contract C { - uint public data; - function x() { - data = 3; // internal access - uint val = this.data(); // external access - } + uint public data; + function x() { + data = 3; // internal access + uint val = this.data(); // external access + } } The next example is a bit more complex: @@ -435,6 +435,15 @@ Ether (without data). In such a context, there is very little gas available to the function call (to be precise, 2300 gas), so it is important to make fallback functions as cheap as possible. +In particular, the following operations will consume more gas than the stipend provided to a fallback function: + +- Writing to storage +- Creating a contract +- Calling an external function which consumes a large amount of gas +- Sending Ether + +Please ensure you test your fallback function thoroughly to ensure the execution cost is less than 2300 gas before deploying a contract. + :: contract Test { diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index ba40c99f..e500717b 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -8,8 +8,10 @@ Browser-Solidity If you just want to try Solidity for small contracts, you can try `browser-solidity <https://ethereum.github.io/browser-solidity>`_ which does not need any installation. If you want to use it -without connection to the Internet, you can also just save the page -locally or clone http://github.com/ethereum/browser-solidity. +without connection to the Internet, you can go to +https://github.com/ethereum/browser-solidity/tree/gh-pages and +download the .ZIP file as explained on that page. + npm / Node.js ============= @@ -22,7 +24,7 @@ package available. To install it, simply use -:: +.. code:: bash npm install solc @@ -32,102 +34,149 @@ Details about the usage of the Node.js package can be found in the Binary Packages =============== -Binary packages of Solidity together with its IDE Mix are available through -the `C++ bundle <https://github.com/ethereum/webthree-umbrella/releases>`_ of -Ethereum. +Binary packages of Solidity available at +`solidity/releases <https://github.com/ethereum/solidity/releases>`_. -Building from Source -==================== +We also have PPAs for Ubuntu. For the latest stable version. -Building Solidity is quite similar on MacOS X, Ubuntu and probably other Unices. -This guide starts explaining how to install the dependencies for each platform -and then shows how to build Solidity itself. +.. code:: bash -MacOS X -------- + sudo add-apt-repository ppa:ethereum/ethereum + sudo apt-get update + sudo apt-get install solc +If you want to use the cutting edge developer version: -Requirements: +.. code:: bash -- OS X Yosemite (10.10.5) -- Homebrew -- Xcode + sudo add-apt-repository ppa:ethereum/ethereum + sudo add-apt-repository ppa:ethereum/ethereum-dev + sudo apt-get update + sudo apt-get install solc -Set up Homebrew: +Homebrew is missing pre-built bottles at the time of writing, +following a Jenkins to TravisCI migration, but Homebrew +should still work just fine as a means to build-from-source. +We will re-add the pre-built bottles soon. -.. code-block:: bash +.. code:: bash brew update brew upgrade + brew tap ethereum/ethereum + brew install solidity + brew linkapps solidity - brew install boost --c++11 # this takes a while - brew install cmake cryptopp gmp jsoncpp -Ubuntu Trusty (14.04) ---------------------- +Building from Source +==================== + +Clone the Repository +-------------------- + +To clone the source code, execute the following command: + +.. code:: bash + + git clone --recursive https://github.com/ethereum/solidity.git + cd solidity + +If you want to help developing Solidity, +you should fork Solidity and add your personal fork as a second remote: + +.. code:: bash + + cd solidity + git remote add personal git@github.com:[username]/solidity.git + -Below are the instructions to install the minimal dependencies required -to compile Solidity on Ubuntu 14.04 (Trusty Tahr). +Prerequisites - macOS +---------------------- -.. code-block:: bash +For macOS, ensure that you have the latest version of +`xcode installed <https://developer.apple.com/xcode/download/>`_. +This contains the `Clang C++ compiler <https://en.wikipedia.org/wiki/Clang>`_, the +`xcode IDE <https://en.wikipedia.org/wiki/Xcode>`_ and other Apple development +tools which are required for building C++ applications on OS X. +If you are installing xcode for the first time, or have just installed a new +version then you will need to agree to the license before you can do +command-line builds: - sudo apt-get -y install build-essential git cmake libgmp-dev libboost-all-dev \ - libjsoncpp-dev +.. code:: bash - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo add-apt-repository -y ppa:ethereum/ethereum-dev - sudo apt-get -y update - sudo apt-get -y upgrade # this will update cmake to version 3.x - sudo apt-get -y install libcryptopp-dev libjsoncpp-dev + sudo xcodebuild -license accept -Ubuntu Xenial (16.04) +Our OS X builds require you to `install the Homebrew <http://brew.sh>`_ +package manager for installing external dependencies. +Here's how to `uninstall Homebrew +<https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#how-do-i-uninstall-homebrew>`_, +if you ever want to start again from scratch. + + +Prerequisites - Windows +------------------------ + +You will need to install the following dependencies for Windows builds of Solidity: + ++------------------------------+-------------------------------------------------------+ +| Software | Notes | ++==============================+=======================================================+ +| `Git for Windows`_ | Command-line tool for retrieving source from Github. | ++------------------------------+-------------------------------------------------------+ +| `CMake`_ | Cross-platform build file generator. | ++------------------------------+-------------------------------------------------------+ +| `Visual Studio 2015`_ | C++ compiler and dev environment. | ++------------------------------+-------------------------------------------------------+ + +.. _Git for Windows: https://git-scm.com/download/win +.. _CMake: https://cmake.org/download/ +.. _Visual Studio 2015: https://www.visualstudio.com/products/vs-2015-product-editions + + +External Dependencies --------------------- -Below are the instructions to install the minimal dependencies required -to compile Solidity on Ubuntu 16.04 (Xenial Xerus). +We now have a "one button" script which installs all required external dependencies +on macOS, Windows and on numerous Linux distros. This used to be a multi-step +manual process, but is now a one-liner: -One of the dependencies (Crypto++ Library, with version >= 5.6.2) can be -installed either by adding the Ethereum PPA (Option 1) or by backporting -``libcrypto++`` from Ubuntu Development to Ubuntu Xenial (Option 2). +.. code:: bash -.. code-block:: bash + ./scripts/install_deps.sh - sudo apt-get -y install build-essential git cmake libgmp-dev libboost-all-dev \ - libjsoncpp-dev +Or, on Windows: - # (Option 1) For those willing to add the Ethereum PPA: - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo add-apt-repository -y ppa:ethereum/ethereum-dev - sudo apt-get -y update - sudo apt-get -y upgrade - sudo apt-get -y install libcryptopp-dev +.. code:: bash - ## (Option 2) For those willing to backport libcrypto++: - #sudo apt-get -y install ubuntu-dev-tools - #sudo pbuilder create - #mkdir ubuntu - #cd ubuntu - #backportpackage --workdir=. --build --dont-sign libcrypto++ - #sudo dpkg -i buildresult/libcrypto++6_*.deb buildresult/libcrypto++-dev_*.deb - #cd .. + scripts\install_deps.bat -Building --------- -Run this if you plan on installing Solidity only: +Command-Line Build +------------------ -.. code-block:: bash +Building Solidity is quite similar on Linux, macOS and other Unices: + +.. code:: bash - git clone --recursive https://github.com/ethereum/solidity.git - cd solidity mkdir build cd build cmake .. && make -If you want to help developing Solidity, -you should fork Solidity and add your personal fork as a second remote: +And even on Windows: -.. code-block:: bash +.. code:: bash - cd solidity - git remote add personal git@github.com:username/solidity.git + mkdir build + cd build + cmake -G "Visual Studio 14 2015 Win64" .. + +This latter set of instructions should result in the creation of +**solidity.sln** in that build directory. Double-clicking on that file +should result in Visual Studio firing up. We suggest building +**RelWithDebugInfo** configuration, but all others work. + +Alternatively, you can build for Windows on the command-line, like so: + +.. code:: bash + + cmake --build . --config RelWithDebInfo diff --git a/docs/utils/SolidityLexer.py b/docs/utils/SolidityLexer.py index d05c7b0c..779147f4 100644 --- a/docs/utils/SolidityLexer.py +++ b/docs/utils/SolidityLexer.py @@ -58,12 +58,14 @@ class SolidityLexer(RegexLexer): r'throw|try|catch|finally|new|delete|typeof|instanceof|void|' r'this|import|mapping|returns|private|public|external|internal|' r'constant|memory|storage)\b', Keyword, 'slashstartsregex'), - (r'(var|let|with|function|event|modifier|struct|enum|contract)\b', Keyword.Declaration, 'slashstartsregex'), + (r'(var|let|with|function|event|modifier|struct|enum|contract|library)\b', Keyword.Declaration, 'slashstartsregex'), (r'(bytes|string|address|uint|int|bool|byte|' + '|'.join( ['uint%d' % (i + 8) for i in range(0, 256, 8)] + ['int%d' % (i + 8) for i in range(0, 256, 8)] + - ['bytes%d' % (i + 1) for i in range(0, 32)] + ['bytes%d' % (i + 1) for i in range(0, 32)] + + ['ufixed%dx%d' % ((i), (j + 8)) for i in range(0, 256, 8) for j in range(0, 256 - i, 8)] + + ['fixed%dx%d' % ((i), (j + 8)) for i in range(0, 256, 8) for j in range(0, 256 - i, 8)] ) + r')\b', Keyword.Type, 'slashstartsregex'), (r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|' r'extends|final|float|goto|implements|int|interface|long|native|' diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 0e5ead2b..bd79bb73 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -42,26 +42,8 @@ using namespace std; using namespace dev; using namespace dev::solidity; -const map<string, string> StandardSources = map<string, string>{ - {"coin", R"(import "CoinReg";import "Config";import "configUser";contract coin is configUser{function coin(bytes3 name, uint denom) {CoinReg(Config(configAddr()).lookup(3)).register(name, denom);}})"}, - {"Coin", R"(contract Coin{function isApprovedFor(address _target,address _proxy)constant returns(bool _r){}function isApproved(address _proxy)constant returns(bool _r){}function sendCoinFrom(address _from,uint256 _val,address _to){}function coinBalanceOf(address _a)constant returns(uint256 _r){}function sendCoin(uint256 _val,address _to){}function coinBalance()constant returns(uint256 _r){}function approve(address _a){}})"}, - {"CoinReg", R"(contract CoinReg{function count()constant returns(uint256 r){}function info(uint256 i)constant returns(address addr,bytes3 name,uint256 denom){}function register(bytes3 name,uint256 denom){}function unregister(){}})"}, - {"configUser", R"(contract configUser{function configAddr()constant returns(address a){ return 0xc6d9d2cd449a754c494264e1809c50e34d64562b;}})"}, - {"Config", R"(contract Config{function lookup(uint256 service)constant returns(address a){}function kill(){}function unregister(uint256 id){}function register(uint256 id,address service){}})"}, - {"mortal", R"(import "owned";contract mortal is owned {function kill() { if (msg.sender == owner) suicide(owner); }})"}, - {"named", R"(import "Config";import "NameReg";import "configUser";contract named is configUser {function named(bytes32 name) {NameReg(Config(configAddr()).lookup(1)).register(name);}})"}, - {"NameReg", R"(contract NameReg{function register(bytes32 name){}function addressOf(bytes32 name)constant returns(address addr){}function unregister(){}function nameOf(address addr)constant returns(bytes32 name){}})"}, - {"owned", R"(contract owned{function owned(){owner = msg.sender;}modifier onlyowner(){if(msg.sender==owner)_}address owner;})"}, - {"service", R"(import "Config";import "configUser";contract service is configUser{function service(uint _n){Config(configAddr()).register(_n, this);}})"}, - {"std", R"(import "owned";import "mortal";import "Config";import "configUser";import "NameReg";import "named";)"} -}; - -CompilerStack::CompilerStack(bool _addStandardSources, ReadFileCallback const& _readFile): - m_readFile(_readFile), m_parseSuccessful(false) -{ - if (_addStandardSources) - addSources(StandardSources, true); // add them as libraries -} +CompilerStack::CompilerStack(ReadFileCallback const& _readFile): + m_readFile(_readFile), m_parseSuccessful(false) {} void CompilerStack::setRemappings(vector<string> const& _remappings) { @@ -81,7 +63,7 @@ void CompilerStack::setRemappings(vector<string> const& _remappings) swap(m_remappings, remappings); } -void CompilerStack::reset(bool _keepSources, bool _addStandardSources) +void CompilerStack::reset(bool _keepSources) { m_parseSuccessful = false; if (_keepSources) @@ -90,8 +72,6 @@ void CompilerStack::reset(bool _keepSources, bool _addStandardSources) else { m_sources.clear(); - if (_addStandardSources) - addSources(StandardSources, true); } m_globalContext.reset(); m_sourceOrder.clear(); @@ -616,10 +596,9 @@ CompilerStack::Contract const& CompilerStack::contract(string const& _contractNa if (_contractName.empty()) // try to find some user-supplied contract for (auto const& it: m_sources) - if (!StandardSources.count(it.first)) - for (ASTPointer<ASTNode> const& node: it.second.ast->nodes()) - if (auto contract = dynamic_cast<ContractDefinition const*>(node.get())) - contractName = contract->name(); + for (ASTPointer<ASTNode> const& node: it.second.ast->nodes()) + if (auto contract = dynamic_cast<ContractDefinition const*>(node.get())) + contractName = contract->name(); auto it = m_contracts.find(contractName); if (it == m_contracts.end()) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Contract " + _contractName + " not found.")); diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index b3c4450c..da479638 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -85,14 +85,13 @@ public: /// Creates a new compiler stack. /// @param _readFile callback to used to read files for import statements. Should return - /// @param _addStandardSources Adds standard sources if @a _addStandardSources. - explicit CompilerStack(bool _addStandardSources = true, ReadFileCallback const& _readFile = ReadFileCallback()); + explicit CompilerStack(ReadFileCallback const& _readFile = ReadFileCallback()); /// Sets path remappings in the format "context:prefix=target" void setRemappings(std::vector<std::string> const& _remappings); /// Resets the compiler to a state where the sources are not parsed or even removed. - void reset(bool _keepSources = false, bool _addStandardSources = true); + void reset(bool _keepSources = false); /// Adds a source object (e.g. file) to the parser. After this, parse has to be called again. /// @returns true if a source object by the name already existed and was replaced. diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 08c08797..fbef56f0 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -560,7 +560,7 @@ bool CommandLineInterface::processInput() } }; - m_compiler.reset(new CompilerStack(m_args.count(g_argAddStandard) > 0, fileReader)); + m_compiler.reset(new CompilerStack(fileReader)); auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); }; try { diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index 896a5922..5cdee2e2 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -159,7 +159,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback return result; }; } - CompilerStack compiler(true, readCallback); + CompilerStack compiler(readCallback); auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return compiler.scanner(_sourceName); }; bool success = false; try diff --git a/std/StandardToken.sol b/std/StandardToken.sol new file mode 100644 index 00000000..db453492 --- /dev/null +++ b/std/StandardToken.sol @@ -0,0 +1,43 @@ +import "./Token.sol"; + +contract StandardToken is Token { + uint256 public totalSupply; + mapping (address => uint256) public balanceOf; + mapping (address => + mapping (address => uint256)) public allowance; + + function StandardToken(address _initialOwner, uint256 _supply) { + totalSupply = _supply; + balanceOf[_initialOwner] = _supply; + } + + function transfer(address _to, uint256 _value) returns (bool success) { + if (balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]) { + balanceOf[msg.sender] -= _value; + balanceOf[_to] += _value; + Transfer(msg.sender, _to, _value); + return true; + } + else { + return false; + } + } + + function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { + if (allowance[_from][msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]) { + allowance[_from][msg.sender] -= _value; + balanceOf[_to] += _value; + Transfer(_from, _to, _value); + return true; + } + else { + return false; + } + } + + function approve(address _spender, uint256 _value) returns (bool success) { + allowance[msg.sender][_spender] = _value; + Approval(msg.sender, _spender, _value); + return true; + } +} diff --git a/std/Token.sol b/std/Token.sol new file mode 100644 index 00000000..50d9ab7a --- /dev/null +++ b/std/Token.sol @@ -0,0 +1,11 @@ +contract Token { + event Transfer(address indexed _from, address indexed _to, uint256 _value); + event Approval(address indexed _owner, address indexed _spender, uint256 _value); + + function totalSupply() constant returns (uint256 supply) {} + function balanceOf(address _owner) constant returns (uint256 balance) {} + function transfer(address _to, uint256 _value) returns (bool success) {} + function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} + function approve(address _spender, uint256 _value) returns (bool success) {} + function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} +} diff --git a/std/mortal.sol b/std/mortal.sol new file mode 100644 index 00000000..8de019ab --- /dev/null +++ b/std/mortal.sol @@ -0,0 +1,8 @@ +import "./owned.sol"; + +contract mortal is owned { + function kill() { + if (msg.sender == owner) + selfdestruct(owner); + } +} diff --git a/std/owned.sol b/std/owned.sol new file mode 100644 index 00000000..37f0ecb9 --- /dev/null +++ b/std/owned.sol @@ -0,0 +1,13 @@ +contract owned { + address owner; + + modifier onlyowner() { + if (msg.sender == owner) { + _ + } + } + + function owned() { + owner = msg.sender; + } +} diff --git a/std/std.sol b/std/std.sol new file mode 100644 index 00000000..c3f66b1b --- /dev/null +++ b/std/std.sol @@ -0,0 +1,4 @@ +import "./owned.sol"; +import "./mortal.sol"; +import "./Token.sol"; +import "./StandardToken.sol"; diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index bb2e5663..3b1d1165 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -230,7 +230,7 @@ protected: if (!s_compiledRegistrar) { m_optimize = true; - m_compiler.reset(false, m_addStandardSources); + m_compiler.reset(false); m_compiler.addSource("", registrarCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); s_compiledRegistrar.reset(new bytes(m_compiler.object("GlobalRegistrar").bytecode)); diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index 6d79bec6..3acfba62 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -131,7 +131,7 @@ protected: if (!s_compiledRegistrar) { m_optimize = true; - m_compiler.reset(false, m_addStandardSources); + m_compiler.reset(false); m_compiler.addSource("", registrarCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); s_compiledRegistrar.reset(new bytes(m_compiler.object("FixedFeeRegistrar").bytecode)); diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 7a9b0b17..9e797af4 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -445,7 +445,7 @@ protected: if (!s_compiledWallet) { m_optimize = true; - m_compiler.reset(false, m_addStandardSources); + m_compiler.reset(false); m_compiler.addSource("", walletCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); s_compiledWallet.reset(new bytes(m_compiler.object("Wallet").bytecode)); diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 77b39978..b21e03eb 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -35,7 +35,7 @@ namespace test class JSONInterfaceChecker { public: - JSONInterfaceChecker(): m_compilerStack(false) {} + JSONInterfaceChecker(): m_compilerStack() {} void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) { diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f3cd387a..8a61907a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2469,21 +2469,6 @@ BOOST_AUTO_TEST_CASE(function_modifier_for_constructor) BOOST_CHECK(callContractFunction("getData()") == encodeArgs(4 | 2)); } -BOOST_AUTO_TEST_CASE(use_std_lib) -{ - char const* sourceCode = R"( - import "mortal"; - contract Icarus is mortal { } - )"; - m_addStandardSources = true; - u256 amount(130 * ether); - compileAndRun(sourceCode, amount, "Icarus"); - u256 balanceBefore = balanceAt(m_sender); - BOOST_CHECK(callContractFunction("kill()") == bytes()); - BOOST_CHECK(!addressHasCode(m_contractAddress)); - BOOST_CHECK(balanceAt(m_sender) > balanceBefore); -} - BOOST_AUTO_TEST_CASE(crazy_elementary_typenames_on_stack) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index c34b00ec..f4bdc657 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -67,7 +67,7 @@ public: std::map<std::string, Address> const& _libraryAddresses = std::map<std::string, Address>() ) { - m_compiler.reset(false, m_addStandardSources); + m_compiler.reset(false); m_compiler.addSource("", _sourceCode); if (!m_compiler.compile(m_optimize, m_optimizeRuns)) { @@ -290,7 +290,6 @@ protected: size_t m_optimizeRuns = 200; bool m_optimize = false; - bool m_addStandardSources = false; dev::solidity::CompilerStack m_compiler; Address m_sender; Address m_contractAddress; diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 8c0c2098..56572b43 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -37,7 +37,7 @@ namespace test class DocumentationChecker { public: - DocumentationChecker(): m_compilerStack(false) {} + DocumentationChecker(): m_compilerStack() {} void checkNatspec( std::string const& _code, |