aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--docs/installing-solidity.rst76
-rw-r--r--libsolidity/ast/Types.cpp23
-rw-r--r--libsolidity/ast/Types.h23
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp45
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp2
7 files changed, 120 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d0e3f66..35a44d1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ include(EthPolicy)
eth_policy()
# project name and version should be set after cmake_policy CMP0048
-set(PROJECT_VERSION "0.3.3")
+set(PROJECT_VERSION "0.3.4")
project(solidity VERSION ${PROJECT_VERSION})
# Let's find our dependencies
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index 400aab5b..a5f9b0f2 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -68,67 +68,75 @@ Set up Homebrew:
brew install llvm --HEAD --with-clang
brew install qt5 --with-d-bus # add --verbose if long waits with a stale screen drive you crazy as well
-Ubuntu
-------
+Ubuntu Trusty (14.04)
+---------------------
-Below are the build instructions for the latest versions of Ubuntu. The best
-supported platform as of December 2014 is Ubuntu 14.04, 64 bit, with at least 2
-GB RAM. All our tests are done with this version. Community contributions for
-other versions are welcome!
-
-Install dependencies:
-
-Before you can build the source, you need several tools and dependencies for the application to get started.
-
-First, update your repositories. Not all packages are provided in the main
-Ubuntu repository, those you'll get from the Ethereum PPA and the LLVM archive.
+Below are the instructions to install the minimal dependencies required
+to compile Solidity on Ubuntu 14.04 (Trusty Tahr).
.. note::
- Ubuntu 14.04 users, you'll need the latest version of cmake. For this, use:
- `sudo apt-add-repository ppa:george-edison55/cmake-3.x`
-
-Now add all the rest:
+ These dependencies are not enough to compile the GUIs (Alethzero and Mix).
.. code-block:: bash
- sudo apt-get -y update
- sudo apt-get -y install language-pack-en-base
- sudo dpkg-reconfigure locales
- sudo apt-get -y install software-properties-common
+ sudo apt-get -y install build-essential git cmake libgmp-dev libboost-all-dev \
+ libjsoncpp-dev libleveldb-dev libcurl4-openssl-dev libminiupnpc-dev \
+ libmicrohttpd-dev
+
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 upgrade # this will update cmake to version 3.x
+ sudo apt-get -y install libcryptopp-dev libjson-rpc-cpp-dev
-For Ubuntu 15.04 (Vivid Vervet) or older, use the following command to add the develop packages:
+Ubuntu Xenial (16.04)
+---------------------
-.. code-block:: bash
+Below are the instructions to install the minimal dependencies required
+to compile Solidity on Ubuntu 16.04 (Xenial Xerus).
- sudo apt-get -y install build-essential git cmake libboost-all-dev libgmp-dev libleveldb-dev libminiupnpc-dev libreadline-dev libncurses5-dev libcurl4-openssl-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libedit-dev libz-dev
+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).
-For Ubuntu 15.10 (Wily Werewolf) or newer, use the following command instead:
+.. note::
-.. code-block:: bash
+ These dependencies are not enough to compile the GUIs (Alethzero and Mix).
- sudo apt-get -y install build-essential git cmake libboost-all-dev libgmp-dev libleveldb-dev libminiupnpc-dev libreadline-dev libncurses5-dev libcurl4-openssl-dev libcryptopp-dev libjsonrpccpp-dev libmicrohttpd-dev libjsoncpp-dev libedit-dev libz-dev
+.. code-block:: bash
-The reason for the change is that ``libjsonrpccpp-dev`` is available in the universe repository for newer versions of Ubuntu.
+ sudo apt-get -y install build-essential git cmake libgmp-dev libboost-all-dev \
+ libjsoncpp-dev libleveldb-dev libcurl4-openssl-dev libminiupnpc-dev \
+ libjsonrpccpp-dev libmicrohttpd-dev
+
+ # (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
+
+ ## (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 ..
Building
--------
-Run this if you plan on installing Solidity only, ignore errors at the end as
-they relate only to Alethzero and Mix
+Run this if you plan on installing Solidity only:
.. code-block:: bash
git clone --recursive https://github.com/ethereum/webthree-umbrella.git
cd webthree-umbrella
./webthree-helpers/scripts/ethupdate.sh --no-push --simple-pull --project solidity # update Solidity repo
- ./webthree-helpers/scripts/ethbuild.sh --no-git --project solidity --all --cores 4 -DEVMJIT=0 # build Solidity and others
- #enabling DEVMJIT on OS X will not build
- #feel free to enable it on Linux
+ ./webthree-helpers/scripts/ethbuild.sh --no-git --project solidity --cores 4 -DEVMJIT=0 -DETHASHCL=0 # build Solidity only
If you opted to install Alethzero and Mix:
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index e964d683..5630743b 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2037,29 +2037,20 @@ FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary, bool _bound)
location = Location::DelegateCall;
}
- TypePointers returnParameterTypes;
- vector<string> returnParameterNames;
- if (location == Location::Internal)
+ TypePointers returnParameterTypes = m_returnParameterTypes;
+ if (location != Location::Internal)
{
- returnParameterNames = m_returnParameterNames;
- returnParameterTypes = m_returnParameterTypes;
- }
- else
- {
- // Removes dynamic types.
- for (size_t i = 0; i < m_returnParameterTypes.size(); ++i)
- if (!m_returnParameterTypes[i]->isDynamicallySized())
- {
- returnParameterTypes.push_back(m_returnParameterTypes[i]);
- returnParameterNames.push_back(m_returnParameterNames[i]);
- }
+ // Alter dynamic types to be non-accessible.
+ for (auto& param: returnParameterTypes)
+ if (param->isDynamicallySized())
+ param = make_shared<InaccessibleDynamicType>();
}
return make_shared<FunctionType>(
parameterTypes,
returnParameterTypes,
m_parameterNames,
- returnParameterNames,
+ m_returnParameterNames,
location,
m_arbitraryParameters,
m_declaration,
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index 967e968c..1ee762e5 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -137,7 +137,8 @@ public:
{
Integer, RationalNumber, StringLiteral, Bool, FixedPoint, Array,
FixedBytes, Contract, Struct, Function, Enum, Tuple,
- Mapping, TypeType, Modifier, Magic, Module
+ Mapping, TypeType, Modifier, Magic, Module,
+ InaccessibleDynamic
};
/// @{
@@ -1081,5 +1082,25 @@ private:
Kind m_kind;
};
+/**
+ * Special type that is used for dynamic types in returns from external function calls
+ * (The EVM currently cannot access dynamically-sized return values).
+ */
+class InaccessibleDynamicType: public Type
+{
+public:
+ virtual Category category() const override { return Category::InaccessibleDynamic; }
+
+ virtual bool isImplicitlyConvertibleTo(Type const&) const override { return false; }
+ virtual bool isExplicitlyConvertibleTo(Type const&) const override { return false; }
+ virtual unsigned calldataEncodedSize(bool _padded) const override { (void)_padded; return 32; }
+ virtual bool canBeStored() const override { return false; }
+ virtual bool canLiveOutsideStorage() const override { return false; }
+ virtual bool isValueType() const override { return true; }
+ virtual unsigned sizeOnStack() const override { return 1; }
+ virtual std::string toString(bool) const override { return "inaccessible dynamic type"; }
+ virtual TypePointer decodingType() const override { return std::make_shared<IntegerType>(256); }
+};
+
}
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 9d958b16..ed53ce59 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -40,7 +40,7 @@ foreach(file ${SRC_LIST})
endforeach(test_raw)
endforeach(file)
-file(GLOB HEADERS "*.h")
+file(GLOB HEADERS "*.h" "*/*.h")
set(EXECUTABLE soltest)
eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 30ae5792..07bf6759 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6793,6 +6793,51 @@ BOOST_AUTO_TEST_CASE(cleanup_bytes_types)
BOOST_CHECK(callContractFunction("f(bytes2,uint16)", string("abc"), u256(0x040102)) == encodeArgs(0));
}
+BOOST_AUTO_TEST_CASE(skip_dynamic_types)
+{
+ // The EVM cannot provide access to dynamically-sized return values, so we have to skip them.
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (uint, uint[], uint) {
+ return (7, new uint[](2), 8);
+ }
+ function g() returns (uint, uint) {
+ // Previous implementation "moved" b to the second place and did not skip.
+ var (a, _, b) = this.f();
+ return (a, b);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(7), u256(8)));
+}
+
+BOOST_AUTO_TEST_CASE(skip_dynamic_types_for_structs)
+{
+ // For accessors, the dynamic types are already removed in the external signature itself.
+ char const* sourceCode = R"(
+ contract C {
+ struct S {
+ uint x;
+ string a; // this is present in the accessor
+ uint[] b; // this is not present
+ uint y;
+ }
+ S public s;
+ function g() returns (uint, uint) {
+ s.x = 2;
+ s.a = "abc";
+ s.b = [7, 8, 9];
+ s.y = 6;
+ var (x, a, y) = this.s();
+ return (x, y);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2), u256(6)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 52e0bf58..3b148c9a 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2154,6 +2154,8 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible)
function f(uint) returns (string);
function g() {
var (x,) = this.f(2);
+ // we can assign to x but it is not usable.
+ bytes(x).length;
}
}
)";