From f5caf205ad3c956cd2829fbf0c178de52d8eaeb8 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Mon, 26 Feb 2018 08:50:27 -0500 Subject: [PATCH 1/5] Adding linkage for softfloat lib --- CMakeLists.txt | 1 + libraries/chain/apply_context.cpp | 10 +++++----- libraries/wasm-jit/Source/WASM/CMakeLists.txt | 4 ++-- libraries/wasm-jit/Source/WASM/WASMSerialization.cpp | 4 +++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bde96a85f2..56092886fe1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,7 @@ else() message( FATAL_ERROR "No WASM compiler cound be found" ) endif() +FIND_PACKAGE(softfloat REQUIRED) include(installer) add_subdirectory( libraries ) diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 4f3323a1b5e..01ace652005 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -23,10 +23,11 @@ void apply_context::exec_one() // get code from cache auto code = mutable_controller.get_wasm_cache().checkout_scoped(a.code_version, a.code.data(), a.code.size()); - - // get wasm_interface - auto &wasm = wasm_interface::get(); - wasm.apply(code, *this); + try { + // get wasm_interface + auto &wasm = wasm_interface::get(); + wasm.apply(code, *this); + } FC_CAPTURE_AND_RETHROW((_pending_console_output.str())); } } } FC_CAPTURE_AND_RETHROW((_pending_console_output.str())); @@ -95,7 +96,6 @@ void apply_context::exec_one() void apply_context::exec() { _notified.push_back(act.account); - for( uint32_t i = 0; i < _notified.size(); ++i ) { receiver = _notified[i]; exec_one(); diff --git a/libraries/wasm-jit/Source/WASM/CMakeLists.txt b/libraries/wasm-jit/Source/WASM/CMakeLists.txt index c9d27a0db98..64b3fbc16c6 100644 --- a/libraries/wasm-jit/Source/WASM/CMakeLists.txt +++ b/libraries/wasm-jit/Source/WASM/CMakeLists.txt @@ -1,7 +1,7 @@ set(Sources WASMSerialization.cpp) set(PublicHeaders ${WAVM_INCLUDE_DIR}/WASM/WASM.h) -include_directories(${WAVM_INCLUDE_DIR}/WASM) +include_directories(${WAVM_INCLUDE_DIR}/WASM ${SOFTFLOAT_INCLUDE_DIR}) add_library(WASM STATIC ${Sources} ${PublicHeaders}) add_definitions(-DWEBASSEMBLY_API=DLL_EXPORT) -target_link_libraries(WASM Logging IR) +target_link_libraries(WASM Logging IR ${SOFTFLOAT_LIBRARIES}) diff --git a/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp b/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp index 98e906cb2bd..4d1355d6874 100644 --- a/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp +++ b/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp @@ -9,6 +9,8 @@ #include +#include + using namespace Serialization; static void throwIfNotValidUTF8(const std::string& string) @@ -558,7 +560,7 @@ namespace WASM Serialization::OutputStream& byteStream; FunctionDef& functionDef; }; - + template struct WasmSerializationImpl { From f02806f8b3c219e485786e8459197b4bb682fcd4 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Mon, 26 Feb 2018 10:17:34 -0500 Subject: [PATCH 2/5] Fix some problems with last PR --- .../include/eosio/chain/apply_context.hpp | 2 +- scripts/eosio-build_darwin.sh | 224 ------------------ scripts/eosio-build_fedora.sh | 198 ---------------- scripts/eosio-build_ubuntu.sh | 179 -------------- tests/CMakeLists.txt | 8 +- tests/wasm_tests/identity_tests.cpp | 3 + tests/wasm_tests/wasm_tests.cpp | 92 ------- 7 files changed, 8 insertions(+), 698 deletions(-) delete mode 100644 scripts/eosio-build_darwin.sh delete mode 100644 scripts/eosio-build_fedora.sh delete mode 100644 scripts/eosio-build_ubuntu.sh diff --git a/libraries/chain/include/eosio/chain/apply_context.hpp b/libraries/chain/include/eosio/chain/apply_context.hpp index 170e1d2ea31..469647ce2a1 100644 --- a/libraries/chain/include/eosio/chain/apply_context.hpp +++ b/libraries/chain/include/eosio/chain/apply_context.hpp @@ -245,7 +245,7 @@ class apply_context { if (itr->t_id != tab->id) return -1; itr_cache.cache_table(*tab); - return itr_cache(*itr); + return itr_cache.add(*itr); } int next_primary( int iterator, uint64_t& primary ) { diff --git a/scripts/eosio-build_darwin.sh b/scripts/eosio-build_darwin.sh deleted file mode 100644 index 04b03415848..00000000000 --- a/scripts/eosio-build_darwin.sh +++ /dev/null @@ -1,224 +0,0 @@ - OS_VER=`sw_vers -productVersion` - OS_MAJ=`echo "${OS_VER}" | cut -d'.' -f1` - OS_MIN=`echo "${OS_VER}" | cut -d'.' -f2` - OS_PATCH=`echo "${OS_VER}" | cut -d'.' -f3` - - MEM_GIG=`bc <<< "($(sysctl -in hw.memsize) / 1024000000)"` - - CPU_SPEED=`bc <<< "scale=2; ($(sysctl -in hw.cpufrequency) / 100000000) / 10"` - CPU_CORE=$( sysctl -in machdep.cpu.core_count ) - - DISK_TOTAL=`df -H $PWD | grep /dev | tr -s ' ' | cut -d\ -f2 | sed 's/[^0-9]//'` - DISK_AVAIL=`df -H $PWD | grep /dev | tr -s ' ' | cut -d\ -f4 | sed 's/[^0-9]//'` - - printf "\n\tOS name: $ARCH\n" - printf "\tOS Version: ${OS_VER}\n" - printf "\tCPU speed: ${CPU_SPEED}Ghz\n" - printf "\tCPU cores: $CPU_CORE\n" - printf "\tPhysical Memory: $MEM_GIG Gbytes\n" - printf "\tDisk space total: ${DISK_TOTAL}G\n" - printf "\tDisk space available: ${DISK_AVAIL}G\n\n" - - if [ $MEM_GIG -lt 8 ]; then - printf "\tYour system must have 8 or more Gigabytes of physical memory installed.\n" - printf "\tExiting now.\n" - exit 1 - fi - - if [ $OS_MIN -lt 12 ]; then - printf "\tYou must be running Mac OS 10.12.x or higher to install EOSIO.\n" - printf "\tExiting now.\n" - exit 1 - fi - - if [ $DISK_AVAIL -lt 100 ]; then - printf "\tYou must have at least 100GB of available storage to install EOSIO.\n" - printf "\tExiting now.\n" - exit 1 - fi - - process_dep() - { - printf "\tChecking XCode installation\n" - XCODESELECT=$(which xcode-select) - if [ $? -ne 0 ]; then - printf "\n\tXCode must be installed in order to proceed.\n\n" - printf "\texiting now.\n" - exit 1 - fi - - printf "\tXCode installation found.\n\n" - - printf "\tChecking Ruby installation\n" - RUBY=$(which ruby) - if [ $? -ne 0 ]; then - printf "\nRuby must be installed in order to proceed.\n\n" - printf "\texiting now.\n" - exit 1 - fi - - printf "\tRuby installation found.\n\n" - - printf "\tChecking Home Brew installation\n" - BREW=$(which brew) - if [ $? -ne 0 ]; then - printf "\tHomebrew must be installed to compile EOS.IO\n\n" - printf "\tDo you wish to install Home Brew?\n" - select yn in "Yes" "No"; do - case $yn in - [Yy]* ) - $XCODESELECT --install 2>/dev/null; - $RUBY -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - if [ $? -ne 0 ]; then - echo "User aborted homebrew installation. Exiting now." - exit 0; - fi - break;; - [Nn]* ) echo "User aborted homebrew installation. Exiting now."; - exit;; - * ) echo "Please enter 1 for yes or 2 for no.";; - esac - done - fi - - printf "\tHome Brew installation found.\n\n" - # DEPS="git automake libtool openssl cmake wget boost llvm@4 gmp gettext" - DCOUNT=0 - COUNT=1 - PERMISSION_GETTEXT=0 - DISPLAY="" - DEP="" - - printf "\tChecking dependencies.\n" - for line in `cat ${WORK_DIR}/scripts/eosio_build_dep`; do - pkg=$( echo "${line}" | cut -d',' -f1 ) - printf "\tChecking $pkg ... " - BIN=$(which $pkg) - if [ $? -eq 0 ]; then - printf "\t$pkg found\n" - continue - fi - - LIB=$( ls -l /usr/local/lib/lib${pkg}* 2>/dev/null | wc -l) - if [ ${LIB} -ne 0 ]; then - printf "\t$pkg found\n" - continue - else - let DCOUNT++ - - if [ $pkg = "LLVM" ]; then - pkg="llvm@4" - fi - - if [ $pkg = "gettext" ]; then - PERMISSION_GETTEXT=1 - fi - - DEP=$DEP" ${pkg} " - DISPLAY="${DISPLAY}${COUNT}. ${pkg}\n\t" - printf "\tPackage ${pkg} ${bldred}NOT${txtrst} found.\n" - let COUNT++ - fi - done - - if [ $DCOUNT -ne 0 ]; then - printf "\n\tThe following dependencies are required to install EOSIO.\n" - printf "\n\t$DISPLAY\n\n" - echo "Do you wish to install these packages?" - select yn in "Yes" "No"; do - case $yn in - [Yy]* ) - if [ $PERMISSION_GETTEXT -eq 1 ]; then - sudo chown -R $(whoami) /usr/local/share - fi - - $XCODESELECT --install 2>/dev/null; - printf "\tUpdating Home Brew.\n" - brew update - printf "\tInstalling Dependencies.\n" - brew install --force $DEP - brew unlink $DEP && brew link --force $DEP - break;; - [Nn]* ) echo "User aborting installation of required dependencies, Exiting now."; exit;; - * ) echo "Please type 1 for yes or 2 for no.";; - esac - done - else - printf "\n\tNo required Home Brew dependencies to install.\n" - fi - - return 0 - } - - process_dep - - printf "\n\tChecking for secp256k1-zkp\n" - # install secp256k1-zkp (Cryptonomex branch) - if [ ! -e /usr/local/lib/libsecp256k1.a ]; then - cd ${TEMP_DIR} - git clone https://github.com/cryptonomex/secp256k1-zkp.git - cd secp256k1-zkp - ./autogen.sh - if [ $? -ne 0 ]; then - printf "\tError running autogen\n" - printf "\tExiting now.\n\n" - exit; - fi - ./configure - make - if [ $? -ne 0 ]; then - printf "\tError compiling secp256k1-zkp.\n" - printf "\tExiting now.\n\n" - exit; - fi - sudo make install - sudo rm -rf ${TEMP_DIR}/secp256k1-zkp - else - printf "\tsecp256k1 found at /usr/local/lib/\n" - fi - - printf "\n\tChecking for binaryen\n" - if [ ! -e /usr/local/binaryen/bin/binaryen.js ]; then - cd ${TEMP_DIR} - git clone https://github.com/WebAssembly/binaryen - cd binaryen - git checkout tags/1.37.14 - cmake . && make - if [ $? -ne 0 ]; then - printf "\tError compiling binaryen.\n" - printf "\tExiting now.\n\n" - exit; - fi - sudo mkdir /usr/local/binaryen - sudo mv ${TEMP_DIR}/binaryen/bin /usr/local/binaryen - sudo ln -s /usr/local/binaryen/bin/* /usr/local - sudo rm -rf ${TEMP_DIR}/binaryen - else - printf "\tBinaryen found at /usr/local/binaryen/bin/\n" - fi - - printf "\n\tChecking for WASM\n" - if [ ! -d /usr/local/wasm/bin ]; then - # Build LLVM and clang for WASM: - cd ${TEMP_DIR} - mkdir wasm-compiler - cd wasm-compiler - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git - cd llvm/tools - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git - cd .. - mkdir build - cd build - sudo cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local/wasm \ - -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \ - -DCMAKE_BUILD_TYPE=Release ../ - if [ $? -ne 0 ]; then - printf "\tError compiling WASM.\n" - printf "\tExiting now.\n\n" - exit; - fi - sudo make -j4 install - sudo rm -rf ${TEMP_DIR}/wasm-compiler - else - printf "\tWASM found at /usr/local/wasm/bin/\n" - fi diff --git a/scripts/eosio-build_fedora.sh b/scripts/eosio-build_fedora.sh deleted file mode 100644 index fdf3cc71c2f..00000000000 --- a/scripts/eosio-build_fedora.sh +++ /dev/null @@ -1,198 +0,0 @@ - OS_VER=$( cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 | sed 's/[^0-9\.]//gI' ) - - MEM_MEG=$( free -m | grep Mem | tr -s ' ' | cut -d\ -f2 ) - - CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 ) - - DISK_TOTAL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f2 | sed 's/[^0-9]//'` - DISK_AVAIL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f4 | sed 's/[^0-9]//'` - - printf "\n\tOS name: $OS_NAME\n" - printf "\tOS Version: ${OS_VER}\n" - printf "\tCPU speed: ${CPU_SPEED}Mhz\n" - printf "\tCPU cores: $CPU_CORE\n" - printf "\tPhysical Memory: $MEM_MEG Mgb\n" - printf "\tDisk space total: ${DISK_TOTAL}G\n" - printf "\tDisk space available: ${DISK_AVAIL}G\n" - - if [ $MEM_MEG -lt 4000 ]; then - echo "Your system must have 8 or more Gigabytes of physical memory installed." - echo "exiting now." - exit 1 - fi - - if [ $OS_VER -lt 25 ]; then - echo "You must be running Fedora 25 or higher to install EOSIO." - echo "exiting now" - exit 1 - fi - - if [ $DISK_AVAIL -lt 100 ]; then - echo "You must have at least 100GB of available storage to install EOSIO." - echo "exiting now" - exit 1 - fi - - printf "\n\tChecking Yum installation\n" - - YUM=$( which yum 2>/dev/null ) - if [ $? -ne 0 ]; then - printf "\n\tYum must be installed to compile EOS.IO.\n" - printf "\n\tExiting now.\n" - exit 0 - fi - - printf "\tYum installation found at ${YUM}.\n" - printf "\tUpdating YUM.\n" - UPDATE=$( sudo yum update ) - - if [ $? -ne 0 ]; then - printf "\n\tYUM update failed.\n" - printf "\n\tExiting now.\n" - exit 1 - fi - - printf "\t${UPDATE}\n" - DEP_ARRAY=( git gcc.x86_64 gcc-c++.x86_64 autoconf automake libtool make cmake.x86_64 bzip2 bzip2-devel.x86_64 openssl-devel.x86_64 gmp.x86_64 gmp-devel.x86_64 libstdc++-devel.x86_64 python3-devel.x86_64 libedit.x86_64 ncurses-devel.x86_64 swig.x86_64 ) - DCOUNT=0 - COUNT=1 - DISPLAY="" - DEP="" - - printf "\n\tChecking YUM for installed dependencies.\n\n" - - for (( i=0; i<${#DEP_ARRAY[@]}; i++ )); - do - pkg=$( sudo $YUM info ${DEP_ARRAY[$i]} 2>/dev/null | grep Repo | tr -s ' ' | cut -d: -f2 | sed 's/ //g' ) - - if [ "$pkg" != "@System" ]; then - DEP=$DEP" ${DEP_ARRAY[$i]} " - DISPLAY="${DISPLAY}${COUNT}. ${DEP_ARRAY[$i]}\n\t" - printf "\tPackage ${DEP_ARRAY[$i]} ${bldred} NOT ${txtrst} found.\n" - let COUNT++ - let DCOUNT++ - else - printf "\tPackage ${DEP_ARRAY[$i]} found.\n" - continue - fi - done - - if [ ${DCOUNT} -ne 0 ]; then - printf "\n\tThe following dependencies are required to install EOSIO.\n" - printf "\n\t$DISPLAY\n\n" - printf "\tDo you wish to install these dependencies?\n" - select yn in "Yes" "No"; do - case $yn in - [Yy]* ) - printf "\n\n\tInstalling dependencies\n\n" - sudo yum -y install ${DEP} - if [ $? -ne 0 ]; then - printf "\n\tYUM dependency installation failed.\n" - printf "\n\tExiting now.\n" - exit 1 - else - printf "\n\tYUM dependencies installed successfully.\n" - fi - break;; - [Nn]* ) echo "User aborting installation of required dependencies, Exiting now."; exit;; - * ) echo "Please type 1 for yes or 2 for no.";; - esac - done - else - printf "\n\tNo required YUM dependencies to install.\n" - fi - - printf "\n\tChecking for boost libraries\n" - if [ ! -d ${HOME}/opt/boost_1_66_0 ]; then - # install boost - printf "\tInstalling boost libraries\n" - cd ${TEMP_DIR} - curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2 - tar xf boost_1.66.0.tar.bz2 - cd boost_1_66_0/ - ./bootstrap.sh "--prefix=$BOOST_ROOT" - ./b2 install - rm -rf ${TEMP_DIR}/boost_1_66_0/ - rm -f ${TEMP_DIR}/boost_1.66.0.tar.bz2 - else - printf "\tBoost 1.66 found at ${HOME}/opt/boost_1_66_0\n" - fi - - printf "\n\tChecking for secp256k1-zkp\n" - # install secp256k1-zkp (Cryptonomex branch) - if [ ! -e /usr/local/lib/libsecp256k1.a ]; then - printf "\tInstalling secp256k1-zkp (Cryptonomex branch)\n" - cd ${TEMP_DIR} - git clone https://github.com/cryptonomex/secp256k1-zkp.git - cd secp256k1-zkp - ./autogen.sh - if [ $? -ne 0 ]; then - printf "\tError running autogen for secp256k1-zkp.\n" - printf "\tExiting now.\n\n" - exit; - fi - ./configure - make - if [ $? -ne 0 ]; then - printf "\tError compiling secp256k1-zkp.\n" - printf "\tExiting now.\n\n" - exit; - fi - sudo make install - rm -rf cd ${TEMP_DIR}/secp256k1-zkp - else - printf "\tsecp256k1 found\n" - fi - - printf "\n\tChecking for binaryen\n" - if [ ! -d ${HOME}/opt/binaryen ]; then - # Install binaryen v1.37.14: - printf "\tInstalling binaryen v1.37.14:\n" - cd ${TEMP_DIR} - git clone https://github.com/WebAssembly/binaryen - cd binaryen - git checkout tags/1.37.14 - cmake . && make - if [ $? -ne 0 ]; then - printf "\tError compiling binaryen.\n" - printf "\tExiting now.\n\n" - exit; - fi - mkdir -p ${HOME}/opt/binaryen/ 2>/dev/null - mv ${TEMP_DIR}/binaryen/bin ${HOME}/opt/binaryen/ - rm -rf ${TEMP_DIR}/binaryen - else - printf "\tBinaryen found at ${HOME}/opt/binaryen\n" - fi - - printf "\n\tChecking for LLVM with WASM support.\n" - if [ ! -d ${HOME}/opt/wasm/bin ]; then - # Build LLVM and clang with EXPERIMENTAL WASM support: - printf "\tInstalling LLVM & WASM\n" - cd ${TEMP_DIR} - mkdir llvm-compiler 2>/dev/null - cd llvm-compiler - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git - cd llvm/tools - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git - cd .. - mkdir build - cd build - cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${HOME}/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ - if [ $? -ne 0 ]; then - printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n" - printf "\tExiting now.\n\n" - exit; - fi - make -j$(nproc) - if [ $? -ne 0 ]; then - printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n" - printf "\tExiting now.\n\n" - exit; - fi - make install - rm -rf ${TEMP_DIR}/llvm-compiler 2>/dev/null - else - printf "\tWASM found at ${HOME}/opt/wasm\n" - fi diff --git a/scripts/eosio-build_ubuntu.sh b/scripts/eosio-build_ubuntu.sh deleted file mode 100644 index e8eb8764e91..00000000000 --- a/scripts/eosio-build_ubuntu.sh +++ /dev/null @@ -1,179 +0,0 @@ - OS_VER=$( cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 | sed 's/[^0-9\.]//gI' ) - OS_MAJ=`echo "${OS_VER}" | cut -d'.' -f1` - OS_MIN=`echo "${OS_VER}" | cut -d'.' -f2` - - MEM_MEG=$( free -m | grep Mem | tr -s ' ' | cut -d\ -f2 ) - - CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 ) - - DISK_TOTAL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f2 | sed 's/[^0-9]//'` - DISK_AVAIL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f4 | sed 's/[^0-9]//'` - - printf "\n\tOS name: $OS_NAME\n" - printf "\tOS Version: ${OS_VER}\n" - printf "\tCPU speed: ${CPU_SPEED}Mhz\n" - printf "\tCPU cores: $CPU_CORE\n" - printf "\tPhysical Memory: $MEM_MEG Mgb\n" - printf "\tDisk space total: ${DISK_TOTAL}G\n" - printf "\tDisk space available: ${DISK_AVAIL}G\n" - - if [ $MEM_MEG -lt 4000 ]; then - echo "Your system must have 8 or more Gigabytes of physical memory installed." - echo "exiting now." - exit 1 - fi - - if [ $OS_MIN -lt 4 ]; then - echo "You must be running Ubuntu 16.04.x or higher to install EOSIO." - echo "exiting now" - exit 1 - fi - - if [ $DISK_AVAIL -lt 100 ]; then - echo "You must have at least 100GB of available storage to install EOSIO." - echo "exiting now" - exit 1 - fi - - DEP_ARRAY=(clang-4.0 lldb-4.0 libclang-4.0-dev cmake make libbz2-dev libssl-dev libgmp3-dev autotools-dev build-essential libbz2-dev libicu-dev python-dev autoconf libtool curl) - DCOUNT=0 - COUNT=1 - DISPLAY="" - DEP="" - - printf "\n\tChecking for installed dependencies.\n\n" - - for (( i=0; i<${#DEP_ARRAY[@]}; i++ )); - do - pkg=$( dpkg -s ${DEP_ARRAY[$i]} 2>/dev/null | grep Status | tr -s ' ' | cut -d\ -f4 ) - if [ -z "$pkg" ]; then - DEP=$DEP" ${DEP_ARRAY[$i]} " - DISPLAY="${DISPLAY}${COUNT}. ${DEP_ARRAY[$i]}\n\t" - printf "\tPackage ${DEP_ARRAY[$i]} ${bldred} NOT ${txtrst} found.\n" - let COUNT++ - let DCOUNT++ - else - printf "\tPackage ${DEP_ARRAY[$i]} found.\n" - continue - fi - done - - if [ ${DCOUNT} -ne 0 ]; then - printf "\n\tThe following dependencies are required to install EOSIO.\n" - printf "\n\t$DISPLAY\n\n" - printf "\tDo you wish to install these packages?\n" - select yn in "Yes" "No"; do - case $yn in - [Yy]* ) - printf "\n\n\tInstalling dependencies\n\n" - sudo apt-get update - sudo apt-get -y install ${DEP} - if [ $? -ne 0 ]; then - printf "\n\tDPKG dependency failed.\n" - printf "\n\tExiting now.\n" - exit 1 - else - printf "\n\tDPKG dependencies installed successfully.\n" - fi - break;; - [Nn]* ) echo "User aborting installation of required dependencies, Exiting now."; exit;; - * ) echo "Please type 1 for yes or 2 for no.";; - esac - done - else - printf "\n\tNo required dpkg dependencies to install.\n" - fi - - printf "\n\tChecking for boost libraries\n" - if [ ! -d ${HOME}/opt/boost_1_66_0 ]; then - # install boost - printf "\tInstalling boost libraries\n" - cd ${TEMP_DIR} - curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2 - tar xf boost_1.66.0.tar.bz2 - cd boost_1_66_0/ - ./bootstrap.sh "--prefix=$BOOST_ROOT" - ./b2 install - rm -rf ${TEMP_DIR}/boost_1_66_0/ - rm -f ${TEMP_DIR}/boost_1.66.0.tar.bz2 - else - printf "\tBoost 1.66 found at ${HOME}/opt/boost_1_66_0\n" - fi - - printf "\n\tChecking for secp256k1-zkp\n" - # install secp256k1-zkp (Cryptonomex branch) - if [ ! -e /usr/local/lib/libsecp256k1.a ]; then - printf "\tInstalling secp256k1-zkp (Cryptonomex branch)\n" - cd ${TEMP_DIR} - git clone https://github.com/cryptonomex/secp256k1-zkp.git - cd secp256k1-zkp - ./autogen.sh - if [ $? -ne 0 ]; then - printf "\tError running autogen for secp256k1-zkp.\n" - printf "\tExiting now.\n\n" - exit; - fi - ./configure - make - if [ $? -ne 0 ]; then - printf "\tError compiling secp256k1-zkp.\n" - printf "\tExiting now.\n\n" - exit; - fi - sudo make install - rm -rf cd ${TEMP_DIR}/secp256k1-zkp - else - printf "\tsecp256k1 found\n" - fi - - printf "\n\tChecking for binaryen\n" - if [ ! -d ${HOME}/opt/binaryen ]; then - # Install binaryen v1.37.14: - printf "\tInstalling binaryen v1.37.14:\n" - cd ${TEMP_DIR} - git clone https://github.com/WebAssembly/binaryen - cd binaryen - git checkout tags/1.37.14 - cmake . && make - if [ $? -ne 0 ]; then - printf "\tError compiling binaryen.\n" - printf "\tExiting now.\n\n" - exit; - fi - mkdir -p ${HOME}/opt/binaryen/ 2>/dev/null - mv ${TEMP_DIR}/binaryen/bin ${HOME}/opt/binaryen/ - rm -rf ${TEMP_DIR}/binaryen - else - printf "\tBinaryen found at ${HOME}/opt/binaryen\n" - fi - - printf "\n\tChecking for LLVM with WASM support.\n" - if [ ! -d ${HOME}/opt/wasm/bin ]; then - # Build LLVM and clang for WASM: - printf "\tInstalling LLVM & WASM\n" - cd ${TEMP_DIR} - mkdir llvm-compiler 2>/dev/null - cd llvm-compiler - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git - cd llvm/tools - git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git - cd .. - mkdir build - cd build - cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${HOME}/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ - if [ $? -ne 0 ]; then - printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n" - printf "\tExiting now.\n\n" - exit; - fi - make -j$(nproc) - if [ $? -ne 0 ]; then - printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n" - printf "\tExiting now.\n\n" - exit; - fi - rm -rf ${TEMP_DIR}/llvm-compiler - else - printf "\tWASM found at ${HOME}/opt/wasm/bin\n" - fi diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d7b14896a8a..468098b5f48 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,9 +18,9 @@ include_directories("${CMAKE_SOURCE_DIR}/contracts") file(GLOB UNIT_TESTS "chain_tests/*.cpp" "api_tests/*.cpp" "tests/abi_tests.cpp" "tests/database_tests.cpp") -#if(WASM_TOOLCHAIN) -# file(GLOB WASM_UNIT_TESTS "wasm_tests/*.cpp") -#endif() +if(WASM_TOOLCHAIN) + file(GLOB WASM_UNIT_TESTS "wasm_tests/*.cpp") +endif() add_executable( chain_test ${UNIT_TESTS} ${WASM_UNIT_TESTS} common/main.cpp ) target_link_libraries( chain_test eosio_testing eosio_chain chainbase eos_utilities eos_egenesis_none chain_plugin abi_generator fc ${PLATFORM_SPECIFIC_LIBS} ) @@ -28,7 +28,7 @@ target_link_libraries( chain_test eosio_testing eosio_chain chainbase eos_utilit if(WASM_TOOLCHAIN) target_include_directories( chain_test PUBLIC ${CMAKE_BINARY_DIR}/contracts ${CMAKE_CURRENT_BINARY_DIR}/tests/contracts ) target_include_directories( chain_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/wasm_tests ) - add_dependencies(chain_test asserter test_api currency proxy identity stltest infinite) + add_dependencies(chain_test asserter test_api currency proxy identity identity_test stltest infinite) endif() diff --git a/tests/wasm_tests/identity_tests.cpp b/tests/wasm_tests/identity_tests.cpp index 1f1f33f9aa2..3f7378efab0 100644 --- a/tests/wasm_tests/identity_tests.cpp +++ b/tests/wasm_tests/identity_tests.cpp @@ -382,6 +382,8 @@ BOOST_FIXTURE_TEST_CASE( trust_untrust, identity_tester ) try { } FC_LOG_AND_RETHROW() //trust_untrust +// TODO: Anton please re-enable when finished with new db api changes +#if 0 BOOST_FIXTURE_TEST_CASE( certify_decertify_owner, identity_tester ) try { BOOST_REQUIRE_EQUAL(success(), create_identity("alice", identity_val)); @@ -656,5 +658,6 @@ BOOST_FIXTURE_TEST_CASE( ownership_contradiction, identity_tester ) try { BOOST_REQUIRE_EQUAL(0, get_identity_for_account("alice")); } FC_LOG_AND_RETHROW() //ownership_contradiction +#endif BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/wasm_tests/wasm_tests.cpp b/tests/wasm_tests/wasm_tests.cpp index c954b4f4f80..e81da2beec9 100644 --- a/tests/wasm_tests/wasm_tests.cpp +++ b/tests/wasm_tests/wasm_tests.cpp @@ -763,96 +763,4 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, tester ) try { } FC_LOG_AND_RETHROW() #endif -BOOST_FIXTURE_TEST_CASE( test_db, tester ) try { - produce_blocks(2); - - create_accounts( {N(tester)} ); - produce_block(); - - set_code(N(tester), test_api_wast); - // set_code(N(tester), test_api_abi); - - produce_blocks(1); - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - - { - signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - test_api_action {}); - - set_tapos(trx); - trx.sign(get_private_key(N(tester), "active"), chain_id_type()); - push_transaction(trx); - produce_block(); - - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - } - -} FC_LOG_AND_RETHROW() /// test_db - - BOOST_AUTO_TEST_SUITE_END() From c7feaf408f86725cc7a2145fae69a3364436dd17 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Mon, 26 Feb 2018 10:24:28 -0500 Subject: [PATCH 3/5] Cleaned up stuff from another branch --- CMakeLists.txt | 1 - libraries/chain/apply_context.cpp | 2 -- libraries/wasm-jit/Source/WASM/CMakeLists.txt | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56092886fe1..2bde96a85f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,6 @@ else() message( FATAL_ERROR "No WASM compiler cound be found" ) endif() -FIND_PACKAGE(softfloat REQUIRED) include(installer) add_subdirectory( libraries ) diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 01ace652005..736c10548e6 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -23,11 +23,9 @@ void apply_context::exec_one() // get code from cache auto code = mutable_controller.get_wasm_cache().checkout_scoped(a.code_version, a.code.data(), a.code.size()); - try { // get wasm_interface auto &wasm = wasm_interface::get(); wasm.apply(code, *this); - } FC_CAPTURE_AND_RETHROW((_pending_console_output.str())); } } } FC_CAPTURE_AND_RETHROW((_pending_console_output.str())); diff --git a/libraries/wasm-jit/Source/WASM/CMakeLists.txt b/libraries/wasm-jit/Source/WASM/CMakeLists.txt index 64b3fbc16c6..c9d27a0db98 100644 --- a/libraries/wasm-jit/Source/WASM/CMakeLists.txt +++ b/libraries/wasm-jit/Source/WASM/CMakeLists.txt @@ -1,7 +1,7 @@ set(Sources WASMSerialization.cpp) set(PublicHeaders ${WAVM_INCLUDE_DIR}/WASM/WASM.h) -include_directories(${WAVM_INCLUDE_DIR}/WASM ${SOFTFLOAT_INCLUDE_DIR}) +include_directories(${WAVM_INCLUDE_DIR}/WASM) add_library(WASM STATIC ${Sources} ${PublicHeaders}) add_definitions(-DWEBASSEMBLY_API=DLL_EXPORT) -target_link_libraries(WASM Logging IR ${SOFTFLOAT_LIBRARIES}) +target_link_libraries(WASM Logging IR) From f6a8025ee9bcf14973be18c7f64843209518e62c Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Mon, 26 Feb 2018 10:25:15 -0500 Subject: [PATCH 4/5] One more clean up --- libraries/chain/apply_context.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 736c10548e6..3d31e2363e6 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -23,10 +23,10 @@ void apply_context::exec_one() // get code from cache auto code = mutable_controller.get_wasm_cache().checkout_scoped(a.code_version, a.code.data(), a.code.size()); - // get wasm_interface - auto &wasm = wasm_interface::get(); - wasm.apply(code, *this); - } + // get wasm_interface + auto &wasm = wasm_interface::get(); + wasm.apply(code, *this); + } } } FC_CAPTURE_AND_RETHROW((_pending_console_output.str())); From 51cf15cef2dec66a5120e1eeede48ccd82a3fb5a Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Mon, 26 Feb 2018 10:28:07 -0500 Subject: [PATCH 5/5] Forgot one last softfloat thing in this branch --- libraries/wasm-jit/Source/WASM/WASMSerialization.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp b/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp index 4d1355d6874..e401fe13aae 100644 --- a/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp +++ b/libraries/wasm-jit/Source/WASM/WASMSerialization.cpp @@ -9,8 +9,6 @@ #include -#include - using namespace Serialization; static void throwIfNotValidUTF8(const std::string& string)